Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to model opening hours in RDF

What is the most pragmatic way to model opening hours of a service, so that SPARQL queries would be able to query things that are open at a certain timestamp/during a certain time interval?

Answers to this question should contain:

  1. example of an ontology
  2. data sample which uses this ontology
  3. a SPARQL query* which returns everything from this sample that is open at a certain timestamp

( * extra points for simplicity and performance)

like image 386
pietercolpaert Avatar asked Oct 03 '13 08:10

pietercolpaert


People also ask

How data is represented in RDF?

RDF is a directed graph composed of triple statements. An RDF graph statement is represented by: 1) a node for the subject, 2) an arc that goes from a subject to an object for the predicate and 3) a node for the object. Each of the three parts of the statement can be identified by a URI.

What is Sparql used for?

SPARQL can be used to express queries across diverse data sources, whether the data is stored natively as RDF or viewed as RDF via middleware. SPARQL contains capabilities for querying required and optional graph patterns along with their conjunctions and disjunctions.

How is RDF data stored?

RDFStore implements a generic hashed data storage that allows to serialise RDF models, resources, properties and property values either to disk or in-memory data structures. It does support several different persistent storage models such as SDBM, BerkeleyDB (standard and Sleepycat) and DBMS.

Is RDF a database?

The RDF triplestore is a type of graph database that stores semantic facts. RDF, which stands for Resource Description Framework, is a model for data publishing and interchange on the Web standardized by W3C. Being a graph database, triplestores store data as a network of objects with materialized links between them.


2 Answers

I suggest that you look at schema.org. It provides a model for opening hours: http://schema.org/OpeningHoursSpecification. You can see an example applied to businesses: http://schema.org/LocalBusiness

You can build your RDF graph accordingly, and it should be straightforward to query later on. Plus, in case you generate web pages from it, major search engines will be able to exploit better your information and use it their own way.

like image 152
loopasam Avatar answered Oct 04 '22 19:10

loopasam


There are various ways to describe calendars online. Amongst others, iCal (or the rdf-ized RDFCal), http://schema.org/OpeningHoursSpecification or the Time ontology (for e.g., describing the time interval of an event).

Opening Hours can be seen as a combination of calendars. Using an rdf:list we can stack calendars and indicate whether each of these calendars indicate closing hours or opening hours. For example, for a simple business I would add 2 calendars: * Opening Hours: open from 9 to 5 from Monday to Sunday * Closing Hours: official holidays

I've published a paper about this and I've created a concise ontology to create opening hours at http://openinghours.io.

like image 31
pietercolpaert Avatar answered Oct 04 '22 20:10

pietercolpaert