-
Notifications
You must be signed in to change notification settings - Fork 30
Issue 189: Add sh:nodeByExpression
Constraint Component
#408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mgberg
wants to merge
7
commits into
gh-pages
Choose a base branch
from
issue-189
base: gh-pages
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+257
−1
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e377602
Add sh:nodeByExpression to spec
mgberg 244e357
Add sh:nodeByExpression to vocabulary
mgberg b210cc7
Add test cases for sh:nodeByExpression
mgberg 7725b2f
Replace "conformance checking" with "conformance check", remove leadi…
mgberg 22d05a9
Apply requested spec edits for sh:nodeByExpression section
mgberg 17dd71b
Apply requested test edits for sh:nodeByExpression
mgberg 7d4abd6
Update shacl12-core/index.html
mgberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
59 changes: 59 additions & 0 deletions
59
shacl12-test-suite/tests/core/node/nodeByExpression-001.ttl
This file contains hidden or 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,59 @@ | ||
@prefix dash: <http://datashapes.org/dash#> . | ||
@prefix ex: <http://datashapes.org/sh/tests/core/node/nodeByExpression-001.test#> . | ||
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> . | ||
@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 sh: <http://www.w3.org/ns/shacl#> . | ||
@prefix sht: <http://www.w3.org/ns/shacl-test#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
||
ex:InvalidInstance | ||
rdf:type ex:TestClass ; | ||
rdfs:label "Invalid instance" ; | ||
. | ||
ex:TestClass | ||
rdf:type rdfs:Class ; | ||
rdf:type sh:NodeShape ; | ||
rdfs:label "Test class" ; | ||
rdfs:subClassOf rdfs:Resource ; | ||
# Only using an IRI Expression here because Core doesn't define interesting node expressions | ||
sh:nodeByExpression ex:TestNodeShape ; | ||
. | ||
ex:TestNodeShape | ||
rdf:type sh:NodeShape ; | ||
sh:class ex:OtherClass ; | ||
. | ||
ex:ValidInstance | ||
rdf:type ex:OtherClass ; | ||
rdf:type ex:TestClass ; | ||
rdfs:label "Valid instance" ; | ||
. | ||
<> | ||
rdf:type mf:Manifest ; | ||
mf:entries ( | ||
<nodeByExpression-001> | ||
) ; | ||
. | ||
<nodeByExpression-001> | ||
rdf:type sht:Validate ; | ||
rdfs:label "Test of sh:nodeByExpression at node shape 001" ; | ||
mf:action [ | ||
sht:dataGraph <> ; | ||
sht:shapesGraph <> ; | ||
] ; | ||
mf:result [ | ||
rdf:type sh:ValidationReport ; | ||
sh:conforms "false"^^xsd:boolean ; | ||
sh:result [ | ||
rdf:type sh:ValidationResult ; | ||
sh:focusNode ex:InvalidInstance ; | ||
sh:resultSeverity sh:Violation ; | ||
sh:sourceConstraint ex:TestNodeShape ; | ||
sh:sourceConstraintComponent sh:NodeConstraintComponent ; | ||
sh:sourceShape ex:TestClass ; | ||
sh:value ex:InvalidInstance ; | ||
] ; | ||
] ; | ||
mf:status sht:approved ; | ||
. |
This file contains hidden or 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
117 changes: 117 additions & 0 deletions
117
shacl12-test-suite/tests/core/property/nodeByExpression-001.ttl
This file contains hidden or 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,117 @@ | ||
@prefix dash: <http://datashapes.org/dash#> . | ||
@prefix ex: <http://datashapes.org/sh/tests/core/property/nodeByExpression-001.test#> . | ||
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> . | ||
@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 sh: <http://www.w3.org/ns/shacl#> . | ||
@prefix sht: <http://www.w3.org/ns/shacl-test#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
|
||
ex:Anon | ||
rdf:type ex:Person ; | ||
ex:firstName "Anon" ; | ||
. | ||
ex:AssignedToShape | ||
rdf:type sh:NodeShape ; | ||
rdfs:comment "All assignees must have an email and a last name." ; | ||
sh:property [ | ||
sh:path ex:email ; | ||
sh:maxCount 1 ; | ||
sh:minCount 1 ; | ||
] ; | ||
sh:property [ | ||
sh:path ex:lastName ; | ||
sh:maxCount 1 ; | ||
sh:minCount 1 ; | ||
] ; | ||
. | ||
ex:Issue | ||
rdf:type rdfs:Class ; | ||
rdf:type sh:NodeShape ; | ||
rdfs:label "Issue" ; | ||
rdfs:subClassOf rdfs:Resource ; | ||
sh:property ex:Issue-assignedTo ; | ||
sh:property ex:Issue-submittedBy ; | ||
. | ||
ex:Issue-assignedTo | ||
sh:path ex:assignedTo ; | ||
sh:class ex:Person ; | ||
# Only using an IRI Expression here because Core doesn't define interesting node expressions | ||
sh:nodeByExpression ex:AssignedToShape ; | ||
. | ||
ex:Issue-submittedBy | ||
sh:path ex:submittedBy ; | ||
sh:class ex:Person ; | ||
sh:minCount 1 ; | ||
. | ||
ex:Issue_1 | ||
rdf:type ex:Issue ; | ||
ex:assignedTo ex:Anon ; | ||
ex:submittedBy ex:Anon ; | ||
rdfs:label "Issue 1" ; | ||
. | ||
ex:Issue_2 | ||
rdf:type ex:Issue ; | ||
ex:assignedTo ex:JohnDoeWithEmail ; | ||
ex:submittedBy ex:Anon ; | ||
rdfs:label "Issue 2" ; | ||
. | ||
ex:JohnDoeWithEmail | ||
rdf:type ex:Person ; | ||
ex:email "[email protected]" ; | ||
ex:firstName "John" ; | ||
ex:lastName "Doe" ; | ||
. | ||
ex:Person | ||
rdf:type rdfs:Class ; | ||
rdf:type sh:NodeShape ; | ||
rdfs:label "Person" ; | ||
rdfs:subClassOf rdfs:Resource ; | ||
sh:property [ | ||
sh:path ex:email ; | ||
ex:datatype xsd:string ; | ||
rdfs:label "email" ; | ||
] ; | ||
sh:property [ | ||
sh:path ex:firstName ; | ||
rdfs:label "first name" ; | ||
sh:datatype xsd:string ; | ||
sh:maxCount 1 ; | ||
sh:minCount 1 ; | ||
] ; | ||
sh:property [ | ||
sh:path ex:lastName ; | ||
rdfs:label "last name" ; | ||
sh:datatype xsd:string ; | ||
] ; | ||
. | ||
<> | ||
rdf:type mf:Manifest ; | ||
mf:entries ( | ||
<nodeByExpression-001> | ||
) ; | ||
. | ||
<nodeByExpression-001> | ||
rdf:type sht:Validate ; | ||
rdfs:label "Test of sh:nodeByExpression at property shape 001" ; | ||
mf:action [ | ||
sht:dataGraph <> ; | ||
sht:shapesGraph <> ; | ||
] ; | ||
mf:result [ | ||
rdf:type sh:ValidationReport ; | ||
sh:conforms "false"^^xsd:boolean ; | ||
sh:result [ | ||
rdf:type sh:ValidationResult ; | ||
sh:focusNode ex:Issue_1 ; | ||
sh:resultPath ex:assignedTo ; | ||
sh:resultSeverity sh:Violation ; | ||
sh:sourceConstraint ex:AssignedToShape ; | ||
sh:sourceConstraintComponent sh:NodeConstraintComponent ; | ||
sh:sourceShape ex:Issue-assignedTo ; | ||
sh:value ex:Anon ; | ||
] ; | ||
] ; | ||
mf:status sht:approved ; | ||
. |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An example at this point showing where it is different to
sh:node
would be useful.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An example was removed as per the discussion above (here and here).
There are two differences between
sh:nodeByExpression
andsh:node
within the scope of the core spec:sh:nodeByExpression
cannot take a node shape that is a blank node assh:node
can, as a blank node would be interpreted as a Node Expression.sh:nodeByExpression
additionally include a value forsh:sourceConstraint
.The example I originally included was essentially a duplicate of the example for
sh:node
with the constraint component replaced and a value forsh:sourceConstraint
in the example result. @HolgerKnublauch suggested I remove it and wait to put a more comprehensive example in the Node Expression spec.I can certainly revert that change if it is desired to have that example back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation.
As a general comment, I'm not sure we are helping users by not including examples that show clear node expressions in Core but that's not for this PR.
(Do people really think there will be common static only SHACL 1.2 implementations?)