Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

Commit

Permalink
Fixed Vocab details required to be in single graph.
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-metalinkage committed May 5, 2021
1 parent 98d668e commit c408385
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions vocprez/source/sparql.py
Expand Up @@ -36,22 +36,31 @@ def collect(details):
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT *
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT *
WHERE {{
GRAPH ?g {{
?cs a skos:ConceptScheme .
OPTIONAL {{ ?cs skos:prefLabel ?title .
FILTER(lang(?title) = "{language}" || lang(?title) = "") }}
OPTIONAL {{ ?cs dcterms:created ?created }}
OPTIONAL {{ ?cs dcterms:issued ?issued }}
OPTIONAL {{ ?cs dcterms:modified ?modified }}
OPTIONAL {{ ?cs dcterms:creator ?creator }}
OPTIONAL {{ ?cs dcterms:creator ?creatornode
OPTIONAL {{ ?creatornode foaf:name|rdfs:label ?createnodename }}
BIND( COALESCE ( ?createnodename, ?creatornode ) AS ?creator )
}}
OPTIONAL {{ ?cs dcterms:source ?source }}
OPTIONAL {{ ?cs dcterms:publisher ?publisher }}
OPTIONAL {{ ?cs owl:versionInfo ?version }}
OPTIONAL {{ ?cs skos:definition ?description .
FILTER(lang(?description) = "{language}" || lang(?description) = "") }}
}}
OPTIONAL {{ ?cs skos:definition ?skosdef .
FILTER(lang(?skosdef) = "{language}" || lang(?skosdef) = "") }}
OPTIONAL {{ ?cs dcterms:description ?dcdescription .
FILTER(lang(?dcdescription) = "{language}" || lang(?dcdescription) = "") }}
OPTIONAL {{ ?cs rdfs:comment ?comment .
FILTER(lang(?comment) = "{language}" || lang(?comment) = "") }}
BIND( COALESCE(?dcdescription, ?skosdef, ?comment, "Set dcterms:description or skos:definition to describe this vocabulary") AS ?description )
}}
ORDER BY ?title
""".format(language=config.DEFAULT_LANGUAGE)
Expand Down Expand Up @@ -80,6 +89,7 @@ def collect(details):

vocab_ids.append(id)


sparql_vocabs[vocab_id] = Vocabulary(
id,
cs["cs"]["value"],
Expand Down

0 comments on commit c408385

Please sign in to comment.