On Mon, Aug 19, 2013 at 2:32 PM, Darius Miliauskas
<[email protected]> wrote:
> yes, the file was not correctly formatted because I just write it by hand,
> not with any editor. Thanks, Joshua! Anyway, it was just an example. Maybe I
> did not formulate the question precisely. It is how to write a query which
> results connects two categories ("person" and "city" in the example) because
> these categories are connected through the third category ("gender" in the
> example)?
>
> The question is how to get answer like the below without directly connecting
> "person" and "city" in the query itself:
>
> | person     | city     |
> | Ivan     | London     |
>
> Between, I got errors while I was using VALUES in the query. Is there any
> recommendation how to use this keyword correctly (I guess it is wrong
> something with brackets or other syntax)?
>
> I used the following way:
>
> SELECT DISTINCT ?person ?city WHERE{ VALUES (?gender ?city) {base:Gender
> base:City} ?person a base:Person; owl:topObjectProperty ?gender. ?city a
> base:City; owl:topObjectProperty ?gender};

Milorad Tosic already replied with the correct version of that query,
but the general syntax is defined in the publicly available W3C SPARQL
recommendation, section 10.2 VALUES: Providing inline data [1].  //JT

[1] http://www.w3.org/TR/sparql11-query/#inline-data

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

Reply via email to