ARC supports 4 serialization formats:
The serializers can process both index and triple structures. Some examples:
Each ARC component provides shortcuts to the serializers. These convenience methods auto-detect the passed structure (resource index or triple set):
- RDF/XML
- RDF/JSON (following the Talis proposal)
- Turtle
- N-Triples
/* ARC2 static class inclusion */
include_once('path/to/arc/ARC2.php');
/* Serializer instantiation */
$ser = ARC2::getTurtleSerializer();
/* Serialize a triples array */
$doc = $ser->getSerializedTriples($triples);
/* Serialize a resource index */
$doc = $ser->getSerializedIndex($index);/* custom namespace prefixes */
$ns = array(
'foaf' => 'http://xmlns.com/foaf/0.1/',
'dc' => 'http://purl.org/dc/elements/1.1/'
);
$conf = array('ns' => $ns);
$ser = ARC2::getRDFXMLSerializer($conf);
$doc = $ser->getSerializedIndex($index);$doc = $parser->toRDFJSON($index);
$doc = $store->toNTriples($triples);
