Skip to content

Commit 3480e93

Browse files
#177: Added sh:singleLine (#268)
* #177: Added sh:singleLine * #177: Added \f and \v * Update shacl12-core/index.html Co-authored-by: Ted Thibodeau Jr <[email protected]> * Update shacl12-core/index.html Co-authored-by: Ted Thibodeau Jr <[email protected]> * Update shacl12-vocabularies/shacl.ttl Co-authored-by: Ted Thibodeau Jr <[email protected]> * #177: Marked feature "At Risk" --------- Co-authored-by: Ted Thibodeau Jr <[email protected]>
1 parent b8ac36a commit 3480e93

File tree

4 files changed

+200
-1
lines changed

4 files changed

+200
-1
lines changed

shacl12-core/index.html

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3002,6 +3002,71 @@ <h4>sh:pattern</h4>
30023002
</aside>
30033003
</section>
30043004

3005+
<section id="SingleLineConstraintComponent">
3006+
<h4>sh:singleLine</h4>
3007+
<p class="issue">
3008+
This feature is "at risk" pending a WG resolution on this (and similar) convenience features.
3009+
The WG is not sure yet where to draw the lines between features that should go into Core versus some other document.
3010+
Originally discussed as <a href="https://github.com/w3c/data-shapes/issues/177">Issue 177</a>.
3011+
</p>
3012+
<p>
3013+
When set to <code>true</code>, <code>sh:singleLine</code> specifies that the <a>value nodes</a> must not contain line breaks.
3014+
In addition to constraint validation, this information can be exploited by user interface builders to select between (single-lined) text fields and (multi-lined) text areas.
3015+
</p>
3016+
<p>
3017+
<span class="component-class">Constraint Component IRI</span>: <code>sh:SingleLineConstraintComponent</code>
3018+
</p>
3019+
3020+
<div class="parameters">Parameters:</div>
3021+
<table class="term-table">
3022+
<tr>
3023+
<th>Property</th>
3024+
<th>Summary and Syntax Rules</th>
3025+
</tr>
3026+
<tr>
3027+
<td><code>sh:singleLine</code></td>
3028+
<td>
3029+
<code>true</code> to activate this constraint.
3030+
<span data-syntax-rule="singleLine-datatype">The values of <code>sh:singleLine</code> in a shape are literals with datatype <code>xsd:boolean</code>.</span>
3031+
<span data-syntax-rule="singleLine-maxCount">A shape has at most one value for <code>sh:singleLine</code>.</span>
3032+
</td>
3033+
</tr>
3034+
</table>
3035+
<div class="def def-text">
3036+
<div class="def-header">TEXTUAL DEFINITION</div>
3037+
<div class="def-text-body" data-validator="SingleLine">
3038+
If <code>$singleLine</code> is <code>true</code>, then, for each <a>value node</a> that is a literal where the lexical form matches the
3039+
regular expression (as defined by the <a data-cite="sparql12-query/#func-regex">SPARQL REGEX function</a>) <code>[\f\r\n\v]</code>, there is a validation result.
3040+
</div>
3041+
</div>
3042+
<p><em>The remainder of this section is informative.</em></p>
3043+
<aside class="example">
3044+
<p>
3045+
In this example, the valid target nodes of the shape can only contain single-lined values for <code>rdfs:label</code>.
3046+
The values of <code>rdfs:comment</code> are explicitly allowed to contain line breaks, indicating to form builders that
3047+
those values should be edited in a multi-line (text area) input widget.
3048+
</p>
3049+
<div class="shapes-graph">
3050+
<div class="turtle">
3051+
ex:SingleLineExampleShape
3052+
a sh:NodeShape ;
3053+
sh:property [
3054+
a sh:PropertyShape ;
3055+
sh:path rdfs:label ;
3056+
sh:datatype xsd:string ;
3057+
sh:singleLine true ;
3058+
] ;
3059+
sh:property [
3060+
a sh:PropertyShape ;
3061+
sh:path rdfs:comment ;
3062+
sh:or ( [ sh:datatype xsd:string ] [ sh:datatype rdf:langString ] ) ;
3063+
sh:singleLine false ;
3064+
] .
3065+
</div>
3066+
</div>
3067+
</aside>
3068+
</section>
3069+
30053070
<section id="LanguageInConstraintComponent">
30063071
<h4>sh:languageIn</h4>
30073072
<p>
@@ -4729,7 +4794,13 @@ <h2>Revision History</h2>
47294794
<li><b>2024-02-14</b>: New work started by cloning the main SHACL spec and splitting it into SHACL Core and SHACL-SPARQL</li>
47304795
</ul>
47314796
</section>
4732-
4797+
4798+
<section class="appendix informative" id="changes-12">
4799+
<h2>Changes between SHACL 1.0 Core and SHACL 1.2 Core</h2>
4800+
<ul>
4801+
<li>Added the new constraint component <a href="#SingleLineConstraintComponent"><code>sh:singleLine</code></a>, see <a href="https://github.com/w3c/data-shapes/issues/177">Issue 177</a></li>
4802+
</ul>
4803+
</section>
47334804
</body>
47344805

47354806
<script type="text/javascript">

shacl12-test-suite/tests/core/property/manifest.ttl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
mf:include <qualifiedMinCountDisjoint-001.ttl> ;
4242
mf:include <qualifiedValueShape-001.ttl> ;
4343
mf:include <qualifiedValueShapesDisjoint-001.ttl> ;
44+
mf:include <singleLine-001.ttl> ;
4445
mf:include <uniqueLang-001.ttl> ;
4546
mf:include <uniqueLang-002.ttl> ;
4647
.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
@prefix dash: <http://datashapes.org/dash#> .
2+
@prefix ex: <http://datashapes.org/sh/tests/core/property/singleLine-001.test#> .
3+
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
4+
@prefix owl: <http://www.w3.org/2002/07/owl#> .
5+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
6+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
7+
@prefix sh: <http://www.w3.org/ns/shacl#> .
8+
@prefix sht: <http://www.w3.org/ns/shacl-test#> .
9+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
10+
11+
ex:InvalidInstanceF
12+
rdf:type ex:SingleLineExampleShape ;
13+
rdfs:label "Invalid\finstanceF" ;
14+
.
15+
ex:InvalidInstanceN
16+
rdf:type ex:SingleLineExampleShape ;
17+
rdfs:label "Invalid\ninstanceN" ;
18+
.
19+
ex:InvalidInstanceR
20+
rdf:type ex:SingleLineExampleShape ;
21+
rdfs:label "Invalid\rinstanceR" ;
22+
.
23+
ex:InvalidInstanceV
24+
rdf:type ex:SingleLineExampleShape ;
25+
rdfs:label "Invalid\u000BinstanceV" ;
26+
.
27+
ex:SingleLineExampleShape
28+
a sh:NodeShape, rdfs:Class ;
29+
sh:property ex:SingleLineExampleShape-label ;
30+
sh:property ex:SingleLineExampleShape-comment ;
31+
.
32+
ex:SingleLineExampleShape-label
33+
a sh:PropertyShape ;
34+
sh:path rdfs:label ;
35+
sh:datatype xsd:string ;
36+
sh:singleLine true ;
37+
.
38+
ex:SingleLineExampleShape-comment
39+
a sh:PropertyShape ;
40+
sh:path rdfs:comment ;
41+
sh:or ( [ sh:datatype xsd:string ] [ sh:datatype rdf:langString ] ) ;
42+
sh:singleLine false ;
43+
.
44+
ex:ValidInstance1
45+
rdf:type ex:SingleLineExampleShape ;
46+
rdfs:label "Valid instance1" ;
47+
rdfs:comment """This is a multi-
48+
line comment.
49+
"""
50+
.
51+
<>
52+
rdf:type mf:Manifest ;
53+
mf:entries (
54+
<singleLine-001>
55+
) ;
56+
.
57+
<singleLine-001>
58+
rdf:type sht:Validate ;
59+
rdfs:label "Test of sh:singleLine at property shape 001" ;
60+
mf:action [
61+
sht:dataGraph <> ;
62+
sht:shapesGraph <> ;
63+
] ;
64+
mf:result [
65+
rdf:type sh:ValidationReport ;
66+
sh:conforms "false"^^xsd:boolean ;
67+
sh:result [
68+
rdf:type sh:ValidationResult ;
69+
sh:focusNode ex:InvalidInstanceF ;
70+
sh:resultPath rdfs:label ;
71+
sh:resultSeverity sh:Violation ;
72+
sh:sourceConstraintComponent sh:SingleLineConstraintComponent ;
73+
sh:sourceShape ex:SingleLineExampleShape-label ;
74+
sh:value "Invalid\finstanceF" ;
75+
] ;
76+
sh:result [
77+
rdf:type sh:ValidationResult ;
78+
sh:focusNode ex:InvalidInstanceN ;
79+
sh:resultPath rdfs:label ;
80+
sh:resultSeverity sh:Violation ;
81+
sh:sourceConstraintComponent sh:SingleLineConstraintComponent ;
82+
sh:sourceShape ex:SingleLineExampleShape-label ;
83+
sh:value "Invalid\ninstanceN" ;
84+
] ;
85+
sh:result [
86+
rdf:type sh:ValidationResult ;
87+
sh:focusNode ex:InvalidInstanceR ;
88+
sh:resultPath rdfs:label ;
89+
sh:resultSeverity sh:Violation ;
90+
sh:sourceConstraintComponent sh:SingleLineConstraintComponent ;
91+
sh:sourceShape ex:SingleLineExampleShape-label ;
92+
sh:value "Invalid\rinstanceR" ;
93+
] ;
94+
sh:result [
95+
rdf:type sh:ValidationResult ;
96+
sh:focusNode ex:InvalidInstanceV ;
97+
sh:resultPath rdfs:label ;
98+
sh:resultSeverity sh:Violation ;
99+
sh:sourceConstraintComponent sh:SingleLineConstraintComponent ;
100+
sh:sourceShape ex:SingleLineExampleShape-label ;
101+
sh:value "Invalid\u000BinstanceV" ;
102+
] ;
103+
] ;
104+
mf:status sht:approved ;
105+
.

shacl12-vocabularies/shacl.ttl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,28 @@ sh:qualifiedValueShapesDisjoint
11091109
rdfs:isDefinedBy sh: .
11101110

11111111

1112+
sh:SingleLineConstraintComponent
1113+
a sh:ConstraintComponent ;
1114+
rdfs:label "Single line constraint component"@en ;
1115+
rdfs:comment "A constraint component that can be used to specify that none of the value nodes may contain line breaks."@en ;
1116+
sh:parameter sh:SingleLineConstraintComponent-singleLine ;
1117+
rdfs:isDefinedBy sh: .
1118+
1119+
sh:SingleLineConstraintComponent-singleLine
1120+
a sh:Parameter ;
1121+
sh:path sh:singleLine ;
1122+
sh:datatype xsd:boolean ;
1123+
sh:maxCount 1 ;
1124+
rdfs:isDefinedBy sh: .
1125+
1126+
sh:singleLine
1127+
a rdf:Property ;
1128+
rdfs:label "single line"@en ;
1129+
rdfs:comment "Specifies whether none of the value nodes may contain a line break."@en ;
1130+
rdfs:range xsd:boolean ;
1131+
rdfs:isDefinedBy sh: .
1132+
1133+
11121134
sh:UniqueLangConstraintComponent
11131135
a sh:ConstraintComponent ;
11141136
rdfs:label "Unique-languages constraint component"@en ;

0 commit comments

Comments
 (0)