Class to serialise an EasyRdf_Graph to RDF/JSON with no external dependancies.
@package EasyRdf @copyright Copyright (c) 2009-2010 Nicholas J Humfrey @license http://www.opensource.org/licenses/bsd-license.php
Expanded class hierarchy of EasyRdf_Serialiser_Json
class EasyRdf_Serialiser_Json extends EasyRdf_Serialiser_RdfPhp {
/**
* Method to serialise an EasyRdf_Graph to RDF/JSON
*
* http://n2.talis.com/wiki/RDF_JSON_Specification
*
* @param object EasyRdf_Graph $graph An EasyRdf_Graph object.
* @param string $format The name of the format to convert to.
* @return string The RDF in the new desired format.
*/
public function serialise($graph, $format) {
parent::checkSerialiseParams($graph, $format);
if ($format != 'json') {
throw new EasyRdf_Exception("EasyRdf_Serialiser_Json does not support: {$format}");
}
return json_encode(parent::serialise($graph, 'php'));
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EasyRdf_Serialiser:: |
protected | property | ||
EasyRdf_Serialiser:: |
protected | function | Keep track of the prefixes used while serialising @ignore | |
EasyRdf_Serialiser:: |
protected | function | Check and cleanup parameters passed to serialise() method @ignore | |
EasyRdf_Serialiser:: |
protected | function | Protected method to get the number of reverse properties for a resource If a resource only has a single property, the number of values for that property is returned instead. @ignore | |
EasyRdf_Serialiser_Json:: |
public | function |
Method to serialise an EasyRdf_Graph to RDF/JSON Overrides EasyRdf_Serialiser_RdfPhp:: |