EasyRdf API Documentation
Class

EasyRdf_Serialiser_Turtle

class EasyRdf_Serialiser_Turtle extends EasyRdf_Serialiser

Class to serialise an EasyRdf_Graph to Turtle with no external dependancies.

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

Methods

__construct()

from EasyRdf_Serialiser
string serialise(EasyRdf_Graph $graph, 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(EasyRdf_Resource $resource, boolean $createNamespace = false)

Given a an EasyRdf_Resource or URI, convert it into a string, suitable to be written to a Turtle document.

string serialiseLiteral(EasyRdf_Literal $literal)

Given an EasyRdf_Literal object, convert it into a string, suitable to be written to a Turtle document.

string serialiseObject(EasyRdf_Resource|EasyRdf_Literal $object)

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

Details

in EasyRdf_Serialiser at line 49
public __construct()

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

Serialise an EasyRdf_Graph to Turtle.

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 58
static public string escapeIri(string $resourceIri)

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

Parameters

string $resourceIri

Return Value

string

at line 72
static public 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 92
public string serialiseResource(EasyRdf_Resource $resource, boolean $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

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

Return Value

string

at line 120
public string serialiseLiteral(EasyRdf_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

EasyRdf_Literal $literal

Return Value

string

at line 152
public string serialiseObject(EasyRdf_Resource|EasyRdf_Literal $object)

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

Parameters

EasyRdf_Resource|EasyRdf_Literal $object

Return Value

string