Minimum/Maximum values

Dear all,

Another naive question from the peanut gallery about date arithmetic (or 
arithmetic in general)

Given a graph:

:bob a :Person;
     :byear "1962".
:carol a :Person;
     :byear "1963".
:ted a :Person;
     :byear "1964".
:alice a :Person;
     :byear "1965".

:Smiths a :Family;
     :children :bob, :carol, :ted, :alice.

How to find the minimum and maximum birthyears represented in family 
Smith? I've gotten this far:

SELECT ?date
WHERE{ ?family :children ?child .
     ?child :byear ?date .
         {?earlier :byear ?edate . FILTER (?edate < ?date)}
         {?later :byear ?ldate . FILTER (?ldate > ?date)}
     FILTER (!bound(?later))

But this binds both earliest and latest to ?date. To make the comparison 
in the filters I have to compare ?edate and ?ldate to a common variable 
?date, but what I'd like my query to return is the earliest date bound to 
?start and the latest bound to ?end.

Something obvious here that I'm missing. Suggestions?


Received on Friday, 27 February 2009 22:00:40 UTC