EasyRdf API Documentation
Class

EasyRdf_Serialiser_GraphViz

class EasyRdf_Serialiser_GraphViz extends EasyRdf_Serialiser

Class to serialise an EasyRdf_Graph to GraphViz

Depends upon the GraphViz 'dot' command line tools to render images.

See http://www.graphviz.org/ for more information.

Methods

object __construct()

Constructor

string serialise(EasyRdf_Graph $graph, string $format, array $options = array())

Serialise an EasyRdf_Graph into a GraphViz dot document.

object setDotCommand(string $cmd)

Set the path to the GraphViz 'dot' command

string getDotCommand()

Get the path to the GraphViz 'dot' command

object setUseLabels(bool $useLabels)

Turn on/off the option to display labels instead of URIs.

bool getUseLabels()

Get the state of the use labels option

object setOnlyLabelled(bool $onlyLabelled)

Turn on/off the option to only display nodes and edges with labels

bool getOnlyLabelled()

Get the state of the only Only Labelled option

object setAttribute(string $name, string $value)

Set an attribute on the GraphViz graph

string getAttribute(string $name)

Get an attribute of the GraphViz graph

renderImage($graph, $format = 'png')

Internal function to render a graph into an image

Details

at line 61
public object __construct()

Constructor

Return Value

object EasyRdfSerialiserGraphViz

at line 375
public string serialise(EasyRdf_Graph $graph, string $format, array $options = array())

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.

Exceptions

EasyRdf_Exception

at line 73
public object setDotCommand(string $cmd)

Set the path to the GraphViz 'dot' command

Default is to search PATH for the command 'dot'.

Parameters

string $cmd The path to the 'dot' command.

Return Value

object EasyRdfSerialiserGraphViz

at line 86
public string getDotCommand()

Get the path to the GraphViz 'dot' command

The default value is simply 'dot'

Return Value

string The path to the 'dot' command.

at line 104
public object setUseLabels(bool $useLabels)

Turn on/off the option to display labels instead of URIs.

When this option is turned on, then labels for resources will be displayed instead of the full URI of a resource. This makes it simpler to create friendly diagrams that non-technical people can understand.

This option is turned off by default.

Parameters

bool $useLabels A boolean value to turn labels on and off

Return Value

object EasyRdfSerialiserGraphViz

at line 115
public bool getUseLabels()

Get the state of the use labels option

Return Value

bool The current state of the use labels option

at line 133
public object setOnlyLabelled(bool $onlyLabelled)

Turn on/off the option to only display nodes and edges with labels

When this option is turned on, then only nodes (resources and literals) and edges (properties) will only be displayed if they have a label. You can use this option, to create concise, diagrams of your data, rather than the RDF.

This option is turned off by default.

Parameters

bool $onlyLabelled A boolean value to enable/display only labelled items

Return Value

object EasyRdfSerialiserGraphViz

at line 144
public bool getOnlyLabelled()

Get the state of the only Only Labelled option

Return Value

bool The current state of the Only Labelled option

at line 162
public object setAttribute(string $name, string $value)

Set an attribute on the GraphViz graph

Example: $serialiser->setAttribute('rotate', 90);

See the GraphViz tool documentation for information about the available attributes.

Parameters

string $name The name of the attribute
string $value The value for the attribute

Return Value

object EasyRdfSerialiserGraphViz

at line 174
public string getAttribute(string $name)

Get an attribute of the GraphViz graph

Parameters

string $name Attribute name

Return Value

string The value of the graph attribute

at line 353
public renderImage($graph, $format = 'png')

Internal function to render a graph into an image

Parameters

$graph
$format