EasyRdf is a PHP library designed to make it easy to consume and produce RDF. It was designed for use in mixed teams of experienced and inexperienced RDF developers. It is written in Object Oriented PHP.
During parsing EasyRdf builds up a graph of PHP objects that can then be walked around to get the data to be placed on the page.
Data is typically loaded into a EasyRdf_Graph object from source RDF documents. The source document could either be an RDF file on the web or the output of a Construct or Describe SPARQL query from a triplestore.
$foaf = new EasyRdf_Graph("http://www.aelius.com/njh/foaf.rdf");
$me = $foaf->primaryTopic();
echo "My name is: ".$me->get('foaf:name')."\n";
The latest version of EasyRdf can be downloaded from GitHub.
- EasyRdf Homepage
- API documentation
- Change Log
- Source Code: http://github.com/njh/easyrdf
- Issue Tracker: http://github.com/njh/easyrdf/issues
- PHP 5.2.1
- API documentation written in phpdoc
- Unit tests written using phpunit
- Choice of RDF parser:
- Built-in: RDF/JSON, N-Triples
- ARC2: RDF/XML, Turtle, RSS, microformats, eRDF, RDFa, ...
- Redland Bindings: RDF/XML, N-Triples, Turtle, TriG, RSS Tag Soup, ...
- rapper: RDF/XML, N-Triples, Turtle, TriG, RSS Tag Soup, ...
- Choice of RDF serialiser:
- Built-in: RDF/JSON, N-Triples, RDF/XML, Turtle
- ARC2: RDF/JSON, RDF/XML, N-Triples, Turtle, POSHRDF
- rapper: RDF/JSON, N-Triples, RDF/XML, Turtle, RSS, Atom, Dot, ...
- Optional support for Zend_Http_Client
- No required external dependancies upon other libraries (PEAR, Zend, etc...)
- Complies with Zend Framework coding style.
- Type mapper - resources of type foaf:Person can be mapped into PHP object of class Foaf_Person
- Comes with a number of examples
- artistinfo.php - Example of mapping an RDF type to a PHP Class
- basic.php - Basic "Hello World" type example
- converter.php - Convert RDF from one format to another
- dump.php - Display the contents of a graph
- easyspec.php - Format an RDF Vocabulary
- foafinfo.php - Display the information in a FOAF file
- foafmaker.php - Construct a FOAF document with a choice of serialisations
- httpget.php - No RDF, just test EasyRdf_Http_Client
- review_extract.php - Extract a review from a page containing Google Review RDFa
- serialise.php - Basic serialisation example