Try the online query validator:

http://www.sparql.org/query-validator.html

        Andy

On 31/10/13 15:17, Maria Jackson wrote:
select ?x ?a ?b ?c ?d ?e ?f where {
   graph ?r {
     ?x ?y <CountryZ>
   }
  graph ?r1{
     ?x ?y <CountryZ1>
}
   ?r <saidBy> Tia ;

      <saidOn> ?b ;
      <saidAt> ?c ;
      <confidence> ?d ;
      <comment> ?e .
?r1 <saidBy> Astrid.
}
Is the above query to retrieve a person who is linked to two different
countries correct?

I am just curious as to whether it is syntactically accepted by Jena


On Thu, Oct 31, 2013 at 8:45 PM, Joshua TAYLOR <[email protected]>wrote:

On Thu, Oct 31, 2013 at 10:47 AM, Eric Scott <[email protected]> wrote:
You could try something like this:

  select ?a?b?c?d?e
  where
{
        ?g a :MyKindaGraph.
        graph ?g

        {
          ?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
        }
}

I think, though I could be wrong, that the point wasn't just to put
the triples _into_ a named graph, but to use a named graph to serve
_as_ the reified triple (or triples).  E.g.,

graph ?g { <Mr_X> <isPresident> <CountryZ> }
?g saidBy ?a ; ... ; comment ?e .

This avoids needing three triples for each reified statement, and
makes the queries easier to write. It also makes it easier to provide
meta information about a collection of triples, rather than just a
single reified triple.

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



Reply via email to