Hi.
Redland's librdf allows nice things like a triple store in a postgres DB
with a SPARQL interface, while at the same time, the ARC2 support for
PostGreSQL isn't ready yet, AFAIK.
I've been giving a try at converting data retrieved from such a redland
triple store into ARC2 internal triples format, so that I'm not stuck
with librdf for the rest of the data processing.
Here's the kind of results that I can get (provided that a model was
already stored in the DB) :
// retrieve data already stored in the redland PostGreSQL triple store
$store = new LibRDF_Storage("postgresql", "
richard.cyganiak.de",
"new='no',
host='localhost',
database='tests',
user='postgres',
password='whatever'");
$model = new LibRDF_Model($store);
// Now that the model has been retrieved from the DB, let's convert it
// to ARC2 internat triples structure
$triples=$model->toArc2Triples();
$parser = ARC2::getRDFParser();
// And serialize it to Turtle
$turtle_doc = $parser->toTurtle($triples);
print($turtle_doc);
I've pushed my code in [1]. Actually, it's not using the librdf PHP
bindings directly, but it's based on its "LibRDF" [0] Object-Oriented
wrapper for PHP (which may offer an alternative to ARC2, in terms of
elegance of the code, at least ;).
It's not completely tested though, and I fear there are some memory
issues, as I've had strange messages spitted out by librdf... so don't
use it on production ;)
I thought some might be interested in case of postgresql storage needs,
while not having to rewrite existing code based on ARC2 or Graphite.
What do you think ? Any comments welcome.
Best regards,
[0]
https://github.com/literarymachine/LibRDF
[1]
https://github.com/olberger/LibRDF/tree/toArc2
P.S.: for more details on the use of LibRDF for a triple store in
PostGreSQL, see my just posted blog :
http://www-public.telecom-sudparis.eu/~berger_o/weblog/2013/02/08/rdf-development-in-php-with-a-postgresql-triple-store-thanks-to-the-librdf-oo-wrapper-for-redlandlibrdf/
--
Olivier BERGER
http://www-public.telecom-sudparis.eu/~berger_o/ - OpenPGP-Id: 2048R/5819D7E8
Ingenieur Recherche - Dept INF
Institut Mines-Telecom, Telecom SudParis, Evry (France)