You are here

public function EasyRdf_Serialiser_RdfPhp::serialise in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/RdfPhp.php \EasyRdf_Serialiser_RdfPhp::serialise()

Method to serialise an EasyRdf_Graph to RDF/PHP

http://n2.talis.com/wiki/RDF_PHP_Specification docs/appendix-a-rdf-formats-php.md

Parameters

EasyRdf_Graph $graph An EasyRdf_Graph object.:

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

array $options:

Return value

string The RDF in the new desired format.

Throws

EasyRdf_Exception

Overrides EasyRdf_Serialiser::serialise

2 calls to EasyRdf_Serialiser_RdfPhp::serialise()
EasyRdf_Serialiser_Arc::serialise in vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Arc.php
Serialise an EasyRdf_Graph into RDF format of choice.
EasyRdf_Serialiser_Json::serialise in vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Json.php
Method to serialise an EasyRdf_Graph to RDF/JSON
2 methods override EasyRdf_Serialiser_RdfPhp::serialise()
EasyRdf_Serialiser_Arc::serialise in vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Arc.php
Serialise an EasyRdf_Graph into RDF format of choice.
EasyRdf_Serialiser_Json::serialise in vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Json.php
Method to serialise an EasyRdf_Graph to RDF/JSON

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/RdfPhp.php, line 60

Class

EasyRdf_Serialiser_RdfPhp
Class to serialise an EasyRdf_Graph to RDF/PHP with no external dependancies.

Code

public function serialise($graph, $format, array $options = array()) {
  parent::checkSerialiseParams($graph, $format);
  if ($format != 'php') {
    throw new EasyRdf_Exception("EasyRdf_Serialiser_RdfPhp does not support: {$format}");
  }

  // Graph is already stored as RDF/PHP resource-centric array internally within the EasyRdf_Graph object
  return $graph
    ->toRdfPhp();
}