class Turtle extends Serialiser

Class to serialise an EasyRdf\Graph to Turtle with no external dependencies.

http://www.w3.org/TR/turtle/

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 Turtle.

static string
escapeIri(string $resourceIri)

Given a IRI string, escape and enclose in angle brackets.

static string
quotedString(string $value)

Given a string, enclose in quotes and escape any quotes in the string.

string
serialiseResource(resource|string $resource, bool $createNamespace = false)

Given a an EasyRdf\Resource or URI, convert it into a string, suitable to be written to a Turtle document. URIs will be shortened into CURIES where possible.

string
serialiseLiteral(Literal $literal)

Given an EasyRdf\Literal object, convert it into a string, suitable to be written to a Turtle document. Supports multiline literals and literals with datatypes or languages.

string
serialiseObject(resource|Literal $object)

Convert an EasyRdf object into a string suitable to be written to a Turtle document.

serialiseCollection($node, $indent)

Protected method to serialise a RDF collection

serialiseProperties($res, $depth = 1)

Protected method to serialise the properties of a resource

serialisePrefixes()

No description

serialiseSubjects(Graph $graph, $filterType)

No description

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 366
string serialise(Graph $graph, Format|string $format, array $options = array())

Serialise an EasyRdf\Graph to Turtle.

Parameters

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

Return Value

string

Exceptions

Exception

at line 67
static string escapeIri(string $resourceIri)

Given a IRI string, escape and enclose in angle brackets.

Parameters

string $resourceIri

Return Value

string

at line 82
static string quotedString(string $value)

Given a string, enclose in quotes and escape any quotes in the string.

Strings containing tabs, linefeeds or carriage returns will be enclosed in three double quotes (""").

Parameters

string $value

Return Value

string

at line 113
string serialiseResource(resource|string $resource, bool $createNamespace = false)

Given a an EasyRdf\Resource or URI, convert it into a string, suitable to be written to a Turtle document. URIs will be shortened into CURIES where possible.

Parameters

resource|string $resource The resource to convert to a Turtle string
bool $createNamespace If true, a new namespace may be created

Return Value

string

at line 142
string serialiseLiteral(Literal $literal)

Given an EasyRdf\Literal object, convert it into a string, suitable to be written to a Turtle document. Supports multiline literals and literals with datatypes or languages.

Parameters

Literal $literal

Return Value

string

at line 176
string serialiseObject(resource|Literal $object)

Convert an EasyRdf object into a string suitable to be written to a Turtle document.

Parameters

resource|Literal $object

Return Value

string

Exceptions

InvalidArgumentException

at line 195
protected serialiseCollection($node, $indent)

Protected method to serialise a RDF collection

Parameters

$node
$indent

at line 231
protected serialiseProperties($res, $depth = 1)

Protected method to serialise the properties of a resource

Parameters

$res
$depth

at line 299
protected serialisePrefixes()

at line 312
protected serialiseSubjects(Graph $graph, $filterType)

Parameters

Graph $graph
$filterType