-
Notifications
You must be signed in to change notification settings - Fork 45
RDF syntax for SHACL Rules #870
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
afs
wants to merge
1
commit into
gh-pages
Choose a base branch
from
rules-rdf-syntax
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.
Open
Changes from all commits
Commits
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,236 @@ | ||
| 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#> | ||
|
|
||
| PREFIX sparql: <http://www.w3.org/ns/sparql#> | ||
| PREFIX sh: <http://www.w3.org/ns/shacl#> | ||
| PREFIX srl: <http://www.w3.org/ns/shacl-rules#> | ||
| PREFIX srl-sh: <http://www.w3.org/ns/shacl-rules-shapes#> | ||
| PREFIX shnex: <http://www.w3.org/ns/shnex#> | ||
|
|
||
| #### RDF Term and variables. | ||
|
|
||
| ## Variables | ||
|
|
||
| srl-sh:variableShape rdf:type sh:NodeShape ; | ||
| sh:property | ||
| [ | ||
| sh:path srl:varName ; | ||
| sh:datatype xsd:string ; | ||
| sh:minCount 1 ; | ||
| sh:maxCount 1 ; | ||
| ] . | ||
|
|
||
| ## RDF Terms (blank nodes exclude syntax usage e.g. as variables) | ||
|
|
||
| srl-sh:termShape rdf:type sh:NodeShape ; | ||
| sh:name "RDF Term" ; | ||
| sh:xone ( | ||
| srl-sh:blankNodeDataShape | ||
| [ sh:nodeKind sh:IRI ] | ||
| [ sh:nodeKind sh:Literal ] | ||
| [ sh:nodeKind sh:TripleTerm ] | ||
| ) . | ||
|
|
||
| srl-sh:blankNodeDataShape rdf:type sh:NodeShape ; | ||
| sh:nodeKind sh:BlankNode ; | ||
| sh:not srl-sh:variableShape ; | ||
| . | ||
|
|
||
| srl-sh:varOrTermShape rdf:type sh:NodeShape ; | ||
| sh:name "VarOrTerm" ; | ||
| sh:xone ( [ sh:node srl-sh:variableShape ] | ||
| [ sh:node srl-sh:termShape ] | ||
| ) . | ||
|
|
||
| srl-sh:varOrIRIShape rdf:type sh:NodeShape ; | ||
| sh:name "VarOrIRI" ; | ||
| sh:xone ( [ sh:node srl-sh:variableShape ] | ||
| [ sh:nodeKind sh:IRI ] | ||
| ) . | ||
|
|
||
| srl-sh:blankNodeOrIRIShape rdf:type sh:NodeShape ; | ||
| sh:name "IRIorBlankNode" ; | ||
| sh:xone ( [ sh:nodeKind sh:BlankNode ] | ||
| [ sh:nodeKind sh:IRI ] | ||
| ) . | ||
|
|
||
| #### Triples | ||
|
|
||
| ## Symmetric RDF Triple including variables. | ||
| srl-sh:tripleShape rdf:type sh:NodeShape ; | ||
| sh:property | ||
| [ sh:path srl:subject ; | ||
| sh:name "Triple subject" ; | ||
| sh:minCount 1 ; | ||
| sh:maxCount 1 ; | ||
| sh:node srl-sh:varOrTermShape | ||
| ] ; | ||
| sh:property | ||
| [ sh:path srl:predicate ; | ||
| sh:name "Triple predicate" ; | ||
| sh:minCount 1 ; | ||
| sh:maxCount 1 ; | ||
| sh:node srl-sh:varOrIRIShape | ||
| ] ; | ||
| sh:property | ||
| [ sh:path srl:object ; | ||
| sh:name "Triple object" ; | ||
| sh:minCount 1 ; | ||
| sh:maxCount 1 ; | ||
| sh:node srl-sh:varOrTermShape | ||
| ] ; | ||
| . | ||
|
|
||
| ## Triple pattern (body) | ||
|
|
||
| srl-sh:triplePatternShape rdf:type sh:NodeShape ; | ||
| sh:node srl-sh:tripleShape ; | ||
| . | ||
|
|
||
| # Triple template (head) | ||
| srl-sh:tripleTemplateShape rdf:type sh:NodeShape ; | ||
| sh:node srl-sh:tripleShape ; | ||
| . | ||
|
|
||
| ## Triple Data (DATA) | ||
|
|
||
| srl-sh:tripleDataShape rdf:type sh:NodeShape ; | ||
| sh:property | ||
| [ sh:path srl:subject ; | ||
| sh:name "Data triple subject" ; | ||
| sh:minCount 1 ; | ||
| sh:maxCount 1 ; | ||
| sh:node srl-sh:termShape | ||
| ] ; | ||
| sh:property | ||
| [ sh:path srl:predicate ; | ||
| sh:name "Data triple predicate" ; | ||
| sh:minCount 1 ; | ||
| sh:maxCount 1 ; | ||
| sh:nodeKind sh:IRI | ||
| ] ; | ||
| sh:property | ||
| [ sh:path srl:object ; | ||
| sh:name "Data triple object" ; | ||
| sh:minCount 1 ; | ||
| sh:maxCount 1 ; | ||
| sh:node srl-sh:termShape | ||
| ] ; | ||
| . | ||
|
|
||
| #### Expressions | ||
|
|
||
| srl-sh:expressionShape rdf:type sh:NodeShape ; | ||
| ## if [ srl:expr [ ...] ] | ||
| ## sh:property | ||
| ## [ sh:path srl:expr ; | ||
| ## sh:minCount 1; | ||
| ## sh:maxCount 1 ; | ||
| ## ] ; | ||
| . | ||
|
|
||
| srl-sh:filterElementShape rdf:type sh:NodeShape ; | ||
| sh:property | ||
| [ sh:path srl:filter ; | ||
| sh:node srl-sh:expressionShape ; | ||
| sh:minCount 1 ; | ||
| sh:maxCount 1 ; | ||
| ]; | ||
| . | ||
|
|
||
| srl-sh:assignmentElementShape rdf:type sh:NodeShape ; | ||
| sh:property | ||
| [ sh:path srl:assign ; | ||
| sh:minCount 1; | ||
| sh:maxCount 1; | ||
| sh:property | ||
| [ sh:path srl:assignVar ; | ||
| sh:node srl-sh:variableShape ; | ||
| sh:minCount 1; | ||
| sh:maxCount 1; | ||
| ]; | ||
| sh:property | ||
| [ sh:path srl:assignValue ; | ||
| sh:node srl-sh:expressionShape ; | ||
| sh:minCount 1 ; | ||
| sh:maxCount 1 ; | ||
| ]; | ||
| ]; | ||
| . | ||
|
|
||
| srl-sh:negationElementBodyShape rdf:type sh:NodeShape ; | ||
| sh:xone ( | ||
| srl-sh:triplePatternShape | ||
| srl-sh:filterElementShape | ||
| ) . | ||
|
|
||
| srl-sh:negationElementShape rdf:type sh:NodeShape ; | ||
| sh:property | ||
| [ sh:path srl:not ; | ||
| sh:memberShape srl-sh:negationElementBodyShape ; | ||
| sh:minCount 1 ; | ||
| sh:maxCount 1 ; | ||
| ] . | ||
|
|
||
| #### DATA | ||
|
|
||
| ## In data blocks, allow triple terms for data triples. | ||
|
|
||
| srl-sh:dataBlockItemShape rdf:type sh:NodeShape ; | ||
| sh:xone ( | ||
| srl-sh:tripleDataShape | ||
| [ sh:nodeKind sh:TripleTerm ] | ||
| ) . | ||
|
|
||
| srl-sh:dataBlockShape rdf:type sh:NodeShape ; | ||
| sh:property [ | ||
| sh:path srl:data ; | ||
| sh:memberShape srl-sh:dataBlockItemShape ; | ||
| ] . | ||
|
|
||
| ### Rule Elements | ||
|
|
||
| srl-sh:ruleBodyElement rdf:type sh:NodeShape ; | ||
| sh:xone ( srl-sh:triplePatternShape | ||
| srl-sh:filterElementShape | ||
| srl-sh:assignmentElementShape | ||
| srl-sh:negationElementShape | ||
| ) . | ||
|
|
||
| srl-sh:ruleHeadElement rdf:type sh:NodeShape ; | ||
| sh:node srl-sh:tripleTemplateShape | ||
| . | ||
|
|
||
| #### Rule Shape | ||
|
|
||
| srl-sh:ruleHeadShape rdf:type sh:NodeShape ; | ||
| sh:property | ||
| [ sh:path srl:head ; | ||
| sh:memberShape srl-sh:ruleHeadElement ; | ||
| sh:maxCount 1; | ||
| sh:minCount 1; | ||
| ] . | ||
|
|
||
| srl-sh:ruleBodyShape rdf:type sh:NodeShape ; | ||
| sh:property | ||
| [ sh:path srl:body ; | ||
| sh:memberShape srl-sh:ruleBodyElement; | ||
| sh:maxCount 1; | ||
| sh:minCount 1; | ||
| ] . | ||
|
|
||
| srl-sh:ruleShape rdf:type sh:NodeShape ; | ||
| sh:node srl-sh:ruleHeadShape ; | ||
| sh:node srl-sh:ruleBodyShape ; | ||
| . | ||
|
|
||
| #### Rule Set | ||
|
|
||
| srl-sh:ruleSetShape rdf:type sh:NodeShape ; | ||
| sh:node srl-sh:dataBlockShape ; | ||
| sh:property | ||
| [ sh:path srl:rules ; | ||
| sh:memberShape srl-sh:ruleShape | ||
| ]; | ||
| . | ||
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,162 @@ | ||
| PREFIX ex: <http://example.org/> | ||
|
|
||
| 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 srl: <http://www.w3.org/ns/shacl-rules#> | ||
| PREFIX owl: <http://www.w3.org/2002/07/owl#> | ||
| PREFIX dc: <http://purl.org/dc/elements/1.1/> | ||
|
|
||
| <> a owl:Ontology ; | ||
| dc:title "The SHACL Rules Language Vocabulary (SRL)" ; | ||
| dc:date "2026-12-31" ; | ||
| dc:description "This is the RDF Schema for SHACL Rules." ; | ||
| rdfs:seeAlso <https://w3c.org/TR/shacl12-rules> . | ||
|
|
||
| #### SHACL Rules Syntax | ||
|
|
||
| ## -- Classes | ||
|
|
||
| srl:RuleSet rdf:type rdfs:Class ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#dfn-rule-set> ; | ||
| rdfs:label "Rule Set" ; | ||
| rdfs:comment "The class of rule sets." . | ||
|
|
||
| srl:Rule rdf:type rdfs:Class ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#dfn-rule> ; | ||
| rdfs:label "A SHACL Rule" ; | ||
| rdfs:comment "The class of SHACL Rules." . | ||
|
|
||
| ## -- Properties | ||
|
|
||
| srl:rules rdf:type rdf:Property ; | ||
| rdfs:domain srl:RuleSet ; | ||
| # range - list of rules | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:label "Rules of a Rule Set" ; | ||
| rdfs:comment "The list of rules of the rule set." . | ||
|
|
||
| srl:data rdf:type rdf:Property ; | ||
| rdfs:domain srl:RuleSet ; | ||
| # range - list | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#dfn-data-block> ; | ||
| rdfs:label "Data" ; | ||
| rdfs:comment "The list of data of the rule set." . | ||
|
|
||
| srl:head rdf:type rdf:Property ; | ||
| rdfs:domain srl:Rule ; | ||
| # range - list of triple templates | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#dfn-rule-head> ; | ||
| rdfs:label "Rule head" ; | ||
| rdfs:comment "The consequent of a rule." . | ||
|
|
||
| srl:body rdf:type rdf:Property ; | ||
| rdfs:domain srl:Rule ; | ||
| # range : list of rule elements | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#dfn-rule-body> ; | ||
| rdfs:label "Rule body" ; | ||
| rdfs:comment "The antecedent of a rule." . | ||
|
|
||
| ## -- Rule Body | ||
|
|
||
| srl:RuleElement rdf:type rdfs:Class ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#dfn-rule-body-element> ; | ||
| rdfs:label "A SHACL Rule Element" ; | ||
| rdfs:comment "The class of SHACL Rule Elements." . | ||
|
|
||
| srl:TriplePattern rdf:type rdfs:Class ; | ||
| rdfs:subClassOf srl:RuleElement ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#dfn-triple-pattern> ; | ||
| rdfs:label "A SHACL Rule Element" ; | ||
| rdfs:comment "The class of triple patterns." . | ||
|
|
||
| srl:CondidtionElement rdf:type rdfs:Class ; | ||
| rdfs:subClassOf srl:RuleElement ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#dfn-condition-element> ; | ||
| rdfs:label "A SHACL Rule condition element" ; | ||
| rdfs:comment "The class of SHACL condition elements." . | ||
|
|
||
| srl:AssignmentElement rdf:type rdfs:Class ; | ||
| rdfs:subClassOf srl:RuleElement ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#dfn-assignment-element> ; | ||
| rdfs:label "A SHACL Rule assignment element" ; | ||
| rdf:comment "The class of SHACL assignment elements." . | ||
|
|
||
| srl:NegationElement rdf:type rdfs:Class ; | ||
| rdfs:subClassOf srl:RuleElement ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#dfn-negation-element> ; | ||
| rdfs:label "A SHACL Rule negation element" ; | ||
| rdf:comment "The class of SHACL negation elements." . | ||
|
|
||
| ## ---- | ||
|
|
||
| srl:filter rdf:type rdf:Property ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#rdf-rules-syntax> ; | ||
| rdfs:label "filter" ; | ||
| rdfs:comment "A filter rule element" . | ||
|
|
||
| ## @@Remove | ||
| srl:assign rdf:type rdf:Property ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#rdf-rules-syntax> ; | ||
| rdfs:label "assign" ; | ||
| rdfs:comment "An asssignment rule element" . | ||
|
|
||
|
|
||
| srl:assignVar rdf:type rdf:Property ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#rdf-rules-syntax> ; | ||
| rdfs:label "assignment variable" ; | ||
| rdfs:comment "The variable of an assignment" . | ||
|
|
||
| srl:assignValue rdf:type rdf:Property ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#rdf-rules-syntax> ; | ||
| rdfs:label "addignment value" ; | ||
| rdfs:comment "The value or expression for an assignment" . | ||
|
|
||
| srl:not rdf:type rdf:Property ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#rdf-rules-syntax> ; | ||
| rdfs:label "negation rule element" ; | ||
| rdfs:comment "A negation rule element" . | ||
|
|
||
| ## ---- | ||
|
|
||
| srl:subject rdf:type rdf:Property ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#rdf-rules-syntax> ; | ||
| rdfs:range rdfs:Resource ; | ||
| rdfs:label "subject" ; | ||
| rdfs:comment "The subject of a triple, triple pattern or triple template." . | ||
|
|
||
| srl:predicate rdf:type rdf:Property ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#rdf-rules-syntax> ; | ||
| rdfs:range rdfs:Resource ; | ||
| rdfs:label "predicate" ; | ||
| rdfs:comment "The predicate of a triple, triple pattern or triple template." . | ||
|
|
||
| srl:object rdf:type rdf:Property ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#rdf-rules-syntax> ; | ||
| rdfs:range rdfs:Resource ; | ||
| rdfs:label "object" ; | ||
| rdfs:comment "The object of a triple, triple pattern or triple template." . | ||
|
|
||
| srl:varName rdf:type rdf:Property ; | ||
| rdfs:isDefinedBy srl: ; | ||
| rdfs:isDefinedBy <https://www.w3.org/TR/shacl12-rules/#rdf-rules-syntax> ; | ||
| rdfs:label "name of a variable" ; | ||
| rdfs:comment "Name of a variable name." . |
Oops, something went wrong.
Oops, something went wrong.
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.