Data Model Examples

From Points of Interest
Jump to: navigation, search

POI data model serialised as JSON, XML, HTML5 & KML - example01

See the original draft here and a new "work in progress" draft example02 here.

Here is a very rough first attempt at mapping the examples developed in the Boulder 2011 face-to-face meeting into serialised json, xml, html5 and kml. The html5 examples also show how we have both the option of using an external link in the head with rel=alternate or embedding it within the dom using microdata (as opposed to using a namespace).

Please send all comments and feedback to the thread on the W3C POI Working Group public discussion list.

In many places things can have alternate versions e.g.
- href/link
  link rel types that seem relevant:
    pois: canonical, self, alternate, related, tag, author, copyright/license, current/latest-version, describedby, payment, version-history
    poi: canonical, self, alternate, related, tag, author, copyright/license, current/latest-version, describedby, enclosure/up, payment, prefetch, version-history
- crs
- point/geo

--------------------------------------------------------------------------------------------------------------
First - here's a very high level json overview of all the key patterns:
--------------------------------------------------------------------------------------------------------------
  NOTES:
  "" means a string representation of a thing (e.g. an href)
  { } means a complex representation of a thing (e.g. a multi-attribute structured data definition of a link)
  Where you see a <- this hints at where this was shamelessly stolen from 8)
--------------------------------------------------------------------------------------------------------------
{
  href:"" or { rel:"", href:"" } or links:[{ rel:"", href:"" },...], <- a href or link rel or atom:link
  description:"", <- dc.description or atom:summary
  rights:"", <- link rel=copyright|license dc.rights or atom:rights
  language:"", <- dc.language or xml:lang
  author:"", <- link rel=author or atom:author or dc.creator
    or {
         name:"", <- atom:name
         email:"", <- atom:email
         uri:"" <- atom:uri
       }
  date:"", <- http-header.date
  published:"", <- atom:published
  updated:"", <- atom:updated or http-header.last-modified
  pois:[
    {
      id:"", <- atom:id or dc.identifier !! NOTE: Atom requires an IRI not just a relative id
      href:"" or { rel:"", href:"" } or links:[{ rel:"", href:"" },...], <- a href or link rel or atom:link
      title:"", <- dc.title or atom:title
      description:"", <- dc.description or atom:summary
      rights:"", <- link rel=copyright|license dc.rights or atom:rights
      language:"", <- dc.language or xml:lang
      author <- link rel=author or atom:author or dc.creator
        or {
             name:"", <- atom:name
             email:"", <- atom:email
             uri:"" <- atom:uri
           }
      date:"", <- http-header.date 
      published:"", <- atom:published
      updated:"", <- atom:updated or http-header.last-modified
      location:{ <- georss/geojson + geo:
        href:"" or { rel:"", href:"" } or links:[{ rel:"", href:"" },...], <- a href or link rel or atom:link
        point:{ <- kml/georss/geojson
          href:"" or { rel:"", href:"" } or links:[{ rel:"", href:"" },...], <- a href or link rel or atom:link
          crs:"", <- geojson.crs or georss.srsName
          lat:"", lon:"", alt:"" or coordinates:[],
        } or "geo:37.786971,-122.399677;u=35;crs=wgs84",
        polygon:{ <- kml/georss/geojson
          href:"" or { rel:"", href:"" } or links:[{ rel:"", href:"" },...], <- a href or link rel or atom:link
          ...
        }
      }
    },
    ...
  ]
}

And below is one simple example expressed as json, xml, html5 linked, html5 embedded and kml.

--------------------------------------------------------------------------------------------------------------
simple json example:
--------------------------------------------------------------------------------------------------------------
GET http://mob-labs.com/poiwg/example01/pois.json

{
  href:"http://mob-labs.com/poiwg/example01/pois.json",
  description:"An example collection of pois",
  rights:"http://mob-labs.com/poiwg/example01/pois/rights",
  language:"en-US",
  author:"roBman@mob-labs.com",
  date:"2011-09-22T19:20:30.45+10:00",
  published:"2011-09-22T19:20:30.45+10:00",
  updated:"2011-09-22T19:20:30.45+10:00",
  pois:[
    {
      id:"http://mob-labs.com/poiwg/example01/pois/123",
      href:"http://mob-labs.com/poiwg/example01/pois/123",
      title:"One single poi",
      description:"This is an individual poi",
      language:"en-US",
      location:{
        href:"http://mob-labs.com/poiwg/example01/pois/123/location",
        point:"geo:48.198634,16.371648;crs=wgs84;u=40",
      }
    }
  ]
}


--------------------------------------------------------------------------------------------------------------
simple xml example:
--------------------------------------------------------------------------------------------------------------
GET http://mob-labs.com/poiwg/example01/pois.xml

<?xml version="1.0" encoding="UTF-8"?>
<pois href="http://mob-labs.com/poiwg/example01/pois.xml" xml:lang="en">
  <description>An example collection of pois</description>
  <rights href="http://mob-labs.com/poiwg/example01/pois/rights" />
  <author>roBman@mob-labs.com</author>
  <date>2011-09-22T19:20:30.45+10:00</date>
  <published>2011-09-22T19:20:30.45+10:00</published>
  <updated>2011-09-22T19:20:30.45+10:00</updated>
  <poi id="http://mob-labs.com/poiwg/example01/pois/123" href="http://mob-labs.com/poiwg/example01/pois/123" xml:lang="en">
    <title>One single poi</title>
    <description>This is an individual poi</description>
    <location>
      <point crs="wgs84">48.198634,16.371648</point>
    </location>
  </poi>
</pois>


--------------------------------------------------------------------------------------------------------------
simple html5 example linked from head:
--------------------------------------------------------------------------------------------------------------
GET http://mob-labs.com/poiwg/example01/pois-linked.html

<!DOCTYPE html>
<html>
<head>
  <link rel="alternate" type="application/poi+xml" hreflang="en" href="http://mob-labs.com/poiwg/example01/pois">
  <script type="application/javascript" src="http://mob-labs.com/poiwg/example01/poi-2-html5-bridge.js"></script>
</head>
<body>
</body>
</html>


--------------------------------------------------------------------------------------------------------------
simple html5 example embedded using microdata:
--------------------------------------------------------------------------------------------------------------
GET http://mob-labs.com/poiwg/example01/pois-embedded.html

<!DOCTYPE html>
<html>
<head>
  <script type="application/javascript" src="http://mob-labs.com/poiwg/example01/poi-microdata-processor.js"></script>
</head>
<body>
<span itemscope itemtype="http://mob-labs.com/poiwg/example01/microdata-vocabulary/pois">
  <span itemprop="description">An example collection of pois</span>
  <link itemprop="canonical" href="http://mob-labs.com/poiwg/example01/pois-embedded.html">
  <link itemprop="rights" href="http://mob-labs.com/poiwg/example01/pois/rights">
  <span itemprop="author">roBman@mob-labs.com</span>
  <span itemprop="date">2011-09-22T19:20:30.45+10:00</span>
  <span itemprop="published">2011-09-22T19:20:30.45+10:00</span>
  <span itemprop="updated">2011-09-22T19:20:30.45+10:00</span>
  <ol itemscope itemprop="pois" itemtype="http://mob-labs.com/poiwg/example01/microdata-vocabulary/poi">
    <li itemprop="poi" id="http://mob-labs.com/poiwg/example01/pois/123/location">
      <link itemprop="canonical" href="http://mob-labs.com/poiwg/example01/pois/123/location">
      <span itemprop="title">One single poi</span>
      <span itemprop="description">This is an individual poi</span>
      <a itemprop="point" href="geo:48.198634,16.371648;crs=wgs84;u=40">???</a>
    </li>
  </ol>
</span>
</body>
</html>


--------------------------------------------------------------------------------------------------------------
simple kml example:
--------------------------------------------------------------------------------------------------------------
GET http://mob-labs.com/poiwg/example01/pois.kml 

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"
xmlns:pois="http://mob-labs.com/poiwg/example01/xmlns/pois"
xmlns:atom="http://www.w3.org/2005/Atom">
<description>An example collection of pois</description>
<pois:link rel="canonical" href="http://mob-labs.com/poiwg/example01/pois">
<pois:link rel="rights" href="http://mob-labs.com/poiwg/example01/pois/rights">
<atom:author>roBman@mob-labs.com</atom:author>
<pois:date>2011-09-22T19:20:30.45+10:00</pois:date>
<atom:published>2011-09-22T19:20:30.45+10:00</atom:published>
<atom:updated>2011-09-22T19:20:30.45+10:00</atom:updated>
<Placemark>
   <pois:link rel="canonical" href="http://mob-labs.com/poiwg/example01/pois/123/location">
   <poi:title><name>One single poi</name></poi:title>
   <description>This is an individual poi</description>
   <Point>
      <coordinates>48.198634,16.371648</coordinates>
    </Point>
</Placemark>
</kml>