Skip to content

Instantly share code, notes, and snippets.

@baskaufs
Created October 15, 2021 21:50
Show Gist options
  • Save baskaufs/916a5210e8df75a41174dffdf9573d7d to your computer and use it in GitHub Desktop.
Save baskaufs/916a5210e8df75a41174dffdf9573d7d to your computer and use it in GitHub Desktop.
SPARQL query to run at https://sparql.vanderbilt.edu/ to find related format concepts
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix skos: <http://www.w3.org/2004/02/skos/core#>
prefix acformat: <http://rs.tdwg.org/format/values/>
select distinct ?broaderConcept ?label ?mediaType ?match ?matchLabel ?fileExtension
from <https://tdwg.github.io/rs.tdwg.org/cvJson/format.jsonld>
where {
# Limit concepts to current terms in pathway scheme
?concept skos:inScheme acformat:m.
# Find the specified concept and all broader concepts
BIND(acformat:m008 AS ?concept) # concept for JPEG media type
?concept skos:broader* ?broaderConcept.
?match skos:exactMatch ?concept.
?concept rdf:value ?mediaType.
?match rdf:value ?fileExtension.
# Print the English label
?broaderConcept skos:prefLabel ?label.
filter(lang(?label) = "en")
?match skos:prefLabel ?matchLabel.
filter(lang(?matchLabel) = "en")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment