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 .

11.4.4.2 Mapping

The Mapping class is used to flag instances of a MappingType instance. It is used mostly as a classifier to indicate that the instance of instance of MappingType is a Mapping. The MappingType instance should always be defined as a subclass of Mapping see ClassMapping example above. The ontology provides two subclasses of Mapping: PropertyMapping to indicate mapping of properties and ResourceMapping to indicate mapping of resources.

11.4.5 Modeling Templates

A Template is used to represent a canned parameterized query. 54 Copyright © 2015 Open Geospatial Consortium.

11.4.5.1 QueryTemplate

The QueryTemplate is the base class for representing canned parameterized SPARQL query. Table 19 summarizes the property of QueryTemplate. Table 19 Query Tempalte properties Name Definition Type Multiplicity labelTemplate A string template contains parameter variable that is aimed to be substituted for display the label associated with instance of Template. String 0..1 templateQuery The canned query that uses the parameters names as variables. Query 1 hasParameter Inherited Property from ParameterizableType that define the parameters of the function Parameter 0..n

11.4.5.2 AskTemplate

An AskTemplate is a QueryTemplate that has a body using only Ask query returning a boolean. Table 20 summarizes the properties of AskTemplate. Table 20 AskTemplate properties Name Definition Type Multiplicity Body The Ask body of the template using the parameter names as variables. Ask 1 hasParameter Inherited Property from ParameterizableType that define the parameters of the function Parameter 0..n

11.4.5.3 ConstructTemplate

A ConstructTemplate is a QueryTemplate that has a body using only Construct query returning a graph. Table 21 summarizes the properties of AskTemplate.