class Rapper extends Ntriples

Class to serialise an EasyRdf\Graph to RDF using the 'rapper' command line tool.

Note: the built-in N-Triples serialiser is used to pass data to Rapper.

Properties

protected $prefixes from Serialiser

Methods

addPrefix($qname)

Keep track of the prefixes used while serialising

checkSerialiseParams($format)

Check and cleanup parameters passed to serialise() method

reversePropertyCount($resource)

Protected method to get the number of reverse properties for a resource If a resource only has a single property, the number of values for that property is returned instead.

string
serialise(Graph $graph, Format|string $format, array $options = array())

Serialise an EasyRdf\Graph to the RDF format of choice.

escapeString($str)

No description

from Ntriples
unicodeCharNo($cUtf)

No description

from Ntriples
escapedChar($c)

No description

from Ntriples
serialiseResource($res)

No description

from Ntriples
string
serialiseValue(array|object $value)

Serialise an RDF value into N-Triples

from Ntriples
__construct(string $rapperCmd = 'rapper')

Constructor

Details

in Serialiser at line 54
protected addPrefix($qname)

Keep track of the prefixes used while serialising

Parameters

$qname

in Serialiser at line 64
protected checkSerialiseParams($format)

Check and cleanup parameters passed to serialise() method

Parameters

$format

in Serialiser at line 85
protected reversePropertyCount($resource)

Protected method to get the number of reverse properties for a resource If a resource only has a single property, the number of values for that property is returned instead.

Parameters

$resource

at line 86
string serialise(Graph $graph, Format|string $format, array $options = array())

Serialise an EasyRdf\Graph to the RDF format of choice.

Parameters

Graph $graph An EasyRdf\Graph object.
Format|string $format The name of the format to convert to.
array $options

Return Value

string The RDF in the new desired format.

Exceptions

Exception

in Ntriples at line 57
protected escapeString($str)

Parameters

$str

in Ntriples at line 78
protected unicodeCharNo($cUtf)

Parameters

$cUtf

in Ntriples at line 108
protected escapedChar($c)

Parameters

$c

in Ntriples at line 147
protected serialiseResource($res)

Parameters

$res

in Ntriples at line 169
string serialiseValue(array|object $value)

Serialise an RDF value into N-Triples

The value can either be an array in RDF/PHP form, or an EasyRdf\Literal or EasyRdf\Resource object.

Parameters

array|object $value An associative array or an object

Return Value

string The RDF value serialised to N-Triples

Exceptions

Exception

at line 63
__construct(string $rapperCmd = 'rapper')

Constructor

Parameters

string $rapperCmd Optional path to the rapper command to use.

Exceptions

Exception