RDF::RDB2RDF::R2RML - map relational database to RDF using R2RML
my $mapper = RDF::RDB2RDF->new('R2RML', $r2rml); print $mapper->process_turtle($dbh);
This class offers support for W3C R2RML, based on the 29 May 2012 working draft. See the COMPLIANCE AND COMPATIBILITY section below for a list on unimplemented areas.
This is a subclass of RDF::RDB2RDF::Simple. Differences noted below...
RDF::RDB2RDF::R2RML->new($r2rml)
RDF::RDB2RDF->new('R2RML', $r2rml)
A single parameter is expected, this can either be an R2RML document as a Turtle string, or an RDF::Trine::Model containing R2RML data. If a Turtle string, then the namespaces from it are also kept.
process_turtle($dbh, %options)
The mapping is included as an R2RML comment at the top of the Turtle. Passing no_r2rml => 1 can disable that feature.
no_r2rml => 1
This implementation should be mostly compliant with the Direct Mapping specification, with the following provisos:
rr:RefObjectMap, rr:parentTriplesMap, rr:joinCondition, rr:JoinCondition, rr:child, rr:parent are only partially working.
rr:defaultGraph is not understood.
Other quirks are database-specific:
This module expects DBI to return utf8 character strings. Depending on your database engine, you might need to play games with DBI and your database server to get this working. If you're using 7-bit safe ASCII, then this probably doesn't concern you.
Different databases support different SQL datatypes. This module attempts to map them to their XSD equivalents, but may not recognise some exotic ones.
This module has only been extensively tested on SQLite 3.6.23.1 and PostgreSQL 8.4.4. I know of no reason it shouldn't work with other relational database engines, provided they are supported by DBI, but as with all things SQL, I wouldn't be surprised if there were one or two problems. Patches welcome.
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=RDF-RDB2RDF.
RDF::Trine, RDF::RDB2RDF, RDF::RDB2RDF::Simple.
http://www.perlrdf.org/.
http://www.w3.org/TR/2012/WD-r2rml-20120529/.
Toby Inkster <tobyink@cpan.org>.
Copyright 2011-2012 Toby Inkster
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
To install RDF::RDB2RDF, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RDF::RDB2RDF
CPAN shell
perl -MCPAN -e shell install RDF::RDB2RDF
For more information on module installation, please visit the detailed CPAN module installation guide.