On Thu, Oct 31, 2013 at 11:17 AM, Maria Jackson
<[email protected]> 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

There's a query validator at sparql.org that's based on Jena [1].  If
you copy your query into it, it says there's a syntax error at "Tia",
which makes sense, because it's not a prefixed name or an absolute
IRI. (This is why I've been wrapping everything in angle brackets.)
We can clean it up a a bit and get the following valid (and slightly
better formatted) query:

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>.
}


//JT

[1] http://sparql.org/query-validator.html
-- 
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/

Reply via email to