Skip to content

Commit 5f489c0

Browse files
authored
Adding more structural tests for the schema. (#4629)
* Also check for target types. * Fix the typo in comments.
1 parent 2308c8c commit 5f489c0

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

software/tests/test_graphs.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ def test_properClassPropertyStructuring(self):
568568
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
569569
PREFIX owl: <http://www.w3.org/2002/07/owl#>
570570
571-
SELECT ?term ?target WHERE {
571+
SELECT ?term ?predicate ?target WHERE {
572572
# Define the combinations of type and predicate to look for
573573
VALUES (?type ?predicate) {
574574
(rdfs:Class rdfs:subPropertyOf)
@@ -577,14 +577,21 @@ def test_properClassPropertyStructuring(self):
577577
(rdfs:Property owl:equivalentClass)
578578
}
579579
580-
# Apply the pattern once using the values above
581-
?term a ?type .
582-
?term ?predicate ?target .
583-
580+
{
581+
# ?term must be of the right type for the predicate
582+
?term a ?type .
583+
?term ?predicate ?target .
584+
}
585+
UNION
586+
{
587+
# ?target must be of the right type for the predicate
588+
?target a ?type .
589+
?term ?predicate ?target .
590+
}
584591
} ORDER BY ?term
585592
""",
586593
error_message="A type cannot be a Class (Property) and also be a subPropertyOf (subClassOf) or something!",
587-
row_pattern="'%(term)s' is a Class/Property and also a subPropertyOf/subClassOf %(target)s")
594+
row_pattern="'%(term)s' is %(predicate)s of %(target)s")
588595

589596

590597
# TODO: Unwritten tests (from basics; easier here?)

0 commit comments

Comments
 (0)