hydrologykg

SAWGraph Hydrology KG

The Hydrology KG is the part of the SAWGraph project that describes streams, waterbodies and wells and their locations.

521.6M triples
127 classes
146 properties
11.3M subjects

The SAWGraph Hydrology KG is part of the Safe Agricultural Products and Water Graph (SAWGraph) that facilities environmental regulators, water safety officials, and PFAS researchers to trace pollutant pathways, identify upstream contamination sources, assess downstream impacts from point sources, and determine which water wells are hydrologically connected to contaminated sites. The Hydrology knowledge graph integrates surface water features including stream reaches, watersheds and waterbodies (e.g. lakes), groundwater features like aquifers and wells, and hydrological connectivity data to support contaminant tracing and water quality analysis. It is built from USGS’s National Hydrography Dataset (NHDPlus) and state well and aquifer datasets. All features are spatially integrated with Level 13 S2 cells and Level 3 administrative regions using KnowWhereGraph topological relations and reuse of geoconnex URIs allows linking to additional details.

Retrieve all flowlines named 'Illinois River
PREFIX hyf: <https://www.opengis.net/def/schema/hy_features/hyf/>
PREFIX nhdplusv2: <http://nhdplusv2.spatialai.org/v1/nhdplusv2#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX schema: <https://schema.org/>

SELECT * WHERE {
  # Select flowlines and desired attributes
  ?flowline rdf:type hyf:HY_FlowPath ;
            schema:name ?name ;
            nhdplusv2:hasCOMID ?COMID ;
            nhdplusv2:hasFTYPE ?FTYPE .
  # Keep only flowlines with the desired name
  FILTER (?name = "Illinois River")
} ORDER BY ?COMID
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?COMID"):::projected 
  v4("?FTYPE"):::projected 
  v3("?flowline"):::projected 
  v2("?name"):::projected 
  c3([hyf:HY_FlowPath]):::iri 
  f0[["?name = 'Illinois River'"]]
  f0 --> v2
  v3 --"a"-->  c3
  v3 --"schema:name"-->  v2
  v3 --"nhdplusv2:hasCOMID"-->  v1
  v3 --"nhdplusv2:hasFTYPE"-->  v4
What surface water bodies are downstream from a particular S2 cell?
PREFIX spatial: <http://purl.org/spatialai/spatial/spatial-full#>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX hyf: <https://www.opengis.net/def/schema/hy_features/hyf/>
PREFIX kwg-ont: <http://stko-kwg.geog.ucsb.edu/lod/ontology/>
PREFIX nhdplusv2: <http://nhdplusv2.spatialai.org/v1/nhdplusv2#>
PREFIX schema: <https://schema.org/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?us_fl_name ?downstream_flowline ?ds_fl_name ?ds_fl_ftype WHERE {
  ?upstream_flowline rdf:type hyf:HY_FlowPath ;
                     spatial:connectedTo <http://stko-kwg.geog.ucsb.edu/lod/resource/s2.level13.5526595845832572928> ;
                     # find all flowlines downstream
                     # hyf:downstreamWaterBodyTC gets the transitive closure
                     hyf:downstreamFlowPathTC ?downstream_flowline ;
                     geo:hasGeometry/geo:asWKT ?us_fl_geom .
  # If available, pull the GNIS name for each flowline
  OPTIONAL { ?upstream_flowline schema:name ?us_fl_name . }
  OPTIONAL { ?downstream_flowline schema:name ?ds_fl_name . }
  # Retrieve the flowline type and geometry for each downstream flowline
  ?downstream_flowline nhdplusv2:hasFTYPE ?ds_fl_ftype ;
                       geo:hasGeometry/geo:asWKT ?ds_fl_geom .
} ORDER BY ?downstream_flowline
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?downstream_flowline"):::projected 
  v6("?ds_fl_ftype"):::projected 
  v7("?ds_fl_geom")
  v5("?ds_fl_name"):::projected 
  v2("?upstream_flowline")
  v3("?us_fl_geom")
  v4("?us_fl_name"):::projected 
  a1((" "))
  a2((" "))
  c4([kwg:s2.level13.5526595845832572928]):::iri 
  c2([hyf:HY_FlowPath]):::iri 
  v2 --"a"-->  c2
  v2 --"spatial-full:connectedTo"-->  c4
  v2 --"hyf:downstreamFlowPathTC"-->  v1
  v2 --"geo:hasGeometry"-->  a1
  a1 --"geo:asWKT"-->  v3
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v2 -."schema:name".->  v4
  end
  subgraph optional1["(optional)"]
  style optional1 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."schema:name".->  v5
  end
  v1 --"nhdplusv2:hasFTYPE"-->  v6
  v1 --"geo:hasGeometry"-->  a2
  a2 --"geo:asWKT"-->  v7
SPARQL Endpoint https://apps.okn.us/hydrologykg/sparql
Triple Pattern Fragments https://apps.okn.us/ldf/hydrologykg
ClassEntities
PropertyTriples