A Foundation for Spatial Data Warehouses
on the Semantic Web

This research emphasizes on how to utilize spatial data warehousing on the Semantic Web with the most recent stable version of QB4SOLAP. We provide a full formalization of QB4SOLAP and a number of SOLAP operators over the defined QB4SOLAP cubes allowing spatial analytical queries over RDF data, and gives their formal semantics. The paper also provides algorithms for generating spatially extended SPARQL queries from individual and nested SOLAP operators, allowing users to write their spatial analytical queries in our high-level SOLAP language instead of the lower-level and more complex SPARQL.

Prefixes

### Additional custom prefixes used in the queries
prefix sdmx-concept: <http://purl.org/linked-data/sdmx/2009/concept#>
prefix sdmx-dimension: <http://purl.org/linked-data/sdmx/2009/dimension#>
prefix sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#>
prefix skos: <http://www.w3.org/2004/02/skos/core#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix geo: <http://www.opengis.net/ont/geosparql#>
prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#>
prefix qb: <http://purl.org/linked-data/cube#>
prefix qb4o: <http://purl.org/qb4solap/cubes#>
prefix qb4so: <http://purl.org/qb4solap/cubes#>
prefix gnw: <http://qb4solap.org/cubes/schemas/geonorthwind#>

                
                

          

S-Slice: Slice on customers of the country, in which the given/clicked point is within.


SELECT ?obs WHERE
{
   ?obs rdf:type qb:Observation ;
    gnw:customerID ?customer .
   ?customer  qb4o:memberOf gnw:customer ;
    skos:broader ?city  .
   ?city  qb4o:memberOf gnw:city ;
    skos:broader ?state1  .
   ?state  qb4o:memberOf gnw:state ;
    skos:broader ?country  .
   ?country  qb4o:memberOf gnw:country ;
     gnw:countryGeo ?countryGeo1  .
FILTER (bif:st_within(bif:st_point(10.140380859375002, 50.98609893339354), ?countryGeo1 ,32))
}

			

S-Dice(1): Sales to customers which are located within 5 km. distance from their city center. (Filter the customers which are within 5 km from their city center)


SELECT ?obs WHERE
{
   ?obs rdf:type qb:Observation ;
    gnw:customerID ?customer  .
   ?customer  qb4o:memberOf gnw:customer ;
    gnw:customerGeo ?customerGeo  .
   ?obs gnw:customerID ?customer2  .
   ?customer2  qb4o:memberOf gnw:customer ;
    skos:broader ?city  .
   ?city  qb4o:memberOf gnw:city ;
    gnw:cityGeo ?cityCentGeo  .
FILTER (bif:st_within(?customerGeo, ?cityCentGeo, 5))
}

			

S-dice(2): Sales to customers which are located within 5 km. distance from their city center. (Calculate the distance between every customer and their city center as ?distance variable, apply a filter on the ?distance variables if it is les than 5)


SELECT ?obs WHERE
{
   ?obs rdf:type qb:Observation ;
    gnw:customerID ?customer  .
   ?customer  qb4o:memberOf gnw:customer ;
    gnw:customerGeo ?customerGeo  .
   ?obs gnw:customerID ?customer2  .
   ?customer2  qb4o:memberOf gnw:customer ;
    skos:broader ?city  .
   ?city  qb4o:memberOf gnw:city ;
    gnw:cityGeo ?cityCentGeo  .
BIND (bif:st_distance (?customerGeo, ?cityCentGeo) AS ?distance)
FILTER (?distance < 5)
}


			

S-Roll-up: Total amount of sales to customers by city of the closest suppliers

SELECT ?obs ?supplierCity (SUM(?salesAmount) AS ?totalsalesAmount) WHERE
{
   ?obs rdf:type qb:Observation ;
     gnw:customerID ?customer1  ;
	 gnw:supplierID ?supplier1  ;
	 gnw:salesAmount ?salesAmount .
   ?customer1  qb4o:memberOf gnw:customer ;
     gnw:customerGeo ?customerGeo1  .
   ?supplier1  qb4o:memberOf gnw:supplier ;
	 skos:broader ?supplierCity  .
   ?supplierCity  qb4o:memberOf gnw:city ;
     gnw:cityGeo ?cityGeo1  .
{
SELECT ?customer2 (MIN(?distance) AS ?MINdistance) WHERE
{
   ?obs2 rdf:type qb:Observation ;
     gnw:customerID ?customer2  ;
     gnw:supplierID ?supplier2  .
   ?customer2  qb4o:memberOf gnw:customer ;
     gnw:customerGeo ?customerGeo2  .
   ?supplier2  qb4o:memberOf gnw:supplier ;
     skos:broader ?city2  .
   ?city2  qb4o:memberOf gnw:city ;
      gnw:cityGeo ?cityGeo2  .
BIND (bif:st_distance( ?customerGeo2, ?cityGeo2 ) AS ?distance)}
GROUP BY ?customer2}
FILTER (?customer1 = ?customer2 && bif:st_distance( ?customerGeo1, ?cityGeo1 ) = ?MINdistance )
}
GROUP BY ?obs ?supplierCity


			

Nested SOLAP1: (s-roll-up(s-slice))


SELECT ?obs2 ?supplierCity (SUM(?sales2) AS ?totalSales) WHERE
{
   ?obs2 rdf:type qb:Observation .
   ?obs2 gnw:customerID ?customer2  .
   ?obs2 gnw:supplierID ?supplier .
   ?customer2  qb4o:memberOf gnw:customer .
   ?customer2  skos:broader ?city2 .
   ?customer2 gnw:customerGeo ?custGeo .
   ?supplier qb4o:memberOf gnw:supplier .
   ?supplier gnw:supplierGeo ?supGeo .
   ?supplier skos:broader ?supplierCity .
   ?supplierCity qb4o:memberOf gnw:city .
   ?city2  qb4o:memberOf gnw:city .
   ?city2  skos:broader ?state1  .
   ?state1  qb4o:memberOf gnw:state .
   ?state1  skos:broader ?country1  .
   ?country1  qb4o:memberOf gnw:country .
   ?country1  gnw:countryGeo ?countryGeo1  .
   ?obs2 gnw:salesAmount ?sales2 .
{ SELECT ?cust1 (MIN(?distance) AS ?minDistance)
WHERE {
?o2 rdf:type qb:Observation .
?o2 gnw:customerID ?cust1 .
?o2 gnw:supplierID ?sup1 .
?sup1 qb4o:memberOf gnw:supplier .
?sup1 gnw:supplierGeo ?sup1Geo .
?cust1 qb4o:memberOf gnw:customer .
?cust1 gnw:customerGeo ?cust1Geo .
BIND (bif:st_distance( ?cust1Geo, ?sup1Geo ) AS ?distance)}
GROUP BY ?cust1 }
FILTER (bif:st_within(bif:st_point(10.079956054687502, 51.06211251399775), ?countryGeo1 ,32))
FILTER (?customer2 = ?cust1 && bif:st_distance( ?custGeo, ?supGeo ) = ?minDistance)
} GROUP BY ?obs2 ?supplierCity
			

Nested SOLAP2: (s-roll-up(s-slice(s-dice)))

SELECT ?obs2 ?supplierCity (SUM(?sales2) AS ?totalSales) WHERE
{
   ?obs2 rdf:type qb:Observation .
   ?obs2 gnw:customerID ?customer2  .
   ?obs2 gnw:supplierID ?supplier .
   ?customer2  qb4o:memberOf gnw:customer .
   ?customer2  skos:broader ?city2 .
   ?customer2 gnw:customerGeo ?custGeo .
   ?supplier qb4o:memberOf gnw:supplier .
   ?supplier gnw:supplierGeo ?supGeo .
   ?supplier skos:broader ?supplierCity .
   ?supplierCity qb4o:memberOf gnw:city .
   ?city2  qb4o:memberOf gnw:city .
   ?city2  skos:broader ?state1  .
   ?state1  qb4o:memberOf gnw:state .
   ?state1  skos:broader ?country1  .
   ?country1  qb4o:memberOf gnw:country .
   ?country1  gnw:countryGeo ?countryGeo1  .
   ?obs2 gnw:salesAmount ?sales2 .
{ SELECT ?cust1 (MIN(?distance) AS ?minDistance)
WHERE {
?o2 rdf:type qb:Observation .
?o2 gnw:customerID ?cust1 .
?o2 gnw:supplierID ?sup1 .
?sup1 qb4o:memberOf gnw:supplier .
?sup1 gnw:supplierGeo ?sup1Geo .
?cust1 qb4o:memberOf gnw:customer .
?cust1 gnw:customerGeo ?cust1Geo .
BIND (bif:st_distance( ?cust1Geo, ?sup1Geo ) AS ?distance)}
GROUP BY ?cust1 }
FILTER (bif:st_within (?supGeo, ?custGeo, 100))
FILTER (bif:st_within(bif:st_point(10.079956054687502, 51.06211251399775), ?countryGeo1 ,32))
FILTER (?customer2 = ?cust1 && bif:st_distance( ?custGeo, ?supGeo ) = ?minDistance)
} GROUP BY ?obs2 ?supplierCity

			

Copyright © 2014 - All Rights Reserved - EXTBI