W3C home > Mailing lists > Public > public-sparql-dev@w3.org > October to December 2015

quick sanity check question on sub-query, service and variable scoping

From: Gary King <gwking@metabang.com>
Date: Mon, 19 Oct 2015 13:54:24 -0400
Message-Id: <1E0B82D6-D778-4F2C-9196-04B17EA14AAE@metabang.com>
To: public-sparql-dev@w3.org
Here is a contrived example trying to find when some person has a startTime after other people (I did say it was contrived :-)). First with sub-query and then with SERVICE:

select distinct * {
  ?person a ex:Person .
  ?person ex:startTime ?time1 .

  { select ?otherPerson {
    ?otherPerson a ex:Person .
    ?otherPerson ex:startTime ?time2 .
    FILTER (?time2 > ?time1)
  } }
}

select distinct * {
  ?person a ex:Person .
  ?person ex:startTime ?time1 .

  service <http://example.com/foo> {
    ?otherPerson a ex:Person .
    ?otherPerson ex:startTime ?time2 .
    FILTER (?time2 > ?time1)
  }
}

My belief is that both of these will correctly return no results because `?time1` is not bound in either the sub-query or the service call and so the filter will uniformly fail. 

Correct?

thanks,

--
Gary Warren King, metabang.com 
Cell: (413) 559 8738
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM * gwking on twitter
Received on Monday, 19 October 2015 17:54:56 UTC

This archive was generated by hypermail 2.3.1 : Monday, 19 October 2015 17:54:56 UTC