-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into rule_mode
- Loading branch information
Showing
8 changed files
with
295 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# NIST Software Licensing Statement | ||
|
||
NIST-developed software is provided by NIST as a public service. | ||
You may use, copy, and distribute copies of the software in any | ||
medium, provided that you keep intact this entire notice. You may | ||
improve, modify, and create derivative works of the software or | ||
any portion of the software, and you may copy and distribute such | ||
modifications or works. Modified works should carry a notice | ||
stating that you changed the software and should note the date | ||
and nature of any such change. Please explicitly acknowledge the | ||
National Institute of Standards and Technology as the source of | ||
the software. | ||
|
||
NIST-developed software is expressly provided "AS IS." NIST MAKES | ||
NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED, IN FACT, OR ARISING BY | ||
OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | ||
WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, | ||
NON-INFRINGEMENT, AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR | ||
WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED | ||
OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE CORRECTED. NIST DOES | ||
NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE | ||
SOFTWARE OR THE RESULTS THEREOF, INCLUDING BUT NOT LIMITED TO THE | ||
CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE | ||
SOFTWARE. | ||
|
||
You are solely responsible for determining the appropriateness of | ||
using and distributing the software and you assume all risks | ||
associated with its use, including but not limited to the risks | ||
and costs of program errors, compliance with applicable laws, | ||
damage to or loss of data, programs or equipment, and the | ||
unavailability or interruption of operation. This software is not | ||
intended to be used in any situation where a failure could cause | ||
risk of injury or damage to property. The software developed by | ||
NIST employees is not subject to copyright protection within the | ||
United States. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
""" | ||
https://github.com/RDFLib/pySHACL/issues/220 | ||
""" | ||
from pyshacl import validate | ||
from pyshacl.rdfutil import load_from_source | ||
|
||
data_graph1 = load_from_source("./test/issues/test_220/kb-REPRODUCTION-1.ttl") | ||
shacl_graph1 = load_from_source("./test/issues/test_220/sh-REPRODUCTION-1.ttl") | ||
data_graph2 = load_from_source("./test/issues/test_220/kb-REPRODUCTION-2.ttl") | ||
shacl_graph2 = load_from_source("./test/issues/test_220/sh-REPRODUCTION-2.ttl") | ||
ont_graph = load_from_source("./test/issues/test_220/owl-REPRODUCTION.ttl") | ||
|
||
|
||
def test_220_1(): | ||
conforms, g, s = validate(data_graph=data_graph1, shacl_graph=shacl_graph1, ont_graph=ont_graph, inference='none') | ||
assert conforms | ||
|
||
|
||
def test_220_2(): | ||
conforms, g, s = validate(data_graph=data_graph2, shacl_graph=shacl_graph2, ont_graph=ont_graph, inference='none') | ||
assert not conforms | ||
assert "Results (2)" in s | ||
|
||
|
||
if __name__ == "__main__": | ||
test_220_1() | ||
test_220_2() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@prefix ex: <http://example.org/ontology/> . | ||
@prefix kb: <http://example.org/kb/> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
||
kb:thing-PASS-2 | ||
a | ||
ex:ThingC , | ||
ex:ThingE | ||
; | ||
rdfs:comment "This should raise no validation results."@en ; | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@prefix ex: <http://example.org/ontology/> . | ||
@prefix kb: <http://example.org/kb/> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
||
kb:thing-PASS-1 | ||
a ex:ThingA ; | ||
rdfs:comment "This should raise no validation results."@en ; | ||
. | ||
|
||
kb:thing-PASS-2 | ||
a | ||
ex:ThingC , | ||
ex:ThingE | ||
; | ||
rdfs:comment "This should raise no validation results."@en ; | ||
. | ||
|
||
kb:thing-XFAIL-1 | ||
a ex:OneXorThing ; | ||
rdfs:comment "This should raise a validation result, due to not being more specifically a ThingA or ThingB as the SHACL requires when reviewing the OWL disjoint union definition of OneXorThing."@en ; | ||
. | ||
|
||
kb:thing-XFAIL-2 | ||
a ex:ThingC ; | ||
rdfs:comment "This should raise a validation result, due to not being a ThingE or ThingF as the SHACL requires when reviewing the entailed superclass TwoXorThing."@en ; | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
@prefix ex: <http://example.org/ontology/> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
||
ex:OneXorThing | ||
a owl:Class ; | ||
owl:disjointUnionOf ( | ||
ex:ThingA | ||
ex:ThingB | ||
) ; | ||
. | ||
|
||
ex:ThingA | ||
a owl:Class ; | ||
rdfs:subClassOf ex:OneXorThing ; | ||
owl:disjointWith ex:ThingB ; | ||
. | ||
|
||
ex:ThingB | ||
a owl:Class ; | ||
rdfs:subClassOf ex:OneXorThing ; | ||
owl:disjointWith ex:ThingA ; | ||
. | ||
|
||
ex:ThingC | ||
a owl:Class ; | ||
rdfs:subClassOf ex:TwoXorThing ; | ||
owl:disjointWith ex:ThingD ; | ||
. | ||
|
||
ex:ThingD | ||
a owl:Class ; | ||
rdfs:subClassOf ex:TwoXorThing ; | ||
owl:disjointWith ex:ThingC ; | ||
. | ||
|
||
ex:ThingE | ||
a owl:Class ; | ||
rdfs:subClassOf ex:TwoXorThing ; | ||
owl:disjointWith ex:ThingF ; | ||
. | ||
|
||
ex:ThingF | ||
a owl:Class ; | ||
rdfs:subClassOf ex:TwoXorThing ; | ||
owl:disjointWith ex:ThingE ; | ||
. | ||
|
||
ex:TwoXorThing | ||
a owl:Class ; | ||
owl:disjointUnionOf | ||
( | ||
ex:ThingC | ||
ex:ThingD | ||
) , | ||
( | ||
ex:ThingE | ||
ex:ThingF | ||
) | ||
; | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@prefix ex: <http://example.org/ontology/> . | ||
@prefix sh: <http://www.w3.org/ns/shacl#> . | ||
@prefix sh-ex: <http://example.org/shapes/> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
||
sh-ex:TwoXorThing-shape | ||
a sh:NodeShape ; | ||
sh:targetClass ex:TwoXorThing ; | ||
sh:xone | ||
( | ||
[ | ||
a sh:NodeShape ; | ||
sh:class ex:ThingC ; | ||
] | ||
[ | ||
a sh:NodeShape ; | ||
sh:class ex:ThingD ; | ||
] | ||
) , | ||
( | ||
[ | ||
a sh:NodeShape ; | ||
sh:class ex:ThingE ; | ||
] | ||
[ | ||
a sh:NodeShape ; | ||
sh:class ex:ThingF ; | ||
] | ||
) | ||
; | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
@prefix ex: <http://example.org/ontology/> . | ||
@prefix sh: <http://www.w3.org/ns/shacl#> . | ||
@prefix sh-ex: <http://example.org/shapes/> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
||
sh-ex:OneXorThing-shape | ||
a sh:NodeShape ; | ||
sh:targetClass ex:OneXorThing ; | ||
sh:xone ( | ||
[ | ||
a sh:NodeShape ; | ||
sh:class ex:ThingA ; | ||
] | ||
[ | ||
a sh:NodeShape ; | ||
sh:class ex:ThingB ; | ||
] | ||
) ; | ||
. | ||
|
||
sh-ex:TwoXorThing-shape | ||
a sh:NodeShape ; | ||
sh:targetClass ex:TwoXorThing ; | ||
sh:xone | ||
( | ||
[ | ||
a sh:NodeShape ; | ||
sh:class ex:ThingC ; | ||
] | ||
[ | ||
a sh:NodeShape ; | ||
sh:class ex:ThingD ; | ||
] | ||
) , | ||
( | ||
[ | ||
a sh:NodeShape ; | ||
sh:class ex:ThingE ; | ||
] | ||
[ | ||
a sh:NodeShape ; | ||
sh:class ex:ThingF ; | ||
] | ||
) | ||
; | ||
. |