Archive

Posts Tagged ‘web 3.0’

/location /location /location – exploring Ordnance Survey Linked Data

October 25, 2009 5 comments

Ordnance Survey now have some linked data available here. This data includes information about the local authority and voting regions of Great Britain. Included in this data are the names (and official names as set out by Statutory Instrument where applicable), census code and area in hectares of the region. Also included are topological relationships between the administrative areas. These allow users to do qualitative spatial queries on the data.  So for example, the data contains information about which regions are contained by other regions. Bordering information is given between regions of the same type (e.g. between consituencies). There is one exception to this where additional bordering information is given between counties, unitary authorities, districts and metropolitan districts [1].

So what can you do with the data? First you can simply explore it in your browser. For example look at the URI for The City of Southampton:  http://data.ordnancesurvey.co.uk/id/7000000000037256. As you can see this contains a list of the regions Southampton borders, contains and overlaps [2].

It is possible to perform free text searches on the data here. The results are returned as an RSS feed. Try it out – type the name of the region you are looking for in the first search box. Typing in Southampton gives three results: the unitary authority The City of Southampton and two westminster constituencies Southampton, Test and Southampton, Itchen.

The interesting queries, however, are done at the SPARQL endpoint located here.  I’ll give a handful of SPARQL queries to get you going. You will need to add this at the top of each query:

PREFIX owl: <http://www.w3.org/2002/07/owl#&gt;
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#&gt;
PREFIX foaf: <http://xmlns.com/foaf/0.1/&gt;
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX admingeo: <http://data.ordnancesurvey.co.uk/ontology/admingeo/&gt;
PREFIX spatialrelations: <http://data.ordnancesurvey.co.uk/ontology/spatialrelations/&gt;

So first of all I can ask for a list of the types of the things in the data:

select distinct ?type
where
{
?a rdf:type ?type .
}

Seeing the data mentions Unitary Authorities I can ask for a list of all unitary authorities and their official names:

select ?a ?name
where
{
?a rdf:type admingeo:UnitaryAuthority .
?a admingeo:hasOfficialName ?name .
}

I can now issue a topological query: find me all westminster consituencies contained by the unitary authority Southampton:

select ?a ?name
where
{
<http://data.ordnancesurvey.co.uk/id/7000000000037256&gt; spatialrelations:contains ?a .
?a rdf:type admingeo:WestminsterConstituency .
?a foaf:name ?name .
}

or find me the regions (and their names) that contain the district of Winchester:

select ?a ?name
where
{
?a spatialrelations:contains
<http://data.ordnancesurvey.co.uk/id/7000000000017754> .
?a foaf:name ?name .
}

This query finds me the regions (and their name and type) that border Winchester:

select ?a ?name ?type
where
{
<
http://data.ordnancesurvey.co.uk/id/7000000000017754 > spatialrelations:borders ?a .
?a rdf:type ?type .
?a foaf:name ?name .
}

This query returns me a list of counties, and the county electoral divisions contained within them along with the names of the county and county electoral division:

PREFIX owl: <http://www.w3.org/2002/07/owl#&gt;
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#&gt;
PREFIX foaf: <http://xmlns.com/foaf/0.1/&gt;
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX admingeo: <http://data.ordnancesurvey.co.uk/ontology/admingeo/&gt;
PREFIX spatialrelations: <http://data.ordnancesurvey.co.uk/ontology/spatialrelations/&gt;

select ?ced ?county ?cedname ?countyname
where
{
?county rdf:type admingeo:County .
?ced rdf:type admingeo:CountyElectoralDivision .
?county spatialrelations:contains ?ced .
?ced rdfs:label ?cedname .
?county rdfs:label ?countyname .
}

One final note for people wanting to do mashups with this data. If you wish to see the boundary on a map then the area code and unit ID attributes can be used in the OS OpenSpace API to display the boundary.

So for example, for Southampton (http://data.ordnancesurvey.co.uk/id/7000000000037256) the area code is UTA (for unitary authority) and the unit ID is 37256. These values can be used as follows:

/*here we set-up the our variable called ‘boundaryLayer’ with the strategies that we require.
In this case, it is its ID and type i.e. Unitary Authority */
boundaryLayer = new OpenSpace.Layer.Boundary(“Boundaries”, {
strategies: [new OpenSpace.Strategy.BBOX()],
admin_unit_ids: ["37256"],
area_code: ["UTA"]
});
//then we add the bounadry to the map
osMap.addLayer(boundaryLayer);
//this effectively refreshes the map, so that the boundary is visible
osMap.setCenter(osMap.getCenter());

to display the Southampton boundary using the OS OpenSpace API. See http://openspace.ordnancesurvey.co.uk/openspace/support.html for more details. An example of the output can be seen here.

Happy SPARQLing…

[1] – if you are (rightly) confused about the geography of Great Britain then there is a handy glossary here.

[2] – the regions that contain Southampton will be added shortly.

Reblog this post [with Zemanta]

Web 3.0 and Social Networks

January 25, 2009 7 comments
Icon for the FOAF (Friend of a Friend) project...
Image via Wikipedia

It is probably fair to say that FOAF is where the social web meets the semantic web. FOAF, which has been around for a while now, basically creates a machine readable graph of the sort of information you might include on sites like facebook, myspace etc. Your FOAF file can include links to people you know, your interests and other personal information. It is probably also fair to say that FOAF files were, until now, the sole property of the geek. However, this has changed, and a number of social networking sites such as livejournal, identi.ca and friend feed build FOAF files from your profile information (are there others?). At least now you don’t need to know how to edit RDF in order to have your own FOAF file. Despite that, these profiles are limited by the features offered on the respective sites.

Recently though QDOS launched a new service that makes FOAF profiles extremely easy to build. This service allows uses to create a FOAF profile generated from information contained in your last.fm, livejournal and flickr profiles as well as importing existing FOAF files. You are then given the option to manually enter other information. Furthmore, you can create a public and private view of your FOAF file. I would not recommend including information like your address, phone number or date of birth in a public FOAF file.  So what are you waiting for – go building yourself a FOAF file and join the linked data web.  My FOAF profile can be found here (my original one is maintained here).

For any linked data geeks one other interesting thing about the QDOS FOAF builder is that it has started linking music data from last.fm to the new music linked data service from the BBC. Hopefully this will be just the beginning and we’ll see links to other linked data services from DBpedia, geonames and Ordnance Survey.

Reblog this post [with Zemanta]

LODr

October 24, 2008 1 comment

LODr is a new semantic web application that allows you to convert your web 2.0 tags from various sites like Flickr to semantically enriched web 3.0 URIs. For example, say you took a photo of a place in Southampton, uploaded it to your Flickr account and gave it a tag “southampton”. LODr lets you connect the tag “southampton” to a URI on the semantic web that represents the entity Southampton. In this case I chose to link up to the Southampton represented in the Ordnance Survey administrative geography ontology. Other tags can be linked to URIs in DBpedia, geonames or if music is your thing the new BBC music beta (semantic) web pages.

I guess initially this will appeal mainly to semantic web geeks, but it will be interesting to see what sort of mash-ups this generates as more and more tags are connected to URIs.

My LODr page can be found here.

More more information on LODr see here.

Follow

Get every new post delivered to your Inbox.

Join 2,092 other followers