data.open.ac.uk - Example queries

This page is here to show nice queries to be examples for users. Some times ago, we started to collect example SPARQL queries of interest through twitter, using the hashtag #queryou. Please feel free to contribute by sending your query on twitter using the #queryou tag.

Courses available in Nigeria

This query lists all the Open University courses that can currently be registered to from Nigeria.

PREFIX mlo: <http://purl.org/net/mlo/> PREFIX aiiso: <http://purl.org/vocab/aiiso/schema#> SELECT ?course FROM <http://data.open.ac.uk/context/course> WHERE { ?course mlo:location <http://sws.geonames.org/2328926/> . ?course a aiiso:Module }

Podcasts, OpenLearn units and the term “earthquake”

This query find any video podcast and OpenLearn units which descriptions contain the term “earthquake”.

PREFIX mlo: <http://purl.org/net/mlo/> SELECT ?thing ?description FROM <http://data.open.ac.uk/context/openlearn> FROM <http://data.open.ac.uk/context/podcast> where { ?thing <http://purl.org/dc/terms/description> ?description . FILTER EXISTS { { ?thing a <http://data.open.ac.uk/openlearn/ontology/OpenLearnUnit> } UNION { ?thing a <http://data.open.ac.uk/podcast/ontology/VideoPodcast> } } . FILTER regex(str(?description), "earthquake", "i" ) }

Subjects of Podcasts

Subject headings used to describe a specific podcast (@psychemedia).

PREFIX dct: <http://purl.org/dc/terms/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> select ?s ?y { <http://data.open.ac.uk/podcast/9687b84ab18c389aace5b9fecdb42457> dct:isPartOf ?c . ?c dct:subject ?s . ?s rdfs:label ?y }

Subject headings used to describe all podcasts (@ppetej).

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX dcterms: <http://purl.org/dc/terms/> PREFIX skos: <http://www.w3.org/2004/02/skos/core#> SELECT DISTINCT ?tlabel FROM <http://data.open.ac.uk/context/podcast> FROM <http://data.open.ac.uk/context/topic> WHERE { {?x a <http://data.open.ac.uk/podcast/ontology/VideoPodcast> ; dcterms:isPartOf ?c . ?c dcterms:subject ?t . ?t rdfs:label ?tlabel } UNION {?x a <http://data.open.ac.uk/podcast/ontology/AudioPodcast> ; dcterms:isPartOf/dcterms:subject ?t . ?t rdfs:label ?tlabel } }

Course offers and prices

Prices (ordered) with currency of OU level 1 courses in Arts and Humanities as available in France.

select ?course ?price ?cur from <http://data.open.ac.uk/context/course> where { ?course <http://data.open.ac.uk/saou/ontology#OUCourseLevel> "1"^^<http://www.w3.org/2001/XMLSchema#string>. ?course <http://purl.org/dc/terms/subject> <http://data.open.ac.uk/topic/arts_and_humanities>. ?off <http://purl.org/goodrelations/v1#includes> ?course. ?off <http://purl.org/goodrelations/v1#hasPriceSpecification> ?ps. ?course <http://purl.org/net/mlo/location> <http://sws.geonames.org/3017382/>. ?off <http://purl.org/goodrelations/v1#availableAtOrFrom> <http://sws.geonames.org/3017382/>. ?ps <http://purl.org/goodrelations/v1#hasCurrencyValue> ?price. ?ps <http://purl.org/goodrelations/v1#hasCurrency> ?cur } order by ?price

Course topic and avaibility

Spanish courses available in Germany.

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?c ?l WHERE { ?c <http://purl.org/dc/terms/subject> <http://data.open.ac.uk/topic/spanish> . ?c rdfs:label ?l . ?c <http://data.open.ac.uk/saou/ontology#isAvailableIn> <http://sws.geonames.org/2921044/> }

People names

People with more than one family name in ORO.

select distinct ?x from <http://data.open.ac.uk/context/oro> { ?x <http://xmlns.com/foaf/0.1/familyName> ?y . ?x <http://xmlns.com/foaf/0.1/familyName> ?z . filter(?z!=?y) }

Properties of OpenLearn units

Properties that OpenLearn units have.

select distinct ?property from <http://data.open.ac.uk/context/openlearn> where { ?subject a <http://data.open.ac.uk/openlearn/ontology/OpenLearnUnit> . ?subject ?property ?x }

Podcast tracks

Sorted tracks of a podcast.

SELECT ?download ?published FROM <http://data.open.ac.uk/context/podcast> WHERE { ?podcast <http://purl.org/dc/terms/published> ?published . ?podcast <http://digitalbazaar.com/media/download> ?download . ?podcast <http://purl.org/dc/terms/isPartOf> <http://data.open.ac.uk/podcast/collection/58dbd5be4f01f4b1eec1df1e8f97eaad> . } order by desc (?published)

YouTube Videos

YouTube videos, sorted by date (latest first).

PREFIX yt: <http://data.open.ac.uk/youtube/ontology/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX dct: <http://purl.org/dc/terms/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX schema: <http://schema.org/> SELECT ?code ?label (max(?published) as ?date) FROM <http://data.open.ac.uk/context/youtube> WHERE { ?x schema:productID ?code ; rdfs:label ?label ; dct:published ?published ; yt:relatesToCourse ?cs } group by ?code ?label order by desc (?date)