Apologies if this has been asked before but it seems an obvious question for which I can’t seem to get a working solution. I’ve loaded some data into Fuseki which contains statements comprising xsd:date information. I have written a query to extract these dates and I would like to find the duration (in days) between two specific date. A cut down query is shown below.
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX abc: <http://www.acme.com/ABC/1.0/abc-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?entry
(date1 - date2) AS ?interval)
WHERE
{
# Not the real query but you get the idea
?entry a abc:thing ;
abc:abcDateType1 ?date1 ;
abc:abcDateType2 ?date2 .
}
?interval is calculated correctly and seems to be in the form of an xsd:duration data type, my question is how do I extract the number of days it contains? Alternatively is there a better (standard) way of doing this.
Thank you for reading.
You will need to work with the lexical for of the XSD duration. It is likely to be for the form “PD….”
The answer should be call fn:days-from-duration, or a keyword for that function, but that isn’t in the standard distribution at the moment.