Last active
September 16, 2024 15:43
-
-
Save C-Loftus/1ce984579cd64ff215dfaa28dd715af4 to your computer and use it in GitHub Desktop.
graph.geoconnex sample sparql query
This file contains hidden or 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#> | |
| PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
| SELECT DISTINCT | |
| ?mainstem | |
| ?monitoringLocation | |
| ?siteName | |
| ?datasetDescription | |
| ?datasetProvider | |
| ?type | |
| ?url | |
| ?variableMeasured | |
| ?variableUnit | |
| ?measurementTechnique | |
| ?temporalCoverage | |
| ?wkt | |
| ### group concat output | |
| ?distributionNames | |
| ?distributionURLs | |
| ?distributionFormats | |
| #### | |
| WHERE { | |
| VALUES ?mainstem { | |
| <https://geoconnex.us/ref/mainstems/29559> | |
| } | |
| ?monitoringLocation (hyf:referencedPosition/hyf:HY_IndirectPosition/hyf:linearElement) ?mainstem; | |
| schema:subjectOf ?item. | |
| ?item (schema:variableMeasured/schema:description) ?datasetDescription; | |
| schema:temporalCoverage ?temporalCoverage; | |
| schema:name ?siteName; | |
| schema:provider/schema:name ?datasetProvider. | |
| ?monitoringLocation hyf:HydroLocationType ?type; | |
| (schema:subjectOf/schema:url) ?url; | |
| (schema:subjectOf/schema:variableMeasured/schema:name) ?variableMeasured; | |
| (schema:subjectOf/schema:variableMeasured/schema:unitText) ?variableUnit; | |
| (gsp:hasGeometry/gsp:asWKT) ?wkt; | |
| (schema:subjectOf/schema:variableMeasured/schema:measurementTechnique) ?measurementTechnique. | |
| { | |
| SELECT ?monitoringLocation (GROUP_CONCAT(DISTINCT ?distributionFormat; SEPARATOR = " | ") AS ?distributionFormats) (GROUP_CONCAT(DISTINCT ?distributionName; SEPARATOR = " | ") AS ?distributionNames) (GROUP_CONCAT(DISTINCT ?distributionURL; SEPARATOR = " | ") AS ?distributionURLs) WHERE { | |
| VALUES ?mainstem { | |
| <https://geoconnex.us/ref/mainstems/29559> | |
| } | |
| ?monitoringLocation (hyf:referencedPosition/hyf:HY_IndirectPosition/hyf:linearElement) ?mainstem; | |
| (schema:subjectOf/schema:distribution) ?distribution. | |
| ?distribution schema:encodingFormat ?distributionFormat; | |
| schema:name ?distributionName; | |
| schema:contentUrl ?distributionURL. | |
| } | |
| GROUP BY ?monitoringLocation | |
| } | |
| } | |
| LIMIT 10 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Clean flat query no concat