You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Guido Zuccarelli <gu...@hotmail.com> on 2014/07/08 17:30:38 UTC

Can't use a database loaded by tdbloader2

I loaded a tdb with 2 ttl files for testing. It worked well:
INFO  Total: 30 tuples : 0.20 seconds : 146.34 tuples/sec [2014/07/08 12:16:28 ART]
 12:16:28 Index phase
 12:16:28 Index SPO
 12:16:28 Build SPO
 12:16:28 Index POS
 12:16:28 Build POS
 12:16:29 Index OSP
 12:16:29 Build OSP
 12:16:30 Index phase end
 12:16:30 -- TDB Bulk Loader Finish
 12:16:30 -- 4 seconds

Then I checked it on jena:

TDB.getContext().set(TDB.symUnionDefaultGraph, true);
String directory = "database";
Dataset dataset = TDBFactory.createDataset(directory);
Iterator<String> names = dataset.listNames();
while (names.hasNext())
     System.out.println(names.next());

I got 0 names.
I also tried with get all triples with SPARQL, with 0 results.
Am i doing something wrong?

Best regards,
Guido Zuccarelli.
 		 	   		  

Re: Can't use a database loaded by tdbloader2

Posted by Dave Reynolds <da...@gmail.com>.
On 08/07/14 16:30, Guido Zuccarelli wrote:
> I loaded a tdb with 2 ttl files for testing. It worked well:
> INFO  Total: 30 tuples : 0.20 seconds : 146.34 tuples/sec [2014/07/08 12:16:28 ART]
>   12:16:28 Index phase
>   12:16:28 Index SPO
>   12:16:28 Build SPO
>   12:16:28 Index POS
>   12:16:28 Build POS
>   12:16:29 Index OSP
>   12:16:29 Build OSP
>   12:16:30 Index phase end
>   12:16:30 -- TDB Bulk Loader Finish
>   12:16:30 -- 4 seconds
>
> Then I checked it on jena:
>
> TDB.getContext().set(TDB.symUnionDefaultGraph, true);
> String directory = "database";
> Dataset dataset = TDBFactory.createDataset(directory);
> Iterator<String> names = dataset.listNames();
> while (names.hasNext())
>       System.out.println(names.next());
>
> I got 0 names.
> I also tried with get all triples with SPARQL, with 0 results.
> Am i doing something wrong?

You have created a triple store rather than a quad store, and have 
loaded both files into a single default graph. So there are no named 
graphs in the dataset to list and by setting unionDefault you have 
replaced the default graph you loaded by the union of the empty set of 
named graphs.

Either use the default graph you loaded (don't set symUnionDefaultGraph) 
or load the different files into different graphs - depending on what 
you are trying to do.

Dave


RE: Can't use a database loaded by tdbloader2

Posted by Guido Zuccarelli <gu...@hotmail.com>.
Thank you!

> Date: Tue, 8 Jul 2014 17:06:40 +0100
> Subject: Re: Can't use a database loaded by tdbloader2
> From: rvesse@dotnetrdf.org
> To: users@jena.apache.org
> 
> listNames() refers to named graphs
> 
> If as in your example you have only loaded Turtle files then you won't
> have any named graphs (since Turtle only encodes triples) therefore all
> your data is in the unnamed default graph
> 
> If you want to put each Turtle file into its own named graph then you need
> to first convert your data into a format that supports named graphs e.g.
> NQuads/TriG
> 
> Rob
> 
> On 08/07/2014 16:30, "Guido Zuccarelli" <gu...@hotmail.com>
> wrote:
> 
> >I loaded a tdb with 2 ttl files for testing. It worked well:
> >INFO  Total: 30 tuples : 0.20 seconds : 146.34 tuples/sec [2014/07/08
> >12:16:28 ART]
> > 12:16:28 Index phase
> > 12:16:28 Index SPO
> > 12:16:28 Build SPO
> > 12:16:28 Index POS
> > 12:16:28 Build POS
> > 12:16:29 Index OSP
> > 12:16:29 Build OSP
> > 12:16:30 Index phase end
> > 12:16:30 -- TDB Bulk Loader Finish
> > 12:16:30 -- 4 seconds
> >
> >Then I checked it on jena:
> >
> >TDB.getContext().set(TDB.symUnionDefaultGraph, true);
> >String directory = "database";
> >Dataset dataset = TDBFactory.createDataset(directory);
> >Iterator<String> names = dataset.listNames();
> >while (names.hasNext())
> >     System.out.println(names.next());
> >
> >I got 0 names.
> >I also tried with get all triples with SPARQL, with 0 results.
> >Am i doing something wrong?
> >
> >Best regards,
> >Guido Zuccarelli.
> > 		 	   		  
> 
> 
> 
> 
 		 	   		  

Re: Can't use a database loaded by tdbloader2

Posted by Rob Vesse <rv...@dotnetrdf.org>.
listNames() refers to named graphs

If as in your example you have only loaded Turtle files then you won't
have any named graphs (since Turtle only encodes triples) therefore all
your data is in the unnamed default graph

If you want to put each Turtle file into its own named graph then you need
to first convert your data into a format that supports named graphs e.g.
NQuads/TriG

Rob

On 08/07/2014 16:30, "Guido Zuccarelli" <gu...@hotmail.com>
wrote:

>I loaded a tdb with 2 ttl files for testing. It worked well:
>INFO  Total: 30 tuples : 0.20 seconds : 146.34 tuples/sec [2014/07/08
>12:16:28 ART]
> 12:16:28 Index phase
> 12:16:28 Index SPO
> 12:16:28 Build SPO
> 12:16:28 Index POS
> 12:16:28 Build POS
> 12:16:29 Index OSP
> 12:16:29 Build OSP
> 12:16:30 Index phase end
> 12:16:30 -- TDB Bulk Loader Finish
> 12:16:30 -- 4 seconds
>
>Then I checked it on jena:
>
>TDB.getContext().set(TDB.symUnionDefaultGraph, true);
>String directory = "database";
>Dataset dataset = TDBFactory.createDataset(directory);
>Iterator<String> names = dataset.listNames();
>while (names.hasNext())
>     System.out.println(names.next());
>
>I got 0 names.
>I also tried with get all triples with SPARQL, with 0 results.
>Am i doing something wrong?
>
>Best regards,
>Guido Zuccarelli.
>