public function EasyRdf_Serialiser_Turtle::serialiseResource in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Turtle.php \EasyRdf_Serialiser_Turtle::serialiseResource()
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
4 calls to EasyRdf_Serialiser_Turtle::serialiseResource()
- EasyRdf_Serialiser_Turtle::serialiseLiteral in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Serialiser/ Turtle.php - 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.
- EasyRdf_Serialiser_Turtle::serialiseObject in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Serialiser/ Turtle.php - Convert an EasyRdf object into a string suitable to be written to a Turtle document.
- EasyRdf_Serialiser_Turtle::serialiseProperties in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Serialiser/ Turtle.php - Protected method to serialise the properties of a resource @ignore
- EasyRdf_Serialiser_Turtle::serialiseSubjects in vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Serialiser/ Turtle.php - @ignore
File
- vendor/
easyrdf/ easyrdf/ lib/ EasyRdf/ Serialiser/ Turtle.php, line 92
Class
- EasyRdf_Serialiser_Turtle
- Class to serialise an EasyRdf_Graph to Turtle with no external dependancies.
Code
public function serialiseResource($resource, $createNamespace = false) {
if (is_object($resource)) {
if ($resource
->isBNode()) {
return $resource
->getUri();
}
$resource = $resource
->getUri();
}
$short = EasyRdf_Namespace::shorten($resource, $createNamespace);
if ($short) {
$this
->addPrefix($short);
return $short;
}
return self::escapeIri($resource);
}