You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Cindy A McMullen <ci...@oracle.com> on 2013/06/10 22:52:10 UTC

Query the union of named graphs

I'm using the in-memory Jena implementation (not TDB).  How do I query across the union of named graphs?

Re: Query the union of named graphs

Posted by Andy Seaborne <an...@apache.org>.
On 11/06/13 16:06, Andy Seaborne wrote:
> On 10/06/13 21:52, Cindy A McMullen wrote:
>> I'm using the in-memory Jena implementation (not TDB).  How do I
>> query across the union of named graphs?
>
> Union of named graphs is really a feature of the storage and not as
> uniformly treated as I would like.
>
> For an in-memory dataset, this works:
>
>      Graph g = GraphView.createNamedGraph(dsg, Quad.unionGraph) ;
>      Model m = ModelFactory.createModelForGraph(g) ;

If you are using a DatasetGraph.createMem, this works:

     Dataset ds = DatasetFactory.createMem() ;
     Graph g = GraphView.createNamedGraph(dsg, Quad.unionGraph) ;
     Model m = ModelFactory.createModelForGraph(g) ;
     ds.setDefaultModel(m) ;

although you don't have the original default model around anymore.

>
> (latest version)
>
> It'll work on on any dataset, maybe not optimally though (but not bad
> either).
>
>      Andy


Re: Query the union of named graphs

Posted by Andy Seaborne <an...@apache.org>.
On 10/06/13 21:52, Cindy A McMullen wrote:
> I'm using the in-memory Jena implementation (not TDB).  How do I
> query across the union of named graphs?

Union of named graphs is really a feature of the storage and not as 
uniformly treated as I would like.

For an in-memory dataset, this works:

     Graph g = GraphView.createNamedGraph(dsg, Quad.unionGraph) ;
     Model m = ModelFactory.createModelForGraph(g) ;

(latest version)

It'll work on on any dataset, maybe not optimally though (but not bad 
either).

	Andy