Skip to content

Commit a3c7c58

Browse files
authored
Only show language in tab group if its div exists (#616)
1 parent efd1f30 commit a3c7c58

File tree

6 files changed

+149
-123
lines changed

6 files changed

+149
-123
lines changed

shacl12-core/index.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,13 @@
7474
const selectors = document.createElement("div");
7575
selectors.classList.add("selectors");
7676

77-
// Check if shaclc div exists in this tab group
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");
7980

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

@@ -1332,7 +1333,7 @@ <h4>Objects-of targets (sh:targetObjectsOf)</h4>
13321333
because it is the <a>object</a> of a <a>triple</a> that has <code>ex:knows</code> as its <a>predicate</a>.
13331334
</p>
13341335
</section>
1335-
1336+
13361337
<section id="targetWhere">
13371338
<h4>Where Targets (sh:targetWhere)</h4>
13381339
<p class="syntax">
@@ -1382,7 +1383,7 @@ <h4>Where Targets (sh:targetWhere)</h4>
13821383
<span class="focus-node-selected">ex:Bob</span> a ex:Person ;
13831384
ex:age 21 .
13841385
</div>
1385-
1386+
13861387
</aside>
13871388
<p>
13881389
In this example, only <code>ex:Bob</code> is a focus node of <code>ex:AdultPerson</code>
@@ -1403,7 +1404,7 @@ <h4>Where Targets (sh:targetWhere)</h4>
14031404
In the worst case, an engine will need to iterate over all nodes in the data graph to filter them one-by-one.
14041405
</p>
14051406
</section>
1406-
1407+
14071408
<section id="explicit-shape-target">
14081409
<h4>Explicit shape targets (sh:shape)</h4>
14091410
<p class="syntax">

shacl12-node-expr/index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,15 @@
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 JSON-LD or shaclc div exists in this tab group
78+
const hasJsonld = tabs.querySelector(".jsonld");
79+
const hasShaclc = tabs.querySelector(".shaclc");
80+
7681
selectors.innerHTML = `
7782
<button class="selected" data-selects="turtle">Turtle</button>
78-
<button data-selects="jsonld">JSON-LD</button>
83+
${hasJsonld ? '<button data-selects="jsonld">JSON-LD</button>' : ''}
84+
${hasShaclc ? '<button data-selects="shaclc">SHACL-C</button>' : ''}
7985
`
8086

8187
tabs.prepend(selectors);

shacl12-profiling/index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,15 @@
7474
for (const tabs of document.querySelectorAll(".ds-selector-tabs")) {
7575
const selectors = document.createElement("div");
7676
selectors.classList.add("selectors");
77+
78+
// Check if JSON-LD or shaclc div exists in this tab group
79+
const hasJsonld = tabs.querySelector(".jsonld");
80+
const hasShaclc = tabs.querySelector(".shaclc");
81+
7782
selectors.innerHTML = `
7883
<button class="selected" data-selects="turtle">Turtle</button>
79-
<button data-selects="jsonld">JSON-LD</button>
84+
${hasJsonld ? '<button data-selects="jsonld">JSON-LD</button>' : ''}
85+
${hasShaclc ? '<button data-selects="shaclc">SHACL-C</button>' : ''}
8086
`
8187

8288
tabs.prepend(selectors);

shacl12-rules/index.html

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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");
@@ -35,7 +35,7 @@
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";
@@ -73,13 +73,14 @@
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

@@ -97,7 +98,7 @@
9798
}
9899
}
99100
});
100-
101+
101102
var respecConfig = {
102103
localBiblio: {},
103104

@@ -117,13 +118,13 @@
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

@@ -154,7 +155,7 @@
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 &gt; 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 &gt; 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 &gt; j</em>.
877878
</li>
878879
</ul>
@@ -905,10 +906,10 @@ <h2>Concrete Syntax forms for Shapes Rules</h2>
905906

906907
DATA { :x :p 1 ; :q 2 . }
907908

908-
RULE { ?x :bothPositive true . }
909+
RULE { ?x :bothPositive true . }
909910
WHERE { ?x :p ?v1 FILTER ( ?v1 &gt; 0 ) ?x :q ?v2 FILTER ( ?v2 &gt; 0 ) }
910911

911-
RULE { ?x :oneIsZero true . }
912+
RULE { ?x :oneIsZero true . }
912913
WHERE { ?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

10451046
Let [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

10501051
eval(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
11061107
let H = empty set
11071108
for 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

Comments
 (0)