Skip to content
Jerzy Kozera edited this page Aug 2, 2020 · 2 revisions

Welcome to the oumodulesbot wiki!

Example SPARQL queries for new features

Courses for given Qualification

PREFIX aiiso: <http://purl.org/vocab/aiiso/schema#>
PREFIX ou: <http://data.open.ac.uk/saou/ontology#>
PREFIX xcri: <http://xcri.org/profiles/catalog/1.2/>
PREFIX rdf: <http://www.w3.org/2000/01/rdf-schema#>

SELECT
    (CONCAT(?pathwayCode, " (", STRBEFORE(?pathwayLabel, " * "), ")") AS ?pathway)
	(STRAFTER(STRAFTER(?stageLabel, ?pathwayLabel), " - Stage ") AS ?stage)
    ?courseCode
WHERE {
    ?qual aiiso:code "Q31" ;  # shouldn't be hardcoded, but it's just an example
          ou:hasPathway ?pw .
  	
    ?pw aiiso:code ?pathwayCode ;
        rdf:label ?pathwayLabel ;
        ou:hasStage ?stg .
 
    ?stg ou:includesCompulsoryCourse ?course ;
         rdf:label ?stageLabel .
    
    { ?course xcri:internalID ?courseCode }  UNION { ?course aiiso:code ?courseCode }
}
LIMIT 20

Example results

(screenshot from https://data.open.ac.uk/query)

Example results table