EasyRdf is a PHP library designed to make it easy to consume and produce RDF.
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 and has been tested extensively using PHPUnit.
After 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. Dump methods are available to inspect what data is available during development.
Data is typically loaded into an
EasyRdf\Graph object from source RDF
documents, loaded from the web via HTTP. The
simplifies loading and saving data to a SPARQL 1.1 Graph Store.
SPARQL queries can be made over HTTP to a Triplestore using the
ASK queries will return an
EasyRdf\Sparql\Result object and
DESCRIBE queries will return
$foaf = new \EasyRdf\Graph("http://njh.me/foaf.rdf"); $foaf->load(); $me = $foaf->primaryTopic(); echo "My name is: ".$me->get('foaf:name')."\n";
The latest stable version of EasyRdf can be downloaded from the EasyRdf website.
- PHP 5.3 or higher
- API documentation written in
- Extensive unit tests written using
- Built-in parsers and serialisers: RDF/JSON, N-Triples, RDF/XML, Turtle
- Optional parsing support for: ARC2, Redland Bindings, rapper
- Optional support for
- No required external dependancies upon other libraries (PEAR, Zend, etc...)
- Complies with Zend Framework coding style.
- Type mapper - resources of type
foaf:Personcan be mapped into PHP object of class
- Support for visualisation of graphs using GraphViz
- Comes with a number of examples
artistinfo.php- Example of mapping an RDF class type to a PHP Class
basic.php- Basic "Hello World" type example
basic_sparql.php- Example of making a SPARQL
converter.php- Convert RDF from one format to another
dump.php- Display the contents of a graph
foafinfo.php- Display the basic information in a FOAF document
foafmaker.php- Construct a FOAF document with a choice of serialisations
graph_direct.php- Example of using
graphstore.php- Store and retrieve data from a SPARQL 1.1 Graph Store
graphviz.php- GraphViz rendering example
html_tag_helpers.php- Rails Style html tag helpers to make the EasyRdf examples simpler
httpget.php- No RDF, just test
serialise.php- Basic serialisation example
sparql_queryform.php- Form to submit SPARQL queries and display the result
uk_postcode.php- Example of resolving UK postcodes using uk-postcodes.com
villages.php- Fetch and information about villages in Fife from dbpedialite.org
zend_framework.php- Example of using