Skip to content

Instantly share code, notes, and snippets.

@adamml
Last active November 13, 2019 15:48
Show Gist options
  • Save adamml/63d082f9c99c82c4206a118769d680b0 to your computer and use it in GitHub Desktop.
Save adamml/63d082f9c99c82c4206a118769d680b0 to your computer and use it in GitHub Desktop.
NVS Hierarchy
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT DISTINCT ?url ?label ?date WHERE
{
{
SELECT (?a AS ?url) (?c AS ?label)
WHERE {
VALUES ?a {<http://vocab.nerc.ac.uk/collection/P01/current/PSALCU01/> <http://vocab.nerc.ac.uk/collection/P01/current/ALATZZ01/>}
?a skos:prefLabel ?c
}
}
UNION
{
SELECT(?d AS ?url) (?e AS ?label)
WHERE {
VALUES ?a {<http://vocab.nerc.ac.uk/collection/P01/current/PSALCU01/> <http://vocab.nerc.ac.uk/collection/P01/current/ALATZZ01/>}
?a ?b ?d.
?d skos:prefLabel ?e.
FILTER regex(str(?d),"P02|P07|S26|L05|L06")
}
}
UNION {
SELECT(?g AS ?url) (?h AS ?label)
WHERE {
VALUES ?a {<http://vocab.nerc.ac.uk/collection/P01/current/PSALCU01/> <http://vocab.nerc.ac.uk/collection/P01/current/ALATZZ01/>}
?a ?b ?d.
?d ?f ?g.
?g skos:prefLabel ?h.
FILTER regex(str(?d),"P02").
FILTER regex(str(?g),"P05|P22|P03|C47").
FILTER (lang(?h) = 'en')
}
}
UNION {
SELECT(?g AS ?url) (?h AS ?label)
WHERE {
VALUES ?a {<http://vocab.nerc.ac.uk/collection/P01/current/PSALCU01/> <http://vocab.nerc.ac.uk/collection/P01/current/ALATZZ01/>}
?a ?b ?d.
?d ?f ?g.
?g skos:prefLabel ?h.
FILTER regex(str(?d),"S26").
FILTER regex(str(?g),"S21").
FILTER (lang(?h) = 'en')
}
}
UNION {
SELECT(?j AS ?url) (?k AS ?label)
WHERE {
VALUES ?a {<http://vocab.nerc.ac.uk/collection/P01/current/PSALCU01/> <http://vocab.nerc.ac.uk/collection/P01/current/ALATZZ01/>}
?a ?b ?d.
?d ?f ?g.
?g ?i ?j.
?j skos:prefLabel ?k.
FILTER regex(str(?d),"P02").
FILTER regex(str(?g),"C47").
FILTER regex(str(?j),"C46").
}
}
UNION {
SELECT(?m AS ?url) (?n AS ?label)
WHERE {
VALUES ?a {<http://vocab.nerc.ac.uk/collection/P01/current/PSALCU01/> <http://vocab.nerc.ac.uk/collection/P01/current/ALATZZ01/>}
?a ?b ?d.
?d ?f ?g.
?g ?i ?j.
?j ?l ?m.
?m skos:prefLabel ?n.
FILTER regex(str(?d),"P02").
FILTER regex(str(?g),"C47").
FILTER regex(str(?j),"C46").
FILTER regex(str(?m),"C45").
}
}
UNION {
SELECT(?j AS ?url) (?k AS ?label)
WHERE {
VALUES ?a {<http://vocab.nerc.ac.uk/collection/P01/current/PSALCU01/> <http://vocab.nerc.ac.uk/collection/P01/current/ALATZZ01/>}
?a ?b ?d.
?d ?f ?g.
?g ?i ?j.
?j skos:prefLabel ?k.
FILTER regex(str(?d),"P02").
FILTER regex(str(?g),"P03").
FILTER regex(str(?j),"P08").
}
}
UNION {
Select (?a AS ?url) (?c AS ?label) (?d AS ?date)
WHERE{
?a ?b skos:Collection.
?a skos:prefLabel ?c.
?a dct:date ?d.
FILTER regex(str(?a),"C45|C46|C47|L05|L06|L22|P01|P02|P03|P05|P08|P22|S21|S26")
}
}
} ORDER BY ?url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment