You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Ján Mojžiš <ja...@gmail.com> on 2011/09/22 10:38:14 UTC

jena tdb question

Hello,
I work with jena tdb triple store and I would like to have following
question answered:

To create and fill jena tdb store I use commands:

TDBFactory tdb = new TDBFactory();
InputStream in = new FileInputStream(new File("dblp-2006-02-06.rdf"));

model = TDBFactory.createModel("data\\");//createModel();
model.read(in, null);
in.close();

jena's tdb then creates a data files under data\\ directory and fills them
with triples from my source file. It is processed without any error and
it is clear, that the database files are filled with something.

Now how to re-open the dataset on disk back, so I can use it again to query?
I suggest to use directory data\\ again, but there is no such argument in
functions TDBLoader.

Please, I look forward to hear anything from you.
Thanks.

Jan Mojzis, new-user of jena tdb

Re: jena tdb question

Posted by Andy Seaborne <an...@apache.org>.
On 22/09/11 09:38, Ján Mojžiš wrote:
> Hello,
> I work with jena tdb triple store and I would like to have following
> question answered:
>
> To create and fill jena tdb store I use commands:
>
> TDBFactory tdb = new TDBFactory();

Not needed : it's all a library of statics.

> InputStream in = new FileInputStream(new File("dblp-2006-02-06.rdf"));
>
> model = TDBFactory.createModel("data\\");//createModel();


> model.read(in, null);
> in.close();
>
> jena's tdb then creates a data files under data\\ directory and fills them
> with triples from my source file. It is processed without any error and
> it is clear, that the database files are filled with something.
>
> Now how to re-open the dataset on disk back, so I can use it again to query?
> I suggest to use directory data\\ again, but there is no such argument in
> functions TDBLoader.
>
> Please, I look forward to hear anything from you.
> Thanks.
>
> Jan Mojzis, new-user of jena tdb
>

"create" refers to the Java object, not the database itself.

Call

model = TDBFactory.createModel("data\\");

Think of it as "connect".

It does autocreate non-existent databases.

Unrelated: By the way, it is better to use

Dataset ds = TDBFactory.createDataset("data\\");
model = ds.getDefaultModel() ;

as you may later want to use the dataset.

	Andy