Created
August 12, 2024 14:37
-
-
Save ksonda/1f24bfb3bc0f31643f07bee3014c284c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX schema: <https://schema.org/> | |
PREFIX gsp: <http://www.opengis.net/ont/geosparql#> | |
PREFIX wiki: <https://www.wikidata.org/wiki/> | |
PREFIX hyf: <https://www.opengis.net/def/schema/hy_features/hyf/> | |
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | |
SELECT ?dataset ?variableName ?temporalCoverage WHERE { | |
# Bind the @id of the mainstem of interest | |
BIND(<https://geoconnex.us/ref/mainstems/1009561> AS ?mainstem) | |
# Find all monitoring locations that reference the mainstem | |
?monitoringLocation hyf:referencedPosition/hyf:HY_IndirectPosition/hyf:linearElement ?mainstem . | |
# Get the datasets for each monitoring location | |
?monitoringLocation schema:subjectOf ?dataset . | |
# Get the measured variable name and temporal coverage for each dataset | |
?dataset schema:variableMeasured/schema:name ?variableName ; | |
schema:temporalCoverage ?temporalCoverage . | |
# Filter datasets by the desired variable name using fuzzier matching | |
FILTER(REGEX(?variableName, "stream(flow)?|discharge|flow", "i")) | |
# Filter datasets to only include those with a temporal coverage | |
# starting before 2018-01-01 and continuing to the present | |
FILTER(strdt(?temporalCoverage, xsd:dateTime) <= "2018-01-01T00:00:00"^^xsd:dateTime && | |
STRSTARTS(?temporalCoverage, "..")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment