This is something I’ve been meaning to do for ages, so spurred on by Martin Hawksey’s wonderful Google Gadgets port of my ad hoc Twitter network visulisation thing using Protovis (which Martin points out doesn’t work with IE9), I finally got round to it today: a wiring up of the OU modules Linked Data to the protovis app:
The data is pulled in from the OU Linked Data endpoint via Sparqlproxy (which provides a JSON output from the query that I can pull directly into the web page).
The query I’m using looks for courses related to the course of interest, and the courses related to those courses:
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
select distinct ?name1 ?code2 ?name2 ?code3 ?name3 from <http://data.open.ac.uk/context/course> where {
?x a <http://purl.org/vocab/aiiso/schema#Module>.
?x <http://data.open.ac.uk/saou/ontology#courseLevel> <http://data.open.ac.uk/saou/ontology#undergraduate>.
?x <http://courseware.rkbexplorer.com/ontologies/courseware#has-title> ?name1.
?x <http://purl.org/goodrelations/v1#isSimilarTo> ?z.
?z <http://courseware.rkbexplorer.com/ontologies/courseware#has-title> ?name2.
?x <http://purl.org/vocab/aiiso/schema#code> 'T215'^^xsd:string.
?z <http://purl.org/vocab/aiiso/schema#code> ?code2.
?z <http://purl.org/goodrelations/v1#isSimilarTo> ?zz.
?zz <http://courseware.rkbexplorer.com/ontologies/courseware#has-title> ?name3.
?zz <http://purl.org/vocab/aiiso/schema#code> ?code3.
} LIMIT 100
(The endpoint is data.open.ac.uk/query; the explicit ‘T215’ course code identifier is paramterised in the URI that runs the query through Sparqlproxy.)
There’s all sorts of opportunities for coloring the nodes (eg to distinguish between the focal point course, it’s direct neighbours, and the neighbours of those neighbors) but that’s an exercise for another day. I should probably have a go at labeling them sensibly too…
(The ability to drag nodes around within the graph has also been added (back) – Martin noticed the order of a couple of the Protovis commands influenced whether this worked or not. Being able to relayout the chart reminds me how rubbish the force layout algorithm Protovis uses actually is!)
Drawing on Martin’s work (i.e. directly pinching his Google Gadget definition!) I also created a widget/gadget (XML) that lets you view the network of courses around a course in your own page…
Here’s the config page:
Of course, this being a WordPress.com hosted blog, I donlt think I can directly embed the gadget to prove that it works…
Related:
– data.open.ac.uk Linked Data Now Exposing Module Information
– Getting Started With data.open.ac.uk Course Linked Data
– Open University Undergraduate Module Map
PS to do – a reimagining of this, probably using arbor.js, where we just do the direct neigbours of a course code, but allow nodes to be clickable so that additional nodes and edges can be added to the graph dynamically… It might also be interesting to support search by keywords, and display courses that match keywords (in one colour) as well as related courses (in another), along with edges showing which courses are related…?
Hey my code is your code … and in this case it is quite literally was your code first ;)
M