public function EasyRdf_Serialiser_Json::serialise

Method to serialise an EasyRdf_Graph to RDF/JSON

http://n2.talis.com/wiki/RDF_JSON_Specification

Parameters

object EasyRdf_Graph $graph An EasyRdf_Graph object.:

string $format The name of the format to convert to.:

Return value

string The RDF in the new desired format.

Overrides EasyRdf_Serialiser_RdfPhp::serialise

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Json.php, line 58

Class

EasyRdf_Serialiser_Json
Class to serialise an EasyRdf_Graph to RDF/JSON with no external dependancies.

Code

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'));
}