Will Hanley
Will Hanley

Reputation: 525

SPARQL filter results dates only

I'm trying to find all results that are dates, regardless of the properties they're describing. This FILTER query gives me the results I want:

PREFIX mydb: <http://mydb.org/schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT ?s ?p ?date 
WHERE { 
?s ?p ?date .
FILTER (?date > "1800-01-01"^^xsd:date)
} 

But it only works because I set a bottom limit earlier than my earliest date. Is there a way to use a boolean filter for the xsd:date datatype, similar to isURI()?

Upvotes: 1

Views: 190

Answers (1)

Will Hanley
Will Hanley

Reputation: 525

FILTER ( datatype(?date) = xsd:date ) is the filter I needed.

Thanks to Stanislav Kralin for his comment.

Upvotes: 1

Related Questions