diff --git a/shapes/core.ttl b/shapes/core.ttl index 5231397..75df289 100644 --- a/shapes/core.ttl +++ b/shapes/core.ttl @@ -676,44 +676,31 @@ Represents a Expression Map. """ ; sh:message """ - Expression Map requires one rml:template or one rml:constant or one + Expression Map may require one rml:template or one rml:constant or one rml:reference. """ ; - sh:property [ rdfs:label "template/constant/reference/returnMap/functionExecution" ; + sh:or ( [ sh:not [ sh:property [ sh:minCount 1 ; + sh:path rml:returnMap ] ] ] [ sh:property [ sh:maxCount 1 ; + sh:minCount 1 ; + sh:path rml:returnMap ], + [ sh:maxCount 1 ; + sh:minCount 1 ; + sh:path rml:functionExecution ] ] ) ; + sh:property [ rdfs:label "template/constant/reference/functionExecution" ; rdfs:comment """ - Exactly one rml:template, one rml:constant, one rml:reference, - one rml:returnMap, or one rml:functionExecution is required. + Only one rml:template, one rml:constant, one rml:reference, + or one rml:functionExecution is allowed. rml:returnMap is only allowed if rml:functionExecution is present. """ ; sh:maxCount 1 ; sh:message """ Exactly one rml:template, one rml:constant, one rml:reference, one rml:returnMap, or one rml:functionExecution is required. """ ; - sh:minCount 1 ; - sh:path [ sh:alternativePath ( rml:template rml:constant rml:reference rml:returnMap rml:functionExecution ) ] ; + sh:path [ sh:alternativePath ( rml:template rml:constant rml:reference rml:functionExecution ) ] ; sh:targetSubjectsOf rml:constant, rml:functionExecution, rml:reference, - rml:returnMap, rml:template ], - [ rdfs:label "reference" ; - rdfs:comment """ - A reference rml:reference is used to refer to a column in case of - databases, a record in case of CSV or TSV data source, an element in - case of XML data source, an object in case of a JSON data source, etc. - - A reference must be a valid identifier, considering the reference - formulation (rml:referenceFormulation) specified. The reference can be - an absolute path, or a path relative to the iterator specified at the - logical source. - """ ; - sh:datatype xsd:string ; - sh:message """ - rml:reference must be a string. - """ ; - sh:nodeKind sh:Literal ; - sh:path rml:reference ; - sh:targetSubjectsOf rml:reference ], [ rdfs:label "returnMap" ; rdfs:comment """ A Return Map rml:returnMap is used to define the return values of a FnO @@ -761,7 +748,25 @@ rml:constant must be an IRI or Literal. """ ; sh:path rml:constant ; - sh:targetSubjectsOf rml:constant ] . + sh:targetSubjectsOf rml:constant ], + [ rdfs:label "reference" ; + rdfs:comment """ + A reference rml:reference is used to refer to a column in case of + databases, a record in case of CSV or TSV data source, an element in + case of XML data source, an object in case of a JSON data source, etc. + + A reference must be a valid identifier, considering the reference + formulation (rml:referenceFormulation) specified. The reference can be + an absolute path, or a path relative to the iterator specified at the + logical source. + """ ; + sh:datatype xsd:string ; + sh:message """ + rml:reference must be a string. + """ ; + sh:nodeKind sh:Literal ; + sh:path rml:reference ; + sh:targetSubjectsOf rml:reference ] . a sh:PropertyShape ; rdfs:label "logicalTarget" ; diff --git a/shapes/expression_map.ttl b/shapes/expression_map.ttl index fc10303..35e23db 100644 --- a/shapes/expression_map.ttl +++ b/shapes/expression_map.ttl @@ -16,7 +16,7 @@ Represents a Expression Map. """ ; sh:message """ - Expression Map requires one rml:template or one rml:constant or one + Expression Map may require one rml:template or one rml:constant or one rml:reference. """ ; @@ -26,23 +26,20 @@ sh:targetSubjectsOf rml:template ; sh:targetSubjectsOf rml:constant ; sh:targetSubjectsOf rml:reference ; - sh:targetSubjectsOf rml:returnMap ; sh:targetSubjectsOf rml:functionExecution ; sh:path [sh:alternativePath (rml:template rml:constant rml:reference - rml:returnMap rml:functionExecution)] ; - rdfs:label "template/constant/reference/returnMap/functionExecution" ; + rdfs:label "template/constant/reference/functionExecution" ; rdfs:comment """ - Exactly one rml:template, one rml:constant, one rml:reference, - one rml:returnMap, or one rml:functionExecution is required. + Only one rml:template, one rml:constant, one rml:reference, + or one rml:functionExecution is allowed. rml:returnMap is only allowed if rml:functionExecution is present. """ ; sh:message """ Exactly one rml:template, one rml:constant, one rml:reference, one rml:returnMap, or one rml:functionExecution is required. """ ; - sh:minCount 1 ; sh:maxCount 1 ; ] ; @@ -134,4 +131,29 @@ sh:nodeKind sh:BlankNodeOrIRI ; # Allow BlankNodes so nested structurces works as well for rml:returnMap ] ; + # If returnMap appears, then functionExecution must also appear + sh:or ( + + [ + sh:not [ + sh:property [ + sh:path rml:returnMap ; + sh:minCount 1 + ] + ] + ] + + [ + sh:property [ + sh:path rml:returnMap ; + sh:minCount 1 ; + sh:maxCount 1 + ] ; + sh:property [ + sh:path rml:functionExecution ; + sh:minCount 1 ; + sh:maxCount 1 + ] + ] + ) .