@@ -222,11 +222,33 @@ aas:AASd-020Shape a sh:NodeShape ;
222222 a sh:SPARQLConstraint ;
223223 sh:message " (AASd-020Shape) - The value of Qualifier/value shall be consistent to the data type as defined in Qualifier/valueType." ;
224224 sh:select """
225- SELECT ?this ?value WHERE {
225+ SELECT ?this ?value ?claimedValueType WHERE {
226226 ?this <https://admin-shell.io/aas/3/0/RC01/Qualifier/value> ?value .
227- ?this <https://admin-shell.io/aas/3/0/RC01/Qualifier/valueType> ?valueType .
228- FILTER (DATATYPE(?value) != URI(?valueType) ) # TODO only works with complete URIs, for instance ?valueType:='http://www.w3.org/2001/XMLSchema#string' works but ?valueType:='string' fails.
229- }
227+ ?this <https://admin-shell.io/aas/3/0/RC01/Qualifier/valueType> ?claimedValueType .
228+
229+ # reference for the constructor functions: https://www.w3.org/TR/2013/REC-sparql11-query-20130321/#FunctionMapping
230+ BIND(IF( <http://www.w3.org/2001/XMLSchema#dateTime>(?value), true, false) AS ?isDateTime)
231+ BIND(IF( <http://www.w3.org/2001/XMLSchema#boolean>(?value), true, false) AS ?isBoolean)
232+ BIND(IF( <http://www.w3.org/2001/XMLSchema#integer>(?value), true, false) AS ?isInteger)
233+ BIND(IF( <http://www.w3.org/2001/XMLSchema#double>(?value), true, false) AS ?isDouble)
234+ BIND(IF( <http://www.w3.org/2001/XMLSchema#long>(?value), true, false) AS ?isLong)
235+ BIND(IF( <http://www.w3.org/2001/XMLSchema#float>(?value), true, false) AS ?isFloat)
236+ BIND( isURI(?value) AS ?isUri)
237+ BIND( isIRI(?value) AS ?isIri)
238+ BIND(IF( <http://www.w3.org/2001/XMLSchema#string>(?value), true, false) AS ?isString)
239+
240+ FILTER( ?claimedValueType = "integer" || ?claimedValueType = "int" || ?claimedValueType = "boolean" || ?claimedValueType = "dateTime" || ?claimedValueType = "double" || ?claimedValueType = "long" || ?claimedValueType = "float" || ?claimedValueType = "uri" || ?claimedValueType = "iri" || ?claimedValueType = "string" )
241+
242+ FILTER( IF( ?claimedValueType = "dateTime", IF(BOUND(?isDateTime), false, true), true ) )
243+ FILTER( IF( ?claimedValueType = "boolean", IF(BOUND(?isBoolean), false, true), true ) )
244+ FILTER( IF( ?claimedValueType = "long", IF(BOUND(?isLong), false, true), true ) )
245+ FILTER( IF( ?claimedValueType = "float", IF(BOUND(?isFloat), false, true), true ) )
246+ FILTER( IF( ?claimedValueType = "integer" || ?claimedValueType = "int", IF(BOUND(?isInteger), false, true), true ) )
247+ FILTER( IF( ?claimedValueType = "double", IF(BOUND(?isDouble), false, true), true ) )
248+ FILTER( IF( ?claimedValueType = "string", IF(BOUND(?isString), false, true), true ) )
249+ FILTER( IF( ?claimedValueType = "uri", IF(?isUri, false, true), true ) )
250+ FILTER( IF( ?claimedValueType = "iri", IF(?isIri, false, true), true ) )
251+ }
230252 """
231253 ]
232254 ];
0 commit comments