3 · SPARQL over SKOS — the queries learners and librarians ask

Transitive broader, label search with language tags, cross-vocabulary join via exactMatch. No reasoner needed.

0/2 done

Theory — three workhorses

The three workhorses

Workhorse 1 — 'Show me everything under Science'

Transitive broader via SPARQL property paths. No reasoner, no inference engine, no vendor lock-in.

PREFIX : <https://w3id.org/openlearn/subjects/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?c ?label WHERE {
  ?c skos:broader+ :Science ;
     skos:prefLabel ?label .
  FILTER(lang(?label) = 'en')
}

Workhorse 2 — Multilingual label search

Search 'cuántica' and find the right Quantum-mechanics concept whether the user typed in English, Spanish or German.

SELECT ?c ?lang ?label WHERE {
  ?c skos:inScheme :Scheme .
  { ?c skos:prefLabel ?label } UNION { ?c skos:altLabel ?label }
  FILTER(CONTAINS(LCASE(STR(?label)), 'cuánt'))
  BIND(LANG(?label) AS ?lang)
}

Workhorse 3 — Cross-vocabulary join

A partner library system uses LCSH. We use OpenLearn subjects. skos:exactMatch joins the two without us rewriting anyone's catalogue.

SELECT ?ourConcept ?theirSubject WHERE {
  ?ourConcept skos:exactMatch ?theirSubject .
  FILTER(STRSTARTS(STR(?theirSubject), 'http://id.loc.gov/'))
}

Reading in progress · 0 of 2 activities done