jena-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Seaborne <andy.seabo...@epimorphics.com>
Subject TDB
Date Fri, 10 Dec 2010 14:37:30 GMT


On 10/12/10 13:02, Benson Margulies wrote:
> On to TDB.
>
> How are named graphs mapped into the Jena API?
>
> Does creating a named Ontology model (OntModel m =
> ModelFactory.createOntologyModel(spec, maker, baseModel);) do the job?
>
> THis page (http://openjena.org/wiki/TDB/Datasets) comes close but does
> quite answer the question.

In TDB, you don't need to create a graph as such - you just need to get 
a handle to a model:

  Model m = dataset.getNamedModel("http://example/graph157") ;

You can wrap that in an OntModel

  OntModel ontModel = ModelFactory.createOntologyModel(spec, base) ;

If you update with SPARQL Update, you can just

INSERT DATA { GRAPH <http://example/graph157> { ...triples... } }

	Andy

Mime
View raw message