Example: Climbing Locations
We will guide SW newbies through various important vocabularies by using an example project. The newbie has a Web site about climbing sites (e.g. ukclimbing.com) and wants to create SW data for it.
Breaking Down the Problem
While the general topic of the climbing site is, not surprisingly, climbing, it is actually possible to break the data on it down into a number of sub topics. That's nice, because there are a number of vocabularies out there for various small, relatively easy to handle domains. So, what kind of data is on the climbing site:
- General Annotations - one thing that is common to all the above is the fact that we always want to annotate things with labels. What is the name of that?
- Location - each climbing site has some location, so we want to model that.
- Review - the site gives reviews about each climbing site. Is it fun, is it dangerous, etc.
- Users - people can register to the site and become users
- Photos - there are lots of pictures on the site of the various climbing sites
- Site - to tie everything together, we can also model our Web site as such
- Climbing-specific - not everything is covered by existing vocabularies. Some things may be so specific to your domain, that you might have to come up with a small vocabularies yourself.
One of the most basic tasks which people need to perform when creating data for the Semantic Web is to label things, saying what the name of something is. There are actually many different properties you can use to do this, but let's stick to the most basic one for now:
rdfs:label. Let's say we have a climbing site called "Benny Beg". So, using
rdfs:label, we can express this in RDF as follows:
<BennyBeg> rdfs:label "Benny Beg" .
If our climbing site is called differently in different languages, we can also add more such labels (later...).
Each climbing site is located somewhere, so we probably want to model that. We could e.g. say which country it is in, if it is close to a city, and even be as detailed as specifying the latitude and longitude. If we do that, we (and others) can make queries such as "show me all climbing sites close to Glasgow", or display climbing sites on a map.
Benny Beg is located in Perthshire in Scotland. Luckily, there already is a database called "Geonames" with lots of locations in it, and each one already has a URI which we can refer to in our data. In order to say that something (e.g. a climbing site) is located near something else, we can use the
<BennyBeg> foaf:based_near <http://sws.geonames.org/2640357> .
Of course, just this will not yet help us to display Benny Beg on a map - for this we need coordinates. A popular vocabulary for specifying locations with coordinates is the Geo vocabulary, which models the World Geodetic System (WGS84)in RDF. In particular, the Geo vocabulary provides properties to specify the latitude and longitude:
geo:long. We can now extend our example as follows:
<BennyBeg> geo:lat "56.35" ; geo:long "-3.84" .
Since our site is about climbing, we are also interested in altitudes. Benny Beg is actually a cliff and not very high, roughly 90m. We can use the
geo:alt property from the Geo vocabulary to give this information:
<BennyBeg> geo:alt "90" .
- Review Vocabulary - http://purl.org/stuff/rev#
<sioc:User rdf:about="http://data.semanticweb.org/user/1"> <sioc:name>Knud</sioc:name> <sioc:email_sha1>b15d1e7efb11374644555fa9734bf75a553a362c</sioc:email_sha1> </sioc:User> <foaf:Person rdf:nodeID="bNode1"> <foaf:mbox_sha1sum>b15d1e7efb11374644555fa9734bf75a553a362c</foaf:mbox_sha1sum> <foaf:holdsAccount rdf:resource="http://data.semanticweb.org/user/1"/> <foaf:depiction rdf:resource="http://data.semanticweb.org/sites/default/files/pictures/picture-1.png"/> </foaf:Person>
Now let's get to pictures. You most likely want to provide a link to things shown on yours. In our example there is a photo displaying Benny Beg. You can use
foaf:depicts to express this relation.
@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix myreviews: <http://example.com/climbing-website/reviews/> . @base <http://example.com/climbing-website/resources/> . # an image with Benny on it <BennyBeg> foaf:depicts <http://example.com/pics/001.jpg> .
There a lots of best practices for designing vocabularies. (...)
- naming conventions
Typically you may want to define some domain specific classes and properties:
* Venue * Climb * Grade
* route (Venue route Climb) * grade (Climb grade Grade) * gradingSystem (Grade gradingSystem <uri>)
To sum it up, this is how the complete RDF for Benny Beg could look like:
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix rev: <http://purl.org/stuff/rev#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix dcterms: <http://purl.org/dc/terms/> . @prefix sioc: <http://rdfs.org/sioc/ns#> . @prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> . @prefix climb: <http://example.com/climbing-vocab/> . @prefix mysite: <http://example.com/climbing-website/> . @prefix myusers: <http://example.com/climbing-website/users/> . @prefix myreviews: <http://example.com/climbing-website/reviews/> . @base <http://example.com/climbing-website/resources/> . #venues <BennyBeg> a climb:Venue ; rdfs:label "Benny Beg" ; geo:lat "56.35" ; geo:long "-3.84" ; foaf:based_near <http://sws.geonames.org/2640357>; rev:hasReview myreviews:46, myreviews:78 . #reviews myreviews:78 a rev:Review ; rev:text """quite possibly the most boring location for a crag, but the routes are ok. Try the traverse (left to right). """ ; dcterms:created "17/Jan/06" ; rev:reviewer myusers:frecro . myreviews:46 a rev:Review ; rev:text """Fairly unique climbing for Scotland. Low grade bolted roadside crag. Good for beginners and those with king size hangovers! """ ; rev:reviewer [ foaf:nick "220bpm" ] ; dcterms:created "04/Jun/07" . #users myusers:frecro foaf:nick "frecro" ; a foaf:Person .
... from ukclimbing.com
Benny Beg Perthshire, SCOTLAND
Climbs 25 – Rocktype Dolerite – Altitude ? – Faces South
Climb name Grade
1 United Colours of Bennyton F3 2 Bill and Benny the Flower Pot Men F3 3 Bennydorm F5 4 Driven Round The Benny'd F5+
USER FEEDBACK Login as a Registered User to add your comments
Fairly unique climbing for Scotland. Low grade bolted roadside crag. Good for beginners and those with king size hangovers! 220bpm - 04/Jun/07
quite possibly the most boring location for a crag, but the routes are ok. Try the traverse (left to right). frecro - 17/Jan/06
USER PHOTO GALLERY Click on the small images to view the full size versions, or you can Upload a new photo for this crag. Click to View all 11 photos. [Enjoying the sun at benny beg, 3 kb]
Classifieds Find Classifieds near to this crag (Indoor Walls, Outdoor Shops, Campsites, etc)
Moderator Updates to this page are checked by UKC volunteer fra5911 ?
- very importantly, we need to give best practices for creating a new vocabulary
- part of that involves finding existing vocabularies and deciding if they are good
- how can we define good? Here are a number of criteria
- popularity (can use Sindice for that)
- linked data compliance (status code, size of document, relevance)
- annotation (quality of, localisations, ...)
- semantics (what species of OWL, ...)