Incremental Export of Relational
Database Contents into RDF Graphs
Nikolaos Konstantinou, Dimitris Kouis, Nikolas Mitrou
By Dr. Nikolaos Konstantinou
National Technical University of Athens
School of Electrical and Computer Engineering
Multimedia, Communications & Web Technologies
4th International Conference on Web Intelligence, Mining and Semantics
Outline
• Introduction
• Proposed Approach and Measurements
• Discussion and Conclusions
24th International Conference on Web Intelligence, Mining and Semantics
Introduction
• Information collection, maintenance and update is not always taking
place directly at a triplestore, but at a RDBMS
• Triplestores are often kept as an alternative content delivery channel
• It can be difficult to change established methodologies and systems
• Newer technologies need to operate side-by-side to existing ones
before migration
34th International Conference on Web Intelligence, Mining and Semantics
Mapping Relational Data to RDF
• No one-size-fits-all approach
• Synchronous Vs Asynchronous RDF Views
• Real-time Vs Ad hoc RDF Views
• Real-time SPARQL-to-SQL Vs Querying the RDF dump using SPARQL
• Queries on the RDF dump are faster in certain conditions, compared to
round-trips to the database
• Difference in the performance more visible when SPARQL queries involve numerous
triple patterns (which translate to expensive JOIN statements)
• In this paper, we focus on the asynchronous approach
• Exporting (dumping) relational database contents into an RDF graph
44th International Conference on Web Intelligence, Mining and Semantics
Incremental Export into RDF (1/2)
• Problem
• Avoid dumping the whole database contents every time
• In cases when few data change in the source database, it is not necessary to
dump the entire database
• Approach
• Every time the RDF export is materialized
• Detect the changes in the source database or the mapping definition
• Insert/delete/update only the necessary triples, in order to reflect these changes in the
resulting RDF graph
54th International Conference on Web Intelligence, Mining and Semantics
Incremental Export into RDF (2/2)
• Incremental transformation
• Each time the transformation is executed, not all of the initial information
that lies in the database should be transformed into RDF, but only the one
that changed
• Incremental storage
• Storing (persisting) to the destination RDF graph only the triples that were
modified and not the whole graph
• Only when the resulting RDF graph is stored in a relational database or using
Jena TDB
• Regardless to whether the transformation took place fully or incrementally
64th International Conference on Web Intelligence, Mining and Semantics
R2RML and Triples Maps
• RDB to RDF Mapping Language
• A W3C Recommendation, as of 2012
• Triples Map: a reusable mapping
definition
• Specifies a rule for translating each row of
a logical table to zero or more RDF triples
• A logical table is a tabular SQL query result
set that is to be mapped to RDF triples
• Execution of a triples map generates the
triples that originate from a specific result
set (logical table)
74th International Conference on Web Intelligence, Mining and Semantics
The R2RML Parser
• An R2RML implementation
• Command-line tool that can export relational database contents as
RDF graphs, based on an R2RML mapping document
• Open-source (CC BY-NC), written in Java
• Publicly available at https://github.com/nkons/r2rml-parser
• Tested against MySQL and PostgreSQL
• Output can be written in RDF/OWL
• N3, Turtle, N-Triple, TTL, RDF/XML notation, or Jena TDB backend
• Covers most (not all) of the R2RML constructs (see the wiki)
• Does not offer SPARQL-to-SQL translations
84th International Conference on Web Intelligence, Mining and Semantics
Outline
• Introduction
• Proposed Approach and Measurements
• Discussion and Conclusions
94th International Conference on Web Intelligence, Mining and Semantics
Information Flow
• Parse the source database contents into result sets
• According to the R2RML Mapping File, the Parser generates a set of
instructions to the Generator
• The Generator instantiates in-memory the resulting RDF graph
• Persist the generated RDF graph into
• An RDF file in the Hard Disk, or
• In Jena’s relational database, or
• In Jena’s TDB (Tuple Data Base, a custom implementation Of B+ Trees)
• Log the results
Parser Generator
Mapping
fileSource database
RDF graph Hard Disk
Target database
TDB
R2RML Parser
104th International Conference on Web Intelligence, Mining and Semantics
Incremental RDF Triple Generation
• Basic challenge
• Discover, since the last time the incremental RDF
generation took place
• Which database tuples were modified
• Which Triples Maps were modified
• Then, perform the mapping only for this altered subset
• Ideally, we should detect the exact changed
database cells and modify only the respectively
generated elements in the RDF graph
• However, using R2RML, the atom of the mapping
definition becomes the Triples Map
a b c d e
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
s p O
. . .
. . .
. . .
.
. . .
. . .
. . .
. . .
. . .
. . .
Triples Map
4th International Conference on Web Intelligence, Mining and Semantics
Result
set
Triples
11
Keeping Track
• Reification
• Allows assertions about RDF statements
• “Reified” model
• A model that contains only reified
statements
• Stores the Triples Map URI that produced
each triple
• Logging
• Store MD5 hashes of
• Triples Maps, SELECT queries, Result sets
• A change in any of the hashes triggers
execution of the Triples Map
subject property object
subject
property
object
blank
node
rdf:subject
rdf:type
rdf:predicate
rdf:object
rdf:Statement
dc:source Triple Map URI
<http://data.example.org/repository/person/1>
foaf:name "John Smith" .
[] a rdf:Statement ;
rdf:subject
<http://data.example.org/repository/person/1> ;
rdf:predicate foaf:name ;
rdf:object "John Smith" ;
dc:source map:persons .
Proposed Approach
• For each Triples Map in the Mapping Document
• Decide whether we have to produce the resulting triples, based on the logged
MD5 hashes
• Dumping to the Hard Disk
• Initially, generate a number of RDF triples
• RDF triples are logged as reified statements, followed by a provenance note
• Incremental generation
• In subsequent executions, modify the existing reified model, by reflecting only the
changes in the source database
• Dumping to the Database or TDB
• No log is needed, storage is incremental by default
134th International Conference on Web Intelligence, Mining and Semantics
Measurements Setup
• An Ubuntu server, 2GHz dual-core, 4GB RAM
• Oracle Java 1.7, Postgresql 9.1, Mysql 5.5.32
• 7 DSpace (dspace.org) repositories
• 1k, 5k, 10k, 50k, 100k, 500k, 1m items, respectively
• A set of complicated, a set of simplified, and a set of simple queries
• In order to deal with database caching effects, the queries were run several
times, prior to performing the measurements
144th International Conference on Web Intelligence, Mining and Semantics
Query Sets
• Complicated
• 3 expensive JOIN conditions
among 4 tables
• 4 WHERE clauses
• Simplified
• 2 JOIN conditions among 3
tables
• 2 WHERE clauses
• Simple
• No JOIN or WHERE conditions
SELECT i.item_id AS item_id, mv.text_value AS text_value
FROM item AS i, metadatavalue AS mv,
metadataschemaregistry
AS msr, metadatafieldregistry AS mfr WHERE
msr.metadata_schema_id=mfr.metadata_schema_id AND
mfr.metadata_field_id=mv.metadata_field_id AND
mv.text_value is not null AND
i.item_id=mv.item_id AND
msr.namespace='http://dublincore.org/documents/dcmi-
terms/'
AND mfr.element='coverage'
AND mfr.qualifier='spatial'
SELECT i.item_id AS item_id, mv.text_value AS text_value
FROM item AS i, metadatavalue AS mv,
metadatafieldregistry AS mfr WHERE
mfr.metadata_field_id=mv.metadata_field_id AND
i.item_id=mv.item_id AND
mfr.element='coverage' AND
mfr.qualifier='spatial'
SELECT "language", "netid", "phone",
"sub_frequency","last_active", "self_registered",
"require_certificate", "can_log_in", "lastname",
"firstname", "digest_algorithm", "salt", "password",
"email", "eperson_id"
FROM "eperson" ORDER BY "language"
Measurements (1/3)
• Export to the Hard Disk
• Simple and complicated queries,
initial export
• Initial incremental dumps take
more time than non-incremental,
as the reified model also has to be
created
0
100
200
300
400
500
600
700
1000 5000 10000
source database rows
non-ncremental
incemental
0
5
10
15
20
25
30
35
40
3000 15000 30000 150000 300000
result model triples
non-incremental
incremental
164th International Conference on Web Intelligence, Mining and Semantics
Measurements (2/3)
• 12 Triples Maps
a. non-incremental mapping
transformation
b. incremental, for the initial time
c. 0/12
d. 1/12
e. 3/12
f. 6/12
g. 9/12
h. 12/12
0
100
200
300
400
500
600
700
a b c d e f g h
1000 items 5000 items 10000 items
0
50
100
150
200
250
300
350
a b c d e f g h
complicated mappings simpler mappings
174th International Conference on Web Intelligence, Mining and Semantics
Data change
Measurements (3/3)
• Similar overall behavior in cases of up
to 3 million triples
• Poor relational database performance
• Jena TDB is the optimal approach
regarding scalability
0
100
200
300
400
500
600
700
800
900
a b c d e f g h
RDF file database jena TDB
0
1000
2000
3000
4000
5000
6000
7000
8000
9000
b c d e f g h
database jena TDB
184th International Conference on Web Intelligence, Mining and Semantics
~180k triples
~1.8m triples
Outline
• Introduction
• Proposed Approach and Measurements
• Discussion and Conclusions
194th International Conference on Web Intelligence, Mining and Semantics
Discussion (1/2)
• The approach is efficient when data freshness is not crucial and/or
selection queries over the contents are more frequent than the updates
• The task of exposing database contents as RDF could be considered
similar to the task of maintaining search indexes next to text content
• Third party software systems can operate completely based on the
exported graph
• E.g. using Fuseki, Sesame, Virtuoso
• Updates can be pushed or pulled from the database
• TDB is the optimal solution regarding scaling
• Caution is still needed in producing de-referenceable URIs
204th International Conference on Web Intelligence, Mining and Semantics
Discussion (2/2)
• On the efficiency of the approach for storing on the Hard Disk
• Good results for mappings (or queries) that include (or lead to) expensive SQL
queries
• E.g. with numerous JOIN statements
• For changes that can affect as much as ¾ of the source data
• Limitations
• By physical memory
• Scales up to several millions of triples, does not qualify as “Big Data”
• Formatting of the logged reified model did affect performance
• RDF/XML and TTL try to pretty-print the result, consuming extra resources, N-TRIPLES is
the optimal
214th International Conference on Web Intelligence, Mining and Semantics
Room for Improvement
• Hashing Result sets is expensive
• Requires re-run of the query, adds an “expensive” ORDER BY clause
• Further study the impact of SQL complexity on the performance
• Reification is currently being reconsidered in RDF 1.1 semantics
• Named graphs being the successor
• Investigation of two-way updates
• Send changes from the triplestore back to the database
224th International Conference on Web Intelligence, Mining and Semantics
Thank you for your attention!
Questions?
234th International Conference on Web Intelligence, Mining and Semantics

More Related Content

PPTX
An Approach for the Incremental Export of Relational Databases into RDF Graphs
PPTX
Transient and persistent RDF views over relational databases in the context o...
PPTX
3TU Datacentrum Tech Overview
PDF
Topic 6: MapReduce Applications
PDF
Geospatial querying in Apache Marmotta - ApacheCon Big Data Europe 2015
PDF
Map Reduce data types and formats
PPTX
Spark core
PPTX
Efficient RDF Interchange (ERI) Format for RDF Data Streams
An Approach for the Incremental Export of Relational Databases into RDF Graphs
Transient and persistent RDF views over relational databases in the context o...
3TU Datacentrum Tech Overview
Topic 6: MapReduce Applications
Geospatial querying in Apache Marmotta - ApacheCon Big Data Europe 2015
Map Reduce data types and formats
Spark core
Efficient RDF Interchange (ERI) Format for RDF Data Streams

What's hot (20)

PDF
Apache Spark — Fundamentals and MLlib
PPT
Status of HDF-EOS, Related Software and Tools
PPTX
Spark Sql and DataFrame
PDF
Map Reduce Execution Architecture
PPTX
Presentation data collection and gtfs
PDF
HadoopXML: A Suite for Parallel Processing of Massive XML Data with Multiple ...
PPTX
PPTX
LIFE GreenYourMove Project - GTFS data
PPTX
Study Notes: Apache Spark
PPTX
A Workshop on R
PPTX
Hadoop MapReduce framework - Module 3
PDF
Towards a More Efficient Paradigm of Storing and Querying Spatial Data on the...
PDF
Bitmap Indexes for Relational XML Twig Query Processing
PPTX
Bringing OpenClinica Data into SAS
PDF
Graph basedrdf storeforapachecassandra
PDF
Scalable Algorithm Design with MapReduce
PPTX
Hadoop in sigmod 2011
PPTX
Timbuctoo 2 EASY
Apache Spark — Fundamentals and MLlib
Status of HDF-EOS, Related Software and Tools
Spark Sql and DataFrame
Map Reduce Execution Architecture
Presentation data collection and gtfs
HadoopXML: A Suite for Parallel Processing of Massive XML Data with Multiple ...
LIFE GreenYourMove Project - GTFS data
Study Notes: Apache Spark
A Workshop on R
Hadoop MapReduce framework - Module 3
Towards a More Efficient Paradigm of Storing and Querying Spatial Data on the...
Bitmap Indexes for Relational XML Twig Query Processing
Bringing OpenClinica Data into SAS
Graph basedrdf storeforapachecassandra
Scalable Algorithm Design with MapReduce
Hadoop in sigmod 2011
Timbuctoo 2 EASY
Ad

Viewers also liked (20)

PPTX
Materializing the Web of Linked Data
PPTX
Conclusions: Summary and Outlook
PPTX
Technical Background
PPTX
Deploying Linked Open Data: Methodologies and Software Tools
PPTX
Introduction: Linked Data and the Semantic Web
PPTX
Creating Linked Data from Relational Databases
PDF
Publishing and Using Linked Data
PPTX
Learning to assess Linked Data relationships using Genetic Programming
PPTX
Linked Open Data Principles, benefits of LOD for sustainable development
PPTX
Generating Linked Data in Real-time from Sensor Data Streams
PDF
RDF Streams and Continuous SPARQL (C-SPARQL)
PPT
Linking KOS Data [using SKOS and OWL2]
PDF
Publishing Linked Data from RDB
PPTX
Entity Linking in Queries: Tasks and Evaluation
PPTX
From Research to Innovation: Linked Open Data and Gamification to Design Inte...
PPTX
Linked Data tutorial at Semtech 2012
PPTX
Introduction to Linked Data 1/5
PPTX
Consuming Linked Data 4/5 Semtech2011
PDF
Méthodes et outils pour interrelier le web des données
PDF
RDF Tutorial - SPARQL 20091031
Materializing the Web of Linked Data
Conclusions: Summary and Outlook
Technical Background
Deploying Linked Open Data: Methodologies and Software Tools
Introduction: Linked Data and the Semantic Web
Creating Linked Data from Relational Databases
Publishing and Using Linked Data
Learning to assess Linked Data relationships using Genetic Programming
Linked Open Data Principles, benefits of LOD for sustainable development
Generating Linked Data in Real-time from Sensor Data Streams
RDF Streams and Continuous SPARQL (C-SPARQL)
Linking KOS Data [using SKOS and OWL2]
Publishing Linked Data from RDB
Entity Linking in Queries: Tasks and Evaluation
From Research to Innovation: Linked Open Data and Gamification to Design Inte...
Linked Data tutorial at Semtech 2012
Introduction to Linked Data 1/5
Consuming Linked Data 4/5 Semtech2011
Méthodes et outils pour interrelier le web des données
RDF Tutorial - SPARQL 20091031
Ad

Similar to Incremental Export of Relational Database Contents into RDF Graphs (20)

PPTX
SWT Lecture Session 10 R2RML Part 1
PPTX
presentation sur r2rml from relational databse to relationel
PPTX
Publishing "5 star" data: the case for RDF
PPTX
Scalable Web Data Management using RDF
PPTX
First Steps in Semantic Data Modelling and Search & Analytics in the Cloud
PDF
Machine-Interpretable Dataset and Service Descriptions for Heterogeneous Data...
PDF
Expressive Querying of Semantic Databases with Incremental Query Rewriting
PDF
Translation of Relational and Non-Relational Databases into RDF with xR2RML
PPTX
‘Facilitating User Engagement by Enriching Library Data using Semantic Techno...
PPTX
Relational Database to RDF (RDB2RDF)
PDF
A Generic Mapping-based Query Translation from SPARQL to Various Target Datab...
PPTX
Virtuoso -- The Prometheus of RDF
ODP
Graphing Your Data
PPTX
Semantic Web and Related Work at W3C
PPTX
Virtuoso, The Prometheus of RDF -- Sematics 2014 Conference Keynote
PDF
IRJET- Data Retrieval using Master Resource Description Framework
PPTX
RDB2RDF Tutorial (R2RML and Direct Mapping) at ISWC 2013
PDF
A Hands On Overview Of The Semantic Web
PPTX
Exposing Bibliographic Information as Linked Open Data using Standards-based ...
PDF
Do it on your own - From 3 to 5 Star Linked Open Data with RMLio
SWT Lecture Session 10 R2RML Part 1
presentation sur r2rml from relational databse to relationel
Publishing "5 star" data: the case for RDF
Scalable Web Data Management using RDF
First Steps in Semantic Data Modelling and Search & Analytics in the Cloud
Machine-Interpretable Dataset and Service Descriptions for Heterogeneous Data...
Expressive Querying of Semantic Databases with Incremental Query Rewriting
Translation of Relational and Non-Relational Databases into RDF with xR2RML
‘Facilitating User Engagement by Enriching Library Data using Semantic Techno...
Relational Database to RDF (RDB2RDF)
A Generic Mapping-based Query Translation from SPARQL to Various Target Datab...
Virtuoso -- The Prometheus of RDF
Graphing Your Data
Semantic Web and Related Work at W3C
Virtuoso, The Prometheus of RDF -- Sematics 2014 Conference Keynote
IRJET- Data Retrieval using Master Resource Description Framework
RDB2RDF Tutorial (R2RML and Direct Mapping) at ISWC 2013
A Hands On Overview Of The Semantic Web
Exposing Bibliographic Information as Linked Open Data using Standards-based ...
Do it on your own - From 3 to 5 Star Linked Open Data with RMLio

More from Nikolaos Konstantinou (7)

PPTX
OR2012 Biblio-transformation-engine
PPT
Priamos: A Middleware Architecture for Real-Time Semantic Annotation of Conte...
PPT
Διαχείριση Ψηφιακού Περιεχομένου με το DSpace: Λειτουργία και τεχνικά ζητήματα
PDF
Publishing Data Using Semantic Web Technologies
PDF
From Sensor Data to Triples: Information Flow in Semantic Sensor Networks
PPT
A rule-based approach for the real-time semantic annotation in context-aware ...
PPT
VisAVis: An Approach to an Intermediate Layer between Ontologies and Relation...
OR2012 Biblio-transformation-engine
Priamos: A Middleware Architecture for Real-Time Semantic Annotation of Conte...
Διαχείριση Ψηφιακού Περιεχομένου με το DSpace: Λειτουργία και τεχνικά ζητήματα
Publishing Data Using Semantic Web Technologies
From Sensor Data to Triples: Information Flow in Semantic Sensor Networks
A rule-based approach for the real-time semantic annotation in context-aware ...
VisAVis: An Approach to an Intermediate Layer between Ontologies and Relation...

Recently uploaded (20)

PDF
From Molecular Interactions to Solubility in Deep Eutectic Solvents: Explorin...
PDF
Chapter 3 - Human Development Poweroint presentation
PPTX
endocrine - management of adrenal incidentaloma.pptx
PPTX
ELISA(Enzyme linked immunosorbent assay)
PPTX
TORCH INFECTIONS in pregnancy with toxoplasma
PDF
Unit 5 Preparations, Reactions, Properties and Isomersim of Organic Compounds...
PDF
Science Form five needed shit SCIENEce so
PPTX
Introcution to Microbes Burton's Biology for the Health
PPTX
Cells and Organs of the Immune System (Unit-2) - Majesh Sir.pptx
PPT
Mutation in dna of bacteria and repairss
PPTX
Substance Disorders- part different drugs change body
PDF
7.Physics_8_WBS_Electricity.pdfXFGXFDHFHG
PPTX
diabetes and its complications nephropathy neuropathy
PDF
Integrative Oncology: Merging Conventional and Alternative Approaches (www.k...
PPTX
SCIENCE 4 Q2W5 PPT.pptx Lesson About Plnts and animals and their habitat
PPT
THE CELL THEORY AND ITS FUNDAMENTALS AND USE
PPTX
Toxicity Studies in Drug Development Ensuring Safety, Efficacy, and Global Co...
PDF
Cosmology using numerical relativity - what hapenned before big bang?
PPTX
Platelet disorders - thrombocytopenia.pptx
PPT
LEC Synthetic Biology and its application.ppt
From Molecular Interactions to Solubility in Deep Eutectic Solvents: Explorin...
Chapter 3 - Human Development Poweroint presentation
endocrine - management of adrenal incidentaloma.pptx
ELISA(Enzyme linked immunosorbent assay)
TORCH INFECTIONS in pregnancy with toxoplasma
Unit 5 Preparations, Reactions, Properties and Isomersim of Organic Compounds...
Science Form five needed shit SCIENEce so
Introcution to Microbes Burton's Biology for the Health
Cells and Organs of the Immune System (Unit-2) - Majesh Sir.pptx
Mutation in dna of bacteria and repairss
Substance Disorders- part different drugs change body
7.Physics_8_WBS_Electricity.pdfXFGXFDHFHG
diabetes and its complications nephropathy neuropathy
Integrative Oncology: Merging Conventional and Alternative Approaches (www.k...
SCIENCE 4 Q2W5 PPT.pptx Lesson About Plnts and animals and their habitat
THE CELL THEORY AND ITS FUNDAMENTALS AND USE
Toxicity Studies in Drug Development Ensuring Safety, Efficacy, and Global Co...
Cosmology using numerical relativity - what hapenned before big bang?
Platelet disorders - thrombocytopenia.pptx
LEC Synthetic Biology and its application.ppt

Incremental Export of Relational Database Contents into RDF Graphs

  • 1. Incremental Export of Relational Database Contents into RDF Graphs Nikolaos Konstantinou, Dimitris Kouis, Nikolas Mitrou By Dr. Nikolaos Konstantinou National Technical University of Athens School of Electrical and Computer Engineering Multimedia, Communications & Web Technologies 4th International Conference on Web Intelligence, Mining and Semantics
  • 2. Outline • Introduction • Proposed Approach and Measurements • Discussion and Conclusions 24th International Conference on Web Intelligence, Mining and Semantics
  • 3. Introduction • Information collection, maintenance and update is not always taking place directly at a triplestore, but at a RDBMS • Triplestores are often kept as an alternative content delivery channel • It can be difficult to change established methodologies and systems • Newer technologies need to operate side-by-side to existing ones before migration 34th International Conference on Web Intelligence, Mining and Semantics
  • 4. Mapping Relational Data to RDF • No one-size-fits-all approach • Synchronous Vs Asynchronous RDF Views • Real-time Vs Ad hoc RDF Views • Real-time SPARQL-to-SQL Vs Querying the RDF dump using SPARQL • Queries on the RDF dump are faster in certain conditions, compared to round-trips to the database • Difference in the performance more visible when SPARQL queries involve numerous triple patterns (which translate to expensive JOIN statements) • In this paper, we focus on the asynchronous approach • Exporting (dumping) relational database contents into an RDF graph 44th International Conference on Web Intelligence, Mining and Semantics
  • 5. Incremental Export into RDF (1/2) • Problem • Avoid dumping the whole database contents every time • In cases when few data change in the source database, it is not necessary to dump the entire database • Approach • Every time the RDF export is materialized • Detect the changes in the source database or the mapping definition • Insert/delete/update only the necessary triples, in order to reflect these changes in the resulting RDF graph 54th International Conference on Web Intelligence, Mining and Semantics
  • 6. Incremental Export into RDF (2/2) • Incremental transformation • Each time the transformation is executed, not all of the initial information that lies in the database should be transformed into RDF, but only the one that changed • Incremental storage • Storing (persisting) to the destination RDF graph only the triples that were modified and not the whole graph • Only when the resulting RDF graph is stored in a relational database or using Jena TDB • Regardless to whether the transformation took place fully or incrementally 64th International Conference on Web Intelligence, Mining and Semantics
  • 7. R2RML and Triples Maps • RDB to RDF Mapping Language • A W3C Recommendation, as of 2012 • Triples Map: a reusable mapping definition • Specifies a rule for translating each row of a logical table to zero or more RDF triples • A logical table is a tabular SQL query result set that is to be mapped to RDF triples • Execution of a triples map generates the triples that originate from a specific result set (logical table) 74th International Conference on Web Intelligence, Mining and Semantics
  • 8. The R2RML Parser • An R2RML implementation • Command-line tool that can export relational database contents as RDF graphs, based on an R2RML mapping document • Open-source (CC BY-NC), written in Java • Publicly available at https://github.com/nkons/r2rml-parser • Tested against MySQL and PostgreSQL • Output can be written in RDF/OWL • N3, Turtle, N-Triple, TTL, RDF/XML notation, or Jena TDB backend • Covers most (not all) of the R2RML constructs (see the wiki) • Does not offer SPARQL-to-SQL translations 84th International Conference on Web Intelligence, Mining and Semantics
  • 9. Outline • Introduction • Proposed Approach and Measurements • Discussion and Conclusions 94th International Conference on Web Intelligence, Mining and Semantics
  • 10. Information Flow • Parse the source database contents into result sets • According to the R2RML Mapping File, the Parser generates a set of instructions to the Generator • The Generator instantiates in-memory the resulting RDF graph • Persist the generated RDF graph into • An RDF file in the Hard Disk, or • In Jena’s relational database, or • In Jena’s TDB (Tuple Data Base, a custom implementation Of B+ Trees) • Log the results Parser Generator Mapping fileSource database RDF graph Hard Disk Target database TDB R2RML Parser 104th International Conference on Web Intelligence, Mining and Semantics
  • 11. Incremental RDF Triple Generation • Basic challenge • Discover, since the last time the incremental RDF generation took place • Which database tuples were modified • Which Triples Maps were modified • Then, perform the mapping only for this altered subset • Ideally, we should detect the exact changed database cells and modify only the respectively generated elements in the RDF graph • However, using R2RML, the atom of the mapping definition becomes the Triples Map a b c d e . . . . . . . . . . . . . . . . . . . . . . . . . s p O . . . . . . . . . . . . . . . . . . . . . . . . . . . . Triples Map 4th International Conference on Web Intelligence, Mining and Semantics Result set Triples 11
  • 12. Keeping Track • Reification • Allows assertions about RDF statements • “Reified” model • A model that contains only reified statements • Stores the Triples Map URI that produced each triple • Logging • Store MD5 hashes of • Triples Maps, SELECT queries, Result sets • A change in any of the hashes triggers execution of the Triples Map subject property object subject property object blank node rdf:subject rdf:type rdf:predicate rdf:object rdf:Statement dc:source Triple Map URI <http://data.example.org/repository/person/1> foaf:name "John Smith" . [] a rdf:Statement ; rdf:subject <http://data.example.org/repository/person/1> ; rdf:predicate foaf:name ; rdf:object "John Smith" ; dc:source map:persons .
  • 13. Proposed Approach • For each Triples Map in the Mapping Document • Decide whether we have to produce the resulting triples, based on the logged MD5 hashes • Dumping to the Hard Disk • Initially, generate a number of RDF triples • RDF triples are logged as reified statements, followed by a provenance note • Incremental generation • In subsequent executions, modify the existing reified model, by reflecting only the changes in the source database • Dumping to the Database or TDB • No log is needed, storage is incremental by default 134th International Conference on Web Intelligence, Mining and Semantics
  • 14. Measurements Setup • An Ubuntu server, 2GHz dual-core, 4GB RAM • Oracle Java 1.7, Postgresql 9.1, Mysql 5.5.32 • 7 DSpace (dspace.org) repositories • 1k, 5k, 10k, 50k, 100k, 500k, 1m items, respectively • A set of complicated, a set of simplified, and a set of simple queries • In order to deal with database caching effects, the queries were run several times, prior to performing the measurements 144th International Conference on Web Intelligence, Mining and Semantics
  • 15. Query Sets • Complicated • 3 expensive JOIN conditions among 4 tables • 4 WHERE clauses • Simplified • 2 JOIN conditions among 3 tables • 2 WHERE clauses • Simple • No JOIN or WHERE conditions SELECT i.item_id AS item_id, mv.text_value AS text_value FROM item AS i, metadatavalue AS mv, metadataschemaregistry AS msr, metadatafieldregistry AS mfr WHERE msr.metadata_schema_id=mfr.metadata_schema_id AND mfr.metadata_field_id=mv.metadata_field_id AND mv.text_value is not null AND i.item_id=mv.item_id AND msr.namespace='http://dublincore.org/documents/dcmi- terms/' AND mfr.element='coverage' AND mfr.qualifier='spatial' SELECT i.item_id AS item_id, mv.text_value AS text_value FROM item AS i, metadatavalue AS mv, metadatafieldregistry AS mfr WHERE mfr.metadata_field_id=mv.metadata_field_id AND i.item_id=mv.item_id AND mfr.element='coverage' AND mfr.qualifier='spatial' SELECT "language", "netid", "phone", "sub_frequency","last_active", "self_registered", "require_certificate", "can_log_in", "lastname", "firstname", "digest_algorithm", "salt", "password", "email", "eperson_id" FROM "eperson" ORDER BY "language"
  • 16. Measurements (1/3) • Export to the Hard Disk • Simple and complicated queries, initial export • Initial incremental dumps take more time than non-incremental, as the reified model also has to be created 0 100 200 300 400 500 600 700 1000 5000 10000 source database rows non-ncremental incemental 0 5 10 15 20 25 30 35 40 3000 15000 30000 150000 300000 result model triples non-incremental incremental 164th International Conference on Web Intelligence, Mining and Semantics
  • 17. Measurements (2/3) • 12 Triples Maps a. non-incremental mapping transformation b. incremental, for the initial time c. 0/12 d. 1/12 e. 3/12 f. 6/12 g. 9/12 h. 12/12 0 100 200 300 400 500 600 700 a b c d e f g h 1000 items 5000 items 10000 items 0 50 100 150 200 250 300 350 a b c d e f g h complicated mappings simpler mappings 174th International Conference on Web Intelligence, Mining and Semantics Data change
  • 18. Measurements (3/3) • Similar overall behavior in cases of up to 3 million triples • Poor relational database performance • Jena TDB is the optimal approach regarding scalability 0 100 200 300 400 500 600 700 800 900 a b c d e f g h RDF file database jena TDB 0 1000 2000 3000 4000 5000 6000 7000 8000 9000 b c d e f g h database jena TDB 184th International Conference on Web Intelligence, Mining and Semantics ~180k triples ~1.8m triples
  • 19. Outline • Introduction • Proposed Approach and Measurements • Discussion and Conclusions 194th International Conference on Web Intelligence, Mining and Semantics
  • 20. Discussion (1/2) • The approach is efficient when data freshness is not crucial and/or selection queries over the contents are more frequent than the updates • The task of exposing database contents as RDF could be considered similar to the task of maintaining search indexes next to text content • Third party software systems can operate completely based on the exported graph • E.g. using Fuseki, Sesame, Virtuoso • Updates can be pushed or pulled from the database • TDB is the optimal solution regarding scaling • Caution is still needed in producing de-referenceable URIs 204th International Conference on Web Intelligence, Mining and Semantics
  • 21. Discussion (2/2) • On the efficiency of the approach for storing on the Hard Disk • Good results for mappings (or queries) that include (or lead to) expensive SQL queries • E.g. with numerous JOIN statements • For changes that can affect as much as ¾ of the source data • Limitations • By physical memory • Scales up to several millions of triples, does not qualify as “Big Data” • Formatting of the logged reified model did affect performance • RDF/XML and TTL try to pretty-print the result, consuming extra resources, N-TRIPLES is the optimal 214th International Conference on Web Intelligence, Mining and Semantics
  • 22. Room for Improvement • Hashing Result sets is expensive • Requires re-run of the query, adds an “expensive” ORDER BY clause • Further study the impact of SQL complexity on the performance • Reification is currently being reconsidered in RDF 1.1 semantics • Named graphs being the successor • Investigation of two-way updates • Send changes from the triplestore back to the database 224th International Conference on Web Intelligence, Mining and Semantics
  • 23. Thank you for your attention! Questions? 234th International Conference on Web Intelligence, Mining and Semantics