66 < title > SHACL 1.2 Rules</ title >
77 < script src ="https://www.w3.org/Tools/respec/respec-w3c " class ="remove "> </ script >
88 < script class ="remove ">
9-
9+
1010 function prepareSyntaxRules ( ) {
1111 document . querySelectorAll ( "[data-syntax-rule]" ) . forEach ( element => {
1212 let ruleId = element . getAttribute ( "data-syntax-rule" ) ;
3535 element . setAttribute ( "id" , "syntax-rule-" + ruleId ) ;
3636 } ) ;
3737 }
38-
38+
3939 function prepareValidators ( ) {
4040 document . querySelectorAll ( "[data-validator]" ) . forEach ( element => {
4141 let validatorId = element . getAttribute ( "data-validator" ) + "ConstraintComponent" ;
7373 for ( const tabs of document . querySelectorAll ( ".ds-selector-tabs" ) ) {
7474 const selectors = document . createElement ( "div" ) ;
7575 selectors . classList . add ( "selectors" ) ;
76-
77- // Check if shaclc div exists in this tab group
76+
77+ // Check if JSON-LD or shaclc div exists in this tab group
78+ const hasJsonld = tabs . querySelector ( ".jsonld" )
7879 const hasShaclc = tabs . querySelector ( ".shaclc" ) ;
79-
80+
8081 selectors . innerHTML = `
8182 <button class="selected" data-selects="turtle">Turtle</button>
82- <button data-selects="jsonld">JSON-LD</button>
83+ ${ hasJsonld ? ' <button data-selects="jsonld">JSON-LD</button>' : '' }
8384 ${ hasShaclc ? '<button data-selects="shaclc">SHACL-C</button>' : '' }
8485 `
8586
9798 }
9899 }
99100 } ) ;
100-
101+
101102 var respecConfig = {
102103 localBiblio : { } ,
103104
117118 {
118119 name : "Robert David" ,
119120 company : "Ontotext" ,
120- //mailto:
121+ //mailto:
121122 w3cid : "97894"
122123 } ,
123124 {
124125 name : "David Habgood" ,
125126 company : "KurrawongAI" ,
126- // mailto:
127+ // mailto:
127128 w3cid : "164266"
128129 } ,
129130
154155 publisher : "W3C" ,
155156 }
156157 }
157-
158+
158159 } ;
159160 </ script >
160161 < style >
@@ -713,7 +714,7 @@ <h3>Document Conventions</h3>
713714 < p > TODO</ p >
714715
715716 < p class ="ednote "> RFC 2119 language should autmatically be inserted here.</ p >
716-
717+
717718 </ section >
718719 </ section >
719720
@@ -766,7 +767,7 @@ <h2>Shape Rules Abstract Syntax</h2>
766767 A < em > data block</ em > is a set of triples.
767768 These form extra facts that are included in the inference process.
768769 </ dd >
769-
770+
770771 < dt > < dfn > triple template</ dfn > </ dt >
771772 < dd >
772773 A < em > triple template</ em > is 3-tuple where each element is either
@@ -778,7 +779,7 @@ <h2>Shape Rules Abstract Syntax</h2>
778779 < dd >
779780 A < em > triple pattern</ em > is 3-tuple where each element is either a
780781 variable, or an RDF term (which might be a triple term).
781- [=Triple patterns=] appear in the [=body=] of a [=rule=].
782+ [=Triple patterns=] appear in the [=body=] of a [=rule=].
782783 </ dd >
783784
784785 < dt > < dfn > condition expression</ dfn > </ dt >
@@ -807,19 +808,19 @@ <h2>Shape Rules Abstract Syntax</h2>
807808 A < em > rule head</ em > is a sequence where each element
808809 of the sequence is a [=triple template=].
809810 </ dd >
810-
811+
811812 < dt >
812813 < dfn data-lt ="body|rule body "> rule body</ dfn >
813814 </ dt >
814815 < dd >
815816 A < em > rule body</ em > is a sequence where each element
816- of the sequence is a [=triple pattern=], a
817+ of the sequence is a [=triple pattern=], a
817818 [=condition expression=], or an [=assignment=].
818819 </ dd >
819-
820+
820821 < dt > < dfn > rule set</ dfn > </ dt >
821822 < dd >
822- A < em > rule set</ em > is a collection of zero or more [=rules=]
823+ A < em > rule set</ em > is a collection of zero or more [=rules=]
823824 and a collection of zero or more [=data blocks=].
824825 </ dd >
825826 </ dl >
@@ -836,10 +837,10 @@ <h3>Well-formedness Conditions</h3>
836837 < p >
837838 Well-formedness is a set of conditions on the abstract syntax of
838839 shapes rules. Together, these rules ensure that a [=variable=] in the
839- [=head=] of a rule has a value defined in the [=body=] of the rule;
840- that each variable in an condition expression or assignment
840+ [=head=] of a rule has a value defined in the [=body=] of the rule;
841+ that each variable in an condition expression or assignment
841842 expression has a value at the point of evaluation; and that each
842- assignment in a rule introduces a new variable,
843+ assignment in a rule introduces a new variable,
843844 not used earlier in the rule body.
844845 </ p >
845846 < p >
@@ -849,15 +850,15 @@ <h3>Well-formedness Conditions</h3>
849850 < ul >
850851 < li > For every [=variable=] appearing in a [=triple template=]
851852 of the [=head=] of the [=rule=],
852- there is one or more occurrences of a [=variable=]
853- of the same name in the [=triple patterns=] in the [=body=],
853+ there is one or more occurrences of a [=variable=]
854+ of the same name in the [=triple patterns=] in the [=body=],
854855 or in an [=assignment=] in the body, or both.
855856 </ li >
856857 < li >
857858 For every [=variable=] in an [=expression=] at position < em > i</ em >
858859 of the [=body=], there is a corresponding [=variable=] of the same
859- name occuring in a [=triple pattern=] at a position < em > j</ em > ,
860- or occurring as an [=assignment variable=] at a position < em > j</ em > ,
860+ name occuring in a [=triple pattern=] at a position < em > j</ em > ,
861+ or occurring as an [=assignment variable=] at a position < em > j</ em > ,
861862 where < em > i > j</ em > .
862863 </ li >
863864 < li >
@@ -870,9 +871,9 @@ <h3>Well-formedness Conditions</h3>
870871 </ li >
871872 < li >
872873 For every [=variable=] in an [=assignment expression=] at position < em > i</ em > ,
873- there is a corresponding variable in a triple pattern at position
874+ there is a corresponding variable in a triple pattern at position
874875 < em > j</ em > where < em > i > j</ em > ,
875- or there is an [=assignment variable=] in an [=assignment=] at position
876+ or there is an [=assignment variable=] in an [=assignment=] at position
876877 < em > j</ em > where < em > i > j</ em > .
877878 </ li >
878879 </ ul >
@@ -905,10 +906,10 @@ <h2>Concrete Syntax forms for Shapes Rules</h2>
905906
906907DATA { :x :p 1 ; :q 2 . }
907908
908- RULE { ?x :bothPositive true . }
909+ RULE { ?x :bothPositive true . }
909910WHERE { ?x :p ?v1 FILTER ( ?v1 > 0 ) ?x :q ?v2 FILTER ( ?v2 > 0 ) }
910911
911- RULE { ?x :oneIsZero true . }
912+ RULE { ?x :oneIsZero true . }
912913WHERE { ?x :p ?v1 ; :q ?v2 FILTER ( ( ?v1 = 0 ) || ( ?v2 = 0 ) ) }
913914</ pre >
914915
@@ -1022,7 +1023,7 @@ <h4>Compact Syntax Abbreviations</h4>
10221023 < h3 > Shape Rules Evaluation</ h3 >
10231024
10241025 < p >
1025- This section defines the outcome of evaluating a rule set on given data.
1026+ This section defines the outcome of evaluating a rule set on given data.
10261027 It does not prescribe the algorithm as the method of implementation.
10271028 An implementation can use any algorithm that generates the same outcome.
10281029 </ p >
@@ -1044,7 +1045,7 @@ <h4>Evaluation of an expression</h4>
10441045
10451046Let [x/row] be
10461047 if x is an RDF term, the [x/row] is x
1047- if x is a variable then [x/row] is the value of x in the row
1048+ if x is a variable then [x/row] is the value of x in the row
10481049 ## By well-formedness, it is an error if x is not in the row.
10491050
10501051eval(F(expr1, expr2), row) = F(eval(expr1, row), eval(expr2, row))
@@ -1079,14 +1080,14 @@ <h4>Evaluation of a rule</h4>
10791080 add row1 to T1
10801081 endfor
10811082 T = T1
1082- endif
1083+ endif
10831084
10841085 if rElt is a condition expression F:
10851086 T1 = empty list
10861087 for each row in T:
10871088 if ( eval(F,B) )
10881089 add R to T1
1089- endif
1090+ endif
10901091 endfor
10911092 T = T1
10921093 endif
@@ -1105,7 +1106,7 @@ <h4>Evaluation of a rule</h4>
11051106# Evaluate rule head
11061107let H = empty set
11071108for each R in T:
1108- Let S = set of triples obtained by replacing variables
1109+ Let S = set of triples obtained by replacing variables
11091110 in the triple templates of the head with values from R
11101111 define [head(R)/row]
11111112 H = H union S
0 commit comments