OpeningHoursUseCase

From W3C Wiki
Revision as of 10:53, 11 August 2012 by Zruset (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

We should be able to use the (Semantic) Web to find out when businesses are open for business.

This is part of a bigger picture: we probably also want to know about their Web site(s), product lines, physical locations, contact details etc. Using RDF, we can tackle the problem in separate chunks, which loosly correspond to RDF vocabularies or 'ontologies'.

Our scenario here is a desire to represent information about local businesses, in particular their opening hours. To illustrate the broader potential we can add in a bit more information, perhaps geo markup for location, or a photo of their physical premises.

This writeup began life as a thread in the RdfCalendar discussions, and has been migrated to the Wiki for collaborative development.

Related: RdfCalendar RestaurantRecommendation EventDiscovery SKICal project 79 Use Cases for Godseye

Scenario

Restaurant opening hours.

This particular example stems from buying food from Urban Gourmet, via from a restaurant info aggregator in Somerville, MA, USA. This site lists the menus and other info for local restaurants. The menus are currently images of paper menus, so there is scope for progress there. See also chefmoz for more RDF/food work.

The bit of the restaurant listing that relates to RdfCalendar concerns is where it says, "Currently [OPEN]", based on info about opening hours. Their summary for the 'Urban Gourmet' restaurant is:

Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday

So longwinded question unpacked: how do we express this in RDF? Can we use recurrence rules expressed over ical in RDF as the basis? Is extra vocabulary needed?

Previous discussion (work to date):

So, we have an RDF/XML representation of some opening hours.

What does this gain us beyond the syntax we already have from iCalendar? It must do more than use up some extra bandwidth... ;)

  • the RDF/XML syntax allows us to use off the shelf parsers (many RDF and XML free tools)
  • the use of XML namespaces gives us a syntax writing down a mix of calendar and other kinds of information
  • RDF's graph data model provides principles for mixing data together
  • We get to re-use existing RDF vocabularies, instead of inventing our own
  • We get to merge this data with other information expressed in RDF

How does that look in practice?

Opening Hours in RDF/XML

Here is the bare 'opening hours' data, translated into RDF with no additions.


<rdf:RDF
  xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
  xmlns='http://www.w3.org/2002/12/cal/ical#'
  xmlns:i='http://www.w3.org/2002/12/cal/ical#'
  xmlns:x='http://www.w3.org/2002/12/cal/prod_apple#'
>  <Vcalendar>
    <component>
    <Vevent>
      <dtstart rdf:parseType='Resource'>
        <dateTime>2003-01-01T16:00:00</dateTime>
      </dtstart>
      <dtend rdf:parseType='Resource'>
        <dateTime>2003-01-01T23:00:00</dateTime>

      </dtend>
      <rrule rdf:parseType='Resource'>
      <byday>TU</byday>
      <freq>WEEKLY</freq>
      <interval>1</interval>
      </rrule>
    </Vevent>

    </component>
    <component>
    <Vevent>
      <dtstart rdf:parseType='Resource'>
        <dateTime>2003-01-01T11:30:00</dateTime>
      </dtstart>
      <dtend rdf:parseType='Resource'>
        <dateTime>2003-01-01T23:00:00</dateTime>

      </dtend>
      <rrule rdf:parseType='Resource'>
      <byday>WE,TH,FR,SA,SU</byday>
      <freq>WEEKLY</freq>
      <interval>1</interval>
      </rrule>
    </Vevent>

    </component>
  </Vcalendar>
</rdf:RDF>


Extending the Example

Let's start extending things, using some additional RDF vocabularies. (excuse the indenting, and the fact that I just made up some new stuff for FOAF to fit the example)


<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF
  xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
  xmlns='http://www.w3.org/2002/12/cal/ical#'
  xmlns:i='http://www.w3.org/2002/12/cal/ical#'
  xmlns:x='http://www.w3.org/2002/12/cal/prod_apple#'
  xmlns:dc='http://purl.org/dc/elements/1.1/'
  xmlns:wn='http://xmlns.com/wordnet/1.6/'
  xmlns:foaf='http://xmlns.com/foaf/0.1/'
  xmlns:g='http://www.w3.org/2003/01/geo/wgs84_pos#'
>

<wn:Shop>
  <!--todo: fix up a more plausible example -->
  <foaf:homepage>
    <rdf:Description rdf:about="http://example.com/asite">
      <dc:title>The ... homepage</dc:title>
      <dc:description>
         The ... website describes this ... restaurant which ... ...
      </dc:description>
    </rdf:Description>
  </foaf:homepage>
  <foaf:depiction rdf:resource="http://example.com/shop1.jpg"/>
  <g:lat>50</g:lat> <!-- whoa! the web site is at 50,50? no, the store is, right? -->
  <g:long>50</g:long> <!-- right! my indenting of the xml was wrong, that's all... -->
  <g:alt>0</g:alt>
  <foaf:openingHours>
  <Vcalendar>
    <component>
    <Vevent>
      <dtstart rdf:parseType='Resource'>
        <dateTime>2003-01-01T16:00:00</dateTime>
      </dtstart>
      <dtend rdf:parseType='Resource'>
        <dateTime>2003-01-01T23:00:00</dateTime>

      </dtend>
      <rrule rdf:parseType='Resource'>
      <byday>TU</byday>
      <freq>WEEKLY</freq>
      <interval>1</interval>
      </rrule>
    </Vevent>

    </component>
    <component>
    <Vevent>
      <dtstart rdf:parseType='Resource'>
        <dateTime>2003-01-01T11:30:00</dateTime>
      </dtstart>
      <dtend rdf:parseType='Resource'>
        <dateTime>2003-01-01T23:00:00</dateTime>

      </dtend>
      <rrule rdf:parseType='Resource'>
      <byday>WE,TH,FR,SA,SU</byday>
      <freq>WEEKLY</freq>
      <interval>1</interval>
      </rrule>
    </Vevent>

    </component>
  </Vcalendar>
  </foaf:openingHours>
  </wn:Shop>
</rdf:RDF>



Editorial Notes and Scribbles

I migrated this to Wiki in hope that others might flesh out the example(s). I also need some meta-help, ie. finding out how best to quote markup examples in the moinmoin wiki syntax. --DanBri

I added the XMl... initially pretty rough, i got muddled about which example

whether to stick with the restaurant in Boston, or do a local shop from Bristol, for which i can get photo, gps'd location etc more easily. --DanBri

Wishlist

  • Flesh out example, stabilise on a shop, its location, photo etc.
  • Add contact info
  • Look at restaurant markup from dmoz
  • wine markup from OWL
  • some other Wine RDF thing I vaguely remember being announced
  • if we had several nearby shops, how to deal w/ GPS granularity issues (spacenamespace?)
  • Some shops have different opening hours on holidays. How can you specify this via RDF? --AndreasHochsteger

The "what does this gain us" section is a little weak.

Let's beef it up a little, in order to understand the nature, and extent, of RDF's cool-ness.

  • "the RDF/XML syntax allows us to use off the shelf parsers (many RDF and XML free tools)"

Okay: What kind of free tools? Specificly? How do they help us understand / communicate / whatever the business hours use case?

  • "the use of XML namespaces gives us a syntax writing down a mix of calendar and other kinds of information"
  • "RDF's graph data model provides principles for mixing data together"

The further example of data mixing is good, but this should be explained up above as well. You want to say: "For example, you could automatically overlap the business hours with the business hours in your daily planner. This works, because there's an OWL description on the Internet that tells how to automatically translate this business hours language into the sort of business hours that your daily planner can understand."

  • "We get to re-use existing RDF vocabularies, instead of inventing our own"
  • "We get to merge this data with other information expressed in RDF"

So we want to explain that: "We can use the description of hours given by the business, and reuse the concept in our own documents."

Question: Why is this true here, but not elsewhere? What's so special about RDF that makes it so we can do this, where elsewhere we don't get to?

Outsider Comments

I'm looking for exactly this xml, but this seems to be very complex, and going off in different tangents. Here are my use cases:

  • I wish to go to a shop or restaurant, and I wish to know if it's open for the next few hours.
  • It's late at night, and I need to go to the drug store or a small market. I wish to be able to search for a business that is open right now. The search should happen on a mapping site, or a web search site.
  • I have business with a microbusiness that's open only a few days a week. It's important enough for me to bring their schedule into my calendar, temporarily, so I can get there when they're open.
  • I want to coordinate a trip and run a few errands. I would like to get all the hours for relevant businesses on a specific day. I can sort through the hours myself.