Skip to content
Marco Brandizi edited this page Sep 12, 2021 · 15 revisions

The RDF-2-PG Converter

rdf2pg is a framework to convert from RDF data to labelled property graphs (PG) [REF], aiming at supporting custom mapping from RDF data models to any target PG format or graph database.

At the moment, we have used the core libraries to write an [RDF-to-graphml format][REF], and to [rewrite the original RDF-to-Neo4j][REF] converter that the project has originated from.

Introduction

While RDF, the Semantic Web stack and the linked data approach are solid foundations for data modelling and standardisation, ever more graph-oriented datasets are being managed by means of graph databases such as Neo4j, or technological stacks like TinkerPop/Gremlin. Such technologies are based on the so called [labelled property graph model][REF] (PG), which is similar to the triple-based RDF model, but with significant differences, such as support to relations with attributes.

The two approaches aren't necessarily opposed, on the contrary, in the Knetminer project, [we take advantages of the complementary set of pros/cons][REF] that come from both. For that reason, we have initially developed the [rdf2neo tool][REF], to convert our own RDF-based data models onto similar Neo4j databases. Later, we generalised the tool to support conversions to other graph databases and PG formats, and implemented an [rdf2graphml tool][REF], to support the needs of [TODO: Carlos affiliation].

Mapping RDF to PG using SPARQL

Contrary to other tools [REF], rdf2pg allows for custom mapping from RDF patterns (eg, based on OWL or RDFS ontologies), to a proerty graph model. The concept is shown in the figure below, taken from [REF].

rdf2pg architecture

As you can see, "canonical" mappings (eg, an RDF resource becomes a PG node, its rdf:type is used to build the node's label) can be mixed with adaptations to your own particular RDF model (eg, our bk:relXXX vocabulary for reified relations is mapped into PG relations with properties).

Those mapping rules can be defined with nothing but SPARQL, as the next figure shows:

rdf2pg architecture

As you can see... TODO.

Where to go from here

Clone this wiki locally