Modeling Mappings .1 MappingType SPARQL Extensions ontology
50
Copyright © 2015 Open Geospatial Consortium.
targetType: the target type to map to RDFS Class; and expression: the transformation function to use to modify the identifier of the
instance ChangeNamespace for example. The Mapping Rule of the Class mapping is defined as a SPARQL Construct. The rule
says that for every instance ?this of class ?sourceType one of the parameter, create an instance ?target with the class ?targetType one of the parameter. The target is defined
as the result of the evaluation of the expression taking ?this for its argument if expression is defined, otherwise ?target is the same than ?this. We introduce a new
function eval in GeoSPARQL to evaluate expression defined as function defined with this ontology.
PREFIX fn:http:www.knowledgesmarts.comontologyfunctions PREFIX ksfun: http:www.usersmarts.comont200506ksfunctor
PREFIX geosparqlFn: http:www.opengis.netdeffunctiongeosparql CONSTRUCT {
?target a ?targetType. }
WHERE { ?this a ?sourceType.
BIND ksfun:ifksfun:bound?expression,geosparqlFn:eval?expression,fn:arg1,?this,?this
AS ?target . }
:ClassMapping a sparql-ext:MappingType , owl:Class ; rdfs:comment Mapping transforming one instance of a class to another
class ; rdfs:label ClassMapping ;
rdfs:subClassOf sparql-ext:Mapping ; sparql-ext:hasParameter [ a sparql-ext:Parameter ;
rdfs:comment The source type to map from ; rdfs:label sourceType ;
sparql-ext:predicate :sourceType ; sparql-ext:valueType rdfs:Class
] ; sparql-ext:hasParameter [ a sparql-ext:Parameter ;
rdfs:comment The target type to map to ; rdfs:label targetType ;
sparql-ext:predicate :targetType ; sparql-ext:valueType rdfs:Class
] ; sparql-ext:hasParameter [ a sparql-ext:Parameter ;
Copyright © 2015 Open Geospatial Consortium.
51 rdfs:comment The transformation function to use to modify
the identifier of the instance ; rdfs:label expression ;
sparql-ext:predicate :expression ; sparql-ext:valueType sparql-ext:Function
] ; sparql-ext:mappingRule [ a sparql-ext:SPARQLRule ;
sparql-ext:body [ a sparql-ext:Construct ; sparql-ext:queryLanguage sd:SPARQL11Query ;
sparql-ext:textForm PREFIX fn:\t\thttp:www.knowledgesmarts.comontologyfunctions\r\nPREFIX ksfun:
http:www.usersmarts.comont200506ksfunctor \r\nPREFIX geosparqlFn: http:www.opengis.netdeffunctiongeosparql \r\nCONSTRUCT {\r\n\t?target a
?targetType.\r\n}\r\nWHERE {\r\n\t?this a ?sourceType .\r\n\tBIND ksfun:ifksfun:bound?expression,geosparqlFn:eval?expression,fn:arg1,?this,?this
AS ?target .\r\n} ]
] ; sparql-ext:name ClassMapping .
The following mapping type PropertyMapping-1-1 maps a source predicate of a resource to a target predicate using optionally a transformation expression.
:PropertyMapping-1-1 a sparql-ext:MappingType , owl:Class ; rdfs:comment Mapping a source predicate of a resource to a target
predicate using optionally a transformation expression ; rdfs:label PropertyMapping11 ;
rdfs:subClassOf sparql-ext:Mapping ; sparql-ext:hasParameter [ a sparql-ext:Parameter ;
rdfs:comment The source predicate to map from ; rdfs:label sourcePredicate ;
sparql-ext:predicate :sourcePredicate ; sparql-ext:valueType rdf:Property
] ; sparql-ext:hasParameter [ a sparql-ext:Parameter ;
rdfs:comment The target predicate to map to ; rdfs:label targetPredicate ;
sparql-ext:predicate :targetPredicate ; sparql-ext:valueType rdf:Property
] ; sparql-ext:hasParameter [ a sparql-ext:Parameter ;
rdfs:comment The transformation function to use to modify the value of source predicate ;
rdfs:label expression ; sparql-ext:predicate :expression ;
sparql-ext:valueType sparql-ext:Function
52
Copyright © 2015 Open Geospatial Consortium.
] ; sparql-ext:hasParameter [ a sparql-ext:Parameter ;
rdfs:comment The mapping context in which this property mapping applies ;
rdfs:label context ; sparql-ext:predicate :context ;
sparql-ext:valueType :ClassMapping ] ;
sparql-ext:mappingRule [ a sparql-ext:SPARQLRule ; sparql-ext:body [ a sparql-ext:Query , sparql-
ext:Construct ; sparql-ext:queryLanguage sd:SPARQL11Query ;
sparql-ext:textForm PREFIX fn:\t\t http:www.opengis.nettestbed11ontgeosparqlextfunctionscore\r\nPREFIX
ksfun: http:www.usersmarts.comont200506ksfunctor \t\r\nPREFIX mapping: http:www.opengis.nettestbed11ontgeosparqlmappingcore \t\t\t\t\t\t\r\nPREFIX
geosparqlFn: http:www.opengis.netdeffunctiongeosparql \r\n\r\n\r\nCONSTRUCT {\r\n\t?target ?targetPredicate ?newValue .\r\n}\r\nWHERE
{\r\n\t?this ?sourcePredicate ?oldValue .\r\n\t?this a ?sourceType .\r\n\tBIND fn:object?context,mapping:sourceType AS ?sourceType .\r\n\t\t\t\t\t\t\t\t\r\n\tBIND
ksfun:ifksfun:bound?expression,geosparqlFn:eval?expression,fn:arg1,?oldValue,?ol dValue AS ?newValue .\r\n\tBIND
ksfun:ifksfun:boundfn:object?context,mapping:expression,geosparqlFn:evalfn:obje ct?context,mapping:expression,fn:arg1,?this,?this AS ?target .\r\n}
] ] ;
sparql-ext:name PropertyMapping11 . The following mapping type PropertyMapping-0-1 creates a target predicate from an
resource using optionally a transformation expression. :PropertyMapping-0-1 a sparql-ext:MappingType , owl:Class ;
rdfs:comment Mapping creating a target predicate from an resource using optionally a transformation expression ;
rdfs:label PropertyMapping01 ; rdfs:subClassOf sparql-ext:Mapping ;
sparql-ext:hasParameter [ a sparql-ext:Parameter ; rdfs:comment The target predicate to map to ;
rdfs:label targetPredicate ; sparql-ext:predicate :targetPredicate ;
sparql-ext:valueType rdf:Property ] ;
sparql-ext:hasParameter [ a sparql-ext:Parameter ;
Copyright © 2015 Open Geospatial Consortium.
53 rdfs:comment The transformation function to use to modify
the value of source predicate ; rdfs:label expression ;
sparql-ext:predicate :expression ; sparql-ext:valueType sparql-ext:Function
] ; sparql-ext:hasParameter [ a sparql-ext:Parameter ;
rdfs:comment The mapping context in which this property mapping applies ;
rdfs:label context ; sparql-ext:predicate :context ;
sparql-ext:valueType :ClassMapping ] ;
sparql-ext:mappingRule [ a sparql-ext:SPARQLRule ; sparql-ext:body [ a sparql-ext:Query , sparql-
ext:Construct ; sparql-ext:queryLanguage sd:SPARQL11Query ;
sparql-ext:textForm PREFIX fn:\t\t http:www.opengis.nettestbed11ontgeosparqlextfunctionscore\r\nPREFIX
ksfun: http:www.usersmarts.comont200506ksfunctor \t\t\r\nPREFIX mapping: http:www.opengis.nettestbed11ontgeosparqlmappingcore \r\nPREFIX
geosparqlFn: http:www.opengis.netdeffunctiongeosparql \r\n\t\t\r\nCONSTRUCT {\r\n\t?target ?targetPredicate ?newValue .\r\n}\r\nWHERE
{\r\n\t?this a ?sourceType .\r\n\tBIND fn:object?context,mapping:sourceType AS ?sourceType .\r\n\tBIND geosparqlFn:eval?expression,fn:arg1,?this AS ?newValue
.\r\n\tBIND geosparqlFn:evalfn:object?context,mapping:expression,fn:arg1,?this AS ?target .\r\n}
] ] ;
sparql-ext:name PropertyMapping01 .