You are here

public function EasyRdf_Serialiser_GraphViz::serialise in Zircon Profile 8

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

Serialise an EasyRdf_Graph into a GraphViz dot document.

Supported output format names: dot, gif, png, svg

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

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/GraphViz.php, line 375

Class

EasyRdf_Serialiser_GraphViz
Class to serialise an EasyRdf_Graph to GraphViz

Code

public function serialise($graph, $format, array $options = array()) {
  parent::checkSerialiseParams($graph, $format);
  switch ($format) {
    case 'dot':
      return $this
        ->serialiseDot($graph);
    case 'png':
    case 'gif':
    case 'svg':
      return $this
        ->renderImage($graph, $format);
    default:
      throw new EasyRdf_Exception("EasyRdf_Serialiser_GraphViz does not support: {$format}");
  }
}