Skip to content

Commit 21931dd

Browse files
authored
Merge pull request #238 from dachafra/expression-map-shapes
remove minCount in expression map (#210) and returnMap constraints (#142)
2 parents a828a07 + 703f4cf commit 21931dd

File tree

2 files changed

+60
-33
lines changed

2 files changed

+60
-33
lines changed

shapes/core.ttl

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -676,44 +676,31 @@
676676
Represents a Expression Map.
677677
""" ;
678678
sh:message """
679-
Expression Map requires one rml:template or one rml:constant or one
679+
Expression Map may require one rml:template or one rml:constant or one
680680
rml:reference.
681681
""" ;
682-
sh:property [ rdfs:label "template/constant/reference/returnMap/functionExecution" ;
682+
sh:or ( [ sh:not [ sh:property [ sh:minCount 1 ;
683+
sh:path rml:returnMap ] ] ] [ sh:property [ sh:maxCount 1 ;
684+
sh:minCount 1 ;
685+
sh:path rml:returnMap ],
686+
[ sh:maxCount 1 ;
687+
sh:minCount 1 ;
688+
sh:path rml:functionExecution ] ] ) ;
689+
sh:property [ rdfs:label "template/constant/reference/functionExecution" ;
683690
rdfs:comment """
684-
Exactly one rml:template, one rml:constant, one rml:reference,
685-
one rml:returnMap, or one rml:functionExecution is required.
691+
Only one rml:template, one rml:constant, one rml:reference,
692+
or one rml:functionExecution is allowed. rml:returnMap is only allowed if rml:functionExecution is present.
686693
""" ;
687694
sh:maxCount 1 ;
688695
sh:message """
689696
Exactly one rml:template, one rml:constant, one rml:reference,
690697
one rml:returnMap, or one rml:functionExecution is required.
691698
""" ;
692-
sh:minCount 1 ;
693-
sh:path [ sh:alternativePath ( rml:template rml:constant rml:reference rml:returnMap rml:functionExecution ) ] ;
699+
sh:path [ sh:alternativePath ( rml:template rml:constant rml:reference rml:functionExecution ) ] ;
694700
sh:targetSubjectsOf rml:constant,
695701
rml:functionExecution,
696702
rml:reference,
697-
rml:returnMap,
698703
rml:template ],
699-
[ rdfs:label "reference" ;
700-
rdfs:comment """
701-
A reference rml:reference is used to refer to a column in case of
702-
databases, a record in case of CSV or TSV data source, an element in
703-
case of XML data source, an object in case of a JSON data source, etc.
704-
705-
A reference must be a valid identifier, considering the reference
706-
formulation (rml:referenceFormulation) specified. The reference can be
707-
an absolute path, or a path relative to the iterator specified at the
708-
logical source.
709-
""" ;
710-
sh:datatype xsd:string ;
711-
sh:message """
712-
rml:reference must be a string.
713-
""" ;
714-
sh:nodeKind sh:Literal ;
715-
sh:path rml:reference ;
716-
sh:targetSubjectsOf rml:reference ],
717704
[ rdfs:label "returnMap" ;
718705
rdfs:comment """
719706
A Return Map rml:returnMap is used to define the return values of a FnO
@@ -761,7 +748,25 @@
761748
rml:constant must be an IRI or Literal.
762749
""" ;
763750
sh:path rml:constant ;
764-
sh:targetSubjectsOf rml:constant ] .
751+
sh:targetSubjectsOf rml:constant ],
752+
[ rdfs:label "reference" ;
753+
rdfs:comment """
754+
A reference rml:reference is used to refer to a column in case of
755+
databases, a record in case of CSV or TSV data source, an element in
756+
case of XML data source, an object in case of a JSON data source, etc.
757+
758+
A reference must be a valid identifier, considering the reference
759+
formulation (rml:referenceFormulation) specified. The reference can be
760+
an absolute path, or a path relative to the iterator specified at the
761+
logical source.
762+
""" ;
763+
sh:datatype xsd:string ;
764+
sh:message """
765+
rml:reference must be a string.
766+
""" ;
767+
sh:nodeKind sh:Literal ;
768+
sh:path rml:reference ;
769+
sh:targetSubjectsOf rml:reference ] .
765770

766771
<http://w3id.org/rml/shapes/RMLLogicalTargetPropertiesShape> a sh:PropertyShape ;
767772
rdfs:label "logicalTarget" ;

shapes/expression_map.ttl

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
Represents a Expression Map.
1717
""" ;
1818
sh:message """
19-
Expression Map requires one rml:template or one rml:constant or one
19+
Expression Map may require one rml:template or one rml:constant or one
2020
rml:reference.
2121
""" ;
2222

@@ -26,23 +26,20 @@
2626
sh:targetSubjectsOf rml:template ;
2727
sh:targetSubjectsOf rml:constant ;
2828
sh:targetSubjectsOf rml:reference ;
29-
sh:targetSubjectsOf rml:returnMap ;
3029
sh:targetSubjectsOf rml:functionExecution ;
3130
sh:path [sh:alternativePath (rml:template
3231
rml:constant
3332
rml:reference
34-
rml:returnMap
3533
rml:functionExecution)] ;
36-
rdfs:label "template/constant/reference/returnMap/functionExecution" ;
34+
rdfs:label "template/constant/reference/functionExecution" ;
3735
rdfs:comment """
38-
Exactly one rml:template, one rml:constant, one rml:reference,
39-
one rml:returnMap, or one rml:functionExecution is required.
36+
Only one rml:template, one rml:constant, one rml:reference,
37+
or one rml:functionExecution is allowed. rml:returnMap is only allowed if rml:functionExecution is present.
4038
""" ;
4139
sh:message """
4240
Exactly one rml:template, one rml:constant, one rml:reference,
4341
one rml:returnMap, or one rml:functionExecution is required.
4442
""" ;
45-
sh:minCount 1 ;
4643
sh:maxCount 1 ;
4744
] ;
4845

@@ -134,4 +131,29 @@
134131
sh:nodeKind sh:BlankNodeOrIRI ;
135132
# Allow BlankNodes so nested structurces works as well for rml:returnMap
136133
] ;
134+
# If returnMap appears, then functionExecution must also appear
135+
sh:or (
136+
137+
[
138+
sh:not [
139+
sh:property [
140+
sh:path rml:returnMap ;
141+
sh:minCount 1
142+
]
143+
]
144+
]
145+
146+
[
147+
sh:property [
148+
sh:path rml:returnMap ;
149+
sh:minCount 1 ;
150+
sh:maxCount 1
151+
] ;
152+
sh:property [
153+
sh:path rml:functionExecution ;
154+
sh:minCount 1 ;
155+
sh:maxCount 1
156+
]
157+
]
158+
)
137159
.

0 commit comments

Comments
 (0)