Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Geospatial Querying in Apache Marmotta - Apache Big Data North America 2016

887 views

Published on

Vancouver (BC, Canada), May 11th 2016

Published in: Engineering
  • Be the first to comment

Geospatial Querying in Apache Marmotta - Apache Big Data North America 2016

  1. 1. Sergio Fernández (Redlink GmbH) Apache Big Data North America 2016 Vancouver, May 11th 2016 Geospatial Querying in Apache Marmotta
  2. 2. Partner Technology Manager at Redlink GmbH also… External Lecturer at Fachhochschule Salzburg Member of The Apache Software Foundation Sergio Fernández @wikier https://linkedin.com/in/sergiofernandez https://www.wikier.org
  3. 3. Geospatial Querying in
  4. 4. What is Apache Marmotta? ● An Open Platform for Linked Data, an open implementation of a Linked Data Platform that can be easily used, extended and deployed by organizations who want to publish Linked Data or build custom applications on Linked Data. ● Key features: ○ Read-Write Linked Data server ○ RDF triple store with transactions, versioning and rule- base reasoning ○ LDP, SPARQL and LDPath querying ○ Transparent Linked Data caching
  5. 5. What is Linked Data? ● The Semantic Web is a Web of Data ● Semantic Web technologies (RDF, OWL, SKOS, SPARQL, etc.) provide an environment where applications can query that data, draw inferences using vocabularies, etc. ● Linked Data lies at the heart of what Semantic Web is all about: large scale integration of, and reasoning on, data on the Web. ● A typical case of a large Linked Dataset is DBPedia, which, essentially, makes the content of Wikipedia available as Linked Data.
  6. 6. What is RDF? ● The Resource Description Framework (RDF) is a family of World Wide Web Consortium (W3C) specifications originally designed as a metadata data model. ● RDF is directed labeled graph, where: ○ nodes are resources; ○ edges represent the named links between two resources; ○ the composition of one resource (subject) linked (with a predicate) to another (object) is known as "RDF triple"; ○ a set of triples form a RDF graph.
  7. 7. Querying in Marmotta Currently Marmotta provides three main means of querying: ● LDP 1.0 (Linked Data Platform), ○ a W3C protocol based on HTTP for managing Linked Data resources ○ https://www.w3.org/TR/ldp/ ● SPARQL 1.1 (SPARQL Protocol and RDF Query Language) ○ a W3C RDF query language and protocol ○ https://www.w3.org/TR/sparql11-query/ ● LDPath ○ a path language for Linked Data, similar to XPath for XML ○ https://marmotta.apache.org/ldpath/language
  8. 8. GeoSPARQL ● The OGC GeoSPARQL standard supports representing and querying geospatial data on the Semantic Web. ● GeoSPARQL defines a vocabulary for representing geospatial data in RDF, and a SPARQL extension for processing geospatial data. ● It makes use of both WKT (Well Known Text) and GML for representing geometries as literals.
  9. 9. GeoSPARQL Ontology Spatial Object GeometryFeature There are three key classes in the GeoSPARQL ontology: ● geo:SpatialObject ○ a superclass of both Features and Geometries; ● geo:Feature ○ a thing that can have a spatial location; e.g., a park; ● geo:Geometry ○ a representation of a spatial location; i.e., a set of coordinates. geo:hasGeometry Namespace: http://www.opengis.net/ont/geosparql#
  10. 10. GeoSPARQL basic data model
  11. 11. GeoSPARQL implementation approaches Two approaches were mainly considered to implement GeoSPARQL: 1. Materialization ○ Pros: fast querying ○ Cons: materialization is computationally expensive , requires more more storage capacity and native operators 2. Query translation ○ Pros: direct comparison, optimal storage and no need of native operators ○ Cons: slow querying In Marmotta we decided to go for the first option.
  12. 12. GeoSPARQL in Marmotta ● More precisely we should say "GeoSPARQL in KiWi" ○ KiWi is our triple store based on RDBMS ○ Marmotta also supports many other Sesame-based triple stores as backend ● Support implemented based on PostGIS for PostgreSQL ○ Support not available for other databases ● All further technical details available at the wiki: https://wiki.apache. org/marmotta/GSoC/2015/MARMOTTA-584 ● Documentation at http://marmotta.apache.org/kiwi/geosparql
  13. 13. GeoSPARQL coverage Apache Marmotta 3.4.0(*) supports: ● Simple Features Topological Relations ● Egenhofer Topological Relations ● RCC8 Topological Relations ● Non-Topological Functions Better to check the documentation: https://wiki.apache. org/marmotta/GSoC/2015/MARMOTTA-584 (*) still under development at MARMOTTA-584 branch, to be released in the upcoming weeks
  14. 14. GeoSPARQL example SELECT DISTINCT ?label WHERE { ?reg1 a geo:provincia ; rdfs:label "Madrid"@es ; geoes:hasExactGeometry ?geo1 . ?geo1 geo:asWKT ?wkt1 . ?reg2 a geo:municipio ; rdfs:label ?label ; geoes:hasExactGeometry ?geo2 . ?geo2 geo:asWKT ?wkt2 . FILTER (geof:sfContains(?wkt1, ?wkt2)) } ORDER BY ?label LIMIT 10 Simple query to get all geometries that are contained by other. Particularly this example queries for the first ten municipalities in the region of Madrid.
  15. 15. GeoSPARQL example (II) SELECT DISTINCT ?label WHERE { ex:Austria a geo:Country ; rdfs:label "Austria"@en ; rdfs:label "Österreich"@de ; geoes:hasExactGeometry ?geo1 . ?geo1 geo:asWKT ?wkt1 . ?river a geo:River ; rdfs:label ?label ; geoes:hasExactGeometry ?geo2 . ?geo2 geo:asWKT ?wkt2 . FILTER (geof:sfTouches(?wkt1, ?wkt2)) } ORDER BY ?label Another query to get all geometries that are touch other. Particularly this example queries for the rivers that make borderline with Austria.
  16. 16. GeoSPARQL example (III) SELECT DISTINCT ?label WHERE { ?route a geo:MTBRoute ; geoes:hasExactGeometry ?geo1 . ?geo1 geo:asWKT ?wkt1 . ?city a geo:City ; rdfs:label ?label ; geoes:hasExactGeometry ?geo2 . ?geo2 geo:asWKT ?wkt2 . FILTER ( geof:geof:sfCrosses(?wkt1, ?wkt2)) } ORDER BY ?label Another query to get all geometries that are crosses another. Particularly this example queries for all Mountain bike routes that cross a city.
  17. 17. let's demo! https://www.flickr.com/photos/nasahqphoto/16409061001/
  18. 18. conclusions ● GeoSPARQL adds a very interesting features for query RDF data ● Requires no much new infrastructure, no performance footprint ● The most important feature in Marmotta 3.4.0 ● Cross-project collaboration within different Apache projects has shown an enormous potential
  19. 19. Q&A
  20. 20. thanks!
  21. 21. The work presented here has been partially developed in the context of the TourPack project, partially funded the Austrian Research Promotion Agency (FFG) IKT der Zukunft program under grant agreement no. 845600. Thanks to the student Francisco Xavier Sumba Toral for contributing the initial GeoSPARQL implementation as part of his project during the Google Summer of Code 2015. So thanks to Google for such awesome open source program! Acknowledgements Thanks to Apache TAC for supporting me travelling to Vancouver.

×