Learn R Programming

redland (version 1.0.17-6)

Serializer-class: An RDF Serializer object.

Description

The Serializer class provides methods to convert a Model object to other forms, for example, write out a Model to a file.

Arguments

Methods

{: Initialize a Serializer object.} setNameSpace{: Set a namespace for the serializer.} serializeToCharacter{: Serialize a model to a character vector.} serializeToFile{: Serialize a model to a file.} freeSerializer{: Free memory used by a librdf serializer.}

See Also

redland{: redland package}

Examples

Run this code
world <- new("World")
storage <- new("Storage", world, "hashes", name="", options="hash-type='memory'")
model <- new("Model", world, storage, options="")
filePath <- system.file("extdata/example.rdf", package="redland")
parser <- new("Parser", world)
parseFileIntoModel(parser, world, filePath, model)
# Creat the default "rdfxml" serizlizer
serializer <- new("Serializer", world)
# Add a namespace definition to the serializer
status <- setNameSpace(serializer, world, namespace="http://purl.org/dc/elements/1.1/", prefix="dc")
rdf <- serializeToCharacter(serializer, world, model, baseUri="")

Run the code above in your browser using DataLab