The Serializer class provides methods to convert a Model object to other forms, for example, write out a Model to a file.
Methods
Serializer-initialize
: 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
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="")