-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5f4228
commit f74dd8a
Showing
8 changed files
with
290 additions
and
48 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
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,118 @@ | ||
@prefix list: <http://www.w3.org/2000/10/swap/list#> . | ||
@prefix sh: <http://www.w3.org/ns/shacl#> . | ||
@prefix log: <http://www.w3.org/2000/10/swap/log#> . | ||
@prefix : <#> . | ||
|
||
# https://w3c.github.io/data-shapes/data-shapes-test-suite/#dfn-full-compliance | ||
# the blank node structures representing property paths via sh:resultPath must not be shared among multiple results | ||
|
||
# create a fresh blank node for each skolem node | ||
{ | ||
?s ?p ?skolem . | ||
?skolem log:rawType log:SkolemIRI . | ||
?p list:in ( | ||
sh:resultPath | ||
sh:inversePath | ||
sh:alternativePath | ||
sh:zeroOrMorePath | ||
sh:zeroOrOnePath | ||
sh:oneOrMorePath | ||
) | ||
} | ||
=> | ||
{ | ||
?skolem :becomes [ :branch ?s ] . | ||
} . | ||
|
||
# create a fresh blank node for each skolem node in a list | ||
{ | ||
?s ?p ?list . | ||
?p list:in (sh:resultPath sh:alternativePath) . | ||
?list list:iterate (?index ?skolem) . | ||
?skolem log:rawType log:SkolemIRI . | ||
} | ||
=> | ||
{ | ||
?skolem :becomes [ :branch ?s; :list ?list; :index ?index ] | ||
} . | ||
|
||
# clone lists having skolem nodes, replacing each with the corresponding blank node | ||
{ | ||
?s ?p ?list . | ||
?p list:in (sh:resultPath sh:alternativePath) . | ||
?list list:member [ log:rawType log:SkolemIRI ] . | ||
(?x { | ||
?list list:iterate (?index []) . | ||
(?s ?list ?index) :nonSkolemMember ?x . | ||
} ?newList) log:collectAllIn [] . | ||
} | ||
=> | ||
{ | ||
?list :becomes ?newList . | ||
?newList :branch ?s . | ||
} . | ||
|
||
# clone sh:resultPath triples, replacing skolem nodes | ||
{ | ||
?result sh:resultPath ?path . | ||
?path :becomes ?new . | ||
?new :branch ?result . | ||
} | ||
=> | ||
{ | ||
?result sh:resultPath ?new . | ||
} . | ||
|
||
# clone triples with skolem subjects, replacing them | ||
{ | ||
?skolem :becomes ?blank ; ?p ?o. | ||
?p log:notEqualTo :becomes . | ||
(?skolem ?o) :nonSkolem ?nonSkolem . | ||
} | ||
=> | ||
{ | ||
?blank ?p ?nonSkolem | ||
} . | ||
|
||
|
||
## maps a node to a skolem-free version: | ||
|
||
# using a :becomes triple, if present | ||
{ | ||
(?branch ?x) :nonSkolem ?y . | ||
} | ||
<= | ||
{ | ||
?x :becomes ?y . | ||
?y :branch ?branch . | ||
} . | ||
# otherwise mapping to itself | ||
{ | ||
(?branch ?x) :nonSkolem ?x . | ||
} | ||
<= | ||
{ | ||
[] log:notIncludes { ?x :becomes [ ] } | ||
} . | ||
|
||
|
||
## maps a list member to a non-skolem node: | ||
|
||
# use the blank replacement for skolem nodes | ||
{ | ||
(?branch ?list ?index) :nonSkolemMember ?blank . | ||
} | ||
<= | ||
{ | ||
(?list ?index) list:memberAt [ :becomes ?blank ] . | ||
?blank :branch ?branch ; :list ?list ; :index ?index . | ||
} . | ||
# otherwise keep the list member | ||
{ | ||
(?branch ?list ?index) :nonSkolemMember ?x . | ||
} | ||
<= | ||
{ | ||
(?list ?index) list:memberAt ?x . | ||
?x log:rawType [ log:notEqualTo log:SkolemIRI ] . | ||
} . |
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,75 @@ | ||
@prefix log: <http://www.w3.org/2000/10/swap/log#> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix sh: <http://www.w3.org/ns/shacl#>. | ||
@prefix list: <http://www.w3.org/2000/10/swap/list#> . | ||
|
||
# Rules used as a query to extract the relevant information to compare SHACL validation reports. | ||
|
||
# SHACL Test Suite definition of full compliance: | ||
# https://w3c.github.io/data-shapes/data-shapes-test-suite/#Validate | ||
|
||
{ | ||
?report a sh:ValidationReport ; ?p ?o . | ||
?p list:in (sh:conforms sh:result) | ||
} | ||
=> | ||
{ | ||
?report a sh:ValidationReport ; ?p ?o . | ||
} . | ||
|
||
{ | ||
?report sh:result ?result . | ||
?result ?p ?o . | ||
?p list:in ( | ||
rdf:type | ||
sh:focusNode | ||
# sh:resultPath | ||
sh:resultSeverity | ||
sh:sourceConstraint | ||
sh:sourceConstraintComponent | ||
sh:sourceShape | ||
sh:value | ||
#sh:resultMessage | ||
) | ||
} | ||
=> | ||
{ | ||
?result ?p ?o | ||
} . | ||
|
||
|
||
# for paths, keep only triples without skolem nodes | ||
# (relying on path-split.n3 to clone triples with skolem nodes) | ||
|
||
{ | ||
?s ?p ?o . | ||
?p list:in ( | ||
sh:resultPath | ||
sh:inversePath | ||
# sh:alternativePath | ||
sh:zeroOrMorePath | ||
sh:zeroOrOnePath | ||
sh:oneOrMorePath | ||
) . | ||
?s log:rawType [ log:notEqualTo log:SkolemIRI ] . | ||
?o log:rawType [ log:notEqualTo log:SkolemIRI, rdf:List ] . # lists are handled in the next rule | ||
} | ||
=> | ||
{ | ||
?s ?p ?o | ||
} . | ||
|
||
{ | ||
?s ?p ?o . | ||
?p list:in ( | ||
sh:resultPath | ||
sh:alternativePath | ||
) . | ||
?s log:rawType [ log:notEqualTo log:SkolemIRI ] . | ||
?o log:rawType rdf:List . | ||
[] log:notIncludes { ?o list:member [ log:rawType log:SkolemIRI ] }. | ||
} | ||
=> | ||
{ | ||
?s ?p ?o | ||
} . |
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,68 @@ | ||
@prefix sh: <http://www.w3.org/ns/shacl#>. | ||
@prefix list: <http://www.w3.org/2000/10/swap/list#> . | ||
@prefix this: <http://eye-shacl#> . | ||
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> . | ||
@prefix sht: <http://www.w3.org/ns/shacl-test#> . | ||
|
||
# Rules used as a query to extract the relevant information to compare SHACL validation reports. | ||
|
||
# SHACL Test Suite definition of full compliance: | ||
# https://w3c.github.io/data-shapes/data-shapes-test-suite/#Validate | ||
|
||
{ | ||
[] a sht:Validate ; mf:result ?result . | ||
?result a sh:ValidationReport | ||
} | ||
=> | ||
{ | ||
?result a sh:ValidationReport | ||
} . | ||
|
||
{ | ||
[] a sht:Validate ; mf:result [ sh:result ?result ] . | ||
?result a sh:ValidationResult | ||
} | ||
=> | ||
{ | ||
?result a sh:ValidationResult | ||
} . | ||
|
||
|
||
{ | ||
[] a sht:Validate ; mf:result ?result . | ||
{?s ?p ?o} this:cbd ?result . | ||
?p list:in ( | ||
sh:result | ||
sh:conforms | ||
sh:focusNode | ||
sh:resultPath | ||
sh:resultSeverity | ||
sh:sourceConstraint | ||
sh:sourceConstraintComponent | ||
sh:sourceShape | ||
sh:value | ||
#sh:resultMessage | ||
) | ||
} | ||
=> | ||
{ | ||
?s ?p ?o | ||
} . | ||
|
||
|
||
{ | ||
[] a sht:Validate ; mf:result [ sh:result ?result ] . | ||
?result sh:resultPath ?path . | ||
{?s ?p ?o} this:cbd ?path . | ||
?p list:in ( | ||
sh:inversePath | ||
sh:alternativePath | ||
sh:zeroOrMorePath | ||
sh:zeroOrOnePath | ||
sh:oneOrMorePath | ||
) | ||
} | ||
=> | ||
{ | ||
?s ?p ?o | ||
} . |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/sh | ||
|
||
eye --nope --quiet --query report.n3 --turtle $1 --output test-expected.ttl | ||
eye --nope --quiet --query report-expected.n3 ../rules/compile/cbd.n3 --turtle $1 --output test-expected.ttl | ||
eye --nope --quiet testFile.n3 $1 --pass-only-new | ||
eye --nope --quiet --query report.n3 test-actual.ttl --output test-actual-report.ttl | ||
eye --nope --quiet --query report-actual.n3 path-split.n3 test-actual.ttl --output test-actual-report.ttl | ||
eye --nope --quiet --pass check.n3 | grep 'isomorphic' | wc -l |