On Thu, Oct 31, 2013 at 10:26 AM, Maria Jackson
<[email protected]> wrote:
> Yes I am talking about the same. Is it possible to query over Jena such that
> there is a join between two named graphs. I know I can write using
> reification in SPARQL using:
>
>  select ?a?b?c?d?e
>  where{
>        ?r rdf:subject <Mr_X>.
>        ?r rdf:predicate <isPresident>.
>        ?r rdf:object <CountryZ>.
>        ?r saidBy ?a.
>        ?r saidOn ?b.
>        ?r saidAt ?c.
>        ?r confidence ?d.
>        ?r comment ?e
>   }
>
> But I am not sure as to how can I write this query using named graphs
> without knowing the names of the graphs. As i am converting from reification
> to named graphs automatically. So the user does not know the names of the
> graphs

If you use the approach I outlined in my first response, so that
you've got something like a graph named:

    <http://example.org/comment_by_tia>

with the triple

    <MrX> <isPresidentOf> <CountryZ>

and then having some triples around somewhere like

    <http://example.org/comment_by_tia> <saidBy> <Tia>
    <http://example.org/comment_by_tia> <saidOn> "2013-10-29"^^...
    <http://example.org/comment_by_tia> <saidAt> <NewYork>
    <http://example.org/comment_by_tia> <confidence> 0.9
    <http://example.org/comment_by_tia> <comment> "This is just a
comment by Tia"

you'd retrieve it with

select ?a ?b ?c ?d ?e ?f where {
  graph ?r {
    <Mr_X> <isPresidentOf> <CountryZ>
  }
  ?r <saidBy> ?a ;
     <saidOn> ?b ;
     <saidAt> ?c ;
     <confidence> ?d ;
     <comment> ?e .
}

//JT
-- 
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/

Reply via email to