Skip to content


Graphite 1.4

I’ve just released Graphite 1.4

Graphite is a PHP library to allow quick scripting with RDF, designed to work on one, or a small number of linked RDF documents and produce a page.

Most of the 1.4 features were added to facilitate Les Carr who was trying to use it to solve a problem. It now has a bunch more methods you can call on a list of resources; append,union,except,intersection and sort.

This means you can now do:


include_once("arc/ARC2.php");
include_once("Graphite.php");


$graph = new Graphite();
$graph->ns( "ecs","http://rdf.ecs.soton.ac.uk/ontology/ecs#" );

$base_interest_uri = "http://id.ecs.soton.ac.uk/interest/";
$graph->load( $base_interest_uri."rdf" );
$graph->load( $base_interest_uri."web_science" );

$rdf_people = $people = $graph->resource( $base_interest_uri."rdf" )->all( "-ecs:hasInterest" );

$wsc_people = $people = $graph->resource( $base_interest_uri."web_science" )->all( "-ecs:hasInterest" );

print "<div>Either RDF or Web Science: ".$rdf_people->union( $wsc_people )->sort( "foaf:name")->label()->join( ", " )."</div>";

print "<div>Both RDF and Web Science: ".$rdf_people->intersection( $wsc_people )->sort( "foaf:name")->label()->join( ", " ).".</div>;

Which I think is beginning to get quite powerful, and remains reasonably easy to read.

It also can now cache the RDF locally so you can save repeated HTTP requests when doing your linked-data thing.

Posted in Graphite, PHP, Uncategorized.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.