Skip to content

Commit

Permalink
refactor(xmlvalidate): ignore built-in dsp-properties (DEV-4191) (#1192)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nora-Olivia-Ammann authored Oct 2, 2024
1 parent 1db3135 commit 3c01cfb
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _construct_resource_nodeshape(onto_graph: Graph) -> Graph:
?shapesIRI a sh:NodeShape ;
sh:targetClass ?class ;
sh:ignoredProperties ( rdf:type rdfs:label ) ;
sh:ignoredProperties ( rdf:type rdfs:label knora-api:hasComment knora-api:isPartOf knora-api:seqnum ) ;
sh:closed true .
} WHERE {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ class TestCheckTripleNumbersOnto:
def test_nodeshape(self, onto_graph: Graph) -> None:
result = _construct_resource_nodeshape(onto_graph)
number_of_resource_classes = 6
triples_collection_ignored_props = 4 * number_of_resource_classes
number_of_ignored_properties = 5
triples_collection_ignored_props = 2 * number_of_ignored_properties * number_of_resource_classes
triples_cls_nodeshape = 4 * number_of_resource_classes
assert len(result) == triples_cls_nodeshape + triples_collection_ignored_props

Expand Down
3 changes: 3 additions & 0 deletions testdata/xml-validate/data/cardinality_correct.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<boolean-prop name=":testBoolean">
<boolean>true</boolean>
</boolean-prop>
<text-prop name="hasComment">
<text encoding="xml">Comment Text</text>
</text-prop>
</resource>

<resource label="Card 1" restype=":ClassInheritedCardinalityOverwriting" id="id_2">
Expand Down
84 changes: 42 additions & 42 deletions testdata/xml-validate/onto-shacl.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<http://0.0.0.0:3333/ontology/9999/onto/v2#CardOneResource_Shape> a sh:NodeShape ;
sh:closed true ;
sh:ignoredProperties ( rdf:type rdfs:label ) ;
sh:ignoredProperties ( rdf:type rdfs:label <http://api.knora.org/ontology/knora-api/v2#hasComment> <http://api.knora.org/ontology/knora-api/v2#isPartOf> <http://api.knora.org/ontology/knora-api/v2#seqnum> ) ;
sh:property [ a sh:PropertyShape ;
sh:maxCount 1 ;
sh:message "0-1" ;
Expand All @@ -16,7 +16,7 @@

<http://0.0.0.0:3333/ontology/9999/onto/v2#ClassInheritedCardinalityOverwriting_Shape> a sh:NodeShape ;
sh:closed true ;
sh:ignoredProperties ( rdf:type rdfs:label ) ;
sh:ignoredProperties ( rdf:type rdfs:label <http://api.knora.org/ontology/knora-api/v2#hasComment> <http://api.knora.org/ontology/knora-api/v2#isPartOf> <http://api.knora.org/ontology/knora-api/v2#seqnum> ) ;
sh:property [ a sh:PropertyShape ;
sh:maxCount 1 ;
sh:message "1" ;
Expand All @@ -27,7 +27,7 @@

<http://0.0.0.0:3333/ontology/9999/onto/v2#ClassInheritedCardinality_Shape> a sh:NodeShape ;
sh:closed true ;
sh:ignoredProperties ( rdf:type rdfs:label ) ;
sh:ignoredProperties ( rdf:type rdfs:label <http://api.knora.org/ontology/knora-api/v2#hasComment> <http://api.knora.org/ontology/knora-api/v2#isPartOf> <http://api.knora.org/ontology/knora-api/v2#seqnum> ) ;
sh:property [ a sh:PropertyShape ;
sh:maxCount 1 ;
sh:message "0-1" ;
Expand All @@ -38,87 +38,87 @@

<http://0.0.0.0:3333/ontology/9999/onto/v2#ClassMixedCard_Shape> a sh:NodeShape ;
sh:closed true ;
sh:ignoredProperties ( rdf:type rdfs:label ) ;
sh:ignoredProperties ( rdf:type rdfs:label <http://api.knora.org/ontology/knora-api/v2#hasComment> <http://api.knora.org/ontology/knora-api/v2#isPartOf> <http://api.knora.org/ontology/knora-api/v2#seqnum> ) ;
sh:property [ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testSimpleText> ],
[ a sh:PropertyShape ;
sh:message "1-n" ;
sh:minCount 1 ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testGeoname> ;
sh:severity sh:Violation ],
[ a sh:PropertyShape ;
sh:maxCount 1 ;
sh:message "1" ;
sh:minCount 1 ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testBoolean> ;
sh:severity sh:Violation ],
[ a sh:PropertyShape ;
sh:message "1-n" ;
sh:minCount 1 ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testGeoname> ;
sh:severity sh:Violation ],
[ a sh:PropertyShape ;
sh:maxCount 1 ;
sh:message "0-1" ;
sh:minCount 0 ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testDecimalSimpleText> ;
sh:severity sh:Violation ] ;
sh:severity sh:Violation ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testSimpleText> ] ;
sh:targetClass <http://0.0.0.0:3333/ontology/9999/onto/v2#ClassMixedCard> .

<http://0.0.0.0:3333/ontology/9999/onto/v2#ClassWithEverything_Shape> a sh:NodeShape ;
sh:closed true ;
sh:ignoredProperties ( rdf:type rdfs:label ) ;
sh:ignoredProperties ( rdf:type rdfs:label <http://api.knora.org/ontology/knora-api/v2#hasComment> <http://api.knora.org/ontology/knora-api/v2#isPartOf> <http://api.knora.org/ontology/knora-api/v2#seqnum> ) ;
sh:property [ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testGeoname> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testIsPartOf> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testRichtext> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testIntegerSimpleText> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testColor> ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testHasRepresentation> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testDecimalSimpleText> ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testHasLinkToCardOneResource> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testUriValue> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testHasLinkToCardOneResource> ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testSubDate1> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testHasRepresentationValue> ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testHasLinkToValue> ],
[ a sh:PropertyShape ;
sh:maxCount 1 ;
sh:message "0-1" ;
sh:minCount 0 ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testBoolean> ;
sh:severity sh:Violation ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testIntegerSpinbox> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testIntegerSimpleText> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testSubDate2> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testIsPartOfValue> ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testRichtext> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testTextarea> ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testHasRepresentationValue> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testHasRepresentation> ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testListProp> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testSimpleText> ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testTimeValue> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testListProp> ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testIsPartOf> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testSubDate1> ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testSimpleText> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testHasLinkTo> ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testTextarea> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testHasLinkToValue> ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testHasLinkToCardOneResourceValue> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testTimeValue> ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testIsPartOfValue> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testDecimalSpinbox> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testHasComment> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testIntegerSpinbox> ],
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testColor> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testHasLinkTo> ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testDecimalSimpleText> ],
[ a sh:PropertyShape ;
sh:maxCount 1 ;
sh:message "0-1" ;
sh:minCount 0 ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testBoolean> ;
sh:severity sh:Violation ],
[ a sh:PropertyShape ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testHasLinkToCardOneResourceValue> ] ;
sh:path <http://0.0.0.0:3333/ontology/9999/onto/v2#testGeoname> ] ;
sh:targetClass <http://0.0.0.0:3333/ontology/9999/onto/v2#ClassWithEverything> .

<http://0.0.0.0:3333/ontology/9999/onto/v2#TestStillImageRepresentation_Shape> a sh:NodeShape ;
sh:closed true ;
sh:ignoredProperties ( rdf:type rdfs:label ) ;
sh:ignoredProperties ( rdf:type rdfs:label <http://api.knora.org/ontology/knora-api/v2#hasComment> <http://api.knora.org/ontology/knora-api/v2#isPartOf> <http://api.knora.org/ontology/knora-api/v2#seqnum> ) ;
sh:targetClass <http://0.0.0.0:3333/ontology/9999/onto/v2#TestStillImageRepresentation> .

0 comments on commit 3c01cfb

Please sign in to comment.