From 2ba94088b93552ba6ec89fec55bfb53876c26a84 Mon Sep 17 00:00:00 2001 From: Andy Seaborne Date: Sun, 31 Aug 2025 20:35:04 +0100 Subject: [PATCH 1/9] Content planning --- shacl12-rules/index.html | 136 +++++++++++++++++++++++++++++++++------ 1 file changed, 116 insertions(+), 20 deletions(-) diff --git a/shacl12-rules/index.html b/shacl12-rules/index.html index 716917ed..4ab044e4 100644 --- a/shacl12-rules/index.html +++ b/shacl12-rules/index.html @@ -657,26 +657,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

@@ -918,39 +934,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 ) ]
             ) ]
         ]
       );
@@ -1145,6 +1162,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 82909d580e457cbfbf09c15b0c55b48b4d77fa99 Mon Sep 17 00:00:00 2001 From: Andy Seaborne Date: Mon, 8 Sep 2025 21:52:00 +0100 Subject: [PATCH 2/9] Named tuples? --- shacl12-rules/index.html | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/shacl12-rules/index.html b/shacl12-rules/index.html index 4ab044e4..e3dc4a8b 100644 --- a/shacl12-rules/index.html +++ b/shacl12-rules/index.html @@ -989,10 +989,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.

@@ -1238,6 +1235,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, ...). +

+
From 783c002f2058bd955ea920b6b20c2902faedf1c7 Mon Sep 17 00:00:00 2001 From: Nicholas Car Date: Tue, 16 Dec 2025 09:40:03 +1000 Subject: [PATCH 3/9] Update shacl12-rules/index.html Co-authored-by: Ted Thibodeau Jr --- shacl12-rules/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shacl12-rules/index.html b/shacl12-rules/index.html index e3dc4a8b..12fa542d 100644 --- a/shacl12-rules/index.html +++ b/shacl12-rules/index.html @@ -1229,9 +1229,9 @@

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). + Assignment takes the rule language 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?

From 205c1a204df3f0a0a4b4c22f534980edd846c85d Mon Sep 17 00:00:00 2001 From: Nicholas Car Date: Tue, 16 Dec 2025 09:40:13 +1000 Subject: [PATCH 4/9] Update shacl12-rules/index.html Co-authored-by: Ted Thibodeau Jr --- shacl12-rules/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shacl12-rules/index.html b/shacl12-rules/index.html index 12fa542d..2599b17f 100644 --- a/shacl12-rules/index.html +++ b/shacl12-rules/index.html @@ -1215,10 +1215,10 @@

More on evaluation

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. +

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

Priority for this feature?

From 766ecd3e068a54afb78ef1a6fe8fd368b04599a8 Mon Sep 17 00:00:00 2001 From: Nicholas Car Date: Tue, 16 Dec 2025 09:40:25 +1000 Subject: [PATCH 5/9] Update shacl12-rules/index.html Co-authored-by: Ted Thibodeau Jr --- shacl12-rules/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shacl12-rules/index.html b/shacl12-rules/index.html index 2599b17f..27aeb641 100644 --- a/shacl12-rules/index.html +++ b/shacl12-rules/index.html @@ -1168,7 +1168,8 @@

Attaching Rules to Shapes

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

Core issue 517 : classification shapes

From 5be971824e34a7f38d75834e451604675efd9489 Mon Sep 17 00:00:00 2001 From: Nicholas Car Date: Tue, 16 Dec 2025 09:40:37 +1000 Subject: [PATCH 6/9] Update shacl12-rules/index.html Co-authored-by: Ted Thibodeau Jr --- shacl12-rules/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shacl12-rules/index.html b/shacl12-rules/index.html index 27aeb641..fab957b9 100644 --- a/shacl12-rules/index.html +++ b/shacl12-rules/index.html @@ -1175,10 +1175,10 @@

Attaching Rules to Shapes

Core issue 517 : classification shapes

How much compatibility? - At one level, nothing needs top done because they have separate evaluation + At one level, nothing needs to be 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. + It might be helpful to say when they happen (before 1.2 Rules — see also default values) + and can infer whether they generate inferred triple.

  • Extends to `rdf:type srl:Rule`
  • From 19250f4dc1280a5074500349120c3a3973321c39 Mon Sep 17 00:00:00 2001 From: Nicholas Car Date: Tue, 16 Dec 2025 09:40:46 +1000 Subject: [PATCH 7/9] Update shacl12-rules/index.html Co-authored-by: Ted Thibodeau Jr --- shacl12-rules/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shacl12-rules/index.html b/shacl12-rules/index.html index fab957b9..1ee7660d 100644 --- a/shacl12-rules/index.html +++ b/shacl12-rules/index.html @@ -1194,7 +1194,7 @@

    Parameterization

    @@ Discussion

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

      -
    • Where do the setting come from?
    • +
    • Where do the settings come from?
    • Is is just one "row" or a data table?
    • Logically, some `BIND` steps at the start of the rule body
    From 73ddb104608e81fbdd835e399e6c4409d36c38ff Mon Sep 17 00:00:00 2001 From: Nicholas Car Date: Tue, 16 Dec 2025 09:40:53 +1000 Subject: [PATCH 8/9] Update shacl12-rules/index.html Co-authored-by: Ted Thibodeau Jr --- shacl12-rules/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shacl12-rules/index.html b/shacl12-rules/index.html index 1ee7660d..930f0798 100644 --- a/shacl12-rules/index.html +++ b/shacl12-rules/index.html @@ -1205,7 +1205,7 @@

    Parameterization

    More on evaluation

    @@ Discussion

    -

    The main evaluatiuon description creates all inferred triple using +

    The main evaluation description creates all inferred triples using the datalog "naive" algorithm.

    Do we need to talk about backward evaluation and stratification?

    From c4d86fde33dca4716dd3e9809805a1c00f269595 Mon Sep 17 00:00:00 2001 From: Nicholas Car Date: Tue, 16 Dec 2025 09:41:12 +1000 Subject: [PATCH 9/9] Update shacl12-rules/index.html Co-authored-by: Ted Thibodeau Jr --- shacl12-rules/index.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shacl12-rules/index.html b/shacl12-rules/index.html index 930f0798..77b4d17f 100644 --- a/shacl12-rules/index.html +++ b/shacl12-rules/index.html @@ -1242,10 +1242,12 @@

    Work space named tuples

    @@ Discussion

    - Currently, SHACL Rules is, in datatlog-speak, only unnamed 3-tuples. + Currently, SHACL Rules are, 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. ` + e.g., name(termOrVar, ...), possibly with a unique marker, e.g., + ` + U+0060 grave accent giving `name(termOrVar, ...).