From 3440a74faf0e347c619c20292d75f8e37575c013 Mon Sep 17 00:00:00 2001 From: Andy Seaborne Date: Sun, 31 Aug 2025 20:35:04 +0100 Subject: [PATCH 1/2] Content planning --- shacl12-inf-rules/index.html | 136 +++++++++++++++++++++++++++++------ 1 file changed, 116 insertions(+), 20 deletions(-) diff --git a/shacl12-inf-rules/index.html b/shacl12-inf-rules/index.html index 205a53eb..b248d06f 100644 --- a/shacl12-inf-rules/index.html +++ b/shacl12-inf-rules/index.html @@ -656,26 +656,42 @@

Document Conventions

Prefix Namespace + Informal Name rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# + RDF rdfs: http://www.w3.org/2000/01/rdf-schema# + RDFS + + + srl: + http://www.w3.org/ns/shacl-rules# + SHACL Rules + + + shnex: + http://www.w3.org/ns/shnex# + SHACL Node Expressions sh: http://www.w3.org/ns/shacl# + SHACL xsd: http://www.w3.org/2001/XMLSchema# + XML Schema ex: http://example.com/ns# + Example

@@ -917,39 +933,40 @@

Concrete Syntax forms for Shapes Rules

 PREFIX :       <http://example/>
 PREFIX rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+PREFIX shr     <http://www.w3.org/ns/shacl-rules#>
 PREFIX sh:     <http://www.w3.org/ns/shacl#>
 PREFIX sparql: <http://www.w3.org/ns/sparql#>
 
 :ruleSet-1
-  rdf:type sh:RuleSet;
-  sh:data (
+  rdf:type srl:RuleSet;
+  srl:data (
     <<( :x :p 1 )>>
     <<( :x :q 2 )>>
   );
-  sh:ruleSet (
+  srl:ruleSet (
     [
-      rdf:type sh:Rule;
-      sh:head (
-        [ sh:subject [ sh:var "x" ] ; sh:predicate :bothPositive; sh:object true ]
+      rdf:type srl:Rule;
+      srl:head (
+        [ srl:subject [ srl:var "x" ] ; srl:predicate :bothPositive; srl:object true ]
       )
-      sh:body (
-        [ sh:subject [ sh:var "x" ]; sh:predicate :p; sh:object [ sh:var "v1" ] ]
-        [ sh:expr [ sparql:greaterThan ( [ sh:var "v1" ] 0 ) ] ]
-        [ sh:subject [ sh:var "x" ] ; sh:predicate :q; sh:object [ sh:var "v2" ] ]
-        [ sh:expr [ sparql:greaterThan ( [ sh:var "v2" ] 0 ) ] ]
+      srl:body (
+        [ srl:subject [ srl:var "x" ]; srl:predicate :p; srl:object [ srl:var "v1" ] ]
+        [ srl:expr [ sparql:greaterThan ( [ srl:var "v1" ] 0 ) ] ]
+        [ srl:subject [ srl:var "x" ] ; srl:predicate :q; srl:object [ srl:var "v2" ] ]
+        [ srl:expr [ sparql:greaterThan ( [ srl:var "v2" ] 0 ) ] ]
       );
     ]
     [
-      rdf:type sh:Rule;
-      sh:head (
-        [ sh:subject [ sh:var "x" ] ; sh:predicate :oneIsZero ; sh:object true ]
+      rdf:type srl:Rule;
+      srl:head (
+        [ srl:subject [ srl:var "x" ] ; srl:predicate :oneIsZero ; srl:object true ]
       )
-      sh:body (
-        [ sh:subject [ sh:var "x" ] ; sh:predicate :p ; sh:object [ sh:var "v1" ] ]
-        [ sh:subject [ sh:var "x" ] ; sh:predicate :q ; sh:object [ sh:var "v2" ] ]
-        [ sh:expr [ sparql:function-or (
-              [ sparql:equals ( [ sh:var "v1" ] 0 ) ]
-              [ sparql:equals ( [ sh:var "v2" ] 0 ) ]
+      srl:body (
+        [ srl:subject [ srl:var "x" ] ; srl:predicate :p ; srl:object [ srl:var "v1" ] ]
+        [ srl:subject [ srl:var "x" ] ; srl:predicate :q ; srl:object [ srl:var "v2" ] ]
+        [ srl:expr [ sparql:function-or (
+              [ sparql:equals ( [ srl:var "v1" ] 0 ) ]
+              [ sparql:equals ( [ srl:var "v2" ] 0 ) ]
             ) ]
         ]
       );
@@ -1144,6 +1161,85 @@ 

Evaluation of a Rule Set

+
+

Drafting Notes

+
+

Attaching Rules to Shapes

+
+

@@ Discussion

+

+ See SHACL AF `sh:rule`, + which describes triple rules, + with a special case of property value rules + and SPARQL Rules (AKA "CONSTRUCT rules"). +

+

Core issue 517 : classification shapes

+

+ How much compatibility? + At one level, nothing needs top done because they have separate evaluation + and it is only a matter of whether an engine supports them or not. + It might be helpful to say when they happen (before 1.2 Rules - seea also defaul values) + and can infer if they generate infered triple. +

+ +
+
+ +
+

Parameterization

+
+

@@ Discussion

+

Define a new rule that is another rule with some variables already set

+
    +
  • Where do the setting come from?
  • +
  • Is is just one "row" or a data table?
  • +
  • Logically, some `BIND` steps at the start of the rule body
  • +
+
+
+ +
+

More on evaluation

+
+

@@ Discussion

+

The main evaluatiuon description creates all inferred triple using + the datalog "naive" algorithm.

+

Do we need to talk about backward evaluation and stratification?

+ +
+
+ +
+

Negation as semi-positive datalog

+
+

@@ Discussion

+

Negation (e.g. via SPARQL `NOT EXISTS`/`EXISTS`) can allowed if + the pattern is executed only one the base data graph, not including the + inferred graph. i.e. inferred triples are not seen. + Or stratification - not seeing inferred tripels from the current stratum. +

+

Priority for this feature?

+
+
+ +
+

Assignment restrictions

+
+

@@ Discussion

+

+ Assignment takes the rule lanuage outside datalog. + Can we define when it is "safe"? (e.g. triples involving the assignment + are not mentioned in the body of any other rule). +

+

Do we need "order" in the syntax?

+
+
+
+

Shapes Rules Language Grammar

From 6a72a17581f28cd0a10f37de54a1203cb9db81c3 Mon Sep 17 00:00:00 2001 From: Andy Seaborne Date: Mon, 8 Sep 2025 21:52:00 +0100 Subject: [PATCH 2/2] Named tuples? --- shacl12-inf-rules/index.html | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/shacl12-inf-rules/index.html b/shacl12-inf-rules/index.html index b248d06f..4a971e92 100644 --- a/shacl12-inf-rules/index.html +++ b/shacl12-inf-rules/index.html @@ -988,10 +988,7 @@

RDF Rules Syntax

-

Describe how the abstract model maps to triples??. - way round - copes with extra triples. - Output is the instance of the abtract model that generates the triples - - but need to define "maximal". +

Alternative: Describe how the abstract model maps to triples.

@@ -1237,6 +1234,19 @@

Assignment restrictions

Do we need "order" in the syntax?

+
+
+

Work space named tuples

+
+

@@ Discussion

+

+ Currently, SHACL Rules is, in datatlog-speak, only unnamed 3-tuples. + To support "programming" in rules, should we allow transient (not part of the output, + only during rulset evaluation) named n-tuples?
+ e.g. name(termOrVar, ...), possibly with a unique marker e.g. ` + giving `name(termOrVar, ...). +

+