You are here

public function EasyRdf_Graph::serialise in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php \EasyRdf_Graph::serialise()

Serialise the graph into RDF

The $format parameter can be an EasyRdf_Format object, a format name, a mime type or a file extension.

Example: $turtle = $graph->serialise('turtle');

Parameters

mixed $format The format to serialise to:

array $options Serialiser-specific options, for fine-tuning the output:

Return value

mixed The serialised graph

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php, line 1294

Class

EasyRdf_Graph
Container for collection of EasyRdf_Resources.

Code

public function serialise($format, array $options = array()) {
  if (!$format instanceof EasyRdf_Format) {
    $format = EasyRdf_Format::getFormat($format);
  }
  $serialiser = $format
    ->newSerialiser();
  return $serialiser
    ->serialise($this, $format
    ->getName(), $options);
}