Skip to content

Commit d5c8299

Browse files
authored
Merge pull request #170 from casework/update_pyshacl_effects
Update pySHACL import to recognize typing
2 parents 02c844f + 0843d4d commit d5c8299

12 files changed

+15
-10
lines changed

case_utils/case_validate/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import warnings
4242
from typing import Any, Dict, List, Optional, Tuple, Union
4343

44-
import pyshacl # type: ignore
44+
import pyshacl
4545
import rdflib
4646
from rdflib import Graph
4747

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*Note*: Some files in this directory have contents incongruous with their file extension. This is a test of whether the `--format` flag overrides the file name detection, so incongruities are expected.

tests/case_utils/case_validate/cli/format_jsonld_output_jsonld.jsonld

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
],
66
"http://www.w3.org/ns/shacl#conforms": [
77
{
8+
"@type": "http://www.w3.org/2001/XMLSchema#boolean",
89
"@value": true
910
}
1011
]

tests/case_utils/case_validate/cli/format_jsonld_output_turtle.ttl

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
],
66
"http://www.w3.org/ns/shacl#conforms": [
77
{
8+
"@type": "http://www.w3.org/2001/XMLSchema#boolean",
89
"@value": true
910
}
1011
]

tests/case_utils/case_validate/cli/format_jsonld_output_txt.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
],
66
"http://www.w3.org/ns/shacl#conforms": [
77
{
8+
"@type": "http://www.w3.org/2001/XMLSchema#boolean",
89
"@value": true
910
}
1011
]

tests/case_utils/case_validate/cli/format_jsonld_output_unspecified.jsonld

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
],
66
"http://www.w3.org/ns/shacl#conforms": [
77
{
8+
"@type": "http://www.w3.org/2001/XMLSchema#boolean",
89
"@value": true
910
}
1011
]

tests/case_utils/case_validate/uco_test_examples/co_XFAIL_validation.ttl

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
[
7979
a sh:ValidationResult ;
8080
sh:focusNode <http://example.org/kb/list-item-4361eb9c-a1c2-40e7-ba83-92802554392a> ;
81-
sh:resultMessage 'Node kb:list-item-4361eb9c-a1c2-40e7-ba83-92802554392a conforms to shape [ rdf:type sh:PropertyShape ; sh:class co:Item ; sh:description Literal("This shape encodes in SHACL that the range of co:itemContent is the complement of co:Item.", lang=en) ; sh:path co:itemContent ]' ;
81+
sh:resultMessage 'Node kb:list-item-4361eb9c-a1c2-40e7-ba83-92802554392a must not conform to shape [ rdf:type sh:PropertyShape ; sh:class co:Item ; sh:description Literal("This shape encodes in SHACL that the range of co:itemContent is the complement of co:Item.", lang=en) ; sh:path co:itemContent ]' ;
8282
sh:resultSeverity sh:Violation ;
8383
sh:sourceConstraintComponent sh:NotConstraintComponent ;
8484
sh:sourceShape uco-co:itemContent-subjects-shape ;

tests/case_utils/case_validate/uco_test_examples/configuration_setting_XFAIL_validation.ttl

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
[
1414
a sh:ValidationResult ;
1515
sh:focusNode <http://example.org/kb/configuration-entry-5f0fc3ea-e763-4b6d-997a-be0d1ceffc8c> ;
16-
sh:resultMessage 'Node kb:configuration-entry-5f0fc3ea-e763-4b6d-997a-be0d1ceffc8c does not conform to exactly one shape in [ sh:property [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path configuration:itemObject ], [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path configuration:itemValue ] ] , [ sh:property [ sh:minCount Literal("1", datatype=xsd:integer) ; sh:path configuration:itemObject ] ] , [ sh:property [ sh:minCount Literal("1", datatype=xsd:integer) ; sh:path configuration:itemValue ] ]' ;
16+
sh:resultMessage 'Node kb:configuration-entry-5f0fc3ea-e763-4b6d-997a-be0d1ceffc8c must conform to exactly one shape in [ sh:property [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path configuration:itemObject ], [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path configuration:itemValue ] ] , [ sh:property [ sh:minCount Literal("1", datatype=xsd:integer) ; sh:path configuration:itemObject ] ] , [ sh:property [ sh:minCount Literal("1", datatype=xsd:integer) ; sh:path configuration:itemValue ] ]' ;
1717
sh:resultSeverity sh:Violation ;
1818
sh:sourceConstraintComponent sh:XoneConstraintComponent ;
1919
sh:sourceShape configuration:ConfigurationEntry ;

tests/case_utils/case_validate/uco_test_examples/database_records_XFAIL_validation.ttl

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
[
1313
a sh:ValidationResult ;
1414
sh:focusNode <http://example.org/kb/table-field-facet-37182dba-4dbd-4b97-b49e-8038b7fbfd29> ;
15-
sh:resultMessage 'Node kb:table-field-facet-37182dba-4dbd-4b97-b49e-8038b7fbfd29 does not conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("false" = False, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("true" = True, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ], [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldValue ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldIsNull ] ]' ;
15+
sh:resultMessage 'Node kb:table-field-facet-37182dba-4dbd-4b97-b49e-8038b7fbfd29 must conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("false" = False, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("true" = True, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ], [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldValue ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldIsNull ] ]' ;
1616
sh:resultSeverity sh:Violation ;
1717
sh:sourceConstraintComponent sh:XoneConstraintComponent ;
1818
sh:sourceShape observable:TableFieldFacet ;
@@ -35,7 +35,7 @@
3535
[
3636
a sh:ValidationResult ;
3737
sh:focusNode <http://example.org/kb/table-field-facet-46aafb6e-0be4-4412-a938-16c4b5ae5314> ;
38-
sh:resultMessage 'Node kb:table-field-facet-46aafb6e-0be4-4412-a938-16c4b5ae5314 does not conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("false" = False, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("true" = True, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ], [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldValue ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldIsNull ] ]' ;
38+
sh:resultMessage 'Node kb:table-field-facet-46aafb6e-0be4-4412-a938-16c4b5ae5314 must conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("false" = False, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:hasValue Literal("true" = True, datatype=xsd:boolean) ; sh:path observable:recordFieldIsNull ], [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldValue ] ] , [ rdf:type sh:NodeShape ; sh:property [ sh:maxCount Literal("0", datatype=xsd:integer) ; sh:path observable:recordFieldIsNull ] ]' ;
3939
sh:resultSeverity sh:Violation ;
4040
sh:sourceConstraintComponent sh:XoneConstraintComponent ;
4141
sh:sourceShape observable:TableFieldFacet ;

tests/case_utils/case_validate/uco_test_examples/hash_XFAIL_validation.ttl

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
[
7979
a sh:ValidationResult ;
8080
sh:focusNode <http://example.org/kb/hash-f46c714f-559a-4325-bf8a-4ef60c92c771> ;
81-
sh:resultMessage 'Node Literal("1", datatype=xsd:integer) does not conform to one or more shapes in [ sh:datatype vocabulary:HashNameVocab ] , [ sh:datatype xsd:string ]' ;
81+
sh:resultMessage 'Node Literal("1", datatype=xsd:integer) must conform to one or more shapes in [ sh:datatype vocabulary:HashNameVocab ] , [ sh:datatype xsd:string ]' ;
8282
sh:resultPath types:hashMethod ;
8383
sh:resultSeverity sh:Violation ;
8484
sh:sourceConstraintComponent sh:OrConstraintComponent ;

tests/case_utils/case_validate/uco_test_examples/rdf_list_XFAIL_validation.ttl

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
sh:detail [
1515
a sh:ValidationResult ;
1616
sh:focusNode <http://example.org/kb/list-1> ;
17-
sh:resultMessage 'Node kb:list-1 does not conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] , [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ] ; sh:xone ( [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:maxCount Literal("1", datatype=xsd:integer) ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:path rdf:first ] ] ) ] ]' ;
17+
sh:resultMessage 'Node kb:list-1 must conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] , [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ] ; sh:xone ( [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:maxCount Literal("1", datatype=xsd:integer) ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:path rdf:first ] ] ) ] ]' ;
1818
sh:resultSeverity sh:Violation ;
1919
sh:sourceConstraintComponent sh:XoneConstraintComponent ;
2020
sh:sourceShape uco-owl:Sequence-shape ;
@@ -40,7 +40,7 @@
4040
sh:detail [
4141
a sh:ValidationResult ;
4242
sh:focusNode <http://example.org/ontology/someDatatypeProperty> ;
43-
sh:resultMessage 'Node ex:someDatatypeProperty does not conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] , [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ] ; sh:xone ( [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:maxCount Literal("1", datatype=xsd:integer) ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:path rdf:first ] ] ) ] ]' ;
43+
sh:resultMessage 'Node ex:someDatatypeProperty must conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] , [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ] ; sh:xone ( [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:maxCount Literal("1", datatype=xsd:integer) ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:path rdf:first ] ] ) ] ]' ;
4444
sh:resultSeverity sh:Violation ;
4545
sh:sourceConstraintComponent sh:XoneConstraintComponent ;
4646
sh:sourceShape uco-owl:Sequence-shape ;
@@ -66,7 +66,7 @@
6666
<http://example.org/kb/concept-7>
6767
<http://example.org/kb/concept-8>
6868
) ;
69-
sh:resultMessage 'Node ( kb:concept-7 kb:concept-8 ) does not conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] , [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ] ; sh:xone ( [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:maxCount Literal("1", datatype=xsd:integer) ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:path rdf:first ] ] ) ] ]' ;
69+
sh:resultMessage 'Node ( kb:concept-7 kb:concept-8 ) must conform to exactly one shape in [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] , [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:path [ sh:oneOrMorePath rdf:rest ] ; sh:xone ( [ rdf:type sh:NodeShape ; sh:hasValue rdf:nil ] [ rdf:type sh:NodeShape ; sh:nodeKind sh:BlankNode ; sh:property [ rdf:type sh:PropertyShape ; sh:maxCount Literal("1", datatype=xsd:integer) ; sh:minCount Literal("1", datatype=xsd:integer) ; sh:path rdf:first ] ] ) ] ]' ;
7070
sh:resultSeverity sh:Violation ;
7171
sh:sourceConstraintComponent sh:XoneConstraintComponent ;
7272
sh:sourceShape uco-owl:Sequence-shape ;

tests/case_utils/case_validate/uco_test_examples/thread_XFAIL_validation.ttl

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
[
4949
a sh:ValidationResult ;
5050
sh:focusNode <http://example.org/kb/thread-item-2bd09467-d413-4a03-af5d-f0e428f7d987> ;
51-
sh:resultMessage 'Node kb:thread-item-2bd09467-d413-4a03-af5d-f0e428f7d987 conforms to shape [ rdf:type sh:PropertyShape ; sh:class co:Item ; sh:description Literal("This shape encodes in SHACL that the range of co:itemContent is the complement of co:Item.", lang=en) ; sh:path co:itemContent ]' ;
51+
sh:resultMessage 'Node kb:thread-item-2bd09467-d413-4a03-af5d-f0e428f7d987 must not conform to shape [ rdf:type sh:PropertyShape ; sh:class co:Item ; sh:description Literal("This shape encodes in SHACL that the range of co:itemContent is the complement of co:Item.", lang=en) ; sh:path co:itemContent ]' ;
5252
sh:resultSeverity sh:Violation ;
5353
sh:sourceConstraintComponent sh:NotConstraintComponent ;
5454
sh:sourceShape uco-co:itemContent-subjects-shape ;

0 commit comments

Comments
 (0)