http://aksw.org/Projects/R2D2 an entity of type: AlumniProject
| The Semantic Web aims at giving data more structure and computer understandable meaning. For that RDF enables to add metadata to the unmanageable mass of data in the World Wide Web. Hence, the transformation of data located in relational databases to RDF plays an essential role. To provide such functionality our implementation R2D2 maps an RDF query to a legacy relational database without having to replicate the data.
Our old website is currently off-line while we are trying recreate it with more modern tech.
R2D2 is be implemented in PHP and uses the RDF API for PHP (RAP) for querying a virtual R2D2-Graph. An R2D2-Graph is read only and may be used like other models in RAP by instantiating a new model named R2D2model. An R2D2model rewrites find(spo) and sparql() queries to SQL queries and transforms the SQL result set back into RDF triples. A database schema is mapped by the D2RQ Mapping Language – a declarative mapping language for describing the relation between an ontology and an relational data model.
The current version is available at Sourceforge-CVS, click here.
Installation and Use
R2D2 is a RAP Plug In. So first, you need to download RAP. For installing R2D2 you simple have to copy the R2D2 directory into the main RAP folder.
Some example scipts are stored in folder testR2D2. You can copy this folder into the main RAP folder, too. After this you can use them with your mapping files . To include R2D2 you have to add the class R2D2Model (in R2D2/R2D2Model.php) into RAP. After this you are able to create a new virtual RDF-graph by $model = new R2D2Model($mapFile).
A map is represented as an RDF-graph. So if you want the RAP database to manage your map you can copy a map to RAP by RAP-methods. Maps that are stored in RAP are used my $model = new R2D2DbModel($db,$modelName).
For more information check the manual (coming soon).
This short examle script shows how user information in a WordPress is mapped to the FOAF vocabulary.
Example Query: Find all user names
Using these parts of the D2RQ map
both find and sparql query will be translated into following SQL command:
the result set may contain following lines:
and is translated into the RDF result triple:
R2D2 implements a new SPARQL2SQL rewriter. This feature is still in progress and buggy. Up to now only group patterns are supported! (for more information see the SPARQL complexity catalog (german version) Regular expressions in find(spo) or SPARQL are not yet supported.