readRDF {Rredland}R Documentation

read an RDF document identified by URI (or deserialize a redland Berkeley DB representation) into a librdf model object

Description

read an RDF document identified by URI (or deserialize a redland Berkeley DB representation) into a librdf model object

Usage

readRDF(uri, storageType=c("internal", "bdb")[1], storageName="test", world=..GredlWorld, stoHash=NULL)
restoreBDB(storageName, world=..GredlWorld, stoHash="hash-type='bdb',dir='.'")

Arguments

uri a redlURI instance, or a string encoding a URI
storageType character string, with value "internal" or "bdb"
storageName basename of file to store the hashes, if storageType is "bdb"
world librdf world (redlWorld class instance)
stoHash a librdf hash specification of parameters to the new storage request; non-default values for advanced users only.

Author(s)

Vince Carey <stvjc@channing.harvard.edu>

Examples

# use character string URI 
ii = readRDF(paste("file:", system.file("RDF/gopart.rdf", package="Rredland"),
        sep=""))
ii
freeRedl(ii)
        # make a URI for a fragment from GO distributed with the package
example(makeRedlURI)
        # read from it with defaults
mm = readRDF(uu)
mm
        # excerpt after transformation to data.frame
as(mm, "data.frame")[1:3,]
        # now we will do some disk operations with BDB
curd = getwd()
tt = tempdir()
        # change dir
setwd(tt)
        # read contents of previous URI, but use external storage
hh = readRDF(uu, storageType="bdb", storageName="gopart")
        # see the created files; note that they are not
        # populated until the storage/model is freed
dir()
        # free the model, so the BDB hashes are populated
freeRedl(hh)
hh
        # now restore the hashes and create a redlModel
ff = restoreBDB("gopart")
ff
        # cleanup
unlink("gopart-so2p.db")
unlink("gopart-po2s.db")
unlink("gopart-sp2o.db")
setwd(curd)
cat(paste("to clean up completely, execute unlink(\"",
        tt,"\", recursive=TRUE) in R, if it looks safe to do so.\n", sep=""))

[Package Rredland version 1.8.0 Index]