1

I want to build a queryable RDF database of events of the form:

:Bob :played :musiccd :at "00:00:00 UTC on 1 January 1970"

Is this possible with RDF/N3/3store/SPARQL?

Does SPARQL know how to compare datetimes and test for membership in datetime ranges? If not, how easy is it to extend SPARQL to do so for a given datetime format?

mcandre
  • 22,868
  • 20
  • 88
  • 147

2 Answers2

3

SPARQL supports the xsd:dateTime natively, many stores will also handles xsd:date and xsd:time as well

If you use a SPARQL 1.1 compliant engine then there are also a bunch of new functions that will let you extract specific sections of dates and times.

Therefore you should be able to write SPARQL queries appropriate to your data

For help with modeling time in RDF and how that affects the formulation of your SPARQL queries see Ian Davis's blog post series on the topic

RobV
  • 28,022
  • 11
  • 77
  • 119
  • Thanks for the link, it shows how to use temporal RDF intervals. How would you represent instantaneous events (not `start`/`end` but `at`)? And how would you do so in N3? Basically, could you rewrite my example in the original post as valid, idiomatic N3? – mcandre Feb 29 '12 at 21:29
2

(Since I cannot comment right now. I'll post this as reply.)

@mcandre: please have a look at the Play Back Ontology and the Counter Ontology for modelling your intended use case

zazi
  • 686
  • 1
  • 7
  • 19
  • 1
    These resources are helpful, but I feel overwhelmed by the amount of content to read. Could you provide example N3 describing an event in which Bob plays a music CD at 9am? – mcandre Mar 01 '12 at 21:24
  • @mcandre you may have a look at the [Play Back and Skip Counter Example](http://purl.org/ontology/pbo/playbackontology.html#sec-play-back-and-skip-counter-example), the [Extended Skip Counter Example](http://purl.org/ontology/pbo/playbackontology.html#sec-extended-skip-counter-example), or the plain play back counter example in the [Examples section](http://purl.org/ontology/co/counterontology.html#sec-example) of the Counter Ontology. PS: don't hesitate to ask further questions about these topic and ontologies, since I'm a co-author of both ;) – zazi Mar 02 '12 at 19:16