Exploring the Web of Data

This is a simple example to illustrate one way of manually exploring the web of data. We will use Openlink’s Virtuoso SPARQL end-point to query information related to Tim Berners-Lee’s FOAF file (FOAF = friend of a friend) and begin to explore the network of relations that extends from this point in the web of data. For details on what we are doing here see the turorial SPARQL by Example.

Exploring a large network of relations manually in this way would be very tedious however it is a process that can easily be automated and presented to the user via a graphical interface.

First lets see what relations are defined in TimBL’s FOAF file:

Go to the SPARQL end-point, clear the default graph URI (we will set this manually within the query), select “Retrieve remote RDF data for all missing source graphs” and enter the following query:

select distinct ?predicate
from <http://www.w3.org/People/Berners-Lee/card>
where {?subject ?predicate ?object .}

See the results. This lists all defined relationships, such as foaf:knows, foaf:name, foaf:homepage, etc, that have been defined between concepts.

Next we look at what entities are mentioned and their type.

select distinct ?subject ?type
from <http://www.w3.org/People/Berners-Lee/card>
where {
    ?subject ?predicate ?object .
    optional { ?subject a ?type .}
}

Note: ‘a’ is a shortcut for “rdf:type” and an ‘optional’ clause can fail without failing the entire query, this is required because not all entities have been given a defined type.

See the results.This tells us all the concepts that have been defined, such as TimBL himself (http://www.w3.org/People/Berners-Lee/card#i) and other people that TimBL knows, which are of type “person”, however there are also concepts of type “PersonalProfileDocument” and “RSAPublicKey”. Also note that TimBL is defined to be of type ‘Male’.

Now lets explore the network of friends surrounding TimBL and retrieve the list of names of TimBL’s friends along with their URI’s.

prefix foaf:  <http://xmlns.com/foaf/0.1/>
prefix card: <http://www.w3.org/People/Berners-Lee/card#>
select distinct ?name ?object
from <http://www.w3.org/People/Berners-Lee/card>
where {
    card:i foaf:knows ?object .
    ?object foaf:name ?name .
}

See the results.

Imagine a graph with a node for TimBL in the centre and a cloud of other nodes representing friends of TimBL connected to the central node by ‘knows’ relations. Each node also has sub-nodes such as name, homepage, etc. Now lets pick one of the friend nodes and expand it to see what friends surround it, lets pick Daniel Krech and see who he knows. From the results of the last query we see that he has the URI http://eikeon.com/foaf.rdf#eikeon.

prefix foaf:  <http://xmlns.com/foaf/0.1/>
prefix card: <http://eikeon.com/foaf.rdf#>
select distinct ?object
from <http://eikeon.com/foaf.rdf>
where {
    card:eikeon foaf:knows ?object .
}

See the results.

In this way we can move through the network / graph of relationships between people by querying the data in their FOAF files to identify who they know and the URI’s of their friend’s FOAF files, then querying those.

Given an application with a graphical interface it would be easy to visualise and explore networks of human relations. Furthermore, any network defined in terms of any concepts and relations can be explore in a similar manner by querying RDF data on the web. In this way the many scattered RDF fragments are linked together by URI’s thus forming a web of data that can be traversed and explored.

If you are interested in building such an application then the Sematic Web Client Library is a Java library that allows any Java application to perform these types of queries without the need for a third-party SPARQL end-point

Note: A useful way to browse the web of data is the Semantic Radar plugin for Firefox. E.g. just install the plugin and go to Tim Berners-Lee’s FOAF file. You will see all of the available data and be able to click on links to explore further into the network of relations.

Tags: , , , , , , , , , ,