Linked Data Introduction @sssw2013 - #sssw2013
May 11, 2015
Linked Data Introduction
@sssw2013 - #sssw2013
Data
Linked Data
The Semantic Web
Open University Website
Open UniversityVLE
KMi Website
Mathieu’s Homepage
Mathieu’s List of
PublicationsMathieu’s
M366 Coursepage
Person: Mathieu
Publication: Pub1
Organisation:The Open University
Course: M366
Country: Belgium
Book: Mechatronics
author
workFor
availableIn
offers
setBook
The Web of Linked DataThe Web
Basis
• URIs and Web based information access• RDF, graph-based data modelling• SPARQL, querying and updating over web
endpoints
URIsExample:
http://data.open.ac.uk/course/aa100
An anchor for linkingLet’s say you took this course.
You – took this URI
An identifier for a data entity
Here, the a course offered by the Open University
An access point to representation(s) of
the data entityIn possibly different
formats…
RDF – graph data model for the Webhttp://data.open.ac.uk/course/aa100
“The arts past and present”
http://data.open.ac.uk/saou/ontology#undergraduate
http://purl.org/vocab/aiiso/schema#Module
http://data.open.ac.uk/topic/arts_and_humanities
http://sws.geonames.org/3017382/ “France”
dc:title
rdf:label
rdf:type
dc:subject
courseLevel
geo:latgeo:long
RDF+XML<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="http://data.open.ac.uk/course/aa100">
<title xmlns="http://purl.org/dc/terms/" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">The arts past and present</title>
<courseLevel xmlns="http://data.open.ac.uk/saou/ontology#" rdf:resource="http://data.open.ac.uk/saou/ontology#undergraduate"/>
<isSimilarTo xmlns="http://purl.org/goodrelations/v1#" rdf:resource="http://data.open.ac.uk/course/a200"/>
<hasBook xmlns="http://data.open.ac.uk/saou/ontology#" rdf:resource="http://data.open.ac.uk/book/9780571195473"/>
<location xmlns="http://purl.org/net/mlo/" rdf:resource="http://sws.geonames.org/2634895/"/>
<location xmlns="http://purl.org/net/mlo/" rdf:resource="http://sws.geonames.org/2638360/"/>
<rdf:type rdf:resource="http://purl.org/vocab/aiiso/schema#Module"/>
<assessment xmlns="http://purl.org/net/mlo/" rdf:resource="http://data.open.ac.uk/saou/assessment/end-of-course-assessment"/>
<assessment xmlns="http://purl.org/net/mlo/" rdf:resource="http://data.open.ac.uk/saou/assessment/tma"/>
<subject xmlns="http://purl.org/dc/terms/" rdf:resource="http://data.open.ac.uk/topic/arts_and_humanities"/>
<is-taught-present xmlns="http://courseware.rkbexplorer.com/ontologies/courseware#" rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</is-taught-present>
<taught-at xmlns="http://courseware.rkbexplorer.com/ontologies/courseware#" rdf:resource="http://education.data.gov.uk/id/school/133849"/>
<code xmlns="http://purl.org/vocab/aiiso/schema#" rdf:datatype="http://www.w3.org/2001/XMLSchema#string">AA100</code>
N3<http://data.open.ac.uk/course/aa100> <http://purl.org/dc/terms/title> "The arts past and present"^^<http://www.w3.org/2001/XMLSchema#string> .
<http://data.open.ac.uk/course/aa100> <http://data.open.ac.uk/saou/ontology#OUCourseLevel> "1"^^<http://www.w3.org/2001/XMLSchema#string> . <http://data.open.ac.uk/course/aa100> <http://data.open.ac.uk/saou/ontology#courseLevel> <http://data.open.ac.uk/saou/ontology#undergraduate> .
<http://data.open.ac.uk/course/aa100> <http://purl.org/goodrelations/v1#isSimilarTo> <http://data.open.ac.uk/course/a200> .
<http://data.open.ac.uk/course/aa100> <http://data.open.ac.uk/saou/ontology#hasBook> <http://data.open.ac.uk/book/9780571195473> .
<http://data.open.ac.uk/course/aa100> <http://data.open.ac.uk/saou/ontology#hasBook> <http://data.open.ac.uk/book/9780582817807> .
<http://data.open.ac.uk/course/aa100> <http://purl.org/net/mlo/location> <http://sws.geonames.org/3077311/> .
<http://data.open.ac.uk/course/aa100> <http://purl.org/net/mlo/location> <http://sws.geonames.org/597427/> .
<http://data.open.ac.uk/course/aa100> <http://purl.org/net/mlo/location> <http://sws.geonames.org/2802361/> . <http://data.open.ac.uk/course/aa100> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/vocab/aiiso/schema#Module> .
<http://data.open.ac.uk/course/aa100> <http://courseware.rkbexplorer.com/ontologies/courseware#has-title> "The arts past and present"^^<http://www.w3.org/2001/XMLSchema#string> .
<http://data.open.ac.uk/course/aa100> <http://purl.org/net/mlo/assessment> <http://data.open.ac.uk/saou/assessment/end-of-course-assessment> .
<http://data.open.ac.uk/course/aa100> <http://purl.org/net/mlo/assessment> <http://data.open.ac.uk/saou/assessment/tma> .
<http://data.open.ac.uk/course/aa100> <http://purl.org/dc/terms/subject> <http://data.open.ac.uk/topic/classical_studies> .
<http://data.open.ac.uk/course/aa100> <http://purl.org/dc/terms/subject> <http://data.open.ac.uk/topic/arts_and_humanities> .
<http://data.open.ac.uk/course/aa100> <http://purl.org/dc/terms/subject> <http://data.open.ac.uk/topic/english_language> .
SPARQL• ASK query: is this true?ask {<http://data.open.ac.uk/course/aa100> a aiiso:Module} (is it a module?)ask{<http://data.open.ac.uk/course/aa100> dc:subject ?x} (is there a subject to this module?)
• Select query: Get me some dataselect ?book ?title where { ?x a aiiso:Module. ?x dc:subject <http://data.open.ac.uk/topic/Music>. ?x courseware:setBook ?book. ?book dc:title ?title filter( ?x != <http://data.open.ac.uk/course/aa100> ) } order by ?title limit 100(get the books associated with courses in music which are not AA100)
• Construct query: Build a (sub) RDF graphconstruct {?agent1 foaf:knows ?agent2} where s{?x bibo:creator ?agent1. ?x bibo:creator ?agent2}(Construct of graph of people knowing each-other because of being co-authors of at least one thing)
SPARQL is also a protocol for Web-based data endpoints…
Example
select distinct ?course where {?course <http://data.open.ac.uk/saou/ontology#isAvailableIn> <http://sws.geonames.org/2328926/>.?course a <http://purl.org/vocab/aiiso/schema#Module>}
Open University courses available in Nigeria (http://sws.geonames.org/2328926/)on http://data.open.ac.uk/query
Exampleselect distinct ?q (count(distinct ?t) as ?n) where { ?q a <http://purl.org/net/mlo/qualification>. ?q <http://data.open.ac.uk/saou/ontology#hasPathway> ?p. ?p <http://data.open.ac.uk/saou/ontology#hasStage> ?s. {{?s <http://data.open.ac.uk/saou/ontology#includesCompulsoryCourse> ?c} union {?s <http://data.open.ac.uk/saou/ontology#includesOptionalCourse> ?c}}. ?c <http://purl.org/dc/terms/subject> ?t. [] <http://www.w3.org/2004/02/skos/core#hasTopConcept> ?t.} group by ?q order by desc(?n)
How many top level subjects are represented in individual Open University qualifications on http://data.open.ac.uk/query
Exampleselect ?broader ?term ?narrowerwhere { graph npgg:subjects { ?subject skos:prefLabel ?term . ?subject skos:broader [ skos:prefLabel ?broader ] . ?_ skos:broader ?subject ; skos:prefLabel ?narrower . } filter(regex(?term, "^Stem cells$", "i"))}order by ?broader ?narrower
Broader and narrower terms for "Stem cells“ on http://data.nature.com/query
Exampleselect ?doi ?datawhere { ?doi a npg:Article ; npg:hasDataCitation [ npg:hasLink [ ?_ ?data ] ; npg:type ?type ] . filter(regex(?type, "pdb"))}limit 25
Data citations to the Protein Database on http://data.nature.com/query
SPARQL updateDelete querydelete {?x ?p ?y} where { ?x a aiiso:Course. ?x ?p ?y. ?a1 aiiso:responsibleFor ?x. ?a2 aiiso:responsibleFor ?x. filter ( ?a1 != ?a2 )}
Insert query insert {?x a onto:WeirdCourse} where{ ?x a aiiso:Course. ?a1 aiiso:responsibleFor ?x. ?a2 aiiso:responsibleFor ?x. filter ( ?a1 != ?a2 )}
What we will during the hands-on session
• Access URIs to get data in different forms – understand how the HTTP protocol is used to access data
• Inspect RDF representations of objects – follow links to others
• Write SPARQL query to retrieve specific information• Create new data with SPARQL update – think about how
to model the data with RDF
Hands-on session