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/11 17:39:09 UTC

Combining default graph with named graphs

I have a graph that is referenced 'Event1' in my default graph, with object properties "w:userFollowed" and "w:occurred".    This query works:

"SELECT DISTINCT ?graph ?time WHERE { ?graph w:action w:userFollowed; w:occurred ?time }"

This query works as well (which is in the named graph, Event1):

 "SELECT DISTINCT ?g ?follower ?followee WHERE { GRAPH ?g { ?follower w:follows ?followee }}"

That finds the Event1 graph (and all the rest of the graphs fitting that pattern).  

Now I want to query that specific named graph (Event1), and have tried this:


"SELECT DISTINCT ?graph ?follower ?followee ?time" +
                " WHERE " +
                "{ " +
                    "{?graph w:action w:userFollowed; w:occurred ?time }" +
                "    { GRAPH ?graph { ?follower w:follows ?followee }}"   +
                "}"

But that returns no results.

What am I doing wrong?  I'm using in-memory Jena.

Re: Combining default graph with named graphs

Posted by Cindy A McMullen <ci...@oracle.com>.
Disregard -- this was a test data issue, not a SPARQL query issue.

On Jun 11, 2013, at 9:39 AM, Cindy A McMullen wrote:

> I have a graph that is referenced 'Event1' in my default graph, with object properties "w:userFollowed" and "w:occurred".    This query works:
> 
> "SELECT DISTINCT ?graph ?time WHERE { ?graph w:action w:userFollowed; w:occurred ?time }"
> 
> This query works as well (which is in the named graph, Event1):
> 
> "SELECT DISTINCT ?g ?follower ?followee WHERE { GRAPH ?g { ?follower w:follows ?followee }}"
> 
> That finds the Event1 graph (and all the rest of the graphs fitting that pattern).  
> 
> Now I want to query that specific named graph (Event1), and have tried this:
> 
> 
> "SELECT DISTINCT ?graph ?follower ?followee ?time" +
>                " WHERE " +
>                "{ " +
>                    "{?graph w:action w:userFollowed; w:occurred ?time }" +
>                "    { GRAPH ?graph { ?follower w:follows ?followee }}"   +
>                "}"
> 
> But that returns no results.
> 
> What am I doing wrong?  I'm using in-memory Jena.