| 1 | = The State of RDF support in Perl = |
| 2 | |
| 3 | |
| 4 | == Experimenting == |
| 5 | |
| 6 | tkappler created a git repository http://github.com/thomas11/perl-rdf-experiments to experiment with RDF in Perl, see what existing modules can do, etc. Biohackathoners, please fork and contribute! |
| 7 | |
| 8 | |
| 9 | == Existing modules == |
| 10 | |
| 11 | Also see http://www.perlrdf.org! |
| 12 | |
| 13 | |
| 14 | === RDF::Trine === |
| 15 | |
| 16 | [http://search.cpan.org/~gwilliams/RDF-Trine-0.117/ RDF::Trine] is a complete RDF package written in Perl. It is the only one that has parsers for RDF serializations other than RDF/XML (including JSON), and that has a SPARQL wrapper. It implements the |
| 17 | [http://www.w3.org/TR/2008/REC-rdf-sparql-protocol-20080115/#query-bindings-http SPARQL protocol] and can thus talk to any SPARQL endpoint. |
| 18 | |
| 19 | Last release: 0.117, 2010-02-04. |
| 20 | |
| 21 | istkappler in touch with the author, Gregory Williams, and it's a pleasure to work with him. Some patches contributed. Here's some of his advice that I intend to include in some more in-depth, step-by-step writeups. |
| 22 | |
| 23 | > In general you should be using RDF::Query for retrieving patterns |
| 24 | > that are more complex than a single triple pattern. get_pattern |
| 25 | > exists mostly for RDF::Query to use when the underlying store is |
| 26 | > expected to be able to execute a complex join query more efficiently |
| 27 | > than the perl implementation (for example, the DBI-based storage |
| 28 | > backend). It's never been a part of the code that has felt very |
| 29 | > stable, so I'd suggest always using the RDF::Query interface for |
| 30 | > situations where get_statements doesn't do as much as you need. |
| 31 | |
| 32 | |
| 33 | See the `trine-*.pl` files for code snippets. |
| 34 | |
| 35 | |
| 36 | === RDF::Redland === |
| 37 | |
| 38 | [http://search.cpan.org/~djbeckett/Redland-1.0.5.4/redland/docs/redland.pod RDF::Redland] is a wrapper for the [Redland C library](http://librdf.org/). Looks |
| 39 | pretty complete. |
| 40 | |
| 41 | I couldn't build it as I have the new version 0.9.17 of librasqal, the query library for Redland, which is API incompatible with its predecessor on which RDF::Redland apparently depends. |
| 42 | |
| 43 | |
| 44 | === Test::RDF === |
| 45 | |
| 46 | [http://search.cpan.org/~mndrix/Test-RDF-0.0.3/lib/Test/RDF.pm Test::RDF] supports checking for data validity, and comparing two graphs for equivalence. It does not explain the differences when they are not equal, however. Builds on RDF::Redland. |
| 47 | |
| 48 | |
| 49 | === RDF::Core === |
| 50 | |
| 51 | Another pure Perl RDF framework. [http://search.cpan.org/~dpokorny/RDF-Core/ CPAN]. Last release: 0.51, 2007-02-19, which probably means that it's not very |
| 52 | much used or supported. Use RDF::Trine unless you have a good reason not to. |
| 53 | |
| 54 | Notes: |
| 55 | |
| 56 | * A pretty complete RDF package written in Perl, including parser and |
| 57 | serializer, model with its own query language, and storage with |
| 58 | either Berkeley DB, in-memory, or PostgreSQL as backend. |
| 59 | * It's unfortunate that it has its own query language, should be |
| 60 | SPARQL. |
| 61 | * RDF/XML serialization and parsing only. |
| 62 | * Has a Schema module to work with RDFS, didn't try it. |
| 63 | * Greg Williams of RDF::Trine, the other, more complete and up-to-date |
| 64 | RDF framework, tried to contribute to RDF::Core but was |
| 65 | "[met with resistance, rejection, or frustratingly long delays](http://kasei.us/archives/2006/09/23/perl_performance)". Not |
| 66 | good. |
| 67 | |
| 68 | |
| 69 | === Onto-Perl === |
| 70 | |
| 71 | [http://search.cpan.org/~easr/ONTO-PERL-1.14/ ONTO-PERL] by fellow Biohackathoner Erick Antezana can translate between OBO, OBO-in-OWL, and RDF (among other things). |
| 72 | |
| 73 | |
| 74 | === Wrappers === |
| 75 | |
| 76 | * [http://search.cpan.org/~mndrix/RDF-Sesame-0.17/lib/RDF/Sesame.pm RDF-Sesame] is a wrapper for the REST API of [Sesame](http://openrdf.org/), to |
| 77 | ask [SerQL](http://www.openrdf.org/doc/sesame/users/ch06.html) |
| 78 | queries and get the results in tabular form. |
| 79 | |
| 80 | * [http://search.cpan.org/~ekawas/MOBY-1.12/ MOBY], a BioMoby client, has MOBY::RDF. |
| 81 | |
| 82 | |
| 83 | == Future Work == |
| 84 | |
| 85 | A lot. Add if you think of something. |
| 86 | |
| 87 | UniProt has a very simple RDF reader that only works with UniProt RDF. It's still useful as it's very easy to use, tkappler is working on packaging it up. |