Hi Ewa,

On 06/12/13 16:03, Ewa Szwed wrote:
> Got it!
> Done:
>
> *    BIND(str(floor(fn:days-from-duration(?date_of_death - ?date_of_birth)
> / 365)) as ?age_at_death)*

Careful; that'll only get you the days component¹. Even if it did what
you were hoping for, you'll end up with off-by-one errors if they die
close to their birthday due to the cumulative effects of leap years.

You probably want:

BIND(fn:years-from-duration(?date_of_death - ?date_of_birth) AS
?age_at_death)

Best regards,

Alex

¹ <http://www.w3.org/TR/xpath-functions/#func-days-from-duration>

-- 
Alexander Dutton
Linked Open Data Architect, Office of the CIO; data.ox.ac.uk, OxPoints
IT Services, University of Oxford


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to