Reputation: 55
So I am able to use this query:
SELECT ?year
WHERE {
?timeInt :hasStartTime ?StartT .
BIND(year(?StartT) AS ?year)
}
to get an output of 2022. This is my RDF data (in turtle language):
:Interval1 :hasStartTime "2022-03-11"^^xsd:date .
but when I use this:
:Interval1 :hasStopTime "2022-03-11T21:01:23Z"^^xsd:dateTimeStamp .
I cannot get my query to output anything. So does this mean that the way BIND works for xsd:date is not the same for xsd:datetimestamp or am I missing something? Are there other options to be able to use the BIND to select for more specific times in xsd:datetimestamp and not just year? Thank you.
Upvotes: 0
Views: 191
Reputation: 16630
It will depend on whether engine supports that datatype. Some do, some don't. It is not required by the SPARQL spec. xsd:dateTime is required.
If necessary you can cast. The most portable way is to write
strdt(str("2022-03-11T21:01:23Z"^^xsd:dateTimeStamp), xsd:dateTime)
which does not rely on anything more than the basic spec.
Upvotes: 2