Are graphs everywhere?

How GIS-friendly are Graph Databases?

Felix Kunde

Slides: http://slides.com/fxku/gis_graphdb#/

What is a

Graph Database?

Graph Theory

  • Nodes and (un/directed) edges
  • Both can have properties

OS Property Graph DB

(with spatial support)

  • ArangoDB
  • Neo4j
  • OrientDB
  • Titan (through Cassandra)

Semantic Web

  • Triples
    • (subject)-predicate->(object)
  • Standards: OWL, RDF, SPARQL

OS Triplestores

(with spatial support)

  • Blazegraph
  • GraphDB (ontotext)
  • KiWi (Sesame) > PostGIS backend
  • Virtuoso

Spatial features

  • In-build point type 
  • WGS 84 reference sytem
  • Geohash indexing
  • (Distance) Within queries

Use cases

  • Routing
  • Meta data catalogue
  • Data modelling

 

Routing

  • Create a routable network
  • Finding shortest path between nodes
  • Finding nearest edge / node to start point

Scenario

  • Data from traffic management system of Dresden
  • Road network with travel time for each link
  • Penalties for traffic lights and turns
  • Student project as part of research project ExCELL

How we did it

  • Streets and intersections as nodes
  • Mapping weights to edges
  • Implemented using Neo4j incl. spatial in embedded mode
  • Dikjstra & A-Star Algorithmus

Results

  • Routing works and it's easy to set up
  • Slower than with SotA routing engines
  • KNN is a lot slower compared to PostGIS

Meta data catalogue

  • Connect heterogenous data source
  • Store meta data as a graph
  • Persist matches through additional edges

3D

2D

GIS

BIM

GIS

...

...

Scenario

  • Data of the Botanical Garden of Berlin maintained in different domain-specific systems
  • Loads of CAD data which had to be georeferenced
  • Research project ArcoFAMA

How we did it

  • Migrating CAD data to Postgres using ETL tools
  • Meta data graph stored in Neo4j
  • Web front end for browsing the graph

Results

  • Meta data graph is easy to build and to extend
  • Fast enough because it does not store the real data
  • Spatial queries done with GeoTools, not Neo4j spatial
  • Semantic Web tools / DBs better suitable to this idea

Data Modelling

When using a

relational DBMS

  • Many tables = many joins
  • Not so flexible with ADEs
  • If it's only for storage why not schemaless?

How we did it

UML

XSD

XML

Jsonix

Binding

[
 Node {id,parent..},
 Node {id,parent..},
 Node {id,parent..},
 .
 .
 Node {id,parent..}
] 

Nodes & Edges

Results

Missing geometry types

Schema validation

UML

XSD

XML

Jsonix

Binding

[
 Node {id,parent..},
 Node {id,parent..},
 Node {id,parent..},
 .
 .
 Node {id,parent..}
] 

Graph DBs are schemaless. No extra layer for validation.

Schema validation

OGC

XSD

XML

Jsonix

Binding

Model

Validation

JSON

Schema

Multi-model

(Documents, Graph)

Foxx

Queries are easy

Neo4j - Cypher

MATCH 
  (b:Building {B.id:?}) -[:REL*]-> (m)
RETURN 
  b,m

ArangoDB - AQL

FOR user IN Buildings
FILTER Building.id == ? 

... compared to

PostgreSQL (3DCityDB) - SQL

SELECT sg.*, tp.*, sd.*, a.* 
  FROM building b
  JOIN thematic_surface ts 
    ON ts.building_id = b.id
  JOIN surface_geometry sg 
    ON sg.root_id = ts.lod2_multi_surface_id
  LEFT JOIN textureparam tp
    ON tp.surface_geometry_id = sg.id
  LEFT JOIN surface_data sd 
    ON sd.id = tp.surface_data_id
  LEFT JOIN appear_to_surface_data ats
    ON ats.surface_data_id = sd.id
  LEFT JOIN appearance a 
    ON a.id = ats.appearance_id
  WHERE b.id = ?

Conclusion

  • Not GIS friendly, yet. No big surprise.

  • But can easily serve complex extendable data models.

  • Not too many use cases for a pure graph DB but multi model approach looks interesting.

  • For good performance you need RAM. A lot of RAM!

Thx

Contact

Felix Kunde

fkunde@beuth-hochschule.de

@FlxKu

 

Slides: http://slides.com/fxku/gis_graphdb#/

 

GIS with Graph Databases

By fxku

GIS with Graph Databases

Presentation of my FOSS4G 2016 talk.

  • 1,409
Loading comments...

More from fxku