N-Triples Serializer (v1)

This class creates N-Triples from a given set of ARC triples.

Setup

Simply include the class file:
include_once("path/to/arc/ARC_ntriples_serializer.php");

Instantiation

The class can be instantiated with an array of parameters:
  • linebreak (default is \r\n)
  • spacer (to be used between subject, predicate, and object, default is " ")
e.g.
$args = array(<br />
  "linebreak" => "<br />"<br />
);<br />
ser = new ARC_ntriples_serializer($args);<br />

Serializing

$ntriples = $ser->get_ntriples($triples);
header("Content-Type: text/plain");
echo $ntriples;

Methods

get_ntriples($triples)
expects an array of triples for $triples and returns an N-Triples string. The triples array has to be structured like the one the ARC RDF/XML Parser produces.