diff --git a/.env.example b/.env.example index f25434c..063f14a 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,6 @@ # Frontend -# URL of the sawgraph-api service (e.g. http://localhost:3001 in dev, -# https://sawgraph-api.onrender.com in prod). +# URL of the API service: +# local dev http://localhost:3001 +# development https://sawgraph-explorer-api-development.up.railway.app +# production https://sawgraph-explorer-api.up.railway.app VITE_API_BASE_URL=http://localhost:3001 diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 0000000..4f21a5a --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,72 @@ +name: Checks + +# The repo's self-checks, on every pull request. They were all runnable before +# this file existed and none of them ran unless someone remembered to, which is +# how an engine bug that every one of these styles of check would have caught +# (upstream tracing the relation backwards, see docs/DEBUGGING.md 2026-09-16) +# survived from the first commit to 2026-09-16. +# +# Everything here is offline and takes seconds. No secrets, no SPARQL, no +# endpoint concurrency group: the live-endpoint workflows (health-check.yml, +# warm-cache.yml) are the ones that have to queue. + +on: + pull_request: + push: + branches: [main, development] + workflow_dispatch: + +jobs: + checks: + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: npm + + # react-leaflet's peer range does not include React 19 (see CLAUDE.md) + - run: npm ci --legacy-peer-deps + + - name: Build (tsc -b && vite build) + run: npm run build + + # Each of these asserts something that is silent when wrong: a wrong + # answer, a mislabelled step, a cache key that collides. They fail the + # build rather than reporting, because a self-check nobody is obliged to + # read is a self-check that does not exist. + - name: Trace direction + run: npm run check-trace-direction + + - name: Flowline scope + run: npm run check-flowline-scope + + - name: Cache key + run: npm run check-cache-key + + - name: Step labels + run: npm run check-step-labels + + - name: Substance labels + run: npm run check-substance-labels + + - name: Query join order and observation joins + run: npm run check-query-joins + + # Golden-file diff of the SPARQL every shape generates. The one above + # asserts a rule; this one notices when a change moves a shape nobody was + # thinking about, which is the failure mode of a shared query builder. + - name: Query snapshots + run: npm run check-query-snapshots + + # Not blocking yet: `npm run lint` reports 15 pre-existing errors, all in + # components and none related to the engine. Make this a required step in + # the same change that clears them, not before, or the signal is noise + # from day one. + - name: Lint (advisory) + run: npm run lint + continue-on-error: true diff --git a/.github/workflows/health-check.yml b/.github/workflows/health-check.yml new file mode 100644 index 0000000..0ce8d0f --- /dev/null +++ b/.github/workflows/health-check.yml @@ -0,0 +1,135 @@ +name: Dashboard health + +# Runs every dashboard question against the live endpoints once a week and +# writes down what happened: worked or not, how long, how many rows. The point +# is dating a regression. Without this, "the Indiana question broke sometime in +# the last month" is the best anyone can say. +# +# Both branches are measured because they hit the same SPARQL endpoints — so a +# difference between main and development is a difference in *our* code. +# +# No secrets. This never reads or writes the result cache: a cached answer would +# report on the cache rather than on the graph. +# +# The schedule only fires once this file is on the default branch (main) — +# GitHub ignores cron in workflows that live only on a feature branch. + +on: + schedule: + - cron: '0 6 * * 1' # Mondays, 06:00 UTC + workflow_dispatch: + +# One job at a time across *every* workflow that queries the graph — this group +# name is shared with warm-cache.yml on purpose. Both run the same eight heavy +# questions, and a warm run started by hand on a Monday morning would otherwise +# land on top of the health cron. That is not hypothetical: three questions were +# recorded as broken while this was being built, purely because something else +# was querying at the same time, and all three passed on retry. +concurrency: + group: sawgraph-endpoint + cancel-in-progress: false + +permissions: + contents: write # commit the history file and status page + issues: write # open an issue when a question regresses + +jobs: + measure: + runs-on: ubuntu-latest + timeout-minutes: 90 + + steps: + - name: Check out development (the branch results are committed to) + uses: actions/checkout@v4 + with: + ref: development + + - name: Check out main alongside it + uses: actions/checkout@v4 + with: + ref: main + path: main-ref + + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: npm + + # react-leaflet's peer range does not include React 19 (see CLAUDE.md) + - run: npm ci --legacy-peer-deps + + - name: Measure development + id: dev + # bash, not the default sh-with-e: without pipefail the exit code would + # be tee's, and a regression would sail through as a pass. + shell: bash + run: npm run health-check -- development | tee dev.log + continue-on-error: true + + - name: Install main's dependencies + working-directory: main-ref + run: npm ci --legacy-peer-deps + + # Runs main's code, but appends to development's history file so both + # branches land in one commit and one status page. + - name: Measure main + id: main + working-directory: main-ref + shell: bash + run: npm run health-check -- main --out "$GITHUB_WORKSPACE/docs/health/history.jsonl" | tee "$GITHUB_WORKSPACE/main.log" + continue-on-error: true + + - name: Commit the results + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + git add docs/health/ + if git diff --cached --quiet; then + echo "Nothing changed." + else + git commit -m "chore: dashboard health $(date -u +%Y-%m-%d)" + git push + fi + + - name: Summary + if: always() + run: | + { + echo "### Dashboard health" + echo + echo '```' + tail -24 dev.log 2>/dev/null || echo "development: no output" + echo + tail -24 main.log 2>/dev/null || echo "main: no output" + echo '```' + } >> "$GITHUB_STEP_SUMMARY" + + # Exit code 2 from the script means a question that worked last week does + # not work now. An issue rather than just a red X, because a red X in a + # weekly job is easy to miss for another week. + - name: Open an issue for regressions + if: steps.dev.outcome == 'failure' || steps.main.outcome == 'failure' + env: + GH_TOKEN: ${{ github.token }} + run: | + { + echo "The weekly health check found a dashboard question that worked before and does not now." + echo + echo "See [the run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) and [docs/health/STATUS.md](${{ github.server_url }}/${{ github.repository }}/blob/development/docs/health/STATUS.md)." + echo + for log in dev.log main.log; do + [ -f "$log" ] || continue + echo "### ${log%.log}" + echo '```' + sed -n '/REGRESSIONS/,$p' "$log" 2>/dev/null | head -40 + echo '```' + done + } > issue.md + gh issue create \ + --title "Dashboard health: a question regressed ($(date -u +%Y-%m-%d))" \ + --body-file issue.md \ + --label bug + + - name: Fail if a question regressed + if: steps.dev.outcome == 'failure' || steps.main.outcome == 'failure' + run: exit 1 diff --git a/.github/workflows/warm-cache.yml b/.github/workflows/warm-cache.yml new file mode 100644 index 0000000..7bc61c0 --- /dev/null +++ b/.github/workflows/warm-cache.yml @@ -0,0 +1,85 @@ +name: Warm result cache + +# Runs the dashboard questions and stores their results, so visitors get them +# instantly instead of waiting 10-70s for a live pipeline run. +# +# Manual on purpose: a cached entry only goes stale when the knowledge graph +# reloads or its 30-day TTL expires, and both are things we control. To make it +# periodic anyway, add a schedule trigger: +# +# schedule: +# - cron: '0 6 * * 1' # Mondays, 06:00 UTC +# +# Setup (once): add the repository secrets CACHE_WRITE_TOKEN_DEV and +# CACHE_WRITE_TOKEN_PROD, matching CACHE_WRITE_TOKEN on each API service. + +on: + workflow_dispatch: + inputs: + environment: + description: Which API to warm + type: choice + required: true + default: development + options: [development, production] + only: + description: 'Optional: only questions whose title contains this text' + type: string + required: false + allow_partial: + description: Cache results even when some slices failed + type: boolean + default: false + +# One job at a time across *every* workflow that queries the graph — shared with +# health-check.yml, so a warm run and the weekly health check queue rather than +# compete for the same graph engine. Warming both environments now serialises +# too, which costs a few minutes and buys clean measurements. +concurrency: + group: sawgraph-endpoint + cancel-in-progress: false + +jobs: + warm: + runs-on: ubuntu-latest + timeout-minutes: 45 + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: npm + + # react-leaflet's peer range does not include React 19 (see CLAUDE.md) + - run: npm ci --legacy-peer-deps + + - name: Warm the cache + env: + API_BASE: >- + ${{ inputs.environment == 'production' + && 'https://sawgraph-explorer-api.up.railway.app' + || 'https://sawgraph-explorer-api-development.up.railway.app' }} + CACHE_WRITE_TOKEN: >- + ${{ inputs.environment == 'production' + && secrets.CACHE_WRITE_TOKEN_PROD + || secrets.CACHE_WRITE_TOKEN_DEV }} + ALLOW_PARTIAL: ${{ inputs.allow_partial && '1' || '0' }} + run: | + if [ -z "$CACHE_WRITE_TOKEN" ]; then + echo "::error::No cache write token for '${{ inputs.environment }}'." + echo "::error::Add CACHE_WRITE_TOKEN_DEV / CACHE_WRITE_TOKEN_PROD as repository secrets." + exit 1 + fi + npm run warm-cache -- "${{ inputs.only }}" | tee warm-cache.log + + - name: Summary + if: always() + run: | + { + echo "### Warm result cache — ${{ inputs.environment }}" + echo + echo '```' + tail -20 warm-cache.log 2>/dev/null || echo "no output" + echo '```' + } >> "$GITHUB_STEP_SUMMARY" diff --git a/README.md b/README.md index 84c290c..8386aa4 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,19 @@ npm run preview # Preview production build ## Deployment -Deployed on **Railway** from the `main` branch. Build config lives in the Railway -dashboard, not in this repo — there is no `railway.json` or `nixpacks.toml` here. +Deployed on **Railway**, two environments, each with a frontend and an API +service. Build config lives in the Railway dashboard, not in this repo — there +is no `railway.json` or `nixpacks.toml` here. + +| Environment | Branch | Frontend | API | +| --- | --- | --- | --- | +| Production | `main` | https://sawgraph-explorer.up.railway.app | https://sawgraph-explorer-api.up.railway.app | +| Development | `development` | https://sawgraph-explorer-development.up.railway.app | https://sawgraph-explorer-api-development.up.railway.app | + +The frontend reaches the API through `VITE_API_BASE_URL`, baked in at build +time, so each environment's frontend points at its own API. The API allows the +frontend's origin via `FRONTEND_ORIGIN`. Both services share a Postgres +instance per environment. ## How queries work @@ -56,9 +67,14 @@ When you click Apply, the query engine: 2. **Executes** steps sequentially (`engine/executor.ts`), threading S2 cell sets between steps 3. **Renders** results as map layers (`resultTransformer.ts` → `MapFeature[]`) -Supported entity types: **samples**, **facilities**, **water bodies** +Supported entity types: **samples**, **facilities**, **water bodies**, **wells**, **streams** Supported relationships: **near** (~1–2 km), **downstream**, **upstream** +Downstream/upstream traces accept an optional cumulative flowpath cutoff +(`Within N km of flow`). Unset, the trace is the full transitive closure. +`node scripts/flow-distance-check.mjs` verifies the bounded trace against the +live endpoints. + ## SPARQL endpoints All hosted at `apps.okn.us`: @@ -85,11 +101,16 @@ All hosted at `apps.okn.us`: Inside `docs/`: -| File | Contents | -| ----------------- | --------------------------------------------------- | -| `ARCHITECTURE.md` | System design, module boundaries, data flow | -| `SCHEMA.md` | Predicate inventories, class counts, endpoint roles | -| `DEBUGGING.md` | Documented bugs with root causes and fixes | -| `CONVENTIONS.md` | Coding standards, endpoint selection rules | -| `changelog/` | Weekly changelogs (`YYYY-Www.md`) | -| `plans/` | Feature planning: `drafts/` → `active/` → `done/` | +| File | Contents | +| ------------------- | --------------------------------------------------------------- | +| `ARCHITECTURE.md` | System design, module boundaries, data flow | +| `SCHEMA.md` | Predicate inventories, class counts, endpoint roles | +| `QUERY-MATRIX.md` | Every query shape, measured — plus the error catalogue (Part 4) | +| `health/STATUS.md` | Weekly dashboard health: working, timings, row-count drift | +| `query-matrix/` | One CSV per sweep, dated, with a generated index | +| `DEBUGGING.md` | Documented bugs with root causes and fixes | +| `CONVENTIONS.md` | Coding standards, endpoint selection rules | +| `wiki/` | One page per filter dropdown; source of truth for the GitHub Wiki | +| `queries/` | Write-ups of individual real questions | +| `changelog/` | Weekly changelogs (`YYYY-Www.md`) | +| `plans/` | Feature planning: `drafts/` → `active/` → `done/` | diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 5ea4002..93d865e 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -11,9 +11,13 @@ A comprehensive guide to understanding how this application works, from knowledg 3. [Folder Structure](#folder-structure) 4. [Data Flow](#data-flow) 5. [The Query Pipeline](#the-query-pipeline) -6. [SPARQL Queries](#sparql-queries) -7. [Key Design Decisions](#key-design-decisions) -8. [The Endpoints](#the-endpoints) +6. [Bounded Execution](#bounded-execution) +7. [The Result Cache](#the-result-cache) +8. [SPARQL Queries](#sparql-queries) +9. [Key Design Decisions](#key-design-decisions) +10. [The Endpoints](#the-endpoints) +11. [Common Patterns](#common-patterns) +12. [Debugging Tips](#debugging-tips) --- @@ -62,6 +66,12 @@ This finds all facilities with industry code 3253 and returns their names. │ ▼ ┌─────────────────────────────────────────────────────────────┐ +│ Result Cache │ +│ A hit here skips everything below (server/ + Postgres) │ +└────────────────┬────────────────────────────────────────────┘ + │ miss + ▼ +┌─────────────────────────────────────────────────────────────┐ │ Query Pipeline │ │ (Planner → Executor → Result Transformer) │ └────────────────┬────────────────────────────────────────────┘ @@ -69,7 +79,7 @@ This finds all facilities with industry code 3253 and returns their names. ▼ ┌─────────────────────────────────────────────────────────────┐ │ SPARQL Query Templates │ -│ (Facilities, Samples, Water Bodies, Spatial, Hydrology) │ +│ (fusedQueries · hydrate · regions · wells · aquifers) │ └────────────────┬────────────────────────────────────────────┘ │ ▼ @@ -81,65 +91,77 @@ This finds all facilities with industry code 3253 and returns their names. ▼ ┌─────────────────────────────────────────────────────────────┐ │ Knowledge Graphs │ -│ (RDF Triples in GraphDB) │ +│ (RDF triples, served by QLever) │ └─────────────────────────────────────────────────────────────┘ ``` **The flow:** -1. User asks: "What samples are near facilities in Maine?" -2. Query pipeline breaks this into steps -3. Each step generates a SPARQL query -4. Query executes against the right endpoint -5. Results transform into map features -6. Map displays points/polygons +1. User builds a question from three blocks: "samples" + "near" + "landfills in Maine" +2. If that exact question is already cached, the answer comes back in one request +3. Otherwise the planner breaks it into steps +4. Each step generates a SPARQL query and runs against the right endpoint +5. A step that is too big for the engine is split and retried in slices +6. Results transform into map features +7. Map displays points, lines and polygons --- ## Folder Structure ``` -sawgraph-query-editor/ +explorer/ ├── src/ │ ├── components/ # React UI components │ │ ├── Dashboard/ # Pre-built query cards │ │ ├── QueryEditor/ # Block A / Relationship / Block C editors -│ │ ├── Map/ # Leaflet map + layers -│ │ ├── Pipeline/ # Pipeline progress visualization +│ │ ├── Map/ # Leaflet map + one layer component per entity type +│ │ ├── Pipeline/ # Progress strip, partial-results notice +│ │ ├── Publish/ # Share a question and its result by link +│ │ ├── DesignSystem/ # Design guide route +│ │ ├── common/ # FlatSelect, HierarchicalSelect, shared bits │ │ └── Layout/ # Header, sidebar, layout │ │ -│ ├── engine/ # THE CORE: Query pipeline logic -│ │ ├── planner.ts # Converts question → pipeline steps -│ │ ├── executor.ts # Executes steps sequentially -│ │ ├── sparqlClient.ts # Sends SPARQL to endpoints +│ ├── engine/ # THE CORE: query planning and execution +│ │ ├── planner.ts # Question → pipeline steps +│ │ ├── executor.ts # Runs steps, splits what the engine refuses +│ │ ├── scope.ts # How to slice a step that was too big +│ │ ├── sparqlClient.ts # Sends SPARQL, retries, 60s request timeout +│ │ ├── sparqlErrors.ts # Classifies failures (a 429 is usually a timeout) +│ │ ├── queryBreadth.ts # Pre-flight warning for questions that reliably fail +│ │ ├── cacheKey.ts # Canonical question → cache key +│ │ ├── wire.ts # What a cached result looks like on the wire │ │ ├── resultTransformer.ts # SPARQL rows → map features -│ │ └── templates/ # SPARQL query builders -│ │ ├── facilities.ts -│ │ ├── samples.ts -│ │ ├── waterBodies.ts -│ │ ├── spatial.ts # Region filters, near expansion -│ │ └── hydrology.ts # Upstream/downstream tracing -│ │ -│ ├── store/ -│ │ └── queryStore.ts # Zustand state (question + results) -│ │ -│ ├── hooks/ -│ │ └── useDiscoveryQueries.ts # React Query for dropdown data +│ │ └── templates/ # SPARQL builders +│ │ ├── fusedQueries.ts # The main one: spatial + hydrological joins +│ │ ├── hydrate.ts # Fetch details for a known list of IRIs +│ │ ├── regions.ts # Dropdown discovery queries +│ │ ├── downstreamSamples.ts +│ │ ├── wells.ts · aquifers.ts +│ │ ├── facilities.ts · samples.ts # Shared fragments, not whole queries +│ │ └── spatial.ts # Region boundary geometry │ │ -│ ├── types/ -│ │ ├── query.ts # AnalysisQuestion, filters -│ │ └── sparql.ts # SPARQL response types +│ ├── api/ # Talks to our own API (not to SPARQL) +│ │ ├── resultCacheClient.ts +│ │ └── publishClient.ts │ │ -│ └── constants/ -│ ├── endpoints.ts # SPARQL endpoint URLs -│ ├── prefixes.ts # SPARQL namespace prefixes -│ └── regions.ts # US states with data +│ ├── store/queryStore.ts # Zustand: the question, results, view state +│ ├── storage/ # localStorage: saved questions, publish tokens +│ ├── hooks/ # React Query + pipeline hooks +│ ├── types/ # AnalysisQuestion, MapFeature, SPARQL rows +│ └── constants/ # Endpoints, prefixes, regions, prebuilt queries │ -└── docs/ - ├── ARCHITECTURE.md # This file - ├── DISCOVERY.md # Predicate inventories + debugging findings - ├── CONVENTIONS.md # Coding standards and patterns - ├── changelog/ # Weekly changelog files (YYYY-Www.md) - └── plans/ # Planning workflow (drafts → active → done) +├── server/ # Express + Postgres API (deployed separately) +│ └── src/ +│ ├── resultCache.ts # Gzipped results in Postgres, with TTLs +│ ├── routes/results.ts # Public read, token-gated write +│ └── routes/publish.ts # Published questions +│ +├── scripts/ # Maintainer tools (tsx) +│ ├── warm-cache.mts # Run the dashboard questions, upload the results +│ ├── check-cache-key.mts # Assertions on cache-key canonicalisation +│ └── query-matrix.mts # Measure every query shape, write the CSV +│ +└── docs/ # See CLAUDE.md for the full map ``` **Key directories:** @@ -147,6 +169,7 @@ sawgraph-query-editor/ - **`components/`** — React UI. Organized by screen area. - **`store/`** — Zustand for global state (the current question and results). - **`hooks/`** — React Query for async data fetching (dropdown population). +- **`server/`** — The only part that is not a static bundle. Holds the cache. --- @@ -157,79 +180,151 @@ sawgraph-query-editor/ User selects in the UI: - **Block A** (target): "Samples" - **Relationship**: "near" -- **Block C** (anchor): "Facilities with NAICS 3253" -- **Region**: "Maine" +- **Block C** (anchor): "Landfills" (NAICS 562212) +- **Region**: "Penobscot County, Maine" -This creates an `AnalysisQuestion` object: +This creates an `AnalysisQuestion` object (`src/types/query.ts`): ```typescript { blockA: { type: 'samples', - sampleFilters: { substances: [...], materialTypes: [...] }, - region: { stateCode: '23', countyCodes: ['23019'] } + region: { + stateCode: '23', + countyCodes: ['23019'], + countyLabels: { '23019': 'Penobscot County, Maine' } // display only + } }, - relationship: { type: 'near' }, + relationship: { type: 'near', hops: 1 }, blockC: { type: 'facilities', - facilityFilters: { industryCodes: ['3253'] }, - region: { stateCode: '23' } + facilityFilters: { industryCodes: ['562212'] } } } ``` +Six entity types are available for either block: `samples`, `facilities`, +`waterBodies`, `wells`, `aquifers`, `streams`. Four relationships: `near` +(with `hops`), `within`, `downstream` and `upstream` (each with an optional +`maxDistanceKm`). + +The `*Labels` maps exist only to render chips in the editor. They never reach a +query, and `cacheKey.ts` strips them, so re-picking the same county with +different label text still hits the cache. + ### 2. Planner Creates Pipeline Steps -`planner.ts` converts the question into a sequence of steps: +`planner.ts` converts the question into a sequence of steps. For the question +above: ```typescript [ - Step 1: GET_S2_FOR_ANCHOR (Find S2 cells with NAICS 3253 facilities) - Step 2: FILTER_S2_TO_REGION (Keep only Maine S2 cells) - Step 3: EXPAND_S2_NEAR (Expand to neighboring S2 cells ~10km) - Step 4: FILTER_S2_POST_SPATIAL (Filter expanded cells to target region) - Step 5: FIND_TARGET_ENTITIES (Find samples in those S2 cells) - Step 6: GET_ANCHOR_DETAILS (Get facility details for map) - Step 7: GET_REGION_BOUNDARIES (Get Maine boundary polygon) + FIND_TARGET_IRIS // federation — which samples are near a landfill? + FIND_ANCHOR_IRIS // federation — which landfills have a sample nearby? + HYDRATE_TARGET_BY_IRI // federation — details for those samples + HYDRATE_ANCHOR_BY_IRI // federation — details for those landfills + GET_REGION_BOUNDARIES // spatialkg — the county outline to draw ] ``` +The full vocabulary is seven step types (`planner.ts` `PipelineStepType`). Two +more appear for hydrological questions: `GET_FLOWLINE_GEOMETRIES` draws the +river reaches, and `GET_SAMPLE_DETAILS` exists but is no longer emitted — +per-sample observations are fetched on demand when a popup opens +(`useSampleDetails.ts`), because fetching them up front cost 18–37 MB per run. + Each step specifies: - **Type** (what kind of operation) - **Endpoint** (which knowledge graph to query) - **Description** (shown to user during execution) -- **Query builder** (function that generates SPARQL) - -### 3. Executor Runs Steps Sequentially - -`executor.ts` runs each step in order: +- **Query builder** — `(context, scope?) => string` +- **`divide`** (optional) — how to slice this step if it is too big +- **`optional`** (optional) — if true, a failure here does not abort the run + +**Find first, then hydrate.** The discovery steps return bare IRIs and nothing +else; the hydrate steps take that list and fetch geometry, labels and +measurements for exactly those entities. Keeping them apart is what stopped an +ID-finding query from building every measurement in the state and throwing it +away — see `docs/QUERY-MATRIX.md` Part 5. + +**Which block seeds the trace, and which way it runs.** The templates know +nothing about block A and block C. They take an *anchor* (the side the query +seeds from, bound into `?s2anchor`) and a *target*, and they trace in one +direction only: the target comes out `direction` of the anchor. So the planner +has to decide two separate things, and they are not independent. + +| Relationship | Anchor is | Target is | Trace runs | Why the anchor is forced | +| --- | --- | --- | --- | --- | +| `A near C` | block C | block A | n/a | symmetric, either side works | +| `A downstream from C` | block C | block A | downstream | C is the upstream side | +| `A upstream from C` | **block A** | block C | **downstream** | A is the upstream side, and seeding from an unfiltered C ("every stream in the country") times out | + +Read the table by its last column and the rule is one line: **the anchor is +always the upstream side of the question, so the trace always runs downstream +from the seed.** Which block that is flips for `upstream`, which is the reason +the two decisions have to be made separately rather than passing +`relationship.type` through as the direction. Doing exactly that answered the +mirror question for every upstream shape until 2026-09-16 +(`docs/DEBUGGING.md`, 2026-09-16), and it is guarded now by +`scripts/check-trace-direction.mts`, which reads the emitted SPARQL rather than +the flag, because three separate builders trace and they all have to agree. + +### 3. Executor Runs the Steps + +`executor.ts` runs steps in order, but each step is more than one request. ```typescript -for (const step of steps) { - // 1. Build SPARQL query using context from previous steps - const query = step.buildQuery(context); - - // 2. Execute against the endpoint - const results = await executeSparql(step.endpoint, query); - - // 3. Update context for next step - if (step produces S2 cells) { - context.s2Cells = results.map(r => r.s2cell); +// Simplified from executor.ts runStep() +const queue: (Scope | undefined)[] = [undefined]; // undefined = the whole query + +while (queue.length) { + const scope = queue.shift(); + try { + rows = await executeSparql(step.endpoint, step.buildQuery(context, scope)); + merge(rows); // deduped by JSON.stringify(row) + } catch (err) { + if (isSplittable(err) && step.divide) { + queue.unshift(...await step.divide(scope)); // try it in smaller pieces + } else { + failed.push(scope?.label ?? 'whole query'); + } + } + if (Date.now() - stepStart > STEP_CEILING_MS) { // 300s per step + skipped.push(...remaining); + break; } - - // 4. Store results - context.results[step.type] = results; - - // 5. Early exit if no S2 cells (empty result) - if (context.s2Cells.length === 0) break; } ``` -**Key concept: Threading S2 cells through steps** -- Step 1 finds S2 cells `['kwgr:s2.level13.123', 'kwgr:s2.level13.456']` -- Step 2 filters them to `['kwgr:s2.level13.123']` -- Step 3 expands to `['kwgr:s2.level13.123', 'kwgr:s2.level13.789']` -- Step 5 uses those cells to find samples +**Try whole, then split.** Every step is attempted in one request first. Only +the slices that actually fail get divided, so a question that fits pays nothing +for the machinery. + +**The slice is chosen per question** (`scope.ts` `chooseAxis`). Which axis is +right flips between states: Maine has 4,528 samples and 2,976 facilities, +Illinois has 78 and 22,574 — so there is no fixed answer to "which side should +we chunk". `chooseAxis` probes both sides in parallel (`LIMIT 201`, cheap), uses +whichever it can enumerate, and falls back to splitting by county. When even +that runs out — a question already scoped to a *single* county, with both sides +past the cheap probe limit — it probes the filtered side once more with a much +higher limit and chunks that. That last resort exists because a single county +is not divisible and the run would otherwise fail outright: 411 Cook County +facilities enumerate fine and chunk into slices of 25 that each answer in +seconds. A slice that still fails is `halve`d until it cannot be divided +further. + +**A run can succeed with pieces missing.** `PartialFailure` distinguishes +*failed* slices (refused even at minimum size — the question needs changing) +from *skipped* ones (the 300s ceiling ran out — running it again may finish). +`PartialResultsNotice.tsx` names them: "York County, Maine could not be +answered". + +**Early exit.** If `FIND_TARGET_IRIS` returns nothing, the run stops there — +there is no point hydrating an empty list. + +**What threads between steps** is `context.targetIris` / `context.anchorIris`, +the entity IRIs found by the discovery steps. (It used to be S2 cells; see +Key Design Decision 2.) ### 4. Result Transformer → Map Features @@ -265,11 +360,17 @@ Handles Point, LineString, Polygon, MultiPolygon geometries. ### 5. Map Renders Layers -React components in `components/Map/` render features: -- `SampleLayer` — orange circles -- `FacilityLayer` — blue markers -- `WaterBodyLayer` — cyan polygons/lines -- `RegionLayer` — gray boundary polygons +React components in `components/Map/` render features, one per entity type: +- `SampleLayer` — sample points, coloured by concentration +- `FacilityLayer` — facility markers +- `WaterBodyLayer` — water body polygons and lines +- `WellLayer` — wells +- `StreamLayer` — river reaches from `GET_FLOWLINE_GEOMETRIES` +- `AquiferBoundaryLayer` — aquifer polygons +- `RegionBoundaryLayer` — county and state outlines + +`useMapLayers.ts` decides which to build by row shape: a `spWKT` column means +samples, `facWKT` facilities, `wbWKT` water bodies. --- @@ -277,78 +378,104 @@ React components in `components/Map/` render features: ### What is a Pipeline Step? -Each step is an object: +Each step is an object (`planner.ts`): ```typescript { - type: 'GET_S2_FOR_ANCHOR', + type: 'FIND_TARGET_IRIS', endpoint: 'federation', - description: 'Finding S2 cells containing matching facilities', - buildQuery: (context) => { - // Generate SPARQL using: - // - User's filters (NAICS codes) - // - Previous step results (S2 cells from context) - return `SELECT ?s2cell WHERE { ... }` - } + description: 'Finding nearby samples', + buildQuery: (context, scope) => buildFusedNearQuery({ ... }), + divide: (scope) => /* smaller scopes to try instead */, } ``` -### Example: "Samples near facilities" Pipeline +`scope` is what makes a step splittable: `undefined` means "the whole thing", +and anything else narrows it to a list of anchor IRIs, target IRIs, or counties. -Let's trace a full pipeline execution. +### Example: "Samples near landfills" Pipeline -#### User Question: -"What samples in Penobscot County, Maine are near facilities with NAICS 3253?" +The question: *what samples in Penobscot County, Maine are near a landfill +(NAICS 562212)?* -#### Step 1: GET_S2_FOR_ANCHOR (Find facility S2 cells) +#### Step 1: FIND_TARGET_IRIS **Endpoint:** `federation` -**SPARQL Generated:** +**SPARQL generated** (prefixes omitted): ```sparql -SELECT DISTINCT ?s2cell WHERE { - ?s2cell rdf:type kwg-ont:S2Cell_Level13 ; - kwg-ont:sfContains ?facility . - ?facility fio:ofIndustry naics:NAICS-3253 . -} GROUP BY ?s2cell +SELECT DISTINCT (?spC AS ?iri) WHERE { + ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . + ?s2anchor kwg-ont:sfContains ?facilityA . + ?facilityA fio:ofIndustry ?industryCodeA . + ?industryCodeA a naics:NAICS-IndustryCode . + VALUES ?selectedIndustryA { naics:NAICS-562212 } + FILTER(?industryCodeA = ?selectedIndustryA + || EXISTS { ?industryCodeA fio:subcodeOf ?selectedIndustryA }) + + ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . + ?s2target rdf:type kwg-ont:S2Cell_Level13 ; + spatial:connectedTo kwgr:administrativeRegion.USA.23019 . + ?spC rdf:type coso:SamplePoint ; + spatial:connectedTo ?s2target . +} ``` -**What this does:** -- Find all S2 Level 13 cells -- That contain facilities -- With NAICS industry code 3253 +**What this does** — all of it in one query: +- find the S2 cells holding a landfill (`?s2anchor`) +- step one cell outwards (`sfTouches`), which is the "near" in the question +- keep only neighbours inside Penobscot County +- return the sample points in them + +The `FILTER ... EXISTS ... fio:subcodeOf` is what makes picking a parent NAICS +code also match its children. + +**Result:** 14 sample point IRIs. + +#### Step 2: FIND_ANCHOR_IRIS + +The mirror image — the same join, returning `?facilityA` instead. This is not +redundant: it answers "which landfills actually had a sample nearby", so the map +draws only the facilities that took part. -**Result:** 1,534 S2 cells (nationwide with NAICS 3253 facilities) +**Result:** 5 facility IRIs. -#### Step 2: FILTER_S2_TO_REGION (Filter to Maine) +#### Steps 3–4: HYDRATE_*_BY_IRI -**Endpoint:** `spatialkg` +Now that the IDs are known, fetch what the map needs for exactly those, with +the IRIs pinned in a `VALUES` block (`hydrate.ts`): -**SPARQL Generated:** ```sparql -SELECT ?s2cell WHERE { - ?s2neighbor spatial:connectedTo kwgr:administrativeRegion.USA.23 . - VALUES ?s2neighbor { kwgr:s2.level13.123 kwgr:s2.level13.456 ... } - ?s2neighbor kwg-ont:sfTouches | owl:sameAs ?s2cell . -} +SELECT (COUNT(DISTINCT ?observation) AS ?resultCount) + (MAX(?numericResult) AS ?max) + (GROUP_CONCAT(DISTINCT ?substance; separator="; ") AS ?substances) + ?sp ?spWKT ?s2cell +WHERE { + VALUES ?sp { <...samplePoint1> <...samplePoint2> ... } + ?sp spatial:connectedTo ?s2cell ; + geo:hasGeometry/geo:asWKT ?spWKT . + ?observation coso:observedAtSamplePoint ?sp ; + coso:ofDSSToxSubstance ?substance ; + coso:hasResult ?result . + ... +} GROUP BY ?sp ?spWKT ?s2cell ``` -**What this does:** -- Take the 1,534 S2 cells from Step 1 -- Find which ones are connected to Maine (FIPS code 23) -- Return those cells + their touching neighbors +**Result:** 13 sample rows, 5 facility rows. (13, not 14 — one sample point has +no observation matching the filters.) + +#### Step 5: GET_REGION_BOUNDARIES -**Result:** 0 S2 cells (no NAICS 3253 facilities in Maine) +**Endpoint:** `spatialkg` — the county outline to draw under the points. -**Pipeline exits early** — no point continuing if no S2 cells remain. +**Result:** 16 geometry rows. Whole pipeline: **26.6 s**. -#### If there were results... the pipeline would continue: +#### When a step finds nothing -**Step 3:** Expand S2 cells to neighbors (~10km radius) -**Step 4:** Filter expanded cells to target region (Penobscot County) -**Step 5:** Find samples in those S2 cells -**Step 6:** Get facility details for map display -**Step 7:** Get county boundary polygon +Ask the same question with NAICS 3253 (paint manufacturing) instead and Step 1 +returns zero IRIs — there are none in Penobscot County. The run stops there in +**1.2 s** rather than hydrating an empty list, and the UI shows "no results" +rather than an error. An empty answer is a valid answer. ### Why S2 Cells? @@ -370,6 +497,93 @@ Level 30 = ~1 cm² --- +## Bounded Execution + +The graph is served by **QLever**, which gives a query 30 seconds and then kills +it. The most important thing to know about this: **it reports that timeout as +HTTP 429 "Too Many Requests"**, with the real cause only in the JSON body. It is +not rate limiting, and backing off does not help. + +`sparqlErrors.ts` classifies what comes back: + +| Kind | How it arrives | Splitting helps? | +| --- | --- | --- | +| `timeout` | 429 + "Operation timed out" / "Sort operation was canceled" | yes | +| `out-of-memory` | 500 + "Tried to allocate X, but only Y were available" | yes | +| `payload-too-large` | 413 / 502 — our request body was too big | yes | +| `sibling-failure` | 500 + "Waited for a result from another thread" | no — just retry | +| `network` | fetch rejected, or a 200 whose JSON was truncated | no | + +`isSplittable(kind)` is what the executor consults before dividing a step. + +Two guards sit around every request: a **60 s client-side timeout** +(`sparqlClient.ts`) so a hung request cannot stall a run, and one automatic +retry on retryable kinds — a repeat query starts warm, and 26.5 s cold vs 1.5 s +warm has been measured on the same query. + +`queryBreadth.ts` catches a few shapes before they are ever sent: statewide, +broad NAICS, no substance filter is a combination that reliably fails, and the +editor warns rather than spending 30 s proving it. + +**The measurements for all of this live in `docs/QUERY-MATRIX.md`** — Part 4 is +the error catalogue, Parts 6 and 7 the before/after. They are not repeated here +because they are re-measured as the graph changes. + +--- + +## The Result Cache + +A dashboard question takes seconds to compute and gives the same answer to +everyone who asks it. So the answer is stored and served directly: +**37 ms cached against 6,604 ms live** on a warm engine, with identical rows. + +**The key** (`cacheKey.ts`) is a SHA-256 of the canonicalised question. What +canonicalisation does matters more than the hash: +- display-only fields (`countyLabels` and friends) are stripped +- filter arrays are sorted — clicking three substances in a different order is + the same question +- empty objects and arrays collapse to "not set", so a filter set and then + cleared still hits +- everything else is kept verbatim. A field dropped from the key is a wrong + answer served; a field kept unnecessarily is only a cache miss. + +`WIRE_VERSION` and `DATA_VERSION` prefix the key so a change to the stored shape, +or a knowledge-graph reload, makes every existing entry unreachable at once. + +**Nothing in the key describes the engine**, which matters when a fix changes +what a question *means* rather than what it stores. Cached answers to the old +meaning stay reachable for their full 30 days and will be served in preference +to running the corrected query. After a semantics fix, purge the affected +entries by question shape rather than bumping `WIRE_VERSION`, which would throw +away every unaffected entry too: + +```sql +DELETE FROM query_results WHERE question->'relationship'->>'type' = 'upstream'; +SELECT id, title, author FROM published_workflows + WHERE question->'relationship'->>'type' = 'upstream'; -- frozen under publish: +``` + +**What is stored** (`wire.ts`): successes only. An error is nearly always +transient endpoint load, and freezing one would turn a bad minute into a bad +month; an empty result is cheap to recompute. Only the four keys the map +actually renders are kept — the intermediate IRI lists ran to 22.6 MB on a +statewide well question and are never drawn. + +**Who can write.** Reads are public; writes are not. The publisher writes the +result it has just computed, authenticated by the `editToken` the server issued +for that publication. The maintainer script `scripts/warm-cache.mts` writes with +`CACHE_WRITE_TOKEN`. Nothing else can put an entry in front of someone else's +map. + +**Storage** (`server/src/resultCache.ts`): gzipped into a Postgres `BYTEA` +column and served with `Content-Encoding: gzip` — never decompressed on the +server. Capped at 25 MB. Complete results live 30 days; partial ones 6 hours, +because a partial result is a snapshot of a bad moment. + +Add `?cache=off` to any URL to force a live run. + +--- + ## SPARQL Queries ### SPARQL Basics @@ -402,48 +616,39 @@ The `?` variables get bound to actual values from the graph. ### How Our Templates Work -Each template function builds a SPARQL string. Example from `facilities.ts`: +Templates are functions that return a SPARQL string. The main one is +`fusedQueries.ts`, and its central idea is a helper that binds one entity inside +an S2 cell: ```typescript -export function buildFacilityS2Query(filters?: FacilityFilters): string { - const industryValuesClause = buildIndustryValues(filters?.industryCodes); - - return ` - ${PREFIXES} - SELECT DISTINCT ?s2cell WHERE { - ?s2cell rdf:type kwg-ont:S2Cell_Level13 ; - kwg-ont:sfContains ?facility . - ?facility fio:ofIndustry ?industryGroup ; - fio:ofIndustry ?industryCode . - ?industryCode a naics:NAICS-IndustryCode . - ${industryValuesClause} - } GROUP BY ?s2cell - `; +// fusedQueries.ts — simplified +function bindEntityInCell(block: EntityBlock, cellVar: string, suffix: string) { + switch (block.type) { + case 'facilities': + return `?${cellVar} kwg-ont:sfContains ?facility${suffix} . + ${industryFilter(block.facilityFilters)}`; + case 'samples': + return `?sp${suffix} rdf:type coso:SamplePoint ; + spatial:connectedTo ?${cellVar} . + ${sampleFilters(block.sampleFilters)}`; + // wells, aquifers, streams, water bodies... + } } ``` -**If user selects NAICS code "3253":** +Both blocks of a question go through it, once for the anchor cell and once for +the target cell, and the relationship supplies the path between the two cells. +That is the whole trick: "near" is `sfTouches`, and a trace is a flow-path join. -`industryValuesClause` becomes: -```sparql -VALUES ?industryCode { naics:NAICS-3253 } -``` - -**Final query:** -```sparql -PREFIX fio: -PREFIX naics: -PREFIX kwg-ont: +**One guard is worth knowing about.** `bindEntityInCell` takes a +`sampleObservations` flag. An ID-finding query needs the sample *points*; a +detail query needs every observation on them. Serving both callers from one +branch is what made a query to find sample IDs build every measurement in the +state and discard it — the bug behind most of `QUERY-MATRIX.md` Part 5. -SELECT DISTINCT ?s2cell WHERE { - ?s2cell rdf:type kwg-ont:S2Cell_Level13 ; - kwg-ont:sfContains ?facility . - ?facility fio:ofIndustry ?industryGroup ; - fio:ofIndustry ?industryCode . - ?industryCode a naics:NAICS-IndustryCode . - VALUES ?industryCode { naics:NAICS-3253 } -} GROUP BY ?s2cell -``` +The older `facilities.ts` and `samples.ts` are no longer whole-query builders. +They survive as fragment helpers — `buildIndustryValues()`, +`buildSampleFilterClauses()` — called from inside the fused builders. ### Common SPARQL Patterns @@ -502,31 +707,41 @@ Extracts "23" from "kwgr:administrativeRegion.USA.23". - Easy to test — mock step results - Easy to change strategy — edit planner, executor stays the same -### 2. Why Thread S2 Cells Between Steps? +### 2. Why Fuse the Join Into One Query -**Problem:** Can't do cross-endpoint joins in SPARQL (federation endpoint has limitations). +**The original design** threaded S2 cells between steps: find the cells holding +facilities on one endpoint, filter them to a region on another, expand to +neighbours, then look for samples in what was left. S2 cells were the join key +because a cross-endpoint join seemed impossible. -**Solution:** Use S2 cells as a "join key" passed through pipeline steps: -1. Find facility S2 cells in `federation` -2. Filter them in `spatialkg` (has admin region data) -3. Find samples in those cells in `sawgraph` +**What replaced it:** the `federation` endpoint does the join itself, so the +whole chain is one query (`fusedQueries.ts`). S2 cells are still the join +*mechanism* — `?s2anchor`, `?s2target` and the `sfTouches` between them — but +they are variables inside a single query rather than lists carried between +requests. -**Benefits:** -- Works around federation limitations -- Fast (S2 cells are pre-indexed) -- Flexible (any entity can link via S2 cells) +**Why it is better:** +- No intermediate list to transfer. A statewide cell list ran to megabytes. +- The engine can plan the whole join, instead of being handed a `VALUES` block + of cells and no context. +- Fewer requests, so fewer chances to hit the 30 s limit. + +**What it costs:** a fused query is one indivisible unit of work, so when it is +too big there is no natural seam. That is exactly what `scope.ts` exists to +supply — see [Bounded Execution](#bounded-execution). ### 3. Why Zustand + React Query? **Zustand** (`queryStore.ts`) — Global state for: -- Current question (Block A/B/C) -- Pipeline results -- UI state (view mode, progress) +- The current question, plus a baseline and a snapshot for the edit modal +- Pipeline results, step progress, and where the result came from + (`resultProvenance` — live or cache, and when it was computed) +- UI state (view mode, modals, tour) **React Query** (`useDiscoveryQueries.ts`) — Async data fetching for: -- Dropdown options (NAICS codes, substances, etc.) -- Cached with `staleTime: Infinity` (doesn't change) -- Hardcoded fallbacks if endpoints fail +- Dropdown options (NAICS codes, substances, material types, counties) +- Long `staleTime` per hook, since this vocabulary changes on graph reloads +- Hardcoded fallbacks if endpoints fail, so the editor still works **Benefits:** - Separation of concerns (query state vs dropdown data) @@ -545,7 +760,31 @@ Extracts "23" from "kwgr:administrativeRegion.USA.23". - Easy to debug — copy query into SPARQL editor to test - Full control — no library limitations -### 5. Why Transform SPARQL Rows to Features? +### 5. Why Each Filter Declares Its Own Joins + +**Problem:** In SPARQL a triple pattern is an inner join, so *every required +triple is also a filter*. Asking for a field that some records lack deletes +those records, silently and with no filter anywhere in the query saying so. + +**What went wrong:** `bindEntityInCell` used one boolean — did the user set any +sample filter? — and if so fetched the whole measurement record. Ticking a +substance therefore pulled in `coso:measurementUnit`, and a non-detect has no +unit (there is no quantity to put a unit on; the record carries detection limits +instead). So a substance-only question dropped **774 of 1,688** Cumberland PFOS +observations while "Include non-detects" sat ticked. Non-detects are 77% of +Maine's observations, so this understated PFAS presence across the app, and +nothing looked broken: the map still drew, with fewer dots. + +**We chose:** `sampleJoinsNeeded` maps each active filter to the joins that +filter actually reads. Substance needs two triples. A concentration range +genuinely reads the unit, so that case keeps it. Nothing ever needs the material +*label*, which is display-only. + +**The rule to carry into new templates:** fetch what you project or filter on, +nothing else, and reach for `OPTIONAL` the moment a field is not universal. +`scripts/check-query-joins.mts` asserts this across all 108 shapes in CI. + +### 6. Why Transform SPARQL Rows to Features? **Problem:** SPARQL returns flat rows with WKT strings: ```javascript @@ -568,7 +807,9 @@ Extracts "23" from "kwgr:administrativeRegion.USA.23". ## The Endpoints -All endpoints are SPARQL query interfaces to different parts of the knowledge graph. +All endpoints are SPARQL query interfaces to different parts of the knowledge +graph, served by QLever. The counts below come from `docs/SCHEMA.md`, which is +where they get re-verified after a graph reload. ### fiokg **Contains:** Facility data @@ -580,7 +821,8 @@ All endpoints are SPARQL query interfaces to different parts of the knowledge gr - `geo:hasGeometry/geo:asWKT` → Point location - `kwg-ont:sfWithin` → S2 cells, admin regions -**Used for:** Facility details (Step 6 in pipelines) +**Used for:** the NAICS industry dropdown only (`useDiscoveryQueries.ts`). +Facility queries in the pipeline run on `federation` — see below. ### sawgraph **Contains:** PFAS sample and observation data @@ -592,7 +834,8 @@ All endpoints are SPARQL query interfaces to different parts of the knowledge gr - `coso:measurementValue` → Concentration (ng/L) - `spatial:connectedTo` → S2 cells (via SamplePoint) -**Used for:** Sample retrieval, concentration data +**Used for:** the substance and material-type dropdowns. Sample data reaches +the pipeline through `federation`. ### spatialkg **Contains:** S2 cells, admin regions, spatial index @@ -604,7 +847,8 @@ All endpoints are SPARQL query interfaces to different parts of the knowledge gr - `kwg-ont:sfTouches` → Neighboring cells - `kwg-ont:hasFIPS` → FIPS codes -**Used for:** Region filtering, near expansion, boundaries +**Used for:** the county dropdown and `GET_REGION_BOUNDARIES`. Region filtering +and neighbour expansion now happen inside the fused query on `federation`. ### hydrologykg **Contains:** Water bodies, flow paths, wells @@ -616,14 +860,17 @@ All endpoints are SPARQL query interfaces to different parts of the knowledge gr - `nhdplusv2:hasCOMID` → NHDPlus identifiers - `schema:name` → Water body names -**Used for:** Water body queries, upstream/downstream tracing +**Used for:** the hydrology data that the fused trace queries join against. ### federation **Contains:** Nothing directly — it queries across all graphs **How it works:** SPARQL federation joins data from multiple endpoints in a single query **Caveat:** Performs owl:sameAs reasoning, inflating facility counts (1.3M real → 4.9M with aliases) -**Used for:** Facility S2 lookup (Step 1), cross-graph queries +**Used for:** almost everything. Every discovery step and every hydrate step +runs here (`planner.ts`), because a fused query needs facilities, samples, +spatial and hydrology data in one place. Only `GET_REGION_BOUNDARIES` goes +elsewhere. Treat this as the primary endpoint, not a special case. --- @@ -631,107 +878,162 @@ All endpoints are SPARQL query interfaces to different parts of the knowledge gr ### Pattern 1: Find entities in a region -```typescript -// Step 1: Find S2 cells with entity -SELECT ?s2cell WHERE { - ?s2cell kwg-ont:sfContains ?entity . - ?entity rdf:type SomeClass . -} - -// Step 2: Filter to region -SELECT ?s2cell WHERE { - VALUES ?s2cell { /* cells from step 1 */ } - ?s2cell spatial:connectedTo kwgr:administrativeRegion.USA.23 . -} - -// Step 3: Get entity details -SELECT ?entity ?wkt ?name WHERE { - VALUES ?s2cell { /* cells from step 2 */ } - ?s2cell kwg-ont:sfContains ?entity . - ?entity geo:hasGeometry/geo:asWKT ?wkt ; - rdfs:label ?name . -} +```sparql +?s2cell rdf:type kwg-ont:S2Cell_Level13 ; + spatial:connectedTo kwgr:administrativeRegion.USA.23019 . # the county +?sp rdf:type coso:SamplePoint ; + spatial:connectedTo ?s2cell . ``` +The region is a starting point, not a post-filter: the cells are selected by +county first, so the engine never looks outside it. + ### Pattern 2: Spatial relationship (near) -```typescript -// Find S2 cells with anchor entity -// Filter to region -// Expand to neighboring cells (via kwg-ont:sfTouches) -// Filter neighbors to target region -// Find target entities in expanded cells +```sparql +# anchor side +?s2anchor kwg-ont:sfContains ?facilityA . +?facilityA fio:ofIndustry naics:NAICS-562212 . + +# the "near" — one hop of neighbouring cells +?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . + +# target side +?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ``` +`hops` repeats the middle line. At four or more hops `neighborPath()` drops the +`owl:sameAs` alternation, because the path expands as 2^N and runs the engine +out of memory. + ### Pattern 3: Hydrological relationship (downstream) -```typescript -// Find S2 cells with anchor (facilities) -// Find flow paths in those cells -// Follow hyf:downstreamFlowPathTC (transitive closure) -// Find S2 cells connected to downstream flow paths -// Find target entities (samples) in those cells +```sparql +# anchor cells → the flow paths passing through them +?s2anchor kwg-ont:sfContains ?facilityA . +?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . +?s2neighbor spatial:connectedTo ?upstream_flowline . +?upstream_flowline rdf:type hyf:HY_FlowPath . + +# follow the network downstream +?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . + +# back to cells, and to what is in them +?s2target spatial:connectedTo ?ds_flowline . +?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ``` +`hyf:downstreamFlowPathTC` is the pre-computed transitive closure, 408M triples. +`A TC B` means **B is downstream of A**, and it is reflexive — ` TC ` +returns a row, so a `?` quantifier after it is redundant. + +Unbounded, this follows the river to the sea. `maxDistanceKm` wraps it in a +subquery that sums `nhdplusv2:hasFlowPathLength` along the path and drops +anything past the budget, then extends one segment further so the drawn line +does not stop mid-channel. On one Maine question, a 30 km bound cut 15,782 +reaches to 3,705 while keeping all 616 facilities. + +**A closure needs both ends bound, and a distance cap is not a substitute.** The +pattern above is safe because it ends at `?spC`, a real target. The stream layer +(`buildFusedFlowlineQuery`) drew its geometry from the seed side only, with +nothing on the right of the closure, and that is not a narrower version of the +same query — it is a fan-out to the end of the network. An anchor near a +drainage divide brought back the neighbouring basin: on "facilities upstream +from PFOS samples in York County, ME", 122 segments of the Merrimack and 21 of +the Winnipesaukee, 130 km away. Intersecting the closure with the flowlines that +reach the resolved targets removed 755 flowlines and added 0. A 25 km cap did +*not* prevent it, because the wrong basin was inside the budget. See +DEBUGGING.md, 2026-09-19. + +**Upstream questions use this same pattern, unchanged.** There is no upstream +query. "A upstream from C" seeds from block A and traces downstream to block C, +which is the same relation read from the other end. The templates can build a +reversed trace (`?ds_flowline hyf:downstreamFlowPathTC ?upstream_flowline`) and +the planner never asks for one: a reversed trace is only correct if the seed is +the *downstream* side, and the seed is never that side, because the side that +seeds is the side the question filtered. See the anchor/target table under +[Planner Creates Pipeline Steps](#2-planner-creates-pipeline-steps). + --- ## Debugging Tips -### 1. Check docs/DISCOVERY.md +### 1. Read the docs first -- Predicate inventories (what predicates exist on each entity type) -- Known bugs, data coverage gaps, debugging findings (merged from FINDINGS.md) +- **`docs/SCHEMA.md`** — does this predicate exist, and on what? Predicate + inventories with triple counts, per endpoint. +- **`docs/QUERY-MATRIX.md`** — Part 4 tells you what an HTTP status actually + means. A 429 is almost never rate limiting. +- **`docs/DEBUGGING.md`** — bugs already diagnosed, with their root causes. -### 2. Inspect Pipeline Steps +### 2. Bypass the cache -In browser DevTools, set breakpoint in `executor.ts` and log each step's query: +A result that looks stale may be cached. Add `?cache=off` to the URL to force a +live run. + +### 3. Inspect pipeline steps + +Set a breakpoint in `executor.ts` and log the query as built: ```typescript -console.log(step.description); -console.log(query); -console.log(results); +console.log(step.type, step.description); +console.log(step.buildQuery(context, scope)); // note: scope is the 2nd arg +console.log(rows.length); ``` -### 3. Test SPARQL Queries Directly +### 4. Test a query directly + +Copy it from the console and run it against the endpoint the step used — they +are listed in `src/constants/endpoints.ts`. Most discovery steps run on +`federation`: -Copy a query from the console, run it at: ``` -https://apps.okn.us/fiokg/sparql +https://apps.okn.us/federation/sparql ``` -### 4. Check S2 Cell Counts +### 5. If a step returns nothing -If a step returns 0 results, check if S2 cells are empty: +Check the IRI lists, not S2 cells: ```typescript -console.log('S2 cells after step:', context.s2Cells.length); +console.log('target IRIs:', context.targetIris.length); +console.log('anchor IRIs:', context.anchorIris.length); ``` -### 5. Validate Predicates +An empty `FIND_TARGET_IRIS` ends the run and shows "no results". That is often +the correct answer — confirm the data exists before treating it as a bug. -Use DISCOVERY.md to check if a predicate exists. Example: -- Using `kwg-ont:sfContains` for water bodies? ❌ Zero triples -- Should use `spatial:connectedTo` ✅ 274K triples +### 6. Run the whole matrix + +`npm run query-matrix` re-measures every query shape and writes +`docs/query-matrix/2026-09-14-raw-baseline.csv`. Slow, but it is how a regression gets proven rather +than suspected. --- ## Summary **The app in one sentence:** -A React SPA that converts natural language questions into multi-step SPARQL query pipelines, executes them against distributed knowledge graph endpoints, and visualizes geospatial results on a map. +A React SPA that lets you build a spatial question from three blocks, compiles +it into SPARQL, runs it against distributed knowledge graph endpoints — slicing +the work when it is too big for them — and draws the answer on a map. **Key concepts:** - **Knowledge graphs** — Triples connecting entities - **SPARQL** — Query language for graphs -- **S2 cells** — Spatial index for fast geo queries -- **Pipeline** — Multi-step query execution -- **Federation** — Cross-graph querying +- **S2 cells** — Spatial index, and the join key between entity types +- **Pipeline** — Planner builds steps, executor runs and splits them +- **Federation** — One query across several graphs **Architecture highlights:** -- Planner creates steps, Executor runs them -- S2 cells thread between steps as "join keys" -- Templates generate SPARQL with user filters +- Planner creates steps, executor runs them and slices what the engine refuses +- Find IRIs first, hydrate them second — never build detail you will discard +- Spatial and hydrological joins are fused into one federated query +- Successful results are cached and served in ~37 ms instead of seconds +- A run can succeed with pieces missing, and says which pieces - Result transformer parses WKT → GeoJSON - Zustand for question state, React Query for dropdown data +**Six entity types:** samples, facilities, water bodies, wells, aquifers, streams + **13 states have data:** AL, AZ, AR, IL, IN, KS, ME, MA, MN, NH, OH, SC, VT diff --git a/docs/DEBUGGING.md b/docs/DEBUGGING.md index 0835126..c2c1fc7 100644 --- a/docs/DEBUGGING.md +++ b/docs/DEBUGGING.md @@ -192,3 +192,588 @@ For downstream/upstream, reverse directional trace is expensive — all anchors **Fix**: Simplified the logic — when a node's code is in `allCodes`, always add it to `userSelections` regardless of whether all descendants are also selected. **Files touched**: `src/components/QueryEditor/HierarchicalSelect/useNaicsTree.ts` **Prevention**: When writing selection collapse/expand logic, handle the case where stored data may not match the fully expanded representation. + +--- + +## 2026-09-08 — Substance dropdown empty: required label predicate with zero triples + +**Component**: `src/engine/templates/regions.ts` — `buildDiscoverSubstancesQuery()`, and `useSubstances()` in `src/hooks/useDiscoveryQueries.ts` +**Symptom**: The Substance dropdown rendered "No options available" with a state selected, and silently showed the seven-entry `FALLBACK_SUBSTANCES` list with no state selected. +**Root cause**: The query required `?substance dcterms:alternative ?_label`. That predicate has **zero** triples on substances, on `sawgraph` and `federation` alike. Because it was a required pattern rather than `OPTIONAL`, the whole query returned 0 rows instead of returning substances without labels. Substance names live on `rdfs:label` (896,899 triples). The likely origin of the mistake is `docs/SCHEMA.md`'s facility table, where `dcterms:alternative` is a legitimate *facility* predicate: 3,824,195 triples in fiokg, 3,742,487 of them on `fio:Facility`, 0 on `comptox:ChemicalEntity`. +**Fix**: Switched to `rdfs:label`, then made both label patterns `OPTIONAL` and added a DTXSID fallback in the hook. Fixing only the predicate still hid 32 of 101 substances (47,642 observations, 5.0% of everything with a substance link) because the label was still required. Live counts: 0 rows → 69 → 101 unfiltered, and 0 → 69 → 79 for Maine. +**Files touched**: `src/engine/templates/regions.ts`, `src/hooks/useDiscoveryQueries.ts`, `docs/wiki/Dropdowns Substance.md`, `docs/SCHEMA.md` +**Prevention**: A label pattern in a discovery query must be `OPTIONAL` with a URI-tail fallback. A required label does not degrade, it deletes: the row disappears along with its data, and the dropdown looks merely short rather than broken. This one mistake caused both the total outage and the 32 hidden substances. Cross-repo confirmation: `SAWGraph/streamlit-app/filters/substance.py:67` carries the identical bug and returns 0 rows live today, while `core/sparql.py:586` and `analyses/pfas_upstream/queries.py:147` in the same repo use `rdfs:label`; `analyses/aquifer_wells/queries.py:96-97` asks for both predicates but marks each `OPTIONAL`, and therefore survives. + +--- + +## 2026-09-09 — QLever aggregate quirks while building the substance label fallback + +**Component**: `src/engine/templates/regions.ts` — `buildDiscoverSubstancesQuery()` +**Symptom**: Three separate failures while adding a fallback that borrows a substance name from the source parameter it was matched to. +**Root cause**: All three are QLever aggregate behaviours, not SPARQL semantics. + +1. `COALESCE(SAMPLE(?a), SAMPLE(?b))` returns HTTP 500 on `federation` with `Assertion 'singleResult.size() == 1' failed. An expression returned a vector expression result that contained an unexpected amount of entries ... GroupByImpl.cpp:436`. The same query succeeds on `sawgraph`, so it passes a casual test. `SAMPLE(COALESCE(?a, ?b))` runs on both. +2. `SAMPLE(?x)` where `?x` is bound inside a nested `OPTIONAL` can return **unbound even when some rows in the group bind it**. This is the dangerous one: it fails silently, costing 8 of 69 acronyms with no error. Requiring the value in the OPTIONAL's own pattern (`OPTIONAL { ?p pred ?s ; rdfs:label ?_x . }`) rather than nesting a second OPTIONAL inside fixes it. +3. `SAMPLE()` picks arbitrarily across the 41 substances matched by more than one parameter, so labels changed between runs. `MIN()` is deterministic and, because `X` sorts before `X_A`, happens to prefer the unsuffixed base form. + +**Fix**: Project the borrowed name as its own column with `MIN(?_viaParam)`, require `rdfs:label` inside the OPTIONAL, and coalesce in the hook rather than in SPARQL. +**Files touched**: `src/engine/templates/regions.ts`, `src/hooks/useDiscoveryQueries.ts` +**Prevention**: Test aggregate expressions against **both** `sawgraph` and `federation`; they do not behave identically. And when an aggregate feeds a fallback chain, assert the expected coverage count rather than eyeballing the first few rows, since a silently unbound `SAMPLE` looks exactly like missing data. + +--- + +## 2026-09-11 — A dead IRI returns 200 with no rows, it does not error + +**Component**: `src/constants/prebuiltQueries.ts`, `src/constants/materialTypes.ts` +**Symptom**: The "PFHpA Groundwater Samples Downstream from Facilities in Cumberland County" card ran every pipeline step, reported success, and drew an empty map. No error anywhere. +**Root cause**: The card's material filter pinned `http://w3id.org/sawgraph/v1/me-egad-data#sampleMaterialType.GW`, which matches zero triples. The August 2026 reload moved the two halves of the graph in opposite directions: instance data to `v2/me-egad-data#` and `v2/us-wqp-data#`, controlled vocabulary out of `-data` and into the roots `v1/me-egad#` and `v1/us-wqp#`. Material types are vocabulary, so the root form is the live one. All six `FALLBACK_MATERIAL_TYPES` entries carried the same dead namespace, and one also used `sampleMaterialType.SO` for sludge, a code that appears nowhere in the vocabulary — the real one is `.SU`. + +The failure mode is the point. The filter it builds is `VALUES ?matType { }`, which is valid SPARQL. The endpoint answers 200 with zero rows, and nothing downstream can distinguish that from an honest "no data matches". Verified live: with the dead IRI, 0 sample points; with the root form, 65 sample points and 171 observations. + +**Fix**: `ef0c40b` — both files moved to `v1/me-egad#`, sludge corrected to `.SU`. +**Files touched**: `src/constants/prebuiltQueries.ts`, `src/constants/materialTypes.ts` +**Prevention**: Same family as the `dcterms:alternative` bug above — *a required pattern that cannot match does not degrade, it deletes*. Extend that to IRIs: a hardcoded IRI is a silent single point of failure the moment a namespace moves. When a query returns nothing, count the triples on the IRIs it names (`SELECT (COUNT(*) AS ?n) WHERE { { ?p ?o } UNION { ?s ?p2 } }`) before investigating anything else. Source of truth for the source-specific vocabularies is `SAWGraph/pfas-kg` under `datasets/*/controlledVocab/`, not `contaminoso`, which defines only the shapes. + +--- + +## 2026-09-11 — QLever reports a query timeout as HTTP 429 + +**Component**: any pipeline step against `apps.okn.us` +**Symptom**: `429 Too Many Requests` in the network tab after ~30s, which reads as rate limiting and sends you looking for a request budget that does not exist. +**Root cause**: QLever uses 429 for query timeouts. The response body carries the real reason: + +```json +{ "exception": "Operation timed out. Last operation: Join on ?s2anchor" } +{ "exception": "Operation timed out. Last operation: Sort (internal order) on ?resultC" } +``` + +A related failure appears as HTTP 500 with `Tried to allocate 409.6 MB, but only 351 MB were available`. Both are resource exhaustion; only the reporting differs. Available memory is not stable — observed at 370 MB, 351 MB and 88 MB within one afternoon on the same endpoint, so the same query can pass and fail minutes apart. This matches the endpoint flakiness recorded in changelog week 37 entry 5. + +**Fix**: None needed in the app. Diagnostic note only. +**Prevention**: Always read the response body before concluding rate limiting; the status code alone is misleading. A 429 that took 30 seconds is a timeout, not a throttle — a real throttle returns immediately. Retry on an idle endpoint before investigating a query, and be aware a green run proves less than a red one here. + +Trimming unused bindings measurably helps. The downstream `FIND_TARGET_IRIS` query selects only `?spC` but also binds `?matTypeLabelC` and computes `?result_valueC`, neither projected nor filtered on. Removing just those two took the query from a hard timeout to 24.7s before it hit the memory ceiling. Same pattern as the Indiana card in changelog week 37 entry 5. +## 2026-09-13 — The 429s, and what shipped to stop them + +Builds on the 2026-09-11 entry above, which established that a 429 from these +endpoints is a query timeout. This one records the scale of the problem and the +fix. + +**How widespread**: a sweep of every question the editor can build (95 shapes, +156 queries) found **37 failing outright and 32 more running over 15s** against +a 30s limit. River-trace questions were half broken — 23 of 50 worked. Maine was +the only healthy state: the same plain question failed in 5 of 6 others, +including Indiana, which is one of our own dashboard cards. Full results and the +catalogue of all nine failure responses are in `docs/QUERY-MATRIX.md`. + +**Root cause beyond the unused bindings** already noted above: `bindEntityInCell` +(`templates/fusedQueries.ts`) served both the ID-finding queries and the hydrate +queries. The hydrate side projects `?substance`, `?matTypeLabel`, +`?result_value`; the ID side projects one column and needs none of it. Both got +the measurement joins, so the ID queries built every measurement in the state +and discarded it. + +**Fix**: ID-finding queries drop those joins unless a filter needs them, and any +query the engine refuses is split into slices and merged +(`src/engine/scope.ts`). 34 of the 37 failures now work, none regressed. + +**Three traps worth knowing** + +- **An unfiltered second block means every entity in the graph** — 1,506,326 + facilities, 532,771 wells. That, not the size of the answer, is what blows the + limit. Narrowing the *first* block does not help: measured, still OOM at + 2.6 GB. The three questions that remain unanswerable all have this shape. +- **413/502 arrives in the browser as a CORS error**, because the gateway's + error response omits `Access-Control-Allow-Origin`. It means our *request* was + too big — an inlined `VALUES` list — not that anything is wrong with CORS. +- **`?timeout=120s` returns 403.** Raising the engine's limit needs an access + token we do not have, so the 30s ceiling is not negotiable from our side. + +**Prevention**: benchmark against more than Maine, and re-run +`npm run query-matrix` after any engine change, diffing against +`docs/query-matrix/2026-09-14-raw-baseline.csv`. + +--- + +## 2026-09-14 — Cached results served for the wrong question (FIXED) + +**Component**: `src/engine/cacheKey.ts` — `canonicalQuestion` + +**Symptom**: none visible. That is the point of this entry. A map would render a +complete, plausible answer that belonged to a *different* question, with no +error, no warning, and the usual "showing saved results" banner. + +**Root cause**: `canonicalQuestion` normalised the relationship by rebuilding it +from a whitelist: + +```ts +const relationship = + rel.type === 'near' || rel.type === 'within' + ? { type: rel.type, hops: rel.hops ?? 1 } + : { type: rel.type }; // ← everything else on the relationship is gone +``` + +Correct when written — `hops` is genuinely only read on the near path, so a +leftover value must not split the key. But the `else` branch discards *any* other +field. When PR #41 added `maxDistanceKm`, a 30 km-bounded question and an +unbounded one immediately hashed to the same key: + +``` +unbounded : q:6b1d1ee8b88e820f5b44f6833c15730d3a9c574894339c8dba671e8c7b04e615 +30 km : q:6b1d1ee8b88e820f5b44f6833c15730d3a9c574894339c8dba671e8c7b04e615 +``` + +Caching either would have served its answer for the other. For "facilities +upstream from PFOS samples in York/Washington/Waldo" that is **12,077 river +reaches and 14 sample points missing**, presented as the complete answer. + +**Caught**: while warming that question for a demo — the key was printed as part +of checking the upload, and the two matched. The upload was killed before it +wrote and the cache verified clean (404 on the colliding key), so nothing needed +purging. It would not have been caught by looking at a map. + +**Fix**: strip only the field known to be irrelevant, and carry the rest +through: + +```ts +const { hops, ...restOfRelationship } = rel; +const relationship = + rel.type === 'near' || rel.type === 'within' + ? { ...restOfRelationship, hops: hops ?? 1 } + : restOfRelationship; +``` + +Unbounded traces keep the key they had before `maxDistanceKm` existed, so +entries cached earlier stay reachable. + +**Prevention** — the general lesson, which matters more than this instance: + +- **A cache key must fail safe, and "safe" is asymmetric.** A field wrongly + *included* costs a cache miss. A field wrongly *dropped* serves the wrong + answer. So build the key by removing known-irrelevant fields, never by + listing known-relevant ones — a whitelist silently drops whatever is added + next, and adding a field to `AnalysisQuestion` is a normal thing to do. +- Any new field on `AnalysisQuestion` that changes results must be reflected in + `scripts/check-cache-key.mts`. It now covers bounded vs unbounded, two + different bounds, and that the unbounded key is unchanged — 19 checks. +- The same reasoning applies to `WIRE_VERSION` in that file: bump it when the + set of stored result keys changes, or cached entries will be missing data the + map expects. + +--- + +## 2026-09-16 — "Upstream from" answered the mirror question (FIXED) + +**Component**: `src/engine/planner.ts` — `buildFusedSteps`, and +`src/engine/templates/fusedQueries.ts` — `buildFusedWellQuery` + +**Symptom**: reported by Torsten: "the upstream query seems to be switched: I +asked for facilities upstream of stream but seem to get stream upstream of +facilities." Every `upstream` question returned the relation read backwards. +Nothing errored, both layers drew, and the streams were real rivers beside real +facilities. + +**Root cause**: the templates trace one way only. The anchor is bound into +`?s2anchor`, the seed flowline hangs off it, and the target comes out +`direction` of the anchor: + +```sparql +downstream mode: ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline # target below anchor +upstream mode: ?ds_flowline hyf:downstreamFlowPathTC ?upstream_flowline # target above anchor +``` + +So the planner decides two things: which block is the anchor (which side seeds) +and which way to trace from it. For `upstream` the anchor has to be block A, +because seeding from an unfiltered block C means every stream in the country and +times out. The anchor was right; the direction was not: + +```ts +if (relationship.type === 'upstream') { anchorBlock = blockA; targetBlock = blockC; } // correct +... +direction: relationship.type === 'downstream' ? 'downstream' : 'upstream', // wrong +``` + +Two flips were required and one was applied. In one line: the code treated *the +name of the relationship the user picked* and *the direction to trace from the +seed* as the same value, and they are the same only when the seed is block C. + +Not a regression from the fused refactor. `d9ba5a6` carried the bug across +faithfully, comment and all; the S2-cell pipeline it replaced did the same thing +(`getS2Step(blockA)` then `traceUpstreamStep()` then `findEntitiesStep(blockC)`), +and `git log -S buildUpstreamTraceQuery --reverse` puts that in the initial +commit. Upstream had never worked. + +**How wrong**: "samples in Maine upstream from landfills", measured live. + +| | Distinct samples | +| --- | --- | +| Before | 840 | +| After | 2,797 | +| In both | 777 | + +72% of the correct answer was missing and 63 rows were false positives. The old +answer was, in effect, the *downstream* relation, so "samples upstream from +landfills" and "samples downstream from landfills" were two names for one +question (404 of 474 rows shared, the rest explained by the seed-side tolerance +below). + +For facility-shaped answers the answer layer barely moves — Cook County returns +411 facilities either way, because "upstream of some stream" and "downstream of +some stream" are both nearly vacuous — so the stream layer was the only visible +tell. That is what was noticed, and it is why no screenshot review ever caught +it. + +**Caught**: by a user, on a shape nothing automated runs. The 9 prebuilt +dashboard questions are 7 `near` and 2 `downstream`, zero `upstream`, so the +weekly health check and the warm cache never touched it. `docs/QUERY-MATRIX.md` +3.3 *did* measure all 36 upstream shapes and passed them: a mirror answer +returns a plausible row count in a plausible time, and the sweep records status, +duration and rows, never semantics. + +**Fix**: name the decision and make it once. + +```ts +const isUpstream = relationship.type === 'upstream'; +const anchorBlock: EntityBlock = isUpstream ? blockA : blockC; +const targetBlock: EntityBlock = isUpstream ? blockC : blockA; +// The anchor is always the upstream side of the question, so the trace always +// runs downstream from it. +const traceDirection = 'downstream' as const; +``` + +Two further things came out of the fix: + +- **A second copy of the rule.** `buildFusedWellQuery` re-derives the whole + trace server-side (a statewide well set is 20k+ IRIs, too many to inline) and + decided its own direction from `relationship.type` via `relationshipMode()`. + Before the fix it agreed with discovery, both wrong. After it, the well layer + would have been a different set from the wells discovery found. The planner + now passes the direction it used and `relationshipMode` is deleted with its + only caller. +- **The corrected question is much heavier**, and it first failed outright: + `chooseAxis` had no axis left for a single-county question (both probes past + `PROBE_LIMIT`, one county not splittable), so the step errored after 64s + instead of slicing. `scope.ts` gained a last-resort bulk probe. + +**Verified** end to end through the real pipeline, and in the app on the PR +preview: Cook County facilities upstream from streams draws 402 facilities and +1,290 flowlines running down the Des Plaines, the Illinois and the Mississippi +past St. Louis. Before the fix the same question drew the headwater tributaries +north of Chicago and nothing downstream of it. + +| Question | Before | After | +| --- | --- | --- | +| Cook facilities upstream from streams, any distance | 1.3s, wrong direction | 214s | +| same, bounded 10 km / 50 km | n/a | 25s / 12s | +| Cook facilities near streams | 11s | 11s | +| ME samples downstream from landfills | 38s | 38s | + +**Prevention** — the general lessons: + +- **A flag that reads like a pass-through is not one.** + `rel.type === 'downstream' ? 'downstream' : 'upstream'` looks like it forwards + the user's choice. It was duplicated at two call sites, so the decision had no + name and no home. Anything with two independent flips has to name both. +- **Do not overload one variable with a semantic role and an execution + property.** `anchor` means both "which side of the question" and "which side + seeds, and therefore which side is cheap". One meaning was updated without + the other, which is what overloaded variables do. +- **Plausible output is not verification.** The only assertion that would have + caught this is one about the *query*, not the result. That is + `scripts/check-trace-direction.mts`: across all 180 planner shapes, every + query carrying `hyf:downstreamFlowPathTC` must trace downstream from the seed, + and a `near` question must not trace at all. It reads the emitted SPARQL, so + it covers all three builders that trace (discovery, the flowline layer, well + hydration) rather than trusting the flag each was handed. Confirmed to fail on + the code before each of the two fixes. +- **The dashboard is not coverage.** A third of the question space had no + automated exercise of any kind. Where a shape cannot be afforded in CI, an + offline assertion about the generated query is the cheap substitute. +- **A semantics fix does not invalidate the cache.** `cacheKey` hashes the + question, not the engine, and complete results live 30 days, so wrong answers + keep being served after the fix deploys. Purge by question shape (see + `docs/ARCHITECTURE.md`, The Result Cache). + +**Known, and not a bug**: the seed side gets a one-cell tolerance the target +side does not (`?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor` before +attaching to a flowline). So "A upstream from C" and "C downstream from A" are +not exactly reciprocal even now, which is part of the 840 vs 474 gap above. +Making them reciprocal means applying that tolerance to both sides or neither. + +--- + +## 2026-09-17: Two silent filters in the fused queries, join order and the unit join + +Both found while running "What facilities are upstream from PFOS samples in York +and Cumberland counties (Maine)?" with the facilities block left empty. The +pipeline failed at step 1 after 116.3s with `500 out-of-memory` ("tried to +allocate 204.8 MB, only 159.3 MB available"), sliced into the two counties, and +both slices failed the same way. + +**Join order (fixed).** `buildFusedWhereBody` always wrote the anchor side +first, and for an upstream question the planner puts block A on the anchor side. +With no region and no industry filter on block A, the query started from every +facility in the graph and traced the national flowline network to look for +samples in two Maine counties. + +QLever does not search join orders exhaustively at these body sizes (12-14 +triples), so it follows the query text. Writing the constrained side first is +the whole fix: same triples, same variables, different order. Measured across +all 72 hydrology shape/config pairs, one county scope: 5 shapes rescued, 0 +regressions, 0 rows lost, faster in 50 of 66 comparable runs. + +Two things this is *not*, both measured, so nobody re-derives them: + +- **Not volume.** Rows materialised through the trace from Cumberland seeds: + samples + PFOS 872,385, facilities 681,299, wells 4,183,432. The samples seed + materialises more than the facilities seed and succeeds where it fails. +- **Not a sub-SELECT.** Fencing the constrained side in a sub-SELECT rescues the + same 5 shapes but breaks 7 that work today, all OOM: a sub-SELECT is an + optimiser barrier, so it forces one plan and forbids every other. A variant + that carried only the distinct cells through the fence and re-joined the + entity last failed the same 7, three of them degrading from OOM into 60s + timeouts. + +**The unit join (fixed).** `bindEntityInCell` emitted the entire observation +chain whenever *any* sample filter was set, including +`?result coso:measurementUnit ?unit`. A non-detect has no +`coso:measurementUnit` (`templates/samples.ts` documents this, and the by-IRI +templates already gated it behind `needsUnitJoin`), so a substance-only question +with "include non-detects" ticked silently dropped every non-detect. Cumberland +PFOS observations: 1,688 total, 914 with a unit, 774 non-detect with none. At +sample-point level, 23 points and 13 facilities became 32 and 15 once the joins +a substance filter actually reads were the only ones emitted. + +The same required join was hiding non-detects in the popup's observation table +(`buildSampleDetailByIriQuery`): on sample point 64220, **474 of 3,334 rows**, +the missing 2,860 all non-detects. `OPTIONAL` in place OOMs at 819.7 MB; joining +it after `resultValueClauses()` with the symbol lookup nested inside costs what +it did before (6.88s vs 6.59s). + +**Lessons** + +- **Every required triple is also a filter.** Joining detail the query only + displays, or that an inactive filter would have read, deletes rows. Both bugs + here are one habit: an all-or-nothing gate that conflated "the user set a + filter" with "fetch the whole record". +- **Textual triple order is a semantic-free change with a non-semantic-free + cost.** It cannot alter the answer, and it decided whether this question + answered at all. That makes it cheap to try and worth asserting: + `scripts/check-query-joins.mts` reads the emitted SPARQL and fails if the + unconstrained side leads, or if the unit join appears without a concentration + range. +- **Measure the fix against the shapes it touches, not the one that prompted + it.** The sub-SELECT looked like a 48% median win on the question at hand and + was a net regression across the shape space. + +## 2026-09-19: The stream layer drew rivers in a basin no sample drains from (FIXED) + +Reported from outside the team: "What facilities are upstream from PFOS samples?" +scoped to York County, ME drew the entire Merrimack River, which is in another +state and another watershed. + +**What was broken.** `GET_FLOWLINE_GEOMETRIES` is a separate query from +discovery, and it traced a one-sided transitive closure. It seeded from the +cells of every resolved anchor, widened each by `sfTouches`, and followed +`hyf:downstreamFlowPathTC` to the end of the network: + +```sparql +?upstream_flowline rdf:type hyf:HY_FlowPath ; + spatial:connectedTo ?s2cellus ; + hyf:downstreamFlowPathTC ?flowline . +``` + +Nothing in it references the target. An anchor sitting near a drainage divide +therefore pulled in the whole of the neighbouring basin. Drawn for that +question: 122 segments of the Merrimack, 40 of the Presumpscot, 37 of the +Suncook, 24 of Cohas Brook, 21 of the Winnipesaukee (~130km away), 16 of the +Powwow. + +**Where it was not.** The discovery query was innocent, which is why the first +guess was wrong. Filtering its own `?upstream_flowline` set for those names +returns zero rows. Only the layer query was one-sided. + +**The fix.** Intersect the closure with the flowlines that reach the resolved +targets. Measured with the real answer sets (1,497 facilities, 200 sample +points): 3,271 flowlines down to 2,516 in the same 7s, **755 removed and 0 +added**, so the change can only subtract flowlines that were never on a path +from a facility to a sample. Of the 755, 684 are in a different basin and 71 lie +below a sample, the latter being a deliberate behaviour change: the drawn river +now stops at the sample instead of running on to the sea. + +**Two forms measured and rejected.** + +- *The direct membership test*, `?flowline hyf:downstreamFlowPathTC? ?_flTarget`, + leaves `?flowline` unbound on the left and QLever times out at 31s ("Join on + ?flowline"). Two `SELECT DISTINCT` closures intersected on `?flowline` run in + the same 7s the one-sided query took. +- *A reflexive reach*, `TC?` instead of `TC` on the target side, recovers **0** + flowlines and costs 8s. `hyf:downstreamFlowPathTC` is already reflexive, so + `TC?` is the same relation spelled more expensively: `X TC X` holds for 2,104 + of 2,104 York County flowlines and there are 434,501 self-pairs graph-wide. + ARCHITECTURE.md Pattern 3 already said so. The segment a target sits on is + therefore drawn; what the intersection excludes is the river *below* it. + +**A distance bound is not a substitute.** The bounded branch got the same +intersection. At 25km it went 3,034 to 2,516, matching the unbounded set, +because connectivity dominates the cap at that range; at 5km the cap still bites +(2,314), so the two constraints compose. The shipped bounded query had been +drawing a Merrimack segment straight through its own 25km cap. + +`scripts/check-flowline-scope.mts` asserts both ends are bound for all 100 +shapes that draw the layer, bounded and unbounded. + +**Also fixed here: `includeNondetects: true` counted as a filter.** The +seed-side rule added on 2026-09-17 asked "is this side narrowed" with a generic +"any filter field is non-null" scan. `includeNondetects: true` is the UI's +default ticked state and narrows nothing, so a samples block carrying only that +was read as constrained and reordered the entire body. Ticking the checkbox and +un-ticking it back therefore changed the emitted SPARQL for a semantically +identical question. Samples now delegate to `sampleJoinsNeeded`, which already +drew the line at `=== false`. + +The same predicate existed three times (`scope.ts` as `hasBlockFilters`, +`sparqlErrors.ts` as `isNarrowed`, and the new copy). `scope.ts` asks it to pick +a chunking axis, so a drift means the executor slices on an axis the template +already led with. It is now one exported `blockIsFiltered`. + +**Lessons** + +- **A one-sided closure is not a filter, it is a fan-out.** Seeding from the + answer set feels bounded and is not: transitive closure from any seed reaches + the end of the network. If both ends of a relationship are known, bind both. +- **The query that produces the wrong output is not always the query that looks + wrong.** Three queries feed one map. Name-filtering each layer's own result + set located this in one step after a day of reading the wrong query. +- **"Stop at the cutoff" and "stop where it stops mattering" are different + bounds.** A distance cap looked like it should have prevented this and did + not, because the wrong basin was well within range. + +## 2026-09-20: A distance bound failed whenever block A was left open (FIXED) + +Picking any "within N km of flow" on "what facilities are upstream from PFOS +samples in York County" returned nothing. Every option, 5, 10 and 30 km, both +projections, six queries, six identical failures: HTTP 429 carrying +`Operation timed out. Last operation: Query planning`. Note *planning*, not +execution. The engine could not even build a plan inside its 30s budget. + +**The bound was not the problem; the side it seeded from was.** The +constrained-side-first reorder that landed on 2026-09-17 deliberately skipped +bounded queries, with a comment recording that the shape had not been measured +either way. It has now. `boundedTrace` duplicates its seed block inside an +aggregate that sums `nhdplusv2:hasFlowPathLength` across two +`hyf:downstreamFlowPathTC` hops, so seeding the unconstrained side sums path +lengths over the national flowline graph. With block A left as plain Facilities +that seed is 1,506,326 facilities. + +Isolated by varying one thing. Same 30 km bound, same target type, only the +block A scope differing: + +| Block A | Result | +| --- | --- | +| wide open | 500, tried to allocate 4.3 GB | +| scoped to York County | 1,429 rows in 4s | + +And the control that proves bounded queries were fine in general: the Cook +County dashboard question, whose block A carries both a county and a NAICS +filter, answers in 28s and 6s throughout. + +**The fix** gives `boundedTrace` a seed side and drops one clause from the +guard, so a bounded trace is reordered by the same rule as everything else. The +trace, the `GROUP BY` and the `+1` fringe all follow the seed. The fringe still +extends away from the seed, which means the physical end that receives the extra +segment follows the seed side; on a question where both forms run, the result +sets were identical, so nothing observable turns on it. + +Measured before trusting the speed: + +- where both forms run, identical IRI sets on both projections +- against the unbounded answer, the bounded one is a strict subset, 918 of 1,494 + facilities, 0 added +- across 5, 10, 30 and 50 km the answers nest, each bound's set inside the next +- the York question answers in 20s and 3s, 132 samples and 918 facilities, + against two 429s before + +**What it did not fix.** Step 0 of the statewide MD shapes still fails; both +rescued rows are step 1. `facilities upstream(30km) streams [ME on C]` changed +failure mode rather than passing. Wells remains unchanged on all four bounded +combinations. Details in `docs/QUERY-MATRIX.md` Part 10. + +### The tripwire this nearly disarmed + +`check-trace-direction.mts` kept `?_flEnd hyf:downstreamFlowPathTC ?_flMid` on a +blacklist of reversed traces. A block seeded from the target writes that exact +triple while tracing correctly, so the string cannot decide it any more. Deleting +the entry would have quietly removed the only guard against the 2026-09-16 +direction bug. + +Queries that name both ends are now checked by reachability instead: build the +directed edges from `hyf:downstreamFlowPathTC` and `hyf:downstreamFlowPath?`, +where `?a ?b` always means a flows into b, and assert a path from +`?upstream_flowline` to `?ds_flowline`. That is the property the string was +standing in for, and it admits both seed sides. Verified by mutation: +reintroducing the 2026-09-16 bug still fails it, and a half-applied reorder that +moves the query text while leaving the aggregate seeded from the anchor fails +the new `seedsFrom` assertion in `check-query-joins.mts`. + +### Two measurement traps worth not repeating + +**Cold against warm.** The first MD sweep was the phase's first ever run, so it +was entirely cold, and the post-fix sweep was warm. Compared directly it credits +the fix with three flips instead of two; the extra row is unbounded and +anchor-constrained, its SPARQL byte-identical at 1,950 characters either side, +timing out cold and answering in 15s warm. Re-run the old engine warm before +quoting a delta. Run-to-run noise, once both halves are warm, is zero: three +consecutive sweeps at identical code agreed on every row. + +**Your own load.** Three bounded queries were measured failing with +out-of-memory, one reporting only 2.9 MB available, while a full pipeline run of +mine was hammering the same endpoint. Re-run alone, they failed differently, as +planning timeouts. The header of `query-matrix.mts` warns about this; it applies +to ad-hoc curl measurements just as much. + +## 2026-09-20: Adding an industry filter broke a question that worked (FIXED) + +Found while answering "what does this result really mean" about the York County +map. The unfiltered question, facilities within 5 km upstream from PFOS +detections, returns 418 facilities in 3s. It also returns dentists and schools, +because block A carries no industry filter and "facility" means anything with a +NAICS code. The obvious next step is to filter block A to PFAS source +categories. Doing that returned nothing: 429, `Operation timed out. Last +operation: Query planning`, on both projections. + +**Root cause, one level up from the 2026-09-20 seed-side entry above.** +`sideIsConstrained` treated a region, an entity filter and an IRI pin as the +same thing. An industry filter made the anchor count as constrained, so the +reorder stopped firing, so the query seeded from block A, which with a filter +and no region means every facility in that industry across the country. + +Isolated by varying one thing at a time, all at 5 km, York, detections only: + +| Block A | Result | +| --- | --- | +| no filter, no region | works, 418 facilities, 3s | +| 1 code, no region | 429, query planning | +| 21 codes, region Maine | 429 Cartesian Product, then 500 at 728 MB | +| 21 codes, region York | 500 at 728 MB | +| 1 code, region York | works, 21 facilities, 13s | + +The pattern is that block A had to be *small*, not merely filtered, and only a +region made it small. + +**The fix** replaces the boolean with a rank: IRI pin 3, region 2, entity filter +1, nothing 0, lead with the higher, ties keep anchor-first. Only questions with +both sides constrained at different levels change plan. See +`docs/QUERY-MATRIX.md` Part 11 for the measurements. + +**Long selections: measure before blaming the clause.** The first version of +this entry said selections beyond about ten codes still fail. Re-measured after +the ranking landed, that is wrong. 21 codes answers at 5 km (101 facilities, +13s; 84 samples, 23s) and only fails unbounded (500, 430 MB). Code count is a +cost on the closure, which a distance bound already caps. + +The suspected culprit was cleared too. `fio:subcodeOf` is materialised +transitively, so `?ic fio:subcodeOf? ?sel` is an exact rewrite of +`FILTER(?ic = ?sel || EXISTS { ?ic fio:subcodeOf ?sel })`. Measured: 13s with +the FILTER, query-planning timeout with the path. The FILTER is the fast form +here; do not "optimise" it. diff --git a/docs/QUERY-MATRIX.md b/docs/QUERY-MATRIX.md new file mode 100644 index 0000000..d69deb5 --- /dev/null +++ b/docs/QUERY-MATRIX.md @@ -0,0 +1,983 @@ +# Query Matrix — what the Explorer can ask, and what happens when it does + +**Baseline measured**: 2026-09-13, against the live `apps.okn.us` endpoints +**Re-measured after Phases 1 + 2**: 2026-09-14 (Part 6) +**Raw data**: [`query-matrix/`](./query-matrix/) — one row per query executed, importable into a spreadsheet +**Harness**: [`scripts/query-matrix.mts`](../scripts/query-matrix.mts) — re-run it and diff the CSV after any engine change + +This is the reference sheet. Every claim here is a measurement, not an estimate. +Where something is an estimate, it says so. + +> **Reading the baseline (Part 3):** those numbers are the *pre-Phase-1/2* +> behaviour, kept as the benchmark to measure against. They are no longer what +> the app does today — see **Part 6** for what changed and what did not. + +--- + +## Part 1 — How to read this + +Each row is one question a user can build in the editor. For each we record: +what it asks, how big the answer is, whether it works today, and if not, which +error comes back. + +**Status values:** + +| Status | Meaning | +| --- | --- | +| ✅ works | Returns results reliably | +| ⚠️ fragile | Returns results, but takes >15s — close enough to the 30s limit that a slow day breaks it | +| ❌ broken | Fails every time, or nearly every time | +| ⬜ n/a | The pipeline never issues this query for this shape | + +"Cold" means the graph engine's internal cache is empty for that query. "Warm" +means the same query ran recently. The gap is large — often 20x — so both are +recorded where known. + +--- + +## Part 2 — The query space + +A question is three choices (`src/types/query.ts`): + +``` +[ Block A: what you want to see ] → [ relationship ] → [ Block C: what it relates to ] +``` + +**Block A and Block C** — 6 entity types each +(`src/components/QueryEditor/EntityTypeSelector.tsx`): +samples, facilities, surface water bodies, wells, aquifers, **streams**. + +**Relationship** — 3 kinds +(`src/components/QueryEditor/RelationshipSelector.tsx`): + +- **Near**, with 5 distances: 0, ~1, ~2, ~3, ~4 miles (S2-cell hops) +- **Downstream of** (follows rivers), optionally bounded by **distance in km** +- **Upstream from** (follows rivers), same optional bound + +> **The measured baseline in Part 3 predates two of these.** `streams` as an +> entity type and the `maxDistanceKm` bound on traces both arrived with PR #41 +> on 2026-09-14. No row below exercises either, so the sheet covers 95 of the +> shapes the editor offered *then*, not the larger space it offers now. The +> distance bound is characterised separately in Part 8. + +That's **6 × 6 × 7 = 252 shapes** before distance bounds, filters or regions. +On top of that: + +- **Region**: none, one of 13 states (`src/constants/regions.ts:8-22`), or any + set of counties within a state +- **Filters per entity type**: substance, material type, concentration range, + include/exclude non-detects (samples); NAICS industry codes at any depth + (facilities); FTYPE (water bodies); category (wells); type (aquifers) + +The `within` relationship exists in the type definition (`types/query.ts:59`) +but the editor never offers it, so no query in this sheet uses it. + +--- + +## Part 3 — Results + +**156 queries executed, covering 95 of the 175 shapes the editor can express.** +Every shape below was run once against the live endpoints in a single sweep on +2026-09-13. + +**What is and is not covered** — so nobody reads this as exhaustive: + +| Dimension | Covered | Not covered | +| --- | --- | --- | +| Entity pairs × relationship | **all 75** (25 pairs × near-1 / downstream / upstream) | — | +| Near distances 0, 2, 3, 4 | 20 of 100 (5 representative pairs) | the other 80 combinations | +| States | 6 of 13 (IL, IN, MA, NH, AL, VT) | AZ, AR, KS, MN, OH, SC | +| Filters | 8 cases, all on one base shape | filter × shape interactions | +| Region scope | none / state / 1 county / 3 counties | arbitrary multi-county selections | +| Dashboard queries | all 8, every step | — | + +The gaps are deliberate: the 80 missing combinations are near-distance variants +of pairs whose hop-1 behaviour is already recorded, and distance cost is +characterised separately in 3.4. Fill them by adding pairs to phase M4 in +`scripts/query-matrix.mts` if a question there ever matters. + +| | Runs | Worked | of which slow (>15s) | Failed | +| --- | --- | --- | --- | --- | +| Near, 1 hop — all 25 entity pairs | 25 | 24 | 3 | **1** | +| Downstream — all 25 pairs | 25 | 10 | 6 | **15** | +| Upstream — all 25 pairs | 25 | 13 | 7 | **12** | +| Distance sweep (0, 2, 3, 4 hops) | 20 | 17 | 5 | **3** | +| 8 dashboard queries (every step) | 40 | 40 | 5 | 0 | +| Statewide downstream, 6 states | 6 | 1 | 1 | **5** | +| No region at all | 3 | 2 | 1 | **1** | +| Filters | 8 | 8 | 3 | 0 | +| County-scoped | 4 | 4 | 1 | 0 | +| **TOTAL** | **156** | **119** | **32** | **37** | + +**Headlines:** + +1. **Roughly a quarter of the query space fails outright** (37 of 156). +2. **River-trace questions are the problem: only 23 of 50 work** (downstream + 10/25, upstream 13/25). "Near" is mostly healthy at 24/25. +3. **Maine is the healthy state.** For the same plain question — "samples + downstream of facilities" — **5 of 6 other states fail**, including Indiana, + which is one of our own dashboard queries. +4. **All 8 dashboard queries pass**, but 4 of 8 take 30–67 seconds end to end, + and one returns 0 results. +5. **A further 32 queries are slow enough to be at risk** — >15s against a 30s + limit. These are the ones that flip between working and failing depending on + the engine's cache. + +**Important caveat about repeatability.** These are single runs. The engine's +cache makes the same query 10–20x faster when warm, so a ⚠️ can become a ❌ on +a cold cache and vice versa. Observed directly: "samples near facilities, +3 hops" failed with a timeout earlier in the day and passed at 20.9s during +this sweep. **Treat ⚠️ as "fails sometimes" and ✅ above ~10s as "fragile".** + +Failure breakdown: 20 × timeout at 30s, 15 × engine out-of-memory, +2 × cancelled sort. See Part 4 for what each means. + +### 3.1 Near, ~1 mile — every entity pair + +| Block A ↓ / Block C → | Samples | Facilities | Water bodies | Wells | Aquifers | +| --- | --- | --- | --- | --- | --- | +| **Samples** | ❌ 32.4s timeout-30s | ⚠️ 15.2s (2273) | ✅ 1.7s (2199) | ✅ 5.1s (4279) | ✅ 1.6s (2759) | +| **Facilities** | ⚠️ 16.3s (1358) | ✅ 2.3s (2976) | ✅ 0.9s (1591) | ✅ 2.8s (2900) | ✅ 1.6s (1728) | +| **Water bodies** | ⚠️ 24.7s (591) | ✅ 1.0s (1015) | ✅ 1.5s (6612) | ✅ 3.6s (3553) | ✅ 2.2s (3165) | +| **Wells** | ✅ 2.4s (14897) | ✅ 1.7s (25668) | ✅ 3.1s (52861) | ✅ 2.5s (83038) | ✅ 1.2s (40080) | +| **Aquifers** | ✅ 6.2s (899) | ✅ 0.9s (1504) | ✅ 0.6s (3712) | ✅ 5.3s (3659) | ✅ 0.7s (4972) | + +### 3.2 Downstream of — every entity pair + +| Block A ↓ / Block C → | Samples | Facilities | Water bodies | Wells | Aquifers | +| --- | --- | --- | --- | --- | --- | +| **Samples** | ✅ 9.8s (3214) | ✅ 12.1s (2412) | ⚠️ 19.8s (2610) | ❌ 34.6s timeout-30s | ⚠️ 25.4s (2741) | +| **Facilities** | ⚠️ 17.4s (1657) | ❌ 30.1s engine-oom | ❌ 29.2s engine-oom | ❌ 31.2s timeout-30s | ❌ 30.4s engine-oom | +| **Water bodies** | ✅ 10.9s (1511) | ❌ 32.3s timeout-30s | ⚠️ 28.6s (6095) | ❌ 32.9s timeout-30s | ❌ 30.1s engine-oom | +| **Wells** | ⚠️ 24.2s (28920) | ❌ 30.3s timeout-30s | ❌ 30.7s timeout-30s | ❌ 30.7s timeout-30s | ❌ 35.3s engine-oom | +| **Aquifers** | ✅ 13.0s (2599) | ⚠️ 28.4s (3242) | ❌ 31.9s engine-oom | ❌ 30.8s timeout-30s | ❌ 30.9s engine-oom | + +### 3.3 Upstream from — every entity pair + +> **These 25 numbers measured the wrong question, and are kept only as a +> record.** Until 2026-09-16 every `upstream` shape traced the relation +> backwards (`docs/DEBUGGING.md`, 2026-09-16), so each cell below is the time +> and row count for the *mirror* question. Status and timing do not carry over: +> the corrected direction is materially more expensive when block C is +> unfiltered. See Part 9. Every `near` and `downstream` number in this document +> is unaffected. + +| Block A ↓ / Block C → | Samples | Facilities | Water bodies | Wells | Aquifers | +| --- | --- | --- | --- | --- | --- | +| **Samples** | ✅ 13.1s (3221) | ✅ 13.7s (2739) | ✅ 13.5s (6072) | ⚠️ 24.3s (47730) | ✅ 12.6s (4650) | +| **Facilities** | ⚠️ 24.3s (3195) | ❌ 31.6s timeout-30s | ❌ 23.3s engine-oom | ❌ 32.1s timeout-30s | ❌ 27.8s engine-oom | +| **Water bodies** | ✅ 8.9s (3064) | ✅ 13.0s (2770) | ⚠️ 20.1s (6504) | ⚠️ 28.1s (51437) | ⚠️ 15.5s (4764) | +| **Wells** | ❌ 36.1s timeout-30s | ❌ 31.3s timeout-30s | ❌ 29.9s engine-oom | ❌ 31.3s timeout-30s | ❌ 28.4s engine-oom | +| **Aquifers** | ⚠️ 23.2s (2935) | ⚠️ 17.1s (1919) | ❌ 18.0s engine-oom | ❌ 32.4s timeout-30s | ❌ 25.9s timeout-sort-estimate | + + +### 3.4 Distance (depth) sweep — Maine + +| Question | Status | Time | Result | +| --- | --- | --- | --- | +| samples near(0) facilities [ME] | ✅ | 0.7s | 985 rows | +| samples near(0) wells [ME] | ✅ | 0.4s | 3254 rows | +| wells near(0) facilities [ME] | ✅ | 0.5s | 5462 rows | +| waterBodies near(0) facilities [ME] | ✅ | 0.3s | 352 rows | +| samples near(0) waterBodies [ME] | ✅ | 0.3s | 709 rows | +| samples near(2) facilities [ME] | ✅ | 6.5s | 3061 rows | +| samples near(2) wells [ME] | ✅ | 11.9s | 4438 rows | +| wells near(2) facilities [ME] | ⚠️ | 18.9s | 45280 rows | +| waterBodies near(2) facilities [ME] | ✅ | 6.7s | 1628 rows | +| samples near(2) waterBodies [ME] | ✅ | 10.6s | 3120 rows | +| samples near(3) facilities [ME] | ⚠️ | 20.9s | 3734 rows | +| samples near(3) wells [ME] | ⚠️ | 21.9s | 4500 rows | +| wells near(3) facilities [ME] | ⚠️ | 16.4s | 59773 rows | +| waterBodies near(3) facilities [ME] | ✅ | 8.6s | 2245 rows | +| samples near(3) waterBodies [ME] | ❌ | 30.7s | **timeout-30s** | +| samples near(4) facilities [ME] | ✅ | 14.7s | 4100 rows | +| samples near(4) wells [ME] | ⚠️ | 25.6s | 4521 rows | +| wells near(4) facilities [ME] | ❌ | 33.3s | **timeout-30s** | +| waterBodies near(4) facilities [ME] | ❌ | 24.4s | **timeout-sort-estimate** | +| samples near(4) waterBodies [ME] | ✅ | 3.4s | 4242 rows | + +### 3.5 Same question, different states — "samples downstream of facilities", no filters + +| State | Status | Time | Result | +| --- | --- | --- | --- | +| Illinois | ❌ | 31.0s | **timeout-30s** | +| Indiana | ❌ | 31.2s | **timeout-30s** | +| Massachusetts | ❌ | 23.3s | **engine-oom** | +| New Hampshire | ❌ | 32.1s | **timeout-30s** | +| Alabama | ❌ | 21.7s | **engine-oom** | +| Vermont | ⚠️ | 20.8s | 17 rows | + +### 3.6 Region scope — smallest to largest + +| Scope | Status | Time | Result | +| --- | --- | --- | --- | +| samples near(1) facilities [1 county (Cumberland)] | ✅ | 0.8s | 430 rows | +| samples near(1) facilities [3 counties] | ✅ | 1.4s | 1048 rows | +| samples downstream facilities [1 county (Cumberland)] | ✅ | 11.3s | 339 rows | +| samples downstream facilities [3 counties] | ⚠️ | 15.0s | 902 rows | +| samples near facilities [NO REGION] | ✅ | 1.4s | 4770 rows | +| samples downstream facilities [NO REGION] | ❌ | 37.3s | **engine-oom** | +| wells near facilities [NO REGION] | ⚠️ | 21.6s | 219026 rows | + +### 3.7 Filters — all applied to Maine + +| Filter | Status | Time | Result | +| --- | --- | --- | --- | +| substance filter (PFOS) | ⚠️ | 16.1s | 1375 rows | +| material filter (GW) | ✅ | 1.0s | 0 rows | +| concentration range 10-1000 | ✅ | 13.3s | 944 rows | +| exclude non-detects | ✅ | 1.5s | 1892 rows | +| substance + downstream | ⚠️ | 27.9s | 1406 rows | +| NAICS 2-digit (whole sector 31) | ✅ | 11.6s | 334 rows | +| aquifer type filter | ⚠️ | 30.0s | 2759 rows | +| waterbody ftype filter | ✅ | 2.0s | 1583 rows | + +### 3.8 The 8 dashboard queries — full pipeline, every step + +| Dashboard query | Steps | Slowest step | Total | Status | +| --- | --- | --- | --- | --- | +| Samples Near Agricultural Chemical Facilities in Maine | 6 | GET_REGION_BOUNDARIES 25.5s | 62.7s | ⚠️ | +| Samples Near Landfills & DOD Sites in Penobscot and Knox County | 6 | GET_SAMPLE_DETAILS 9.7s | 15.4s | ✅ | +| Surface Water Bodies Near Landfills & DOD Sites in Penobscot and Knox County | 5 | HYDRATE_TARGET_BY_IRI 27.5s | 30.8s | ⚠️ | +| Samples Downstream of Waste Treatment Facilities in Indiana | 7 | GET_FLOWLINE_GEOMETRIES 22.5s | 67.2s | ⚠️ | +| Maine Private Wells Near Landfills & DoD Sites | 5 | HYDRATE_TARGET_BY_IRI 13.4s | 18.8s | ✅ | +| Maine Private Wells Near Wastewater Treatment Facilities | 5 | HYDRATE_TARGET_BY_IRI 9.9s | 13.4s | ✅ | +| Maine Private Wells Near Airports & Air Transportation Sites (AFFF) | 5 | HYDRATE_TARGET_BY_IRI 10.9s | 14.4s | ✅ | +| PFHpA Groundwater Samples Downstream from Facilities in Cumberland County (returns 0 results) | 1 | FIND_TARGET_IRIS 2.1s | 2.1s | ✅ | + +--- + +## Part 4 — Error catalogue + +Every distinct failure observed, what it actually means, and why it happens. +The user sees one message for all of them: **"Something went wrong. You can edit +the question and try again."** That single message is itself part of the +problem — it hides which of these nine cases occurred. + +### 1. `429 Too Many Requests` — "Operation timed out" + +```json +{ "exception": "Operation timed out. Last operation: Join on ?s2neighbor" } +``` + +**What it really is:** not rate limiting. QLever, the graph engine, stops any +query that exceeds **30 seconds** and reports that stop with the 429 status +code. The `Last operation` field names whichever join it was working on when +the clock ran out. Observed variants: `Join on ?s2neighbor`, `Join on +?ds_flowline`, `Join on ?spC`, `Join on ?flowline`, `Join on ?s2anchor`, +`OptionalJoin on ?substanceUri`, `Exists Join`, `Query planning`, `Sort +(internal order)`. + +**Why:** the query asks for more work than fits in 30 seconds. Confirmed it is +not throttling by sending 8 simultaneous requests — all 8 returned 200. + +**Confusing detail:** these 429 responses are large (323 KB, 375 KB, 996 KB +observed) because the error body echoes the entire query back. A big response +body on a "Too Many Requests" error is what made this look like something else. + +### 2. `429` — "Sort operation was canceled" + +``` +Sort operation was canceled, because time estimate exceeded remaining time by a factor of N +``` + +**What it really is:** the same 30-second limit, caught earlier. QLever +estimated the sort would not finish in the time left and gave up rather than +burning the remaining budget. + +### 3. `500` — "Tried to allocate X, but only Y were available" + +Observed: 80.2 MB, 310.4 MB, 825.6 MB, **3.2 GB**, **3.3 GB**. + +**What it really is:** the engine ran out of memory building an intermediate +result. Not our browser, not the network — the server. + +**Why:** an intermediate join result is enormous, even when the final answer is +small. The Illinois example is the clearest: a query returning **0 rows** tried +to allocate 3.3 GB along the way. + +### 4. `500` — "Waited for a result from another thread which then failed" + +**What it really is:** a secondary symptom, not a root cause. QLever shares +sub-computations between queries; this query was waiting on a shared piece that +failed for one of the reasons above. Retrying often gives the real error. + +### 5. `413 Payload Too Large` — appears in the browser as a CORS error + +**What it really is:** the request we sent was too big — a `VALUES` clause with +~20,000 well IRIs, about 1.5 MB (documented in commit `ebc6dda`). + +**Why it looks like CORS:** the gateway's 413 response has no +`Access-Control-Allow-Origin` header, so the browser refuses to show it and +reports a CORS failure instead. This misdirection cost real debugging time. + +**Current ceiling:** `federation` accepted a 1.9 MB body in testing today, so +this limit is per-endpoint (it bit `hydrologykg`) rather than global. + +### 6. `502 Bad Gateway` + +Same cause as 413 on a different endpoint — an oversized POST body from inlined +IRI lists. Recorded in the code comment at +`src/engine/templates/fusedQueries.ts:251`. + +### 7. `403 Forbidden` — on `?timeout=120s` + +**What it really is:** QLever lets a client request a longer timeout, but only +with an access token. We don't have one, so the 30-second limit is currently not +raisable from our side. + +### 8. Client-side: `Bad control character in string literal in JSON` + +Observed at byte positions 4,194,053 and 12,582,605 of large responses. + +**What it really is:** a truncated response body. The server stopped mid-JSON +and our `response.json()` choked on the fragment. Seen only when several large +queries ran at once, so it is likely server-side memory pressure rather than a +client bug — but it means a very large response can fail *after* a successful +200 status. + +### 9. What the user sees + +**Baseline:** all eight surfaced as the same red card — nothing distinguished +"this question is too big" from "the server had a bad moment, press retry". + +**Now:** classified in `src/engine/sparqlErrors.ts` and shown per kind. A +`sibling-failure` says to just run it again; a network error says to check the +connection; a timeout or out-of-memory offers the lever that applies to the +question being asked (see Part 8.1) rather than one fixed sentence. + +A partial result — some slices answered, some not — names the slices that +failed, because a count alone leaves the user guessing which part of the map is +missing. + +--- + +## Part 5 — Why these happen (four root causes) + +Every error above traces back to one of four things: + +**A. The work is unbounded.** *(addressed in Phase 2 — bounded by splitting)* A single query carries the whole river-network +closure (`hyf:downstreamFlowPathTC`) or a whole-state spatial join. Cost scales +with how much data exists in the state, not with what the user asked to see. +There is no `LIMIT`, no chunk, no budget anywhere in the pipeline. +→ Causes errors 1, 2, 3, 4. + +**B. One code path serves two different needs.** *(fixed 2026-09-13)* `bindEntityInCell` +(`fusedQueries.ts`, added in `d9ba5a6` on 2026-05-30) is used both by queries +that need measurement columns and by queries that only need a list of IDs. Both +got the measurement joins. The ID queries were building every chemical +measurement in the state and throwing it away. +→ Caused errors 1 and 3 on every downstream question. Partially fixed 2026-09-13. + +**C. A false choice between two bad options.** *(dissolved — chunks are small enough to inline, so neither horn applies)* Either inline the IRI list into +the request (risks errors 5 and 6) or re-derive the set inside the query (risks +errors 1–4). The project has swung between these twice. Neither reuses work, +which is the actual problem. + +**D. Nothing remembers anything.** *(partly addressed — session cache for boundaries and probes; the shared server cache is Phase 3, still outstanding)* The same query costs 26.5s cold and 1.5s +warm. Every user and every page reload races the same cold cache. We control no +cache of our own. +→ Turns a fast query into a slow one, and a slow one into error 1. + +--- + +## Part 6 — After Phases 1 and 2 (measured 2026-09-14) + +Phases 1 and 2 of +[the execution plan](./plans/done/2026-09-13-query-execution-architecture.md) +are implemented: the pipeline no longer fetches popup detail up front, and any +query the engine refuses is split into slices that fit and merged back together. + +### 6.1 Re-measured shapes + +| Shape | Baseline (Part 3) | Now | Note | +| --- | --- | --- | --- | +| ME samples ↓ airports | 21.2s warm, fails cold | **16.1–16.7s warm** | 1,172 → 999 rows, unchanged | +| ME samples ~ airports | 12.8s | same counts (515 / 45) | 18 MB detail payload gone | +| **samples ~ samples [ME]** | ❌ 32.4s timeout | ✅ **86.3s** | hydration split into 5 slices | +| **IL samples ↓ airports** | ❌ 500 OOM @ 16s | ✅ **218s** | 4 discovery slices; 1 flowline slice reported as partial | +| ME samples ↓ 83,038 wells | ❌ 429 @ 42s | ✅ via county slices | 16 slices, 6.3–7.5s each | +| **facilities ↓ facilities [ME]** | ❌ 500 OOM, 5.9 GB | ❌ **still fails**, ~2.5 min | see 6.3 | +| **wells ↓ facilities [ME]** | ❌ 429 @ 30s | ❌ **still fails**, ~3 min | see 6.3 | + +Per-step, "ME samples downstream of airports", two sequential warm passes: + +``` +Finding samples downstream of facilities 4,391ms 1,172 rows +Finding facilities with samples downstream of them 4,283ms 190 rows +Loading downstream stream geometries 1,070ms 4,661 rows +Loading details for samples 6,257ms 999 rows +Loading details for facilities 579ms 190 rows +Loading region boundaries 135ms 16 rows +TOTAL 16.7s (second pass 16.1s) +``` + +`GET_SAMPLE_DETAILS` is absent — that step alone was 18–37 MB and 15–26s. + +**1,172 found vs 999 shown is not a discrepancy.** 173 of those sample points +have no contaminant observations recorded, and hydration only emits rows for +points with at least one measurement. Identical before and after chunking; the +merge is exact. + +### 6.2 What splitting costs + +Slices run sequentially — the endpoint serialises them anyway — so a heavily +split question is slower in wall-clock than a question that fits whole, and its +first run is slower than the old *failure*. What it buys is an answer where +there was none, plus a bounded, honest outcome when even slices cannot finish. + +Two mechanisms exist to keep that bounded: + +- **Per-step budget, 120s.** Without it a step whose slices all fail keeps + subdividing — observed past 400s. Per step rather than per pipeline, so a + slow-but-progressing question (Illinois, ~3.5 min overall) still completes. +- **Partial results.** Slices that fail are reported in the UI + (`PartialResultsNotice`) rather than silently dropped. + +### 6.3 The two shapes that still fail, and why + +Block A = facilities (or wells) in Maine, **Downstream of**, Block C = +facilities with **no filter and no region**. The generated `FIND_TARGET_IRIS` +leaves the anchor side completely unconstrained: + +```sparql +?s2anchor kwg-ont:sfContains ?facilityA . # ← no region, no filter +?facilityA fio:ofIndustry ?industryCodeA . +... +?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . # full river closure +?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . +``` + +Leaving Block C's region blank means "downstream of any facility anywhere", and +that is a very large anywhere: + +``` +ALL facilities in the graph: 1,506,326 +ALL wells in the graph: 532,771 +``` + +So the query traces the river network from 1.5 million facilities and intersects +the result with Maine. Splitting cannot rescue it: neither entity side is +enumerable under the probe limit, and a single county still exceeds the engine's +budget. + +**What actually helps — measured, not assumed:** + +| Change | Result | +| --- | --- | +| Block C region = Maine | ✅ 338s, partial — 119 targets, 574 anchors | +| Block C industry filter (landfills) | ✅ 262s, partial — 274 targets, 27 anchors | +| **Block A narrowed to one county** | ❌ **no help** — 500 OOM, 2.6 GB | + +The last row matters for the UI copy: narrowing the *first* block, the intuitive +"look at a smaller area" move, changes nothing, because the cost lives entirely +on the unconstrained second block. The error message names Block C for that +reason. + +### 6.4 Still outstanding + +- **Phase 3** — server-side execution with a shared Postgres cache. Everything + in 6.1 is measured cold-per-session; the cache is what turns a 16s repeat into + an instant one, and what makes a 218s Illinois answer a one-time cost. +- **Not re-measured:** the full 156-query sweep has not been re-run since the + change. Only the shapes in 6.1 were checked. Re-run + `scripts/query-matrix.mts` before treating Part 3 as superseded. +- **The okn.us asks** (access token to raise the 30s limit; a materialized + downstream relation) would remove the ceiling that everything here works + around. + +--- + +## Part 7 — Full verification sweep (2026-09-14) + +The whole matrix re-run through the real engine (`QUERY_MATRIX_MODE=engine`), so +splitting, merging, partial results and the step budget were all exercised — +not just the raw SPARQL. Raw data: `docs/query-matrix/2026-09-14-engine.csv`. + +**124 shapes compared. Of the 37 that failed at baseline, 34 now work. No +regressions.** + +| Outcome | Count | +| --- | --- | +| Fixed | **34** | +| Still failing | **3** | +| Regressions | **0** | +| Unchanged, working | 85 | + +### 7.1 The 3 that still fail + +Every one leaves the **second block** completely unconstrained, which is what +drives the cost — not the size of the answer. + +| Shape | What it asks | Failure | +| --- | --- | --- | +| `samples near(3) waterBodies [ME]` | within 3 miles of *any* water body in the graph | OOM, 1.4 GB | +| `facilities ↓ facilities [ME]` | downstream of *all 1,506,326* facilities | no response in 60s | +| `samples ↓ facilities [NO REGION]` | the above with no region on either side | OOM, 2.6 GB | + +Constraining the second block fixes them (measured in 6.3). Narrowing the +*first* block does not — the cost is not there. + +### 7.2 Small questions stay fast + +| Shape | Time | Rows | +| --- | --- | --- | +| 1 county, near 1 mile | 0.8s | 430 | +| 3 counties, near 1 mile | 1.4s | 1,048 | +| 1 county, downstream | 12.2s | 339 | +| 0-mile radius, any pair | 0.3–0.8s | — | +| 2-mile radius | 6–19s | up to 45,280 | + +Note `wells near(2) facilities`: **45,280 rows in 18.8s**. Large answers are +fine. Unbounded *search spaces* are not. + +### 7.3 Dashboard queries — all 8 pass, 3 materially faster + +| Query | Before | After | +| --- | --- | --- | +| Samples Near Agricultural Chemical Facilities | 62.7s | **33.4s** | +| Surface Water Bodies Near Landfills & DOD | 30.8s | **24.1s** | +| Samples Near Landfills & DOD (Penobscot/Knox) | 15.4s | **10.6s** | +| Samples Downstream of Waste Treatment (Indiana) | 67.2s | 70.8s | +| Maine Private Wells × 3 | 13–19s | 13–23s | +| PFHpA Groundwater Samples (Cumberland) | 2.1s, empty | 2.4s, **still empty** | + +The speed-ups are the deleted `GET_SAMPLE_DETAILS` step. PFHpA returning nothing +is unchanged and unrelated to performance — a data or query-correctness issue +that deserves its own investigation. + +### 7.4 Three defects the sweep exposed, and fixed + +**A missing client timeout.** `executeSparql` had no `AbortController`, so a +stalled endpoint blocked indefinitely — single requests recorded at **959s and +1,918s**. The per-step budget could not help, because it is checked *between* +slices. Worse, a hang never becomes a classified error, so the query never +split: three shapes recorded as "still failing" were only hanging, and all three +work now (`facilities upstream facilities` → 224s, 2,813 rows, complete). A 60s +cap now reports a stall as a timeout, which is splittable. + +**Two budget rules, both wrong, in opposite directions.** Budgeting *elapsed* +time killed runs that were succeeding: `wells near(4)` had 13 of 16 county +slices working and was cut off at 120s for being big. Budgeting only *wasted* +time then broke the opposite case: Illinois has slices that fail slowly before +the ones that succeed, so it gave up before reaching the answer. Both are gone. +One rule remains — every slice is attempted, only the 300s step total is +bounded. Both cases now complete: Illinois 248s, `wells near(4)` 283s with +69,127 rows and nothing missing. + +**"Failed" and "skipped" were the same number.** A slice the engine refused and +a slice never attempted were both reported as "too large". They need opposite +advice — narrow the question vs. just run it again — and are now tracked and +worded separately. + +### 7.5 The recorded CSV is older than the counts above + +`query-matrix/2026-09-14-engine.csv` was captured *before* the budget fix, and +the gap is wider than it first looked. **The file has 9 error rows; the table +above says 3.** Both are honest about the moment they describe — the counts came +from the code as it stands, the CSV from the code a few commits earlier — but +only one of them is re-derivable, and it is not the table. + +Six of those nine are known to have been fixed by changes made after the +capture: + +| Shape in the CSV | Why it is stale | +| --- | --- | +| `samples ↓ facilities [17]` (Illinois) | the budget fix; 7.4 records it completing in 248s | +| five `upstream` shapes | two of them hung for 1918s and 959s, which the 60s client cap in `sparqlClient.ts` now prevents | + +The `partialSlices` numbers are pessimistic for the same reason: they count +slices skipped by a rule that has since been replaced. `wells near(4)` went from +11 missing to **0** when re-measured. + +**What to do about it:** run a fresh engine sweep (~95 min) and let the new +dated file supersede this one. Until then, treat the table as current and the +CSV as an artefact of 2026-09-14. This is precisely the confusion the per-sweep +file naming and the generated index in `query-matrix/README.md` exist to prevent +from recurring — a sweep is now stamped with its own commit, and the index shows +what moved between one sweep and the next. + +--- + +## Part 7.6 — The 2026-09-14 re-sweep, and why it is unusable + +A full engine sweep was run overnight to supersede 7.5's stale CSV. It is kept +as `query-matrix/2026-09-14-engine-contaminated-9128aa9.csv` — named for what it +is, so nobody reads its 29 failures as measurements. What went wrong is worth +recording, because it is a trap anyone re-running this will hit. + +**The step ceiling did not hold, and one phase ate eight hours.** M4 (the +multi-hop distance sweep) spent 484 minutes on 20 queries, 16 of which failed: + +| Shape | Recorded | +| --- | --- | +| `waterBodies near(2) facilities [ME]` | 2095s | +| `samples near(3) waterBodies [ME]` | 2074s | +| `wells near(3) facilities [ME]` | 2048s | + +`STEP_CEILING_MS` is 300s and these are single-step runs, so the expected bound +is ~300s plus one in-flight slice. Recorded time equals wall-clock time for +every phase, so these are genuine elapsed seconds, not a suspended process. +**Cause not yet established.** `divide()` issuing its own probe queries after the +ceiling check accounts for roughly 11 minutes per iteration, not 35. + +**Everything after M4 inherited a degraded endpoint.** M5 failed two *dashboard* +questions at 1101s and 490s which `health/history.jsonl` records succeeding at +14s and 19s the evening before. Once a phase runs away, every later phase is +measuring our own load — exactly what the harness header warns about. + +**Two mechanical faults, both fixed:** + +- Engine mode crashed on its first query: the progress line still referenced + `partialSlices`, removed when the count was split into failed/skipped. Engine + mode had been unusable since that commit, which is why 7.5's CSV could never + have been refreshed. +- The sweep split across two files. `runAt` is UTC and the runner logs local + time, so a sweep starting at 19:21 local crossed UTC midnight at phase M3 and + began writing to the next day's filename. Fix: the runner computes + `QUERY_MATRIX_OUT` once and exports it, so every phase shares one path. + +**Before re-running:** find out why the ceiling misses, run under +`caffeinate -i` or in Actions rather than on a laptop, and treat any phase that +exceeds its expected bound as a reason to stop the sweep rather than push on — +a runaway phase invalidates everything after it. + +--- + +## Part 8 — Distance-bounded traces (2026-09-14) + +PR #41 added an optional `maxDistanceKm` to downstream and upstream questions: +the trace sums `nhdplusv2:hasFlowPathLength` over the segments between seed and +candidate and drops anything past the budget, then extends one segment further +so the drawn path does not stop mid-channel. + +Measured on "facilities upstream from PFOS samples in York, Washington and Waldo +counties" — the question that prompted this, because its map covered most of +southern Maine in river lines: + +| Bound | Time | Reaches | Facilities | Samples | Payload | +| --- | --- | --- | --- | --- | --- | +| none | 109s | 15,782 | 616 | 372 | 22.3 MB | +| **30 km** | 99s | **3,705** | **616** | 358 | **7.1 MB** | +| 10 km | 52s | 1,684 | 554 | 287 | 4.6 MB | + +**30 km removes 77% of the river reaches while keeping every facility**, and +brings the payload under the 25 MB cache limit. It is not free: 14 sample points +disappear, and at 10 km, 62 facilities and 85 samples do. A bound answers a +different question — "within this distance" — rather than rendering the same +answer more legibly. + +Note the time barely moves at 30 km. The engine still computes the closure and +then filters on summed length; the saving is in what is transferred and drawn. +Only 10 km meaningfully cuts runtime. + +**Reliability caveat, worth knowing before relying on it.** The same 30 km +question ran 99s complete in one hour and 361s *partial* (2 slices missing) in +the next, with no code change between. Distance bounds reduce volume; they do +not make a heavy trace dependable. + +### 8.1 Which slice failed, and what actually rescues it + +The 361s partial run above is worth following, because it is the case the +error copy was getting wrong. Running each county on its own: + +| County | Result | +| --- | --- | +| York | ❌ 429 timeout at 72s | +| Washington | ✅ 7s — 16 samples | +| Waldo | ✅ 23s — 177 samples | + +York is the dense corner of the state, so it carries the most facilities and the +busiest river network. Not missing data: York holds 361 PFOS sample points. + +What rescues it, measured on York alone: + +| Change | Result | +| --- | --- | +| 30 km, no Block A filter | ❌ 429 timeout at 64s | +| **10 km** | ✅ **145 samples in 25s** | +| 30 km, Block A = landfills | ⬜ *empty* in 3s | + +Two things follow, and both are now encoded in `adviceForOversizedQuestion` +(`src/engine/sparqlErrors.ts`): + +- **A shorter distance is the lever that works here** — and it was the one the + old message never mentioned. It said to add a filter or region to the second + block, which on this question already had a substance and three counties. +- **A filter is not automatically good advice.** It makes a query cheap by + asking for less, and here it turned a timeout into an empty result: a missing + answer traded for no answer. + +The slice labels themselves used to read `area 1`, `area 2` — `chooseAxis` held +the county codes and discarded the identity. They now carry the county name, so +a partial result says *York County, Maine* rather than *1 too large*. + +**A trap to avoid when measuring this.** The landfill run above returns +`status: 'empty'`, which is a valid answer. The first pass of this test counted +it as a failure and reported all three variants as broken. Any script that +treats `status !== 'success'` as an error will draw the same wrong conclusion. + +### What was tried and rejected: trimming by connectivity + +The original goal was to keep only the reaches that actually connect a matched +facility to a matched sample — bounding by *terminus* rather than by distance. +That was measured and **does not work**: + +| Query | Result | +| --- | --- | +| current (no terminus) | 16s, 4,661 reaches | +| terminus-bounded | **429 timeout at 70s** | + +Adding a second `hyf:downstreamFlowPathTC` join — a 408M-triple relation — +exceeds what the endpoint will do, even with all 1,172 target IRIs pinned in a +`VALUES` block. `maxDistanceKm` is the trimming mechanism that exists. + +If anyone revisits this: the remaining untested idea is applying the terminus +constraint only on the *distance-bounded* path, where `boundedTrace` has already +cut the candidate set before the second join runs. That would only help +questions that set a distance. + +### Useful facts established while measuring + +- **`hyf:downstreamFlowPathTC` is reflexive** — ` hyf:downstreamFlowPathTC ` + returns a row. A zero-or-one path (`?`) after it is redundant. +- **`A TC B` means B is downstream of A.** Three Penobscot headwater reaches at + ~46.1°N had successors averaging 0.73–0.79° south (seaward) and predecessors + immediately upslope. +- **The network contains genuine two-way connectivity.** Testing linked pairs + returned *both* directions true for every pair sampled, and not because the + reaches coincided (0 of 50 shared one). Braided channels mean "is A upstream + of B" has no clean yes/no answer — so do not use a single pair to reason about + trace direction. + +--- + +## Part 9 — The corrected upstream direction (2026-09-16) + +Upstream questions traced the relation backwards from the first commit until +2026-09-16. The root cause, the size of the error and the guard that now +prevents it are in `docs/DEBUGGING.md` (2026-09-16); this part is what the fix +costs to run, since that is what this document is for. + +### 9.1 What it costs + +Measured end to end through the real pipeline, Cook County, IL, NAICS 325 + 326: + +| Question | Before (wrong direction) | After | +| --- | --- | --- | +| facilities upstream from streams, any distance | 1.3s | **214s**, 411 facilities + 1,290 flowlines | +| facilities upstream from streams, 50 km | n/a | 12s, 411 facilities | +| facilities upstream from streams, 10 km | n/a | 25s, 393 facilities | +| facilities near streams (control) | 11s | 11s | +| ME samples downstream from landfills (control) | 38s | 38s | + +The asymmetry is real and worth understanding before reading Part 3.3 as a +baseline. The old direction, from Cook County, asked "what drains *into* these +facilities", which in a headwater county is a small set. The corrected direction +asks "what do they drain into", and from Chicago that is the Illinois River, the +Mississippi and everything to the Gulf: 1,290 reaches. Same engine, same +question shape, 150x the work. + +**A distance bound is the practical answer**, not a tidier rendering of the same +thing. At 50 km the answer is the same 411 facilities in an eighth of the time, +because the facility set is almost insensitive to the bound: nearly every +facility near a stream is upstream of *something*. Unbounded upstream against an +unfiltered block C is close to a vacuous question with a very expensive answer. + +### 9.2 It first failed rather than ran slowly + +The corrected query timed out at 64s and the run errored, because +`chooseAxis` had nothing left to slice: both probes were past `PROBE_LIMIT` +(411 facilities, and streams are unbounded), and the question was already scoped +to a single county, which cannot be split. `scope.ts` now probes the filtered +side once more at a much higher limit and chunks it (25 per slice, 17 slices). +That is what turns the 64s failure into the 214s answer above. + +This is the fourth axis, and it only engages when the other three have declined, +so no shape that already worked can slow down. + +### 9.3 Part 3.3 needs re-measuring + +All 25 upstream rows in the last sweep (`docs/query-matrix/2026-09-14-engine.csv`) +measured the mirror question, as does every upstream shape the editor can build +(36 of them, including streams as a block type, which the sweep does not cover). Expect the re-sweep to move them: shapes with an +unfiltered block C get more expensive, and some that passed will not. The 72 +`near` and `downstream` shapes should be unchanged, which is the useful control +when reading the diff. + +### 9.4 How the trace direction was verified + +Not by reasoning about a pair of linked reaches. The note at the end of Part 8 +is right that braided channels make a single pair useless for that. + +NHD flowline geometries are digitised from upstream to downstream, so the +orientation can be read off the coordinates directly: for `?a hyf:downstreamFlowPath ?b` +on `hydrologykg`, a's last coordinate is exactly b's first coordinate. + +``` +comid/1001 -> comid/1005 a_end == b_start: true a_start == b_end: false +``` + +So `A TC B` means B is downstream of A, as the predicate name says, and as Part +8 already concluded by a different route. This is the cheaper check to repeat if +it is ever in doubt again. + +## Part 10: Flow-distance bounds and the seed side (2026-09-20) + +Until this date the harness never swept the flow-distance bound at all. +`maxDistanceKm` appeared zero times in `scripts/query-matrix.mts`, `mk()` had no +distance parameter, and M4, which the header called a distance sweep, sweeps the +`near` relationship's hop distance in miles instead. The only bounded shape the +matrix ever ran was one dashboard prebuilt inside M5. + +There was a second gap behind that one. `mk()` attached the region to block A +unconditionally, and for an upstream question the planner maps block A to the +anchor, so the anchor was always the constrained side. The join order that only +fires when the *target* is narrowed was unreachable from this harness, and so +was every bounded question that leaves block A wide open, which is the shape +users build. + +Phase MD closes both: four shapes, each bounded and unbounded, with the region +on block A and on block C, on both discovery steps. 32 rows. + +### 10.1 What the bound was doing + +Every bounded shape whose constrained side was the target failed, and the bound +was the thing breaking it. `boundedTrace` embeds its seed inside an aggregate +that sums path lengths across two closure hops, so seeding the wide-open side +sums them over the national flowline graph, all 1,506,326 facilities. The +failure is a 30s timeout in *query planning*, before execution starts, or a 4.3 +GB allocation failure. + +The isolating measurement, same bound, same target type, only the block A scope +differing: + +| Block A | Result | +| --- | --- | +| wide open | 500, tried to allocate 4.3 GB | +| scoped to York County | 1,429 rows in 4s | + +### 10.2 Before and after, warm against warm + +`ec221d9` seeds the bounded block from whichever side is constrained, the same +rule the unbounded path already followed. + +| | pre-fix warm | post-fix warm | +| --- | ---: | ---: | +| MD rows passing | 12/32 | **14/32** | + +| Row | Before | After | +| --- | --- | --- | +| `facilities upstream(30km) samples [ME on C] step1` | out of memory | **3,213 rows, 17s** | +| `samples downstream(30km) facilities [ME on A] step1` | out of memory | **3,213 rows, 15s** | +| all 8 bounded rows constrained on the anchor | unchanged | unchanged | + +0 regressed, and no row-count drift on any row that passed both times. Three +consecutive post-fix sweeps agree on every row, so run-to-run noise on this +phase is zero. + +### 10.3 Three things this phase says that a spot check did not + +**Step 0 of both fixed shapes still fails.** The fix lands on step 1 both times. +MD runs statewide Maine with no filters, where the samples projection is the +heavier half; the York County question that prompted the work passes both steps +in 20s and 3s. So "bounded upstream questions work now" is false as a general +claim, and the honest one is that the bound no longer fails *because* block A is +open. + +**`facilities upstream(30km) streams [ME on C]` did not start passing.** It +changed failure mode, from a timeout to an out-of-memory on step 0 and to a +sort-estimate timeout on step 1. + +**Wells is unchanged on all four bounded combinations**, as it was before, for +the reasons in Part 9 and W38 entry 12. + +### 10.4 The cold-cache trap, which cost three extra sweeps + +The first MD sweep was the first ever run of the phase, so every query in it +missed the engine's cache, and the sweep taken after the fix was warm. Compared +directly, that credits the fix with three flips instead of two. The extra one is +`facilities upstream samples [ME on A] step1`, which is unbounded and +anchor-constrained: the reorder cannot reach it, and its generated SPARQL is +byte-identical at 1,950 characters either side of the fix. It times out cold and +answers in 15s warm. + +The header of `query-matrix.mts` has always said results are cache-sensitive. +This is what ignoring it looks like in practice: a plausible number, in the +right direction, that attributes a cache effect to a code change. The pre-fix +engine was re-run warm into `2026-09-20-raw-e84a11f.csv`, and that file, not the +cold one, is the before-half of 10.2. The cold sweep carries a `.note` saying so. + +## Part 11: Narrowness is a ranking, not a boolean (2026-09-20) + +Part 10 made the distance bound work when block A is left open. Putting an +industry filter on block A broke it again, and for a reason one level up from +the seed side. + +`sideIsConstrained` answered yes for a region, a filter or an IRI pin alike. An +industry filter therefore made the anchor "constrained", the reorder stopped +firing, and the query seeded from block A again. Only now block A meant every +facility in that industry nationwide rather than every facility in the graph, +which is smaller and still far too large to seed an aggregate from. + +### 11.1 What it cost + +"What facilities are within 5 km upstream from PFOS samples", York County, +detections only, block A carrying no region: + +| Block A | Before | After | +| --- | --- | --- | +| no filter | 418 facilities, 3s | unchanged | +| 1 code, unbounded | 429, query planning | 35 facilities, 16s | +| 1 code, 5 km | 429, query planning | 22 facilities, 8s | +| 8 codes, 5 km | 429, query planning | **88 facilities, 3s** | +| 8 codes, unbounded | 429, query planning | 192 facilities, 15s | + +Adding a filter to a working question made it fail. That is the shape of the +report: a user narrowing a result set that was too broad, and getting nothing. + +### 11.2 The rank + + 3 an IRI pin. The executor chose this slice; re-seeding discards it. + 2 a region. Bounded by geography at any level, and indexed for. + 1 an entity filter only. Selective in kind, unbounded in extent. + 0 nothing. + +The body leads with the higher rank, and ties keep the anchor-first order. So +this only changes questions where both sides are constrained at *different* +levels; everything where one side was constrained and the other was not keeps +the plan it had. Of the 375 shapes in `scripts/__snapshots__/query-shapes.txt`, +2 move, both variants with a region on one side and a bare filter on the other. + +### 11.3 What it does not fix + +**Long industry selections fail only without a bound.** An earlier draft of +this part said 21 codes fails outright. Re-measured after the ranking landed, +that is wrong: the code count only matters when the trace is unbounded. + +| Codes | 5 km | Unbounded | +| ---: | --- | --- | +| 1 | 22 facilities, 8s | 35 facilities, 16s | +| 8 | 88 facilities, 3s | 192 facilities, 15s | +| 21 | 101 facilities, 13s | 500, out of memory at 430 MB | + +Which is what a bound is for: the unbounded form walks the whole closure from +every matched facility, so more codes means more seeds and more work, while the +bounded form caps it. A long selection is a reason to set a distance, not a +reason to shorten the list. + +**A rewrite of the industry clause was tried and rejected.** The obvious suspect +was `FILTER(?ic = ?sel || EXISTS { ?ic fio:subcodeOf ?sel })`, evaluated per +selected code and duplicated inside the bounded aggregate. `fio:subcodeOf` is +materialised transitively (`325110` is a direct subcode of `32`, `325` and +`3251`), so `?ic fio:subcodeOf? ?sel` says exactly the same thing as a +zero-or-one path. It is slower, not faster: the 21-code bounded query answers in +13s with the FILTER and times out in query planning with the path. Leave the +clause alone. + +**One dashboard question changes plan.** `samples-downstream-waste-indiana` +scopes samples to Indiana and filters block C to NAICS 5622 with no region, so +its anchor is nationwide and its target is one state. Both orders were measured +before accepting the change: identical answers, 136 samples and 415 facilities +either way, and the reordered form is no slower at 13s and 2s against 16s and +3s. diff --git a/docs/SCHEMA.md b/docs/SCHEMA.md index eba0890..f1f8033 100644 --- a/docs/SCHEMA.md +++ b/docs/SCHEMA.md @@ -24,6 +24,42 @@ SELECT ?predicate (COUNT(*) AS ?count) WHERE { Note: `gwml2:` is `gwml2.org`, **not** the OGC `opengis.net/def/gwml` namespace the UML diagrams suggest. +### Instance data vs controlled vocabulary (August 2026 reload) + +The reload moved the two halves of the SAWGraph source data in **opposite directions**. +Getting this backwards produces queries that are valid, return 200, and match nothing. + +| What | Where it lives | Example | +|---|---|---| +| Instance data — samples, sample points, observations | `v2/-data#` | `v2/me-egad-data#d.egad.sample.136913…` | +| Controlled vocabulary — material types, parameters, qualifiers | `v1/#` (root) | `v1/me-egad#sampleMaterialType.GW` | + +A single WQP sample carries both at once, which is the clearest illustration: + +``` +instance: http://w3id.org/sawgraph/v2/us-wqp-data#d.wqp.sample.11113300-A302638001 +vocabulary: http://w3id.org/sawgraph/v1/us-wqp#sampleMedia.water +``` + +Verified live 2026-09-11, counting triples on all four spellings of one vocabulary term: + +| IRI | Triples | +|---|---| +| `v1/me-egad#sampleMaterialType.GW` | **46,110** | +| `v1/me-egad-data#sampleMaterialType.GW` | 0 | +| `v2/me-egad#sampleMaterialType.GW` | 0 | +| `v2/me-egad-data#sampleMaterialType.GW` | 0 | + +Confirmed by Katrina Schweikert's note on the reload: *"all controlled vocabulary terms are +in the root namespaces (me_egad and us_wqp)"*. + +Source of truth for the source-specific vocabularies is **`SAWGraph/pfas-kg`**, under +`datasets///controlledVocab/`. Maine's material types are +`datasets/maine/egad/controlledVocab/sample_type.ttl`, which declares +`@prefix me_egad: ` and defines 47 terms. +`SAWGraph/contaminoso` defines the shapes (`coso:MaterialSample` and its subclasses), +**not** the source terms — do not look for a material type there. + --- ## S2 Cell Predicates @@ -155,6 +191,38 @@ Federation has ~3.5x more facility data than fiokg alone (28M type assertions vs | `us-wqp:hasProjectId` | 5K | WQP-specific | | `us-wqp:sampleID` | 5K | | +#### Material type inventory + +`coso:sampleOfMaterialType` is what the Material dropdown offers. Measured live 2026-09-11: +**171 distinct values**, drawn from four unrelated source vocabularies that were never +reconciled with each other. + +| Values | Observations | Vocabulary | Example | +|---|---|---|---| +| 79 | 163,405 | `v1/us-wqp#biologicalTaxon.*` | `Lepomis macrochirus` | +| 47 | 833,058 | `v1/me-egad#sampleMaterialType.*` | `GROUNDWATER`, `LEACHATE` | +| 39 | 33,790 | `v1/me-egad#sampleMaterialTypeQualifier.*` | `DEER`, `SPLIT` | +| 6 | 208,219 | `v1/us-wqp#sampleMedia.*` | `Water`, `Tissue` | + +Consequences worth knowing before writing a query against it: + +- **Labels are inconsistent by source.** EGAD shouts (`GROUNDWATER`), WQP is title case + (`Tissue`). Upstream, not a rendering artefact. +- **It includes things that are not materials.** Fish species sit alongside groundwater, and + the qualifier vocabulary mixes animals (`DEER`, `TURKEY`) with QA/QC flags (`SPLIT`, + `FIELD BLANK`, `NORMAL ENVIRONMENTAL SAMPLE`). +- **`us-wqp#sampleMedia.water` is ambiguous.** It spans groundwater and surface water with + no way to separate them. +- **14 samples (177 observations) have no `coso:sampleOfMaterialType` at all.** They are + unreachable through any material filter, though they appear when none is applied. One is + identified as "PFAS SLUDGE" and typed `coso:RawWaterSample`, so the information exists — + just not on this predicate. + +The grouping the dropdown shows is not in the data. It is computed per query by left joining +each sample to the four direct subclasses of `coso:MaterialSample` and taking `MIN` of a +hardcoded priority. The buckets are not naturally disjoint: 171 material types produce 178 +type-to-bucket links, and `MIN` resolves the 7 overlaps. + ### Predicates TO `coso:MaterialSample` (incoming) | Predicate | Count | Notes | @@ -332,6 +400,65 @@ Same predicates as HY_WaterBody (73K instances each, same entities with dual typ ### Facility Labels - `rdfs:label` — 1.2M in fiokg, 3.6M in federation +### Substance Labels + +Substances are `comptox:ChemicalEntity` (`http://w3id.org/DSSTox/v1/`), reached from an +observation via `coso:ofDSSToxSubstance`. 101 of them are typed in sawgraph, and every +observed substance is typed, so the type pattern drops nothing. + +A substance carries 39 distinct predicates. Only these can name it: + +| Field | Coverage | Verdict | +|-------|----------|---------| +| `skos:altLabel` on the substance | 25 of 101 | **Best acronym.** Canonical casing: `PFOS`, `PFHxS` | +| `rdfs:label` on the substance | 69 of 101 | **Best full name.** `Perfluorooctanoic acid` | +| `rdfs:label` on the source parameter | **101 of 101** | Polluted in general, good as a last resort | +| `skos:altLabel` on the source parameter | 68 of 101 | Rejected, see below | +| `dcterms:alternative` | **0** | Does not exist on substances, on any endpoint | +| `owl:sameAs` | 101 of 101 | Self-referential, useless | +| `hasCASRN`, `hasInChIKey`, `hasSMILES`, `dcterms:identifier` | 40 of 101 | Identifiers, and all sit inside the labelled 69 | +| `rdfs:seeAlso`, `rdfs:isDefinedBy` | 68 of 101 | Provenance URIs | +| 30 physicochemical properties (`logP`, `meltingPoint`, …) | 40 of 101 | Not names | + +Regenerate with: + +```sparql +SELECT ?p (COUNT(DISTINCT ?s) AS ?substances) WHERE { + ?s a comptox:ChemicalEntity . ?s ?p ?v +} GROUP BY ?p ORDER BY DESC(?substances) +``` + +**The label chain is `skos:altLabel` → `rdfs:label` → source parameter's `rdfs:label` → +DTXSID.** The source parameter is reached by the inbound +`?param comptox:sameAsDSSToxSubstance ?substance`. This resolves all 101. + +**Every label predicate must be queried as `OPTIONAL`.** The 32 substances with no +`rdfs:label` of their own carry 47,642 observations, 5.0% of the 944,541 with a substance +link, and they hold only `rdf:type` and `owl:sameAs`. A required label pattern does not +return them unlabelled, it drops them entirely. + +**Do not use the parameter's `skos:altLabel` as an acronym.** Its `_A` suffix marks the +*acid* as distinct from the anion: `PFOS_A` is Perfluorooctanesulfonic acid +(`DTXSID3031864`), `PFOS` is Perfluorooctanesulfonate (`DTXSID80108992`). `_L` and `_BR` mark +linear and branched isomers. Borrowing these collapses 10 pairs of genuinely different +substances into identical labels; stripping the suffixes makes it worse, not better. + +**Parameter name quality**, for the 171 distinct values: 31 contain `***retired***use …` +(which names its own replacement, so split on it and take the right side), 78 are ALL CAPS, +21 are CAS-index style (`1-Octanesulfonic acid, 1,1,2,2,3,3,…`), and one is misspelled +(`PERFLOUROOCTANE`). 41 substances have several conflicting values, so aggregate with `MIN()` +for determinism. For the 32 that actually need it, 31 have exactly one value and 30 need no +cleanup. + +**Known upstream error:** `me-egad#parameter.PFECHS_A` is aligned to `DTXSID7022546`, which +is `Acetohydroxamic acid`, not a PFAS. 2 observations. Belongs in an issue against +`SAWGraph/pfas-kg`. + +**Trap:** `dcterms:alternative` in the facility table above is a *facility* predicate. +Measured on fiokg: 3,824,195 triples, of which 3,742,487 are on `fio:Facility` and **0 on +`comptox:ChemicalEntity`**. Using it for substance names returns zero rows. See +`docs/DEBUGGING.md`, 2026-09-08. + --- ## Class Counts @@ -348,6 +475,7 @@ Same predicates as HY_WaterBody (73K instances each, same entities with dual typ | `coso:MaterialSample` | sawgraph | ~28K | | `coso:WaterSample` | sawgraph | ~21K | | `coso:ContaminantObservation` | sawgraph | ~705K | +| `comptox:ChemicalEntity` | sawgraph | 101 (69 with `rdfs:label`) | | `kwg-ont:S2Cell_Level13` | spatialkg/hydrologykg | ~7.4M | | `kwg-ont:AdministrativeRegion_3` | spatialkg | ~35K (counties) | | `kwg-ont:AdministrativeRegion_2` | spatialkg | ~6K (states) | diff --git a/docs/changelog/2026-W36.md b/docs/changelog/2026-W36.md index 0e262ea..f709456 100644 --- a/docs/changelog/2026-W36.md +++ b/docs/changelog/2026-W36.md @@ -12,7 +12,9 @@ *Files:* `docs/wiki/` (new, 9 pages), `.github/workflows/wiki-sync.yml`, `docs/CONVENTIONS.md`, `CLAUDE.md` 2. **Found: Unfiltered Substance Dropdown Always Falls Back** (2026-09-02) - With no region selected, `buildDiscoverSubstancesQuery()` returns zero rows, so the dropdown silently shows the seven hardcoded PFAS entries in `FALLBACK_SUBSTANCES`. The query requires `dcterms:alternative` for the label, and the `sawgraph` endpoint has zero triples using that predicate; substances there carry `rdfs:label`. `dcterms:alternative` exists only on `federation`, which is why the region-scoped variant works and returns 71 substances for Maine. This corrects last week's claim that all discovery queries return live data after the host migration. Not yet fixed. The fix is either to point the no-region query at `federation` as well, or to accept `rdfs:label` in the label pattern. + With no region selected, `buildDiscoverSubstancesQuery()` returns zero rows, so the dropdown silently shows the seven hardcoded PFAS entries in `FALLBACK_SUBSTANCES`. The query requires `dcterms:alternative` for the label, and the `sawgraph` endpoint has zero triples using that predicate; substances there carry `rdfs:label`. This corrects last week's claim that all discovery queries return live data after the host migration. Not yet fixed. The fix is to accept `rdfs:label` in the label pattern. + + **Correction (2026-09-08):** this entry originally said `dcterms:alternative` "exists only on `federation`, which is why the region-scoped variant works and returns 71 substances for Maine", and proposed pointing the no-region query at `federation` as one possible fix. That was wrong. `dcterms:alternative` has zero triples on substances on `federation` too, so the region-scoped variant was returning zero rows as well and the whole dropdown was broken, not just the unfiltered one. The proposed `federation` fix would not have worked. See week 37. *Files:* documented in `docs/wiki/Dropdowns Substance.md` diff --git a/docs/changelog/2026-W37.md b/docs/changelog/2026-W37.md new file mode 100644 index 0000000..1b12495 --- /dev/null +++ b/docs/changelog/2026-W37.md @@ -0,0 +1,65 @@ +# Changelog — Week 37, 2026 (Sep 7 – Sep 13) + +--- + +1. **Fixed: Substance Dropdown Returned Nothing At All** (2026-09-08) + The Substance dropdown showed "No options available" with a state selected, and the seven-entry `FALLBACK_SUBSTANCES` list with no state selected. `buildDiscoverSubstancesQuery()` required `?substance dcterms:alternative ?_label`, and that predicate has zero triples on substances on every endpoint. Because it was required rather than `OPTIONAL`, the query returned zero rows rather than returning substances without labels. Substance names live on `rdfs:label`. Switched the predicate; the query went from 0 rows to 69. + + This also corrects week 36 entry 2, which blamed the outage on `dcterms:alternative` existing only on `federation` and reported the region-scoped variant as working. Both variants were returning zero rows. + + The likely origin of the wrong predicate is `docs/SCHEMA.md`'s facility table, where `dcterms:alternative` is a legitimate *facility* predicate: 3,824,195 triples in fiokg, 3,742,487 of them on `fio:Facility`, and 0 on `comptox:ChemicalEntity`. `SAWGraph/streamlit-app/filters/substance.py:67`, which this query was ported from, carries the identical bug and still returns zero rows. + + *Files:* `src/engine/templates/regions.ts` + +2. **Fixed: 32 Substances Were Being Silently Hidden** (2026-09-08) + Switching to `rdfs:label` fixed the outage but kept the underlying mistake, since the label was still a required pattern. Only 69 of the 101 substances in the graph carry `rdfs:label`, so the other 32 were dropped from the dropdown entirely, taking 47,642 observations with them, 5.0% of everything with a substance link. Made both label patterns `OPTIONAL` and added a DTXSID fallback in `useSubstances()`, mirroring how `useMaterialTypes()` already handles missing labels. Unlabelled substances now appear as their bare DTXSID, for example `DTXSID301035178 (6,493)`. + + Verified live: unfiltered went 0 → 69 → 101 substances, Maine went 0 → 69 → 79. + + *Files:* `src/engine/templates/regions.ts`, `src/hooks/useDiscoveryQueries.ts` + +3. **Select All Rows Now Show an Option Count** (2026-09-08) + Both select components already computed this count but only rendered it while a search term was typed, so opening a dropdown showed a bare "Select all". It now always shows the number of options the checkbox would tick, for example `Select all (79)`. The number excludes disabled options and narrows with an active search, so it always matches what the checkbox actually does. Counts are now comma formatted everywhere, on the Select all row and on individual options: `PFOA (20,120)` rather than `PFOA (20120)`. + + Note that dropdown search matches on the label text, which contains the count, so typing `20120` no longer matches `PFOA (20,120)`. + + *Files:* `src/components/QueryEditor/FlatSelect/FlatSelect.tsx`, `src/components/QueryEditor/HierarchicalSelect/HierarchicalSelect.tsx`, `src/components/QueryEditor/HierarchicalSelect/TreeNode.tsx`, `src/components/QueryEditor/SampleFilters.tsx`, `src/components/QueryEditor/WellFilters.tsx` + +4. **Documented the Substance Label Model** (2026-09-08) + `SCHEMA.md` had no substance or chemical inventory at all, despite being the predicate reference. Added a Substance Labels section recording the coverage that matters: `rdfs:label` on 69 of 101, `skos:altLabel` on 25, `dcterms:alternative` on none, plus an explicit warning that the identically named facility predicate is a different thing. Rewrote `docs/wiki/Dropdowns Substance.md` around the corrected query and refreshed its numbers, which were stale. Logged the root cause in `DEBUGGING.md` with the reusable lesson: a required label pattern does not degrade, it deletes. + + *Files:* `docs/SCHEMA.md`, `docs/DEBUGGING.md`, `docs/wiki/Dropdowns Substance.md`, `docs/wiki/Dropdowns.md`, `docs/changelog/2026-W36.md` + +5. **Audit: All Prebuilt Queries and Dropdowns Run Against Live Endpoints** (2026-09-09) + Executed all 8 prebuilt pipelines and all 15 dropdown discovery queries end to end. Dropdowns: 15 of 15 return rows, no fallback triggered. The two slowest are Industry/NAICS at 26s (5,596 rows) and Illinois well purposes at 38s (33 rows). + + Prebuilt queries: 7 of 8 passed on the day, with the PFHpA card counted as passing because the material IRI fix in entry 8 was applied locally at the time — it did not land in the repo until 2026-09-11, so anyone checking out this commit range would have seen it fail. The remaining failure is "Samples Downstream of Waste Treatment Facilities in Indiana", which gets HTTP 500 from `federation` with `Tried to allocate 409.6 MB, but only 351 MB were available`. Reproducible on an idle endpoint, so it is not load. The `FIND_TARGET_IRIS` query selects only `?spC` but still binds `?observationC ?substanceC ?sampleC ?matTypeC ?matTypeLabelC ?resultC ?unitC`, none of which are projected or filtered on when the question carries no sample filters — statewide Indiana is large enough that the unused join blows the memory budget. Not yet fixed. + + Also worth recording: `apps.okn.us` is flaky under concurrent load. Two pipelines (`samples-near-agchem-maine`, `wells-near-landfill-dod-maine`) failed during the batch run and both pass cleanly in isolation — the latter completes all 5 steps in 14s on an idle endpoint after failing twice at 500s and 1165s under load. + +6. **All 101 Substances Now Show a Real Chemical Name** (2026-09-09) + Entry 2 made the 32 label-less substances visible as bare DTXSIDs. They now show real names. Every one of them is the target of a `comptox:sameAsDSSToxSubstance` link from the source-data parameter it was matched to, and that parameter carries a name on `rdfs:label`. Added it as a fourth step in the chain: `skos:altLabel` → `rdfs:label` → parameter's `rdfs:label` → DTXSID. Verified live: 101 of 101 named unfiltered, 79 of 79 for Maine, no DTXSID rows and no duplicate labels. + + Surveyed all 39 predicates a substance carries before picking. Only two name it; the rest are identifiers (`hasCASRN`, `hasInChIKey`, all sitting inside the already-labelled 69), provenance URIs, or physicochemical properties. `owl:sameAs` is self-referential and useless. + + The parameter also carries acronyms, covering 68 rather than 25, and those were deliberately **not** adopted. The `_A` suffix marks the acid as distinct from the anion, so `PFOS_A` is Perfluorooctanesulfonic acid and `PFOS` is Perfluorooctanesulfonate, two different DTXSIDs. Borrowing them collapsed 10 pairs of distinct substances into identical rows, and stripping the suffix made it 10 rather than 7. The full chemical names keep them apart. + + *Files:* `src/engine/templates/regions.ts`, `src/hooks/useDiscoveryQueries.ts`, `docs/SCHEMA.md`, `docs/DEBUGGING.md`, `docs/wiki/Dropdowns Substance.md` + +7. **Found: PFECHS Aligned to the Wrong Chemical Upstream** (2026-09-09) + `Acetohydroxamic acid` appears in the Substance dropdown with 2 observations. Not a PFAS, and not a display bug: the Maine EGAD parameter `me-egad#parameter.PFECHS_A` is aligned to `DTXSID7022546`, which genuinely is acetohydroxamic acid. The correct target is perfluoroethylcyclohexane sulfonate. Belongs in an issue against `SAWGraph/pfas-kg`; nothing to fix here. Worth noting that displaying the parameter acronym instead would have masked this behind a plausible-looking `PFECHS`. + + *Files:* documented in `docs/SCHEMA.md` and `docs/wiki/Dropdowns Substance.md` + +8. **Fixed: Material Type IRIs Pointed at a Dead Namespace** (2026-09-11) + The "PFHpA Groundwater Samples Downstream from Facilities in Cumberland County" prebuilt card ran to completion and rendered an empty map. Its material-type filter pinned `http://w3id.org/sawgraph/v1/me-egad-data#sampleMaterialType.GW`, which matches zero triples. All six entries of `FALLBACK_MATERIAL_TYPES` carried the same dead namespace, so the fallback list would have been equally inert had discovery ever failed over to it. + + The August reload moved the two halves in opposite directions: instance data went to `v2/me-egad-data#`, controlled vocabulary came out of `-data` into the root `v1/me-egad#`. Source of truth is `pfas-kg`, `datasets/maine/egad/controlledVocab/sample_type.ttl`, whose prefix is `v1/me-egad#` and which defines 47 terms. Confirmed by Katrina's note on the reload: "all controlled vocabulary terms are in the root namespaces". Checked all four combinations for groundwater — `v1/me-egad#` has 46,110 triples, the other three have none. + + The failure was silent by construction. `VALUES` with a dead IRI is valid SPARQL, so the endpoint answers 200 with no rows and the app cannot distinguish that from "no data here". + + Also corrected the sludge code: the fallback listed `sampleMaterialType.SO`, which appears nowhere in the vocabulary; the real code is `.SU` (SLUDGE, 330 samples / 850 observations). All six shipped IRIs now resolve — GROUNDWATER 609,496, SOIL 80,386, SURFACE WATER 26,424, LEACHATE 6,126, DRINKING WATER 2,858, SLUDGE 850 observations. + + Scoped to the sample side, the card's own filters now return 65 sample points and 171 observations in 2.3s, against 0 before. **The card as a whole still fails**, on the downstream hydrology join, which times out and then OOMs on `federation`. That is pre-existing and unrelated — the same query fails identically with the old dead IRI. Note that QLever reports a timeout as HTTP 429, which reads like rate limiting and is not. See entry 5 on endpoint flakiness; retry on an idle endpoint before investigating. + + *Files:* `src/constants/prebuiltQueries.ts`, `src/constants/materialTypes.ts` diff --git a/docs/changelog/2026-W38.md b/docs/changelog/2026-W38.md new file mode 100644 index 0000000..0383502 --- /dev/null +++ b/docs/changelog/2026-W38.md @@ -0,0 +1,192 @@ +# Changelog — Week 38, 2026 (Sep 14 – Sep 20) + +--- + +1. **Bounded Query Execution — Queries Now Split Instead of Failing** (2026-09-14) + Roughly a quarter of the questions the editor can build simply did not work. QLever stops any query at 30 seconds and reports that stop as HTTP `429 Too Many Requests`, which reads as rate limiting and is not — the real cause appears only in the response body (`"Operation timed out"`). Sending eight simultaneous requests returned 200 every time; the endpoint was never throttling us. + + Two things pushed queries over that limit. `bindEntityInCell` served both the ID-finding queries and the hydrate queries, so queries that return a single column of IDs were joining in every chemical measurement in the state and discarding it — removing those joins turned 7/7 failures into 4.3s. And work was unbounded per request: one query carried the whole `hyf:downstreamFlowPathTC` closure, so cost scaled with the state's data rather than with what the user asked for. A query returning 0 rows could still try to allocate 3.3 GB. + + Execution now runs a query whole and, only when the engine refuses, splits the scope into slices that fit and merges the results. The split axis is chosen per question by probing each side with `LIMIT 201` (not `COUNT` — counting Maine's unfiltered facilities takes 11.0s): anchor entities, else target entities, else counties. No fixed axis works, because the right one flips between states — Maine has 4,528 samples to 2,976 facilities, Illinois has 78 to 22,574, and county slicing that works in Maine dies in Cook County at 3.3 GB. + + Verified by re-running all 124 shapes through the real engine: **of the 37 that failed before, 34 now work, and none regressed.** The 3 remaining all leave the second block unconstrained — the largest asks for every facility in the graph, all 1,506,326 of them. Small questions are untouched: one county at one mile is 0.8s, and wells near two miles still returns 45,280 rows in 18.8s. + + *Files:* `src/engine/scope.ts` (new), `src/engine/executor.ts`, `src/engine/planner.ts`, `src/engine/sparqlErrors.ts` (new), `src/engine/sparqlClient.ts`, `src/engine/templates/fusedQueries.ts` + +2. **Sample Measurements Fetched When a Popup Opens** (2026-09-14) + Every pipeline run fetched the full observation history of every sample point up front — 18–37 MB, 37,425 rows for one Maine question — to fill popups that open one at a time. One sample point is about 30 KB. The bulk step is gone; a popup loads its own measurements on open. Three dashboard queries got materially faster as a result: Agricultural Chemical Facilities 62.7s → 33.4s, Surface Water Bodies 30.8s → 24.1s, Landfills & DOD 15.4s → 10.6s. + + *Files:* `src/hooks/useSampleDetails.ts` (new), `src/components/Map/MapPopup.tsx`, `src/components/Map/SampleLayer.tsx`, `src/engine/resultTransformer.ts`, `src/hooks/useMapLayers.ts` + +3. **Failures Explained Instead of "Something Went Wrong"** (2026-09-14) + Nine distinct SPARQL failures shared one red card, so a user could not tell "this question is too big" from "the server had a bad moment, press retry". Each is now classified and worded for what it is. The timeout message names the *second* block specifically, because measurement showed narrowing the first block does not help at all — the cost lives on the unconstrained second block. + + Partial results are also shown rather than discarded: when some slices succeed and others do not, the map renders what came back with a notice distinguishing slices that failed (narrow the question) from slices never attempted (run it again). + + *Files:* `src/engine/sparqlErrors.ts` (new), `src/components/Pipeline/PartialResultsNotice.tsx` (new), `src/components/Pipeline/PipelineProgressStrip.tsx`, `src/App.css` + +4. **Query Matrix — Every Question the Editor Can Ask, Measured** (2026-09-14) + There was no record of which questions worked. `docs/QUERY-MATRIX.md` now covers 95 of the 175 shapes the editor can express — all 75 entity-pair × relationship combinations, plus distances, six states, filters, county scopes and all eight dashboard queries — with status, timing and row counts per shape, a catalogue of all nine failure modes and what each really means, and before/after results. Raw data in `docs/query-matrix.csv` and `docs/query-matrix-after.csv`; the harness is committed at `scripts/query-matrix.mts` so it can be re-run and diffed after any engine change. + + The sweep is what caught three defects in the first implementation: a missing client-side timeout (single requests hung for 959s and 1,918s), a budget rule that killed runs which were succeeding, and partial-result reporting that blamed size for work that had merely run out of budget. + + *Files:* `docs/QUERY-MATRIX.md` (new), `docs/query-matrix.csv` (new), `docs/query-matrix-after.csv` (new), `scripts/query-matrix.mts` (new), `docs/DEBUGGING.md`, `docs/plans/done/2026-09-13-query-execution-architecture.md` (new) + +5. **Cached Results — Shared Links Stop Re-Running the Pipeline** (2026-09-14) + Opening a published link re-ran the entire SPARQL pipeline in the visitor's browser — 26–218 seconds, sometimes failing outright — to rebuild an answer that does not change. That is the flow behind the original "Something went wrong" report. + + The fix turned out to be cheaper than moving execution to the server, which is what the plan originally called for. The publisher's browser has *already computed* the result: when someone clicks Publish, it is sitting in the store. So publishing now hands it over, authenticated by the `editToken` the server already issues, and every later visitor gets it in one request. Measured on a dashboard question: **37 ms cached against 6,604 ms live on a warm graph engine — 178× — with identical row counts.** A 1.4 MB payload stores as 86 KB gzipped. + + Only trusted paths can write: the publisher for their own result, and a maintainer-run script (`scripts/warm-cache.mts`) for the dashboard questions, using a token that never ships in the browser bundle. Reads are public. An open write endpoint would have let anyone place fabricated contamination readings on a real map for every visitor, so that design was rejected rather than mitigated. + + A cached map says so — "Showing saved results, computed today" with a **Re-run live** button — because this tool's output ends up in reports and a stored answer must never be mistaken for a fresh one. Any cache miss or error falls through to running locally exactly as before, so the cache can only make a run faster. + + *Files:* `src/engine/cacheKey.ts`, `src/engine/wire.ts`, `src/api/resultCacheClient.ts`, `src/components/Pipeline/CachedResultNotice.tsx`, `server/src/resultCache.ts`, `server/src/routes/results.ts` (all new), `server/src/routes/publish.ts`, `server/src/schema.sql`, `server/src/index.ts`, `src/hooks/useQueryPipeline.ts`, `src/components/Layout/PublishedView.tsx`, `src/components/Layout/AnalysisQuestionBar.tsx`, `scripts/warm-cache.mts`, `scripts/check-cache-key.mts` + +6. **Document the Railway Environments; Drop the Last Render References** (2026-09-14) + Nothing in the repo recorded where the app actually runs. `.env.example` still pointed at `sawgraph-api.onrender.com`, which returns 503. The README now carries a table of the four services — production and development, each with a frontend and an API, and which branch each tracks — plus how the two halves find each other (`VITE_API_BASE_URL`, `FRONTEND_ORIGIN`). The W35 entry recording `render.yaml`'s deletion is left alone; changelogs are history, not current state. + + Note for whoever reads this next: `CLAUDE.md` lives one directory *above* the repo root and is not tracked by this repo, so edits to it stay on one machine. The deployment table was put in the README for that reason. + + *Files:* `.env.example`, `README.md`, `server/.gitignore` + +7. **One-Click Cache Warming from the Actions Tab** (2026-09-14) + The dashboard questions are cached by a maintainer-run script, which is only useful if running it is easy. `Actions → Warm result cache → Run workflow` now does it: pick development or production, optionally filter to one question by title, and the run reports what it cached in the job summary. Concurrency is limited to one run per environment, since these queries are heavy on a shared endpoint and two runs would compete for the same graph engine. + + Needs `CACHE_WRITE_TOKEN_DEV` / `CACHE_WRITE_TOKEN_PROD` as repository secrets; the workflow fails with a clear message rather than silently uploading nothing when one is absent. No schedule attached — a cached entry only goes stale when the graph reloads or its TTL expires, both of which we control, and the workflow header shows the three lines that would add a weekly cron if that changes. + + `tsx` moved from an on-demand `npx` download to a pinned devDependency so CI installs it deterministically, and the repo scripts now have npm aliases: `warm-cache`, `check-cache-key`, `query-matrix`. + + *Files:* `.github/workflows/warm-cache.yml` (new), `package.json` + +8. **Distance-Bounded River Tracing; Streams as an Answerable Type** (2026-09-14) + Downstream and upstream questions drew the entire river network they traced — a question about facilities upstream from PFOS samples in three counties covered most of southern Maine in blue, because the flowline query had no notion of a terminus and emitted the whole transitive closure. Rebased and merged the stream-distance work that had been open as #32 since 2026-08-28, which adds an optional distance bound (5–100 km) and makes streams selectable as an answer rather than only decoration. + + On that PFOS question, a 30 km bound removes 77% of the river reaches — 15,782 down to 3,705 — while keeping all 616 facilities, and brings the payload from 22.3 MB to 7.1 MB, under the cache limit. It is a different question rather than a tidier rendering of the same one: 14 sample points drop at 30 km, and at 10 km, 62 facilities and 85 samples. Runtime barely moves at 30 km; the engine still computes the closure and filters afterwards. + + #32 predated both the wells-classification and bounded-execution work, so three of its changes were stale rather than conflicting and were dropped: `wellFilters.wellTypes` (renamed to `wellCategories`), `buildWellsByIri` (deleted in `ebc6dda` after 20k inlined IRIs produced a 413), and `buildFusedSampleAggregateQuery` (deleted because re-deriving the trace inside hydration is what timed out). + + Trimming by *connectivity* instead — keeping only reaches that reach a matched sample — was measured and rejected: a second `hyf:downstreamFlowPathTC` join times out at 70s where the current query answers in 16s. Recorded in `docs/QUERY-MATRIX.md` Part 8 so it is not rebuilt. + + *Files:* `src/engine/templates/fusedQueries.ts`, `src/engine/templates/hydrate.ts`, `src/engine/planner.ts`, `src/engine/scope.ts`, `src/types/query.ts`, `src/components/QueryEditor/StreamFilters.tsx` (new), `RelationshipSelector.tsx`, `EntityBlock.tsx` + +9. **Fixed: Cached Results Could Be Served for the Wrong Question** (2026-09-14) + The result-cache key normalised a question by rebuilding its relationship from a whitelist of fields, which silently discarded anything not on that list. Correct until entry 8 added a distance bound — after which a 30 km question and an unbounded one hashed identically, so caching either would have served its answer for the other, with 12,077 river reaches and 14 sample points missing and nothing in the UI to indicate it. + + Caught while warming that question for a demo; the upload was stopped before it wrote and the cache verified clean, so nothing needed purging. The key is now built by removing the one field known to be irrelevant rather than listing the ones known to matter — a field wrongly included costs a cache miss, one wrongly dropped serves the wrong answer, and only the second is silent. Unbounded traces keep their previous key, so entries cached earlier stay reachable. + + *Files:* `src/engine/cacheKey.ts`, `scripts/check-cache-key.mts` (19 checks), `docs/DEBUGGING.md` + +10. **Fixed: "Upstream From" Answered the Mirror Question** (2026-09-16) + Reported by Torsten: "I asked for facilities upstream of stream but seem to get stream upstream of facilities." He was right, and it had never worked. Every `upstream` question, for every combination of entity types, returned the relation read backwards, from the first commit until now. + + The templates trace one way only: the anchor is the side the query seeds from, and the target comes out `direction` of the anchor. So the planner decides two things, and they are not independent. For an upstream question the anchor has to be block A, because seeding from an unfiltered block C means every stream in the country and times out; that part was right. The direction was still being derived from the name of the relationship the user picked, and those two are only the same thing when the seed is block C. Two flips were required and one was applied. + + Measured on "samples in Maine upstream from landfills": the old answer returned **840 samples where the correct answer is 2,797**, overlapping in 777. So 72% of the real answer was missing and 63 rows were false positives. Worse, the wrong answer *was* the downstream relation, so "samples upstream from landfills" and "samples downstream from landfills" were two names for one question and the real upstream question could not be asked at all. + + Nothing caught it for three reasons worth recording. The 9 prebuilt dashboard questions are 7 `near` and 2 `downstream` and zero `upstream`, so no health check, warm-cache run or demo ever exercised a third of the question space. `docs/QUERY-MATRIX.md` 3.3 did measure all 25 upstream shapes and passed them, because a mirror answer returns a plausible row count in a plausible time and the sweep records status, duration and rows, never meaning. And the output stays believable: for facility-shaped answers the answer layer barely moves (Cook County returns 411 facilities either way, since "upstream of some stream" and "downstream of some stream" are both nearly vacuous), so the stream layer was the only visible tell. + + Two things fell out of the fix. `buildFusedWellQuery` held a second copy of the same rule, because it re-derives the whole trace server-side rather than hydrating by IRI; before the fix it agreed with discovery, both wrong, and after it the well layer would have been a different set from the wells discovery found. And the corrected query is much heavier, which first made it fail rather than run slowly: `chooseAxis` had no axis left for a question already scoped to one county, so `scope.ts` gained a last-resort bulk probe (411 Cook County facilities chunk into 17 slices of 25). Cook County facilities upstream from streams now answers in 214s unbounded, or 12 to 25s with a distance bound, drawing 402 facilities and the 1,290 reaches running down the Des Plaines, the Illinois and the Mississippi past St. Louis. `near` and `downstream` timings are unchanged. + + Verified in the app on the PR preview, not just in the engine. The direction of `hyf:downstreamFlowPathTC` was confirmed independently from geometry: NHD flowlines are digitised upstream to downstream, so for `?a hyf:downstreamFlowPath ?b`, a's last coordinate is exactly b's first. + + *Files:* `src/engine/planner.ts`, `src/engine/scope.ts`, `src/engine/templates/fusedQueries.ts`, `scripts/check-trace-direction.mts` (new, 2,068 checks), `.github/workflows/checks.yml` (new), `package.json`, `docs/DEBUGGING.md`, `docs/ARCHITECTURE.md`, `docs/QUERY-MATRIX.md` + +11. **The Self-Checks Now Run on Every Pull Request** (2026-09-16) + Four offline self-checks existed (`check-cache-key`, `check-step-labels`, `check-substance-labels`, and the new `check-trace-direction`) and none of them ran unless someone remembered to type the command. Entry 10 is what that costs: a bug that an assertion about the generated query would have caught on the day it was written instead survived from the first commit, because the only thing looking at upstream questions was a person looking at a map. + + `Checks` runs the build and all four on every PR and on pushes to `main` and `development`. They are blocking, since a self-check nobody is obliged to read is a self-check that does not exist. Everything in it is offline and takes seconds, so it carries no secrets and does not join the endpoint concurrency group that the live-query workflows share. + + `npm run lint` is in the workflow but advisory, because it reports 15 pre-existing errors, all in components. It should be made blocking in the same change that clears them, not before. + + *Files:* `.github/workflows/checks.yml` (new), `package.json` + +12. **Dashboard: Upstream Questions, and One Fewer Way to Ask the Same Thing** (2026-09-16) + Entry 10 fixed the upstream direction, and nothing on the dashboard asked an upstream question, so a third of the query space stayed invisible to anyone who does not build their own. Three changes, all measured against the live endpoints first. + + **"PFHpA Groundwater Samples Downstream from Facilities in Cumberland County" is now its mirror**, "Facilities Upstream from PFHpA Groundwater Contamination in Cumberland County". The old question traced downstream from *every facility in the graph*, with no industry filter, so the answer amounted to "these samples have some facility upstream somewhere", which is true of nearly everything. Asked the other way it is source attribution: given groundwater that tested positive, which facilities in the county sit upstream of it. Same county, same substance, same concentration band, same answer size (49 samples, 265 facilities against the old 49 and 268), and the trace it draws is the path between them. + + **Added "Chemical & Plastics Manufacturers Upstream from Streams in Cook County, IL"** (NAICS 325 and 326, bounded to 50 km of flow), the question that surfaced the direction bug, and the only Illinois entry on a mostly-Maine dashboard. Measured at 33s on a healthy endpoint and 72s on a busy one, returning 526 reaches and 732 facility rows. Unbounded it is 214s and draws the Mississippi to the Gulf, which is correct and useless; the bound is what makes it a dashboard question. + + **Dropped "Maine Private Wells Near Airports & Air Transportation Sites"**, the most diffuse of the three wells questions at 4,425 wells. + + The four cards on the landing page are now four different question shapes rather than four variations on "samples near facilities": upstream, near, downstream, upstream, with samples, streams and facilities each as the thing being asked about, highest-value question first. The rest sit behind "Explore More Prebuilt Analyses" as before. + + **A wells-upstream question was attempted and abandoned**, which is worth recording so nobody tries it again without knowing. "Maine landfills and DoD sites upstream from private wells" timed out on all four scopings measured (statewide and Penobscot-only, 10 km and 30 km), always on the wells side. The direction is not the problem: "wells downstream of landfills" builds the identical query, since the planner seeds from the filtered facilities either way. Wells as the far end of a hydrology trace is simply the expensive shape, which is why all three existing wells questions use proximity. + + *Files:* `src/constants/prebuiltQueries.ts`, `.github/workflows/health-check.yml` + +13. **Fixed: Two Silent Filters in the Fused Queries** (2026-09-17) + Both surfaced on "What facilities are upstream from PFOS samples?" with block A left as plain Facilities and block C set to PFOS samples in York and Cumberland counties. The question failed at step 1 with `500 out-of-memory` after 116s, sliced into its two counties, and failed both slices. + + **Join order.** `buildFusedWhereBody` always wrote the anchor block first, and an upstream question puts block A there. With no region and no industry filter on block A, the query started from every facility in the graph and traced the national flowline network looking for samples in two Maine counties. QLever does not search join orders exhaustively at these body sizes, so it follows the query text: writing the constrained side first is the whole fix, same triples and same variables in a different order. Measured across all 72 hydrology shape and config pairs: **5 rescued, 0 regressions, 0 rows lost, faster in 50 of 66 comparable runs.** The reorder is deliberately narrow, firing only when one side is narrowed and the other is wide open, because the unconditional version was measured too and rescued the same 5 while breaking 7. "Narrowed" is not "small": a county of wells is narrowed and still enormous. + + **The unit join.** `bindEntityInCell` emitted the whole observation chain whenever any sample filter was set, including `coso:measurementUnit`. A non-detect has no unit recorded, because no quantity was measured; the record carries detection limits instead. So ticking a substance silently deleted every non-detect while "Include non-detects" sat ticked, and the checkbox did nothing in either position. Cumberland PFOS: **774 of 1,688 observations** dropped, turning 23 sample points and 13 facilities into 32 and 15. The same required join hid **2,860 of 3,334 rows** in the sample popup. Non-detects are 77% of Maine's observations, so this understated PFAS presence everywhere in the app, and nothing looked broken: the map still drew, with fewer dots. Any figure taken off the app before this date understates. + + Each filter now declares the joins it actually reads. A concentration range genuinely needs the unit and keeps it; nothing ever needs the material label. Expect dashboard counts to move **up** when this deploys. That is the fix landing, not a regression. + + `scripts/check-query-joins.mts` asserts both rules on the emitted SPARQL (265 checks) and runs in CI. `docs/DEBUGGING.md` records the measurements and the two designs tried and rejected, including the sub-SELECT that rescued 5 shapes and broke 7. + + *Files:* `src/engine/templates/fusedQueries.ts`, `src/engine/templates/downstreamSamples.ts`, `scripts/check-query-joins.mts` (new), `.github/workflows/checks.yml`, `package.json`, `docs/DEBUGGING.md`, `docs/plans/active/2026-09-17-fused-seed-side-and-observation-joins.md` (new) + +14. **Fixed: The Stream Layer Drew Rivers in a Basin No Sample Drains From** (2026-09-19) + Reported by the project's PI: the same York County question drew the entire Merrimack River, which is in another state and another watershed. + + The river layer is a separate query from discovery, and it traced a one-sided transitive closure. It seeded from the cells of every resolved facility, widened each by `sfTouches`, and followed the network to its end. Nothing in it referenced the samples at all, so a facility near a drainage divide pulled in the whole neighbouring basin: **122 segments of the Merrimack, 40 of the Presumpscot, 37 of the Suncook, 21 of the Winnipesaukee** about 130 km away. + + Worth recording where it was *not*, because the first guess was wrong and cost a day. The discovery query was innocent. Filtering its own flowline set for those river names returns zero rows. Only the layer query was one-sided. + + The closure is now intersected with the flowlines that reach the resolved samples. Measured with the real answer sets (1,497 facilities, 200 sample points): **3,271 flowlines down to 2,516 in the same 7s, 755 removed and 0 added**, so the change can only subtract flowlines that were never on a path from a facility to a sample. Of those 755, 684 are in a different basin and 71 lie below a sample, the latter a deliberate behaviour change: the drawn river now stops at the sample instead of running on to the sea. If the full river to the coast is wanted back, that is one clause and a decision, not a rebuild. + + A distance bound is not a substitute and was never going to be. The shipped bounded query had been drawing a Merrimack segment straight through its own 25 km cap, because the wrong basin was inside the budget. + + Two forms were measured and rejected. The direct membership test leaves `?flowline` unbound on the left and times out at 31s; two intersected subqueries run in the original 7s. A reflexive reach adds nothing, because `hyf:downstreamFlowPathTC` is already reflexive (`X TC X` holds for 2,104 of 2,104 York County flowlines). + + **Also fixed, found while reviewing the above:** the seed-side rule from entry 13 counted `includeNondetects: true` as a filter. That is the UI's default ticked state and narrows nothing, so a samples block carrying only that was read as a narrowed side and reordered the entire query. Ticking the checkbox and un-ticking it back therefore changed the emitted SPARQL for a question that had not changed. The same "is this side narrowed" predicate also existed in three places, one of which the executor uses to pick a chunking axis, so a drift between them would have had the executor slicing on a side the query already led with. Now one definition. + + **Documented, not only fixed.** A new wiki page, [Include non-detects](https://github.com/SAWGraph/explorer-app/blob/main/docs/wiki/Samples%20Non%20Detects.md), covers what the checkbox does now that it works: it filters at two levels, so unticking removes 84 of York County's 451 sample points *and* strips 14,712 non-detect readings from popups that stay on the map. Ticked, a dot means "someone sampled here"; unticked, it means "PFAS was found here", and the absence of a dot is what misleads. `docs/ARCHITECTURE.md` gains the principle behind both this entry and entry 13: in SPARQL every required triple is also a filter, so asking for detail you do not need silently deletes the rows that lack it. + + **Known gap, measured but not fixed.** To connect an entity to a river there has to be a river in its S2 cell (about 1 km across), and often there is not, so the query widens by one ring of neighbouring cells. That widening is applied to exactly one side, and which side is an accident of how the query is written. We widen the facility side, which costs **130 York County sample points, 82 of them carrying measured PFOS detections up to 2,200 ng/L**, roughly 110x Maine's interim drinking water standard. Widening both sides in one query does not run (2.6 GB allocation failure, two formulations tried). Drafted in `docs/plans/drafts/2026-09-19-symmetric-cell-widening.md`. + + `scripts/check-flowline-scope.mts` asserts both ends of the closure are bound for all 100 shapes that draw the layer (400 checks), bounded and unbounded, and runs in CI. + + *Files:* `src/engine/templates/fusedQueries.ts`, `src/engine/planner.ts`, `src/engine/scope.ts`, `scripts/check-flowline-scope.mts` (new), `.github/workflows/checks.yml`, `package.json`, `docs/DEBUGGING.md`, `docs/ARCHITECTURE.md`, `docs/wiki/Samples Non Detects.md` (new), `docs/wiki/_Sidebar.md`, `docs/wiki/Home.md`, `docs/wiki/Dropdowns.md`, `docs/plans/drafts/2026-09-19-symmetric-cell-widening.md` (new) + +15. **Fixed: The Distance Dropdown Did Nothing on the Most Common Question Shape** (2026-09-20) + Reported while verifying the York County map with the PI's question: picking any "within N km of flow" on "what facilities are upstream from PFOS samples" returned nothing at all. Every option, 5, 10 and 30 km, both projections, six queries and six identical failures, each a 30s timeout in *query planning* rather than execution. + + The bound was not the problem. The constrained-side-first reorder from entry 13 deliberately skipped bounded queries, with a comment recording that the shape had never been measured either way. `boundedTrace` duplicates its seed inside an aggregate that sums flow-path lengths across two closure hops, so seeding the unconstrained side sums them over the national flowline graph: with block A left as plain Facilities, 1,506,326 facilities. One variable isolates it. Same bound, same target, block A wide open gives a 4.3 GB allocation failure; block A scoped to York County gives **1,429 rows in 4 seconds**. + + A bounded trace is now seeded from whichever side is constrained, the same rule everything else follows. The York question answers in **20s and 3s, 132 samples and 918 facilities**, against two timeouts before. Correctness was checked before speed: where both forms run they return identical IRI sets on both projections, the bounded answer is a strict subset of the unbounded one (918 of 1,494 facilities, 0 added), and across 5, 10, 30 and 50 km the answers nest. + + **The measurement cost more than the fix.** Three things had to be redone. Three bounded queries were first measured failing with out-of-memory while a pipeline run of ours was hammering the same endpoint. The before-and-after was first taken cold against warm, which credited the fix with three flips instead of two: the extra row is unbounded and anchor-constrained, with SPARQL byte-identical at 1,950 characters either side, timing out cold and answering in 15s warm. Re-run warm against warm, the honest number is **2 rows fixed, 0 regressed, 0 row-count drift**, identical across three consecutive sweeps. + + **Stated rather than buried:** step 0 of the statewide sweep shapes still fails, both rescued rows are step 1, and "bounded upstream questions work now" would be false. What is true is that the bound no longer fails *because* block A is open. `facilities upstream(30km) streams` changed failure mode rather than passing, and wells is unchanged on all four bounded combinations. + + Two guards were rebuilt rather than relaxed. `check-query-joins` asserted that bounded traces keep the anchor-first order, which was the defect; it now asserts the constrained-side rule and, separately, that the aggregate seeds from that side, since a query can read target-first while the cost stays where it was. `check-trace-direction` kept a string on a blacklist of reversed traces that a correctly target-seeded block also writes, so deleting it would have disarmed the only guard against the 2026-09-16 direction bug; queries naming both ends are now checked by reachability through the flow graph. Both verified by mutation. + + *Files:* `src/engine/templates/fusedQueries.ts`, `scripts/check-query-joins.mts`, `scripts/check-trace-direction.mts`, `scripts/query-matrix.mts`, `docs/query-matrix/*` (4 sweeps + a note), `docs/QUERY-MATRIX.md` (Part 10), `docs/DEBUGGING.md` + +16. **The Sweep That Could Not See the Bug, and a Snapshot Test That Was Never Committed** (2026-09-20) + Entry 15 could not be measured when it was found, because nothing in the harness could express the failing shape. `maxDistanceKm` appeared **zero times** in `scripts/query-matrix.mts`; M4, labelled a distance sweep in the header, sweeps the `near` relationship's hop distance in miles. The only bounded shape the matrix ever ran was one dashboard prebuilt. Behind that sat a second gap: `mk()` attached the region to block A unconditionally, and since the planner maps block A to the anchor for an upstream question, the anchor was always the constrained side, so the target-first join order and every question that leaves block A wide open were both unreachable. Phase MD adds the two axes, 32 rows, and measures both discovery steps rather than only the first, because at 30 km the samples projection answered while the facilities projection ran out of memory. + + Separately, `scripts/check-query-snapshots.mts` turned out to already exist, written on 2026-09-17, **untracked**, with `package.json` on another branch registering a command against a file nobody else had. It is committed here with its grid extended, because it was blind in the same two places: region placement and the flow bound. Measured on entry 15's fix, the old grid reports **1** moved shape; the extended grid reports **74**, bucketed by axis. 375 shapes now, and it is blocking in CI. + + Two things keep that snapshot readable rather than enormous. The PREFIX preamble is byte-identical in every query and was 66% of the file, so it is stripped and recorded once. Query bodies are written once each in a hash-keyed table: 375 shapes reference 2,078 step queries but only 603 distinct ones, the region-boundary query alone being identical in 373 of them. Together, 1.7MB down to 688KB, and a one-line change to a shared query stops being 373 lines of diff. + + **Known limit, recorded so it is not discovered later:** the snapshot drives everything through `planPipeline`, so it covers shapes a user can ask for and is blind to builder arguments the planner never produces. A reordering of the anchor-seeded `upstream` branch of `boundedTrace` passes all seven checks. The guarantee is "no reachable shape moved unintentionally", not "no emitted SPARQL moved". + + *Files:* `scripts/query-matrix.mts`, `scripts/check-query-snapshots.mts` (new), `scripts/__snapshots__/query-shapes.txt` (new), `package.json`, `.github/workflows/checks.yml` + +17. **Fixed: Narrowing a Question by Industry Made It Fail** (2026-09-20) + Found immediately after entry 15, by doing the obvious next thing with the map it fixed. "What facilities are within 5 km upstream from PFOS samples in York County" answers in 3s and returns 418 facilities, of which 261 distinct industries include dentists, schools and hospitals, because block A carries no industry filter and "facility" means anything with a NAICS code. Filtering block A to PFAS source categories returned nothing at all: a 30s timeout in query planning, on both projections. + + The cause sits one level above entry 15. `sideIsConstrained` answered yes for a region, an entity filter or an IRI pin alike, so an industry filter made the anchor count as constrained, the reorder stopped firing, and the query seeded from block A again. With a filter and no region that means every facility in that industry nationwide. The comment two lines above the predicate already read "narrowed is not small"; the predicate did not act on its own warning. + + It now returns a rank instead: an IRI pin 3, a region 2, an entity filter 1, nothing 0. The body leads with the higher, and ties keep the anchor-first order, so only questions with both sides constrained at *different* levels change plan. Of the 375 shapes in the query snapshot, 2 move. + + Measured with block A carrying no region: one code goes from a planning timeout to **35 facilities in 16s** unbounded and **22 in 8s** at 5 km; eight codes go from a planning timeout to **88 facilities in 3s** at 5 km. The filtered map is the useful one, 88 candidates rather than 418, with the dentists gone and sewage treatment, dry cleaners, boatyards, airports and petroleum terminals at the top. + + **One limit, and one that turned out not to exist.** A long industry selection fails only without a distance bound: 21 codes answers at 5 km (101 facilities, 13s) and runs out of memory unbounded, because the unbounded form walks the whole closure from every matched facility. That is a reason to set a distance, not to shorten the list. The clause first blamed for it, `FILTER(?ic = ?sel || EXISTS { ?ic fio:subcodeOf ?sel })`, was cleared by measurement: `fio:subcodeOf` is materialised transitively, so a zero-or-one path is an exact rewrite, and it is slower, 13s against a planning timeout. And one dashboard question changes plan, `samples-downstream-waste-indiana`, whose anchor is NAICS 5622 with no region against samples scoped to Indiana. Both orders were run before accepting it: identical answers, 136 samples and 415 facilities either way, reordered no slower. + + *Files:* `src/engine/templates/fusedQueries.ts`, `scripts/check-query-joins.mts` (30 new assertions), `scripts/__snapshots__/query-shapes.txt`, `docs/QUERY-MATRIX.md` (Part 11), `docs/DEBUGGING.md` diff --git a/docs/health/STATUS.md b/docs/health/STATUS.md new file mode 100644 index 0000000..347bea4 --- /dev/null +++ b/docs/health/STATUS.md @@ -0,0 +1,33 @@ +# Dashboard health + +_Generated by `npm run health-check` — see the weekly workflow in +`.github/workflows/health-check.yml`. Every run goes through the live pipeline, +never the result cache._ + +**Targets** are the entities the question asks for, **anchors** the ones it +relates them to, **reaches** the river segments drawn for a trace. Region +boundaries are recorded in the history but not shown — they are the county +outline, not an answer. + +A moved count is not automatically a bug: the knowledge graph reloads and +numbers change for real reasons. It is flagged so that when something *does* +look wrong, there is a date to point at. + +## development + +**8 of 8 working** · 2026-09-14 21:44 UTC · `9ecbbe0` + +| | Question | Time | Targets | Anchors | Reaches | Change since last run | +| --- | --- | ---: | ---: | ---: | ---: | --- | +| ✅ | Samples Near Agricultural Chemical Facilities in Maine | 22s | 29 | 11 | — | _first run_ | +| ✅ | Samples Near Landfills & DOD Sites in Penobscot and Knox County | 11s | 60 | 8 | — | _first run_ | +| ✅ | Surface Water Bodies Near Landfills & DOD Sites in Penobscot and Knox County | 4s | 103 | 6 | — | _first run_ | +| ✅ | Samples Downstream of Waste Treatment Facilities in Indiana | 14s | 123 | 882 | 15696 | _first run_ | +| ✅ | Maine Private Wells Near Landfills & DoD Sites | 19s | 751 | 38 | — | _first run_ | +| ✅ | Maine Private Wells Near Wastewater Treatment Facilities | 14s | 2431 | 135 | — | _first run_ | +| ✅ | Maine Private Wells Near Airports & Air Transportation Sites (AFFF) | 14s | 4425 | 174 | — | _first run_ | +| ✅ | PFHpA Groundwater Samples Downstream from Facilities in Cumberland County | 159s | 49 | 268 | 362 | _first run_ | + +--- + +Full history: [`history.jsonl`](./history.jsonl) — one JSON line per question per run. diff --git a/docs/health/history.jsonl b/docs/health/history.jsonl new file mode 100644 index 0000000..f65349a --- /dev/null +++ b/docs/health/history.jsonl @@ -0,0 +1,8 @@ +{"runAt":"2026-09-14T21:44:17.124Z","ref":"development","commit":"9ecbbe0","id":"samples-near-agchem-maine","title":"Samples Near Agricultural Chemical Facilities in Maine","attempts":1,"status":"success","ms":22053,"counts":{"FIND_TARGET_ENTITIES":29,"GET_ANCHOR_DETAILS":11,"GET_REGION_BOUNDARIES":16},"partialFailed":[],"partialSkipped":[],"error":null} +{"runAt":"2026-09-14T21:44:17.124Z","ref":"development","commit":"9ecbbe0","id":"samples-near-landfill-dod-penobscot-knox","title":"Samples Near Landfills & DOD Sites in Penobscot and Knox County","attempts":1,"status":"success","ms":11482,"counts":{"FIND_TARGET_ENTITIES":60,"GET_ANCHOR_DETAILS":8,"GET_REGION_BOUNDARIES":16},"partialFailed":[],"partialSkipped":[],"error":null} +{"runAt":"2026-09-14T21:44:17.124Z","ref":"development","commit":"9ecbbe0","id":"waterbodies-near-landfill-dod-penobscot-knox","title":"Surface Water Bodies Near Landfills & DOD Sites in Penobscot and Knox County","attempts":1,"status":"success","ms":4451,"counts":{"FIND_TARGET_ENTITIES":103,"GET_ANCHOR_DETAILS":6,"GET_REGION_BOUNDARIES":16},"partialFailed":[],"partialSkipped":[],"error":null} +{"runAt":"2026-09-14T21:44:17.124Z","ref":"development","commit":"9ecbbe0","id":"samples-downstream-waste-indiana","title":"Samples Downstream of Waste Treatment Facilities in Indiana","attempts":1,"status":"success","ms":14399,"counts":{"FIND_TARGET_ENTITIES":123,"GET_ANCHOR_DETAILS":882,"GET_REGION_BOUNDARIES":92,"GET_FLOWLINE_GEOMETRIES":15696},"partialFailed":[],"partialSkipped":[],"error":null} +{"runAt":"2026-09-14T21:44:17.124Z","ref":"development","commit":"9ecbbe0","id":"wells-near-landfill-dod-maine","title":"Maine Private Wells Near Landfills & DoD Sites","attempts":1,"status":"success","ms":19223,"counts":{"FIND_TARGET_ENTITIES":751,"GET_ANCHOR_DETAILS":38,"GET_REGION_BOUNDARIES":16},"partialFailed":[],"partialSkipped":[],"error":null} +{"runAt":"2026-09-14T21:44:17.124Z","ref":"development","commit":"9ecbbe0","id":"wells-near-wwtp-maine","title":"Maine Private Wells Near Wastewater Treatment Facilities","attempts":1,"status":"success","ms":14266,"counts":{"FIND_TARGET_ENTITIES":2431,"GET_ANCHOR_DETAILS":135,"GET_REGION_BOUNDARIES":16},"partialFailed":[],"partialSkipped":[],"error":null} +{"runAt":"2026-09-14T21:44:17.124Z","ref":"development","commit":"9ecbbe0","id":"wells-near-airports-maine","title":"Maine Private Wells Near Airports & Air Transportation Sites (AFFF)","attempts":1,"status":"success","ms":14222,"counts":{"FIND_TARGET_ENTITIES":4425,"GET_ANCHOR_DETAILS":174,"GET_REGION_BOUNDARIES":16},"partialFailed":[],"partialSkipped":[],"error":null} +{"runAt":"2026-09-14T21:44:17.124Z","ref":"development","commit":"9ecbbe0","id":"facilities-downstream-pfhpa-gw-cumberland","title":"PFHpA Groundwater Samples Downstream from Facilities in Cumberland County","attempts":1,"status":"success","ms":159024,"counts":{"FIND_TARGET_ENTITIES":49,"GET_ANCHOR_DETAILS":268,"GET_REGION_BOUNDARIES":16,"GET_FLOWLINE_GEOMETRIES":362},"partialFailed":[],"partialSkipped":[],"error":null} diff --git a/docs/plans/active/2026-09-17-fused-seed-side-and-observation-joins.md b/docs/plans/active/2026-09-17-fused-seed-side-and-observation-joins.md new file mode 100644 index 0000000..4870730 --- /dev/null +++ b/docs/plans/active/2026-09-17-fused-seed-side-and-observation-joins.md @@ -0,0 +1,318 @@ +# Seed the fused trace from the constrained side, and only join the observation detail a filter needs + +**Status**: active +**Created**: 2026-09-17 + +## Problem + +Two independent defects in `src/engine/templates/fusedQueries.ts`, both found while +running "What facilities are upstream from PFOS samples in York and Cumberland +counties (Maine)?" (facilities block empty, samples block PFOS + ME + two counties, +include non-detects on). + +**P1, seed side.** `buildFusedWhereBody` always emits the anchor block first, and +for an upstream question the planner puts block A on the anchor side +(`planner.ts:215`). Block A here has no region and no industry filter, so the query +starts from every facility in the graph and traces the national flowline network to +look for samples in two Maine counties. Measured: the pipeline fails at step 1 after +116.3s with `500 out-of-memory` ("tried to allocate 204.8 MB, only 159.3 MB +available"), retries as two county slices, and both slices fail the same way. +Wrapping the constrained side (samples + region + substance) in a sub-SELECT and +joining outward returns the answer in 18.6s cold. Full pipeline with the fix: +100.0s cold, 8.9s warm, complete. + +**P2, observation joins.** `bindEntityInCell` returns the full observation chain for +a samples block whenever `hasSampleFilters` is true, regardless of which filters are +set: `analyzedSample`, `hasResult`, `sampleOfMaterialType`, the material label, and +`coso:measurementUnit`. A substance-only filter needs two triples. Worse, the unit +join is a silent filter: a non-detect has no `coso:measurementUnit` (documented at +`samples.ts:11`, and the by-IRI templates already gate it behind `needsUnitJoin`), so +fused discovery drops non-detects even when the user asked to include them. Measured +on Cumberland PFOS observations: 1,688 observation rows, 914 with a unit, 774 +non-detect with no unit. At sample-point level on a pinned comparison case +(Cumberland, NAICS 5622) the shipped query returns 23 sample points and 13 +facilities; without the unneeded joins it returns 32 and 15, a superset with zero +losses either way. + +## Approach + +**P1: write the constrained side first in the flat body. No sub-SELECT.** + +`buildFusedWhereBody` emits the anchor block, then the trace, then the target block. +When the anchor side has no region, no block filters and no IRI pin and the target +side has at least one of those, emit the target block, then the trace, then the +anchor block. Same triples, same variables, different textual order. Nothing else +changes: no sub-SELECT, no new option on the builders, no executor retry. + +Two earlier designs were measured and rejected, in this order: + +1. *Wrap the constrained side in a sub-SELECT.* Rescues 5 shapes, breaks 7 that work + today, all `500 out-of-memory`. A sub-SELECT is an optimiser barrier in QLever: it + has to be materialised before anything joins to it and the planner cannot reorder + across it, so it forces one plan and forbids every other. +2. *Keep the sub-SELECT but project only the distinct cells, re-joining the target + entity last.* Same 7 shapes still fail, three of them degrading from OOM into 60s + timeouts. Entity multiplicity through the trace was not the cause either. + +What the measurements actually point at is that **textual triple order changes +QLever's plan for these bodies**. They run 12 to 14 triples, past the point where the +planner searches join orders exhaustively, so it falls back on something that follows +the query text. Writing the unconstrained side first is what produces the bad plan; +moving the constrained side to the top is the entire fix. + +Volume is not the discriminator, which is worth recording so nobody re-derives it. +Rows materialised through the trace, Cumberland seeds: samples + PFOS 872,385; +facilities 681,299; wells 4,183,432. The samples seed materialises more than the +facilities seed and succeeds where it fails. + +**P2: emit only the joins the active filters read.** + +Replace the all-or-nothing `hasSampleFilters` gate with a per-filter requirement set +for the IRI-finding queries: + +| filter set | joins needed | +| --- | --- | +| `substances` | `?observation coso:observedAtSamplePoint`, `coso:ofDSSToxSubstance` | +| `materialTypes` | the above + `coso:analyzedSample`, `coso:sampleOfMaterialType` | +| `minConcentration` / `maxConcentration` | + `coso:hasResult`, `qudt:quantityValue`, `coso:measurementUnit` | +| `includeNondetects: false` | + `coso:hasResult` and the non-detect binds | +| none | no observation joins (today's `sampleObservations: false`) | + +The material *label* join (`?matType rdfs:label`) is never needed for filtering, only +for display, so it goes in every discovery case. Hydrate queries keep the full block: +they project `?matTypeLabel`, `?unit` and `?result_value`. + +While in there, fix the adjacent `near` wart this exposed: `buildFusedNearQuery` +passes `anchorSampleObservations: opts.project !== 'anchor'`, so the *non-projected* +samples side keeps the whole chain even with zero filters. Verified: anchor samples +with no filters, `project: 'target'` emits the chain and the unit join. The same +per-filter rule removes it. + +## Tasks + +- [x] `fusedQueries.ts`: `sideIsConstrained` (region / block filters / IRI pin per side) and the target-first hydrology body when the anchor is unconstrained +- [x] `fusedQueries.ts`: replace the `hasSampleFilters` gate in `bindEntityInCell` with `sampleJoinsNeeded`, per-filter; hydrate callers keep the full block +- [x] `buildFusedNearQuery`: drop the `project !== side` heuristic, pass `false` for both sides +- [x] `buildEntityProbeQuery`: same lean bind, so the probe sees what discovery sees (the probe list becomes the chunk membership) +- [x] `buildSampleDetailByIriQuery`: the unit join moved after `resultValueClauses()` with the symbol lookup nested inside, so popups stop hiding non-detects +- [x] `scripts/check-query-joins.mts` (265 checks): join order across all 72 hydrology shapes x 2 projections, the pinned and distance-bounded exceptions, the per-filter join rule on hydrology and near, and that no prebuilt reorders. Wired into `package.json` and `.github/workflows/checks.yml` +- [x] `docs/DEBUGGING.md`: both bugs, with the measurements and the two rejected designs +- [ ] re-run `npm run health-check` and record the row-count movement in `docs/health/STATUS.md` +- [ ] `npm run query-matrix` sweep, then `--index`, to price both fixes across the shape space +- [ ] update `docs/QUERY-MATRIX.md` (error catalogue: the OOM that this removes) +- [ ] measure the distance-bounded shape reordered, and drop the `!maxDistanceKm` + exclusion if it holds. This is the one condition in the gate that is a "we + did not look", not a "we looked and it was worse": `boundedTrace` takes the + seed as a pre-rendered string and embeds it twice, so there was no seam to + reorder at. Left unmeasured it hardens into folklore. +- [ ] decide on the retry variant below + +## Verified after implementing (2026-09-17) + +`check-trace-direction` (2,068 checks), `check-step-labels` (651), +`check-cache-key` (19), `check-substance-labels` (13) and the new +`check-query-joins` (265) all pass. `tsc -b` clean; `npm run lint` still reports +the same 15 pre-existing component errors as the unmodified tree. + +Live, through the real builder, single-county spot checks matched the sweep +exactly where the sweep was comparable: `facilities <- facilities` 4 rows, +`waterBodies <- facilities` 146, `wells <- aquifers` 7,434. The two samples +shapes returned 307 and 351 rather than the sweep's 339 and 384, which is P2 +working: sweep 2's flat variant predated it and dropped the substance filter +entirely, so its counts were unfiltered. 307 and 351 match sweep 1, which +applied the filter. + +Popup detail on sample point 64220: **3,334 rows, 2,860 non-detect, 8.8s**, up +from 474 rows. + +**The screenshot question now answers, but not quickly.** End to end through the +pipeline: **245.5s, status success**, where before it was a hard error. It is +slow because the two-county query still exceeds the budget as one flat request +(62s timeout, reproducible), so the executor rescues it by slicing into the two +counties, and each county takes 15-16s per projection. The slices now succeed, +which is why the run completes at all; before the fix they inherited the +anchor-first order and failed too. + +## The retry variant, measured and not implemented + +The sub-SELECT was rejected as a *default* because it breaks 7 shapes. As a +*retry after a splittable failure* it cannot regress anything that succeeds, and +on this question it is worth a great deal: + +| Query | Time | Rows | +| --- | --- | --- | +| flat reorder, both counties | 62.0s timeout | fails | +| sub-SELECT, both counties | **7.3s** | 503 | +| flat reorder, Cumberland only | 15.2s | 307 | +| sub-SELECT, Cumberland only | **1.4s** | 307 | + +That is 245.5s of slice-and-retry versus one 7.3s request. It needs a +`buildRetryQuery` hook on `PipelineStep` and one branch in the executor's +failure path, ahead of `chooseAxis`. Deliberately left out of this change: it is +a new execution mechanism rather than a template fix, and it should be measured +across the shape space on its own. + +## Measured regression sweep (2026-09-17) + +All 36 hydrology entity-type pairs, two configurations each (region + filters on the +target side with the anchor wide open, and the mirror), `project: 'target'`, +Cumberland County, unbounded trace. Shipped query versus proposed query, comparing +IRI sets and time. 72 comparisons per sweep, run twice: once for the rejected +sub-SELECT design, once for the flat reorder that this plan now proposes. + +| | sub-SELECT (rejected) | flat reorder (proposed) | +| --- | ---: | ---: | +| Shipped succeeded | 66 | 66 | +| Proposed succeeded | 70 | **71** | +| Rescues (shipped failed, proposed worked) | 5 | **5** | +| Regressions (shipped worked, proposed failed) | **7** | **0** | +| Comparisons that lost a row | 0 | **0** | +| Median time change where both succeed | +48% | +9% | + +The +48% on the rejected design is inflated: several of its "wins" are shapes it then +broke. The flat reorder is faster in 50 of 66 comparable runs. + +The 5 rescues are the same in both sweeps, and they are the screenshot shape: +`samples <- facilities / waterBodies / wells / aquifers / streams [target-scoped]`. +Shipped OOMs or times out at 28.1s to 69.3s; the flat reorder answers in 7.9s to +12.8s. + +One shape fails both ways and is untouched by this plan: `wells <- wells +[target-scoped]`, ~80s timeout on both. + +The 7 shapes the sub-SELECT broke, all of which the flat reorder leaves working with +identical row sets: `facilities <- facilities`, `facilities <- aquifers`, `facilities +<- streams`, `waterBodies <- facilities`, `waterBodies <- aquifers`, `wells <- +facilities`, `wells <- aquifers`. + +Sweep 1 also confirmed P2 independently: every `X <- samples [anchor-scoped]` row +gained rows and lost none (+599 wells, +129 streams, +42 samples, +19 facilities, ++13 water bodies, +13 aquifers), which is the recovered non-detects. + +**What the sweeps do not cover**, and what the tasks above therefore still call for: +one run per combination against a memory-pressured endpoint, a single county scope, +one filter configuration, `project: 'target'` only, and no `maxDistanceKm`. Several +passing shapes land at 15-25s, close enough to the 30s ceiling that load decides the +outcome. Distance-bounded traces route through `boundedTrace`, which embeds the body +a second time and was not measured here. + +## Impact on other query shapes + +**P1 reaches 72 of the 108 shapes, but reorders almost none of them in practice.** +The edit is in the `mode !== 'near'` branch, shared by `buildFusedHydrologyQuery`, +`buildFusedWellQuery` and (via the duplicated seed) `boundedTrace`, so it covers all +36 downstream and all 36 upstream shapes including the well and flowline layers. The +36 `near` shapes take the other branch and are untouched. Whether a given question +actually changes depends on its filters, not its shape: I evaluated all eight +prebuilt dashboard questions and **none of them reorder**, because every one has a +constrained anchor (`facilities` with an industry filter, or a county). The reorder +fires for user-built questions that leave one side wide open, which is exactly the +screenshot case. + +**P2 reaches every shape with samples on a filtered side, `near` included.** +`bindEntityInCell` is shared by all three builders. Of the 108 shapes, 33 have +samples on at least one side. Row counts move upward wherever a substance-only or +material-only filter is set, because those questions stop dropping non-detects. Of +the prebuilt questions only `facilities-upstream-pfhpa-gw-cumberland` carries sample +filters, and it sets a 10-1000 ng/L range, so it keeps the unit join and its counts +should not move at all. The `near` cleanup was measured on +`samples-near-agchem-maine`: 5 facilities shipped, 5 facilities trimmed, 8.05s vs +7.74s, so no movement there either. + +**P2 does not reintroduce the OOM the old note feared.** The `ponytail` comment at +`fusedQueries.ts:90` says dropping the unit join "triples the matched rows and the +endpoint OOMs on statewide pipelines". Re-measured on a statewide Maine PFOS +downstream question: shipped asks for 825.6 MB (project=target) / 712.1 MB +(project=anchor) and OOMs; trimmed asks for 409.6 MB and still OOMs. Trimming +*lowers* the peak allocation. The statewide shape fails either way, which is a +chunking problem, not this one. The comment should be replaced with these numbers. + +**Chunking behaviour is unchanged.** Both fixes are template-level. `chooseAxis`, +`halve` and the step budget keep working as they do now; P1 only makes the whole +query succeed more often, so slicing runs less. + +## Are we making the P2 mistake anywhere else? + +Audited every site that touches the sample observation chain. + +1. **`downstreamSamples.ts:97`, `buildSampleDetailByIriQuery` (popup detail): yes, + same bug, larger effect.** `?result coso:measurementUnit ?unit .` is required, so + the observation table in a sample popup silently omits every non-detect. Measured + on `me-egad-data#d.egad.samplePoint.64220`: **474 rows as shipped, 3,334 rows with + the unit join made optional, of which 2,860 are non-detects**. The naive fix + (`OPTIONAL { ?result coso:measurementUnit ?unit }` in place) OOMs at 819.7 MB. + Moving the join after `resultValueClauses()` and nesting the symbol lookup inside + it works at the same cost as today: 6.88s vs 6.59s, 3,334 rows. Worth doing in + this plan or immediately after it. +2. **`downstreamSamples.ts:40`, `buildSampleRetrievalByIriQuery` (sample hydration): + correct already.** Gated behind `needsUnitJoin(filters)`. Its other required joins + are legitimate: hydration lost exactly 1 of 547 discovered sample points in the + measured run, and that point has no `geo:asWKT` at all, so it cannot be drawn. +3. **`regions.ts` discovery queries (substance, material, county, industry dropdowns): + clean.** None of them join `coso:measurementUnit` or `coso:hasResult`; the + substance and material counts shown in the dropdowns are not deflated. +4. **`hydrate.ts` facility / water body / stream / aquifer queries: no observation + joins.** `buildFacilitiesByIri` does require `rdfs:label` on both the facility and + its industry code, which would drop an unlabelled facility; not observed in this + run and out of scope here. + +## The same class of bug elsewhere (measured 2026-09-17) + +Beyond the observation chain, every required (non-`OPTIONAL`) join in the templates +was checked against live per-entity coverage in Cumberland County and statewide +Maine. Three findings, one of them larger than P2. + +**1. The facility layer shows about a quarter of the facilities it could.** +`buildFacilitiesByIri` (`hydrate.ts:15`) and the facilities branch of +`bindEntityInCell` both require `fio:ofIndustry` and `?industryCode a +naics:NAICS-IndustryCode`, whether or not the user picked an industry. Maine, cells +to layer: + +| Required joins, cumulative | Facilities | +| --- | ---: | +| `fio:Facility` in ME S2 cells | 11,954 | +| + `geo:asWKT` (legitimate, cannot map without it) | 10,164 | +| + `rdfs:label` | 10,164 | +| + `fio:ofIndustry` | 3,601 | +| + `?ic a naics:NAICS-IndustryCode` | 2,718 | +| + `?ic rdfs:label` (what we ship) | 2,718 | + +So the industry-code requirement costs **7,446 of 10,164 mappable Maine facilities, +73%**. Cumberland alone: 2,595 in cells, 2,203 mappable, 603 shipped. The excluded +ones are not junk records: sampling them returns SEBAGO LAKE WATER TREATMENT +FACILITY, AMERICOLD LOGISTICS PLANT # 80573, KOCH MATERIALS. A water treatment plant +is exactly what a PFAS question is looking for. + +Both label joins are free (100% of geometry-carrying facilities have them), so they +are waste rather than a filter, and the NAICS type assertion costs a further 883 on +its own. Fixing this is a bigger behaviour change than P2 and deserves its own plan, +but it is the same mistake: a join added for display or for a filter that is not set. + +**2. `?s2cell` is projected by three hydrate queries and read by nothing.** +`buildFacilitiesByIri`, `buildSampleRetrievalByIriQuery` and `buildWaterBodiesByIri` +all select it; grep finds no consumer outside `templates/` and `engine/scope.ts`. +Its join is required, so it filters, and because it appears in `DISTINCT` / +`GROUP BY`, an entity touching several cells is returned several times. + +**3. Two suspects came back clean, worth recording so nobody re-checks them.** +Flowline `nhdplusv2:hasFTYPE` and geometry are at **434,501 of 434,501** graph-wide, +so requiring them costs nothing. Sample-side labels are complete too: of 576 +Cumberland sample points, 575 have geometry, 571 have an observation, and all 571 +have the lab-sample label, material type, material label and `coso:fromSamplePoint` +that the hydrate and detail queries require. The one sample point the pipeline drops +has no `geo:asWKT` at all. + +## Notes + +- Equivalence evidence for P1: on a pinned case the current template survives + (Cumberland, NAICS 5622), current and reordered return identical IRI sets both ways + when the observation joins are held constant (23 samples / 13 facilities, zero + diff). That is the check to re-run after implementing, since it separates P1 from + P2. +- Endpoint capacity is volatile. One repeat of the two-county query OOM'd trying to + allocate 1.6 MB, and York alone measured 9.5s standalone but 2.4s after Cumberland + warmed the shared sub-results. Treat single cold timings as plus or minus 10s, and + re-measure warm and cold separately. +- The screenshot question returns 3,013 facilities for two counties because block A + has no industry filter. Correct, but it is also 4 flowline batches and 37s of the + 100s cold run. Not part of this plan. diff --git a/docs/plans/done/2026-09-13-query-execution-architecture.md b/docs/plans/done/2026-09-13-query-execution-architecture.md new file mode 100644 index 0000000..d907e7c --- /dev/null +++ b/docs/plans/done/2026-09-13-query-execution-architecture.md @@ -0,0 +1,425 @@ +# Query Execution Architecture + +**Status**: done +**Completed**: 2026-09-14 — Phases 1 and 2 implemented and verified; Phase 3 +shipped as a result cache instead of server-side execution, see +[`2026-09-14-phase-3-result-cache.md`](./2026-09-14-phase-3-result-cache.md) +**Created**: 2026-09-13 +**Reference sheet**: [`docs/QUERY-MATRIX.md`](../../QUERY-MATRIX.md) — every question the +UI can build, measured against the live endpoints. This plan is verified against +that sheet in Part 8. + +--- + +## Part 1 — Summary + +Today the Explorer sends one big SPARQL query per pipeline step and hopes it +finishes. The graph engine kills anything that takes more than 30 seconds, and +many of our questions take 20–40 seconds, so a large share of the query space +fails — not sometimes, but always. + +This plan changes one thing at the core: **stop sending work we can't bound.** +Run a query whole; if it fails, split it into pieces that fit and merge the +results. Then put the whole pipeline behind our own API server so the answer is +computed once and reused, instead of every visitor re-running it. + +Nothing about the questions the user can ask changes. Nothing about the answers +changes. What changes is how the work is packaged. + +--- + +## Part 2 — The problem in plain language + +**The 30-second wall.** QLever (the graph engine at `apps.okn.us`) stops any +query at 30 seconds and returns HTTP 429. That status normally means "too many +requests," which sent us looking for rate limiting that doesn't exist. The +response body says what really happened: `"Operation timed out."` + +**Our queries sit at or past that wall.** The expensive part is the river +network trace (`hyf:downstreamFlowPathTC`) and whole-state spatial joins. Their +cost depends on how much data exists in the state, not on what the user asked +for. A query returning 0 rows can still try to allocate 3.3 GB on the way there. + +**The engine's cache decides whether we pass.** The identical query measured +**26.5s cold** and **1.5s warm**. So a question that worked yesterday fails +today, with no change on our side. That is why this has felt intermittent and +unfixable. + +**We have swung between two bad options twice.** Either we paste the list of +IDs into the query (too big a request → 413/502) or we make the server +re-derive the list every time (too slow → 429/500). Both waste work. Neither is +the answer. + +--- + +## Part 3 — How it works today (before) + +### 3.1 The pipeline + +A question becomes 6 or 7 sequential queries (`src/engine/planner.ts`), run one +after another by `src/engine/executor.ts`. All 75 type/relationship combinations +collapse into **12 distinct step sequences**. The two most common: + +``` +Near (e.g. samples near facilities), 6 steps: + FIND_TARGET_IRIS → FIND_ANCHOR_IRIS → HYDRATE_TARGET_BY_IRI + → HYDRATE_ANCHOR_BY_IRI → GET_SAMPLE_DETAILS → GET_REGION_BOUNDARIES + +Downstream / upstream, 7 steps — same, plus GET_FLOWLINE_GEOMETRIES +``` + +Everything runs on the `federation` endpoint except water-body and aquifer +hydration (`hydrologykg`) and region boundaries (`spatialkg`). + +### 3.2 What each step does, and what's wrong with it + +| Step | What it asks for | Problem today | +| --- | --- | --- | +| `FIND_TARGET_IRIS` | IDs of the things to show | Unbounded. Carries the whole state's trace. **This is where most failures happen.** | +| `FIND_ANCHOR_IRIS` | IDs of the things they relate to | Same query, projected the other way — so the same cost is paid **twice** | +| `GET_FLOWLINE_GEOMETRIES` | river lines to draw | Inlines every anchor ID; no limit on how many | +| `HYDRATE_TARGET_BY_IRI` | map data for the targets | Above 3,000 IDs, falls back to a re-derived query that is known to time out | +| `HYDRATE_ANCHOR_BY_IRI` | map data for the anchors | Same | +| `GET_SAMPLE_DETAILS` | every measurement at every sample | 18–37 MB, used only to fill popups one click at a time | +| `GET_REGION_BOUNDARIES` | county/state outlines | 2.6 MB of geometry, re-fetched every run | + +### 3.3 The three failure behaviours + +1. **All-or-nothing.** `executor.ts:100` aborts the whole pipeline when any step + fails. Five successful steps are discarded because the sixth timed out. +2. **No memory.** Every run starts cold. Two users asking the same question pay + the full cost twice; so does one user pressing reload. +3. **One error message.** Nine distinct failures (see the matrix sheet, Part 4) + all surface as *"Something went wrong. You can edit the question and try + again."* The user cannot tell "too big" from "try again in a minute." + +### 3.4 What changed on 2026-09-13 (the three patches) + +These are in the working tree now. They are real improvements and they stay +until this plan replaces them. + +| # | Before | After the patch | +| --- | --- | --- | +| 1 | ID-finding queries joined in every measurement (substance, sample, result, material, unit) and discarded them | Those joins are dropped unless a filter needs them. Downstream `FIND_TARGET_IRIS`: 7/7 failures → 4.3s | +| 2 | Sample hydration re-derived the entire trace inside the query | Reuses the IDs the previous step found, when ≤3,000. 33.8s timeout → 0.8s | +| 3 | Any 429 killed the run | One automatic retry, which lands on the now-warm cache | + +**What they did not fix**, and this plan must: upstream questions, near with +3+ hops, traces anchored on large entity sets, Illinois, and anything above the +3,000-ID cap. + +--- + +## Part 4 — How it will work (after) + +### 4.1 The core idea + +``` +run(query, scope): + result ← execute(query, scope) + if result failed AND scope can be divided: + left, right ← divide(scope) + return merge(run(query, left), run(query, right)) + return result +``` + +Run it whole. If the engine refuses, cut the scope in half and run both halves. +Keep cutting only where cutting is needed. + +**Why split-on-failure rather than always-split:** most questions already work +in a few seconds (the matrix sheet shows the majority of shapes at ✅). Those +should keep costing exactly one request. Only the shapes that fail pay the +splitting cost, and they pay it only as deep as they need. + +**Why this beats tuning thresholds:** per-chunk cost is not predictable. One +Illinois sample point took **26.9s** while its neighbours took 4s. No static +"chunk size = N" rule survives that. Failure is the only reliable signal. + +### 4.2 What "divide the scope" means + +Three axes. The executor picks whichever side is smallest. + +| Axis | Divide by | Use when | Measured | +| --- | --- | --- | --- | +| **Anchor entities** | batches of the Block C entities | anchor set is small and listable | 186 ME airports in 0.8s → 8 batches of 25 → 2.8–3.0s each | +| **Target entities** | batches of the Block A entities | target set is the small side | IL: 78 samples → batches of 20 → 12.7s each | +| **Region** | one county at a time | neither entity side is listable | ME ↓ 83,038 wells → 16 counties → 6.3–7.5s each | + +**The axis is not fixed, because the right one flips between states:** + +| | Maine | Illinois | +| --- | --- | --- | +| Sample points | 4,528 | **78** | +| Facilities | 2,976 | **22,574** | +| Best axis | anchor (facilities) or county | **target (samples)** | +| County axis | works — 6.3–7.5s per county | **fails — Cook County alone needs 3.3 GB** | + +### 4.3 Choosing the axis cheaply + +Do **not** use `COUNT` to size a side. Counting Maine's facilities without an +industry filter took **11.0s** — as expensive as the query we're trying to +plan. + +Instead **probe with a limit**: `SELECT ?x WHERE { ...block filters... } LIMIT 201`. +If fewer than 201 rows come back, the side is small and listable, and we already +have the list. If it fills, that side is "large" and we move on to the next +axis. Filtered probes are fast: 186 ME airports listed in **0.8s**. + +Probe results are cached — a side's size only changes when the graph data does. + +### 4.4 Merging chunk results + +- **ID lists** (`FIND_TARGET_IRIS`, `FIND_ANCHOR_IRIS`): union, deduplicated by + IRI. Verified identical to the monolith on shapes 3, 4 and 6 of the matrix + (1,172 / 1,591 / 2,274 rows, exact match). +- **Hydration rows**: chunked by target IRI, so a given entity appears in + exactly one chunk. Per-entity aggregates (`COUNT`, `MAX`, `GROUP_CONCAT`) + stay correct because their `GROUP BY` key never spans chunks. **This is the + rule that must not be broken:** never chunk an aggregate query on an axis + other than its own `GROUP BY` key. +- **Geometry rows** (flowlines, boundaries): union, deduplicated by IRI. The + same river reach reached from two anchors is one line. + +### 4.5 Run it on our server, and remember the answer + +> **Superseded 2026-09-14 — see +> [the Phase 3 plan](./2026-09-14-phase-3-result-cache.md).** Exploration found +> a cheaper answer than moving execution server-side: the publisher's browser +> has *already computed* the result, so it can simply hand it over. What shipped +> is a result cache written only by trusted paths (the publisher via their +> `editToken`; a maintainer script via `CACHE_WRITE_TOKEN`), with public reads +> and a fall-through to local execution on a miss. Measured 37 ms cached vs +> 6.6 s live on a warm engine, 178×. Server-side execution stays deferred; the +> read path is identical either way, so it can be swapped in later without +> touching the client. The rest of this section is kept as the original +> reasoning. + +`server/` is already an Express + Postgres service deployed for publishing +(`server/src/index.ts`, `server/src/routes/publish.ts`). Add `POST /api/query`: +it runs the pipeline and caches the result in Postgres, keyed by a hash of the +`AnalysisQuestion` plus a data-version tag. + +What this buys that the browser cannot: + +- **The cold cost is paid once, ever.** First asker waits; everyone after gets + the cached answer. Given the 26.5s → 1.5s cold/warm gap, this is the single + biggest user-visible win. +- **Single-flight.** Ten people opening the same shared link trigger one + computation, not ten. +- **Retries and chunk splitting are invisible.** The browser makes one request. +- **Published links precompute at publish time** — exactly the flow that + produced the original 429 screenshot. +- **Nightly prewarm** of the 8 dashboard questions + (`src/constants/prebuiltQueries.ts`), so the common paths are never cold. +- **Responses shrink** — the server can filter and aggregate before sending. + +### 4.6 Fetch popup details on demand + +`GET_SAMPLE_DETAILS` returns 18–37 MB per run. Its only consumer is the popup +body (`useMapLayers.ts:57` → `MapPopup.tsx:119`), which shows one sample at a +time. One sample's details is **31 rows / 29.8 KB**. + +Remove the step; fetch per sample when its popup opens. Caveat worth planning +for: a single-sample fetch measured **10s cold**, so this needs the server +cache (4.5) or a viewport prefetch behind it, or we trade a 26s wait up front +for a 10s wait on click. + +--- + +## Part 5 — Before and after, step by step + +| Step | Before | After | +| --- | --- | --- | +| Choosing scope | none — always whole region | probe both sides with `LIMIT 201`, pick the smaller as the split axis | +| `FIND_TARGET_IRIS` | one unbounded query | one query; on failure, split and merge | +| `FIND_ANCHOR_IRIS` | second unbounded query, same cost paid twice | derived from the same chunk results where possible | +| `GET_FLOWLINE_GEOMETRIES` | inlines all anchor IDs, uncapped | chunked with the same mechanism; no cap needed | +| `HYDRATE_*_BY_IRI` | ≤3,000 inline, else a query that times out | always inline, chunked at ~1,000 IDs (70 KB/request, 1.0–3.3s measured) | +| `GET_SAMPLE_DETAILS` | 18–37 MB up front | deleted; per-sample on popup open | +| `GET_REGION_BOUNDARIES` | 2.6 MB every run | cached server-side; it changes ~never | +| On failure | whole pipeline aborts, generic red card | chunk retried, then split; partial results shown with an explicit note | +| Second identical run | full cost again | served from Postgres cache | + +--- + +## Part 6 — Worked examples + +**A. "Samples in Maine near airports" (works today)** +Before: 6 queries, 12.8s. After: 6 queries, 12.8s cold — **unchanged**, because +nothing failed and nothing was split. Second run: near-instant from cache. + +**B. "Samples in Maine downstream of airports" (fragile today)** +Before: 4–32s, fails when cold. After: `FIND_TARGET_IRIS` runs whole (4.3s warm) +or, when it fails cold, splits into 8 anchor batches of 2.8–3.0s. Same 1,172 +sample points either way. + +**C. "Samples in Maine downstream of wells" (always fails today)** +Before: 429 at 42s, every time. After: the anchor side probes as large (83,038 +wells), so the executor falls to the county axis — 16 chunks at 6.3–7.5s. + +**D. "Samples in Illinois downstream of airports" (always fails today)** +Before: 500 OOM at 16s. After: anchor side is large (22,574 facilities) and the +county axis is fatal (Cook County: 3.3 GB), so the target side wins — 78 samples +in batches of 20, 12.7s each, 4 chunks. + +--- + +## Part 7 — Edge cases + +| Case | What happens | +| --- | --- | +| A chunk returns 0 rows | Normal. Merge skips it; other chunks still count. | +| Every chunk returns 0 rows | Same "no results" state as today (`executor.ts` empty path). | +| A chunk fails even when split to a single entity | Cannot divide further. Return partial results **and say so** — "showing 7 of 8 areas; one timed out" — never silently. | +| An entity appears in several chunks | Deduplicated by IRI on merge. | +| Aggregate query chunked on the wrong axis | Forbidden by rule 4.4 — aggregates may only be chunked on their `GROUP BY` key. | +| User edits the question mid-run | Abort in-flight chunks (`AbortController`), discard partial state. | +| Two users ask the same question at once | Single-flight in the server; one computation, both served. | +| Graph data is updated | Cache key includes a data-version tag; bump it to invalidate. | +| Filters set (substance, material, range, non-detects) | Applied inside every chunk, never after merging — otherwise per-chunk results are wrong. | +| "Near, 0 miles" (hops = 0) | Same cell, no neighbour expansion — cheapest shape, never split. | +| User already picked counties | The region axis is those counties, not all 16. | +| No region selected at all | Largest possible query; region axis falls back to the state list. See matrix row M7 for whether this is viable at all. | +| Water body / aquifer hydration | Runs on `hydrologykg`, which rejects >~1 MB bodies (413, `ebc6dda`). Chunk size must respect the smaller per-endpoint limit. | +| Very large successful response | A 37 MB body can still truncate mid-JSON under load. Chunking bounds response size too. | +| Server cache miss under load | Falls through to live execution; no correctness difference, only latency. | + +--- + +## Part 8 — Verification against the matrix sheet + +The sheet ran **156 queries**: 119 worked, 37 failed, and 32 of the 119 were +slow enough (>15s against a 30s limit) to fail on a cold cache. This part checks +the plan against every group in it. + +### 8.1 Does the plan fix what is broken? + +| Group in the sheet | Failing today | Which part of the plan handles it | Proven? | +| --- | --- | --- | --- | +| Downstream, 25 pairs | 15 fail | 4.1 bisection + 4.2 axis choice | ✅ verified on 3 of them (airports, wells, all-facilities) | +| Upstream, 25 pairs | 12 fail | same | ✅ verified: 8 chunks × 2.8–3.0s, 2,274 rows | +| Near ≥ 3 hops | 3 fail | same | ✅ verified: 8 chunks × 3.4–8.2s, 1,591 rows | +| Other states (5 of 6 fail) | 5 fail | 4.2 — target axis, because county is fatal in Illinois | ✅ verified for Illinois; ❌ **Indiana, Massachusetts, New Hampshire, Alabama not yet tested** | +| No region at all | 1 fail | 4.2 — region axis falls back to the state list | ❌ not tested | +| `samples near samples` | 1 fail | bisection on either side (both are samples) | ❌ not tested | +| Hydration above 3,000 IDs | latent | 4.4 — chunk at ~1,000 | ✅ verified: 5 chunks, 1.0–3.3s, 0 failures | +| 32 fragile (>15s) queries | at risk | 4.5 server cache — cold cost paid once | ❌ not tested (no server yet) | +| 4 dashboard queries at 30–67s | slow | 4.5 cache + 4.6 lazy details | ❌ not tested | + +**Verified so far: ~40 chunk runs, 0 failures, every merged result identical to +the monolith where a monolith could produce one.** + +### 8.2 What the sheet says that changes the plan + +1. **This is not an edge-case problem.** 37 of 156 queries fail and 32 more are + fragile — that is **44% of the measured space at risk**. Bounded execution is + not an optimisation, it is the fix. +2. **Maine flatters us.** Every state we test against by habit is the one state + where things mostly work. Indiana is in our own dashboard and fails on the + plain form of the question. **Phase 2 must be verified against at least + three states, not Maine alone.** +3. **`GET_REGION_BOUNDARIES` took 25.5s** in one dashboard run — a query for + county outlines that never change. It is the clearest possible case for + caching, and it is not even about chunking. Move it to Phase 1. +4. **The distance selector is a cliff.** 0 hops is 0.3–0.7s; 4 hops times out. + Cost per hop rises steeply and unevenly. The UI currently offers 0–4 miles + with no indication that the top of that range mostly doesn't work. +5. **One dashboard query returns 0 results** ("PFHpA Groundwater Samples + Downstream from Facilities in Cumberland County"). That is a data or query + correctness issue, not a performance one — **out of scope for this plan, but + it should be raised separately.** + +### 8.3 Gate for calling this done + +Re-run the matrix harness after each phase and diff against +`docs/query-matrix/2026-09-14-raw-baseline.csv`: + +- No shape may move from ✅/⚠️ to ❌. +- All 37 ❌ rows must become ✅ or ⚠️. +- The 32 fragile rows should move under 15s once the cache lands. +- Run the sweep twice — once cold, once warm — because a single sweep hides the + cache effect that causes most intermittent failures. + +--- + +## Part 9 — What we are deliberately not doing + +- **No backoff on retries.** There is no quota to wait out; the failure is a + fixed 30-second compute limit. +- **Not removing the NAICS `EXISTS` subcode filter.** Measured *slower* without + it (16.7s vs 8.0s, identical rows). +- **Not capping the flowline anchor list with a server-side fallback.** That + fallback is documented as wrong in `3f50251` — it dropped 16 of 39 + contributing landfills. +- **Not parallelising chunks for speed.** The endpoint serializes them anyway + (22s parallel vs 23s sequential, measured). Chunking is for bounded failure, + not latency. Latency comes from the cache. +- **Not moving to a different graph engine or hosting our own copy.** Out of + scope, and the cache plus bounded work should make it unnecessary. + +--- + +## Part 10 — Tasks + +**Phase 1 — done 2026-09-13** +- [x] Cache `GET_REGION_BOUNDARIES` — `sparqlClient.ts` session cache, opted into per step +- [x] Per-sample popup fetch (`hooks/useSampleDetails.ts`); `GET_SAMPLE_DETAILS` deleted from the pipeline +- [x] Error cases distinguished (`engine/sparqlErrors.ts` → `PipelineProgressStrip`) +- [ ] Email okn.us: access token to raise the 30s limit; materialized downstream relation + (draft ready at `docs/plans/drafts/2026-09-13-team-email-429.md`, not sent — + see "Carried forward" below) + +**Phase 2 — done 2026-09-13** +- [x] `LIMIT 201` side-probe + axis selection (`engine/scope.ts`) +- [x] Split-on-failure runner with merge + dedupe (`engine/executor.ts`) +- [x] Chunk-level progress in `PipelineProgressStrip` +- [x] Partial-result UI state (`components/Pipeline/PartialResultsNotice.tsx`) +- [x] `MAX_INLINE_SAMPLE_IRIS` and the inline-vs-re-derive fork deleted, along with + `buildFusedSampleAggregateQuery` / `buildFusedSampleDetailsQuery` + +**Phase 3 — shipped as a result cache, not server-side execution** + +Moving execution to the server was dropped deliberately. The publisher's browser +has *already computed* the result, so handing that over is far cheaper than +re-running the pipeline server-side, and it removes the single-flight and +queueing problems entirely. Measured 37ms cached vs 6,604ms live. + +- [x] Publish-time result caching + maintainer prewarm — see the Phase 3 plan +- [x] Precompute on publish; prewarm of the 8 dashboard questions + (`scripts/warm-cache.mts`, run from the Actions tab) +- [ ] ~~`POST /api/query` + single-flight~~ — not needed; revisit only if a + question appears that no browser can finish + +**Carried forward, not done** +- [ ] Email okn.us: access token to raise the 30s limit; materialized downstream + relation (draft at `docs/plans/drafts/2026-09-13-team-email-429.md`) + +### Results after implementing Phases 1 and 2 (measured 2026-09-14) + +| Shape | Before | After | +| --- | --- | --- | +| ME samples ↓ airports | 21.2s warm, flaky cold | **16.1–16.7s warm**, 48–66s cold; 1,172 → 999 (unchanged) | +| ME samples ~ airports | 12.8s | same counts (515 / 45), details payload gone | +| **samples ~ samples [ME]** | ❌ timeout | ✅ 86.3s (5 hydration chunks) | +| **Illinois samples ↓ airports** | ❌ 500 OOM | ✅ 218s, 4 discovery chunks; one flowline slice reported partial | +| facilities ↓ facilities [ME], no filters | ❌ 30s, misleading message | ❌ still — but bounded at ~2.5 min with "narrow the area" guidance | +| wells ↓ facilities [ME], no filters | ❌ | ❌ same | + +Two shapes remain unfixable by splitting: both sides unfiltered *and* a river +trace, where even a single county exceeds the 30s budget and neither entity side +is enumerable under the probe limit. They now fail predictably with actionable +guidance instead of a bare error card. Adding any filter, or choosing counties, +makes them work. + +Two mechanisms were added during implementation that the plan did not anticipate: + +- **Per-step time budget (120s).** Without it a step whose slices all fail keeps + splitting indefinitely — observed running past 400s. Budgeted per step, not per + pipeline, so a slow-but-progressing question (Illinois, ~3.5 min total) still + finishes. +- **County refinement axis.** When a region slice is down to one county and still + fails, chunk the *target* entities inside it. Target-only: narrowing the anchor + side would drop out-of-region contributors (`3f50251`). + +**Verification gate for each phase:** re-run the matrix harness and compare +against `docs/query-matrix/2026-09-14-raw-baseline.csv`. No shape may regress; the ❌ rows must turn ✅. diff --git a/docs/plans/done/2026-09-14-phase-3-result-cache.md b/docs/plans/done/2026-09-14-phase-3-result-cache.md new file mode 100644 index 0000000..a29f2f4 --- /dev/null +++ b/docs/plans/done/2026-09-14-phase-3-result-cache.md @@ -0,0 +1,254 @@ +# Phase 3 — Cache what's already computed + +**Status**: done +**Created**: 2026-09-14 +**Completed**: 2026-09-14 (PRs #40, #42) + +Phase 3 of [the query execution +plan](./2026-09-13-query-execution-architecture.md). Phases 1 and 2 +(PR #38) bounded how much work one query does; this one stops us doing the same +work twice. + +## Problem + +Nothing remembers anything. The same query measures **26.5s cold and 1.5s warm** +on the graph engine, and today every user and every page reload races the same +cold cache. + +The sharpest case is a shared link. `PublishedView.tsx:42-53` fetches only the +question JSON and then sets `pendingAutoRun`, so **every visitor re-runs the +entire pipeline in their own browser** — 26–218s, sometimes failing outright. +That is the flow that produced the original 429 screenshot. + +The original spec (§4.5 of the Phase 1–2 plan) answered this by moving execution +to the server. Exploration found a cheaper answer: **the publisher's browser has +already computed the result.** When someone clicks Publish, `pipelineResult` is +sitting in the store. Sending it costs zero extra compute and needs no engine on +the server. + +Target outcome: opening a cached link makes **zero requests to `apps.okn.us`** +and renders immediately. + +## Approach + +A results cache that only **trusted writers** populate: + +| Writer | Authenticated by | Writes | +| --- | --- | --- | +| The publisher | the existing `editToken` (`publish.ts:9-15` `tokensMatch`) | their own published result | +| A maintainer script | `CACHE_WRITE_TOKEN`, never in the browser bundle | the 8 dashboard questions | + +Reads are public. Because nothing untrusted can write, the cache-poisoning and +content-injection risks of an open write endpoint never arise. This matters more +than usual here: the tool renders PFAS contamination near named facilities, and +a poisoned cache would place fake readings on a real map, identically for every +visitor. + +**The design constraint that shapes everything: the server never computes a +cache key.** So it never imports engine code, so there is no cross-package +bundling and no Railway build-root change. Two key namespaces, one table: + +- `publish:` — derived from the URL param the server already trusts +- `q:` — computed by the client (to read) and the maintainer script (to + write, token-authenticated); the server stores it verbatim + +### Data model + +Appended to `server/src/schema.sql`, which `db.ts:21` replays in full on every +boot — so every statement must stay idempotent. + +```sql +CREATE TABLE IF NOT EXISTS query_results ( + cache_key TEXT PRIMARY KEY, -- 'publish:' | 'q:' + question JSONB NOT NULL, + payload BYTEA NOT NULL, -- gzipped wire JSON + payload_bytes INTEGER NOT NULL, + source TEXT NOT NULL, -- 'publish' | 'prewarm' + partial BOOLEAN NOT NULL DEFAULT FALSE, + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + last_hit_at TIMESTAMPTZ NOT NULL DEFAULT now(), + hit_count INTEGER NOT NULL DEFAULT 0, + expires_at TIMESTAMPTZ NOT NULL +); + +-- payload is already gzipped; don't let TOAST try to pglz it again +ALTER TABLE query_results ALTER COLUMN payload SET STORAGE EXTERNAL; +CREATE INDEX IF NOT EXISTS query_results_expires_at_idx ON query_results (expires_at); + +ALTER TABLE published_workflows ADD COLUMN IF NOT EXISTS result_key TEXT; +``` + +**gzip bytea, not JSONB.** Payloads are 3–21 MB of JSON dominated by repeated +IRI prefixes, where gzip gets ~10–20×. Stored bytes are served verbatim with +`Content-Encoding: gzip` — never decompressed server-side, never re-compressed, +and the browser inflates transparently. + +**TTL:** 30 days for a clean success; 6 hours when `partial` is true, because a +partial result means slices failed and a warmer engine may do better — it must +not freeze for a month. Only `status: 'success'` is cached; errors are usually +transient endpoint load. + +### Server + +Global JSON limit stays 64 kb (`index.ts:13`); the write routes get a +**route-scoped** `express.json({ limit: '25mb' })`. + +- `server/src/routes/publish.ts` — `PUT /:id/result` (requires `editToken`, + reuses `tokensMatch`; gzips with `node:zlib`, upserts under `publish:`, + sets `result_key`) and `GET /:id/result`. +- `server/src/routes/results.ts` (new) — `GET /:key` public read, bumping + `hit_count`/`last_hit_at`, 404 on missing *or expired*; `PUT /:key` requiring + `X-Cache-Token`, for the maintainer script only. +- `server/src/index.ts` — mount the router, and sweep + `DELETE FROM query_results WHERE expires_at < now()` at boot. + +### Client + +- `src/engine/cacheKey.ts` (new, shared with the script) — canonicalises the + question before hashing: strips display-only label maps (`countyLabels`, + `substanceLabels`, `industryLabels` — verified never to reach a query + template), sorts object keys and filter arrays, drops `undefined` and `[]`, + and normalises `hops` (only read when `mode === 'near'`, per + `fusedQueries.ts:209`, so `{type:'downstream', hops:3}` must share a key with + `{type:'downstream'}`). Hash includes `WIRE_VERSION` and `DATA_VERSION`. + Uses `crypto.subtle.digest`, which exists in both the browser and Node 18+. +- `src/engine/wire.ts` (new) — `toWire` trims `data` to the four keys the map + actually consumes (`useMapLayers.ts:41-44`), dropping internal IRI lists; + `fromWire` rebuilds a `PipelineResult`. +- `src/hooks/useQueryPipeline.ts` — try the cache first; on any miss or error + fall through to today's local execution, unchanged. `?cache=off` forces local. +- `src/components/Layout/PublishedView.tsx` — with a `result_key`, fetch the + cached result and `setPipelineResult` instead of setting `pendingAutoRun`. + Without one, behaviour is exactly as today. +- `src/components/Layout/AnalysisQuestionBar.tsx:359` — after publishing + succeeds, PUT the trimmed result. Fire-and-forget with a `.catch`, so + publishing never fails because caching did. +- **Provenance**: the published view shows "Results computed <date>" and a + **Re-run live** button. A cached map must never silently look like a fresh + one — this tool's output ends up in reports. +- `scripts/warm-cache.mts` (new) — runs the 8 questions in + `src/constants/prebuiltQueries.ts` through the real engine in Node (the + pattern `scripts/query-matrix.mts` already proves works under `tsx`) and PUTs + each result. Run by hand after a data update. + +## Tasks + +- [x] Save this plan into the repo; moved to `active/` +- [x] Retarget PR #38 to `development`; branch `phase-3-result-cache` off it +- [x] Remove the last Render references; document the four Railway services +- [x] `src/engine/cacheKey.ts` + `src/engine/wire.ts`, with a losslessness check +- [x] `schema.sql`: `query_results` table + `result_key` column +- [x] `server/src/routes/results.ts`; `PUT`/`GET /:id/result`; mount + boot sweeper +- [x] Read path: `useQueryPipeline.ts`, `PublishedView.tsx`, provenance UI +- [x] Write path: `AnalysisQuestionBar.tsx` after publish +- [x] `scripts/warm-cache.mts` for the 8 dashboard questions +- [x] Verify (below); update §4.5 of the Phase 1–2 plan; changelog entry + +## Results (measured 2026-09-14, local Postgres 16 + live SPARQL endpoints) + +The gate, on "Samples Near Landfills & DOD Sites in Penobscot and Knox County": + +| | Time | Payload | +| --- | --- | --- | +| Cached | **37 ms** | 724 KB gzipped, one request | +| Live, warm graph engine | 6,604 ms | 5 requests to `apps.okn.us` | +| Live, cold graph engine | ~100 s | as above | + +**178× on a warm engine**, and identical row counts either way +(`FIND_TARGET_ENTITIES=57 GET_ANCHOR_DETAILS=8 GET_REGION_BOUNDARIES=16`) — +the cached answer is the same answer. + +Compression is better than estimated: a 1.4 MB wire payload stored as **86 KB** +(16×). Round-trip verification covered 15 cases — auth rejection (no token, +wrong token, wrong `editToken`), the 64 kb limit still holding on every other +route, gzip headers, `result_key` exposure, 404 on a miss, and byte-for-byte +losslessness through `toWire`/`fromWire`. + +Two bugs the verification caught, both fixed: + +- **The global 64 kb JSON parser rejected result uploads before the + route-scoped parser ran.** Route-scoped body limits are useless if a global + parser has already read the body; `index.ts` now skips the two upload paths. +- **Canonicalisation left empty objects behind**, so `{industryCodes: []}` + hashed differently from a question with no filter at all — a filter set and + then cleared would have missed its own cache entry forever. + +## Notes + +### Deliberately deferred, not dropped + +- **Server-side execution** — needs engine bundling, a job+polling transport, a + concurrency gate, and a *blocking* Railway change (the API build root would + have to include `explorer/src`). The read path here is identical either way, + so it can be swapped in later without touching the client. +- **SSE / progress streaming** — only needed if execution moves server-side. +- **Single-flight** — only implementable server-side, and N≈1 at this scale. +- **Nightly cron** — a maintainer-run script instead. No scheduled-job pattern + exists in this repo, and the thing it would guard against is a TTL we control. + +### Verification + +A working database is the prerequisite. Docker is installed but its daemon is +not running: start Docker Desktop and +`docker run -e POSTGRES_PASSWORD=dev -p 5432:5432 -d postgres:16`, then set +`DATABASE_URL=postgresql://postgres:dev@localhost:5432/postgres` and +`PGSSL=disable`. Alternatively use the Railway dev database's **public TCP +proxy** URL — the `*.railway.internal` host only resolves inside Railway. + +1. **Migration idempotence** — boot twice; `runMigrations()` must succeed both + times, including the `ALTER ... SET STORAGE`. +2. **Serialization losslessness** (no DB needed) — build map layers from a live + `pipelineResult`, then from `fromWire(toWire(result))`, and compare per-layer + feature counts. `SparqlRow` is `Record` so it should be + lossless; prove it rather than assume it. +3. **End-to-end** — publish, open `/p/:id` in a private window, confirm devtools + shows **zero requests to `apps.okn.us`** and identical feature counts. +4. **The gate** — open-to-render for a published link, before and after. Target + 26–218s → under 2s. *If that number doesn't move dramatically, nothing else + in Phase 3 is justified.* +5. **Auth** — `PUT` with no token, a wrong token, and a mismatched `editToken` + must all be rejected; oversized bodies 413 on the write routes while the rest + of the API keeps its 64 kb limit. +6. **No engine regression** — this scope adds files but changes no query logic; + run one shape through `scripts/query-matrix.mts` to confirm. + +### Risks + +- **Size cap.** The Indiana dashboard pipeline was 21.2 MB raw. Trimming + internal IRI lists (and the already-deleted details step) puts most under + ~7 MB, but anything over the 25 MB cap is skipped — logged, with publishing + still succeeding. A browser-side `CompressionStream` gzip before upload is the + fallback if uploads prove slow; deliberately not built first. +- **Staleness.** A cached result is a snapshot. Mitigated by the 30-day TTL, the + `DATA_VERSION` component of the key, the visible computed-on date, and the + re-run control. +- **Hit rate for ad-hoc questions is probably low** — two users rarely build a + byte-identical question by hand. The value is concentrated in published links + and the dashboard queries, which is exactly where the trusted writers are. +- **`server/.env` currently points `DATABASE_URL` at a dead Render host.** + Running `npm run dev` against it would migrate the wrong database. Replace it + before any local server work. + +### Warming the dashboard questions + +A GitHub Action does this on a button press: **Actions → Warm result cache → Run +workflow**, pick `development` or `production`, optionally filter by title, then +Run. It checks out the repo, runs the eight questions through the real engine on +the runner, and uploads each result. + +One-time setup: add repository secrets `CACHE_WRITE_TOKEN_DEV` and +`CACHE_WRITE_TOKEN_PROD` matching `CACHE_WRITE_TOKEN` on each API service. The +workflow fails with an explicit message if the one it needs is missing, rather +than silently uploading nothing. + +Locally the same thing is `npm run warm-cache` with `API_BASE` and +`CACHE_WRITE_TOKEN` set. Run it after a graph reload (bump `DATA_VERSION` +first), after editing `prebuiltQueries.ts`, or when the 30-day TTL lapses. +Deliberately no schedule — the header of the workflow file shows the three lines +that would add one. + +### Railway dashboard (manual, outside the repo) + +Add `CACHE_WRITE_TOKEN` to both API services, and optionally `DATA_VERSION`. No +build-command, root-directory, or replica changes — that is the payoff of +keeping the engine out of the server. diff --git a/docs/plans/done/2026-09-14-trim-stream-layer.md b/docs/plans/done/2026-09-14-trim-stream-layer.md new file mode 100644 index 0000000..369e4f5 --- /dev/null +++ b/docs/plans/done/2026-09-14-trim-stream-layer.md @@ -0,0 +1,65 @@ +# Trim the stream layer to reaches that actually connect + +**Status**: done — partially. The connectivity trim was measured and rejected; +distance bounding shipped instead. +**Created**: 2026-09-14 +**Completed**: 2026-09-14 + +## Problem + +Downstream and upstream questions drew the entire river network they traced. A +question about facilities upstream from PFOS samples in three Maine counties +covered most of southern Maine in blue: 15,782 reaches for 616 facilities and +372 samples. + +`buildFusedFlowlineQuery` took the resolved anchors, expanded to their S2 cells +plus neighbours, and emitted the whole `hyf:downstreamFlowPathTC` closure. The +target entities appeared nowhere in it, so a reach was drawn whether or not it +ever reached a matched sample. Three costs: unreadable maps, payloads past the +25 MB cache limit, and ~64,000 React elements at 21,000 reaches. + +## What shipped + +**PR #41** — rebased and merged the stream-distance work that had been open as +#32 since 2026-08-28. Optional `maxDistanceKm` (5–100 km) on traces, plus +streams as an answerable entity type. On the PFOS question a 30 km bound cut +reaches by 77% and payload from 22.3 MB to 7.1 MB while keeping every facility. + +**PR #42** — fixed the cache-key collision that #41 exposed: a bounded and an +unbounded question hashed identically. See `docs/DEBUGGING.md`. + +## What was rejected, with the measurement + +Bounding by **terminus** — keeping only reaches that reach a matched sample — +was the original intent and does not work: + +| Query | Result | +| --- | --- | +| current (no terminus) | 16s, 4,661 reaches | +| terminus-bounded | **429 timeout at 70s** | + +A second `hyf:downstreamFlowPathTC` join over 408M triples exceeds what the +endpoint will do, even with all 1,172 target IRIs pinned. **Do not rebuild this +as specified.** The untested remainder is applying the constraint only on the +distance-bounded path, where `boundedTrace` has already shrunk the candidate set +— that would only help questions that set a distance. + +## Not done + +**The rendering safety net.** `StreamLayer.tsx` still maps 1:1 to +`` + `` + `` with no cap, no simplification and no +zoom awareness, and `parseWKTLineString` keeps every vertex. Independent of the +query, no correctness risk, and still worth doing — a distance bound reduces the +count but does not bound it. + +## Notes + +Facts established while measuring, kept in `docs/QUERY-MATRIX.md` Part 8: +`hyf:downstreamFlowPathTC` is reflexive; `A TC B` means B is downstream of A; +and the network has genuine two-way connectivity in braided channels, so a +single pair cannot be used to reason about trace direction. + +A suspicion that the upstream branch was inverted was investigated and **not +substantiated** — two attempts failed to produce a clean answer. It is recorded +here only so the next person does not re-raise it without a better method than +comparing population means or sampling one pair. diff --git a/docs/plans/drafts/2026-09-11-material-and-breaking-changes-checklist.md b/docs/plans/drafts/2026-09-11-material-and-breaking-changes-checklist.md new file mode 100644 index 0000000..4f11c29 --- /dev/null +++ b/docs/plans/drafts/2026-09-11-material-and-breaking-changes-checklist.md @@ -0,0 +1,148 @@ +# Working checklist — Material dropdown + upstream breaking changes + +Consolidates the scratch notes of 2026-08-28 and the 2026-09-01 / 2026-09-08 +emails from Katrina Schweikert and David Kedrowski. Status verified against the +repo and live endpoints on 2026-09-11. + +--- + +## A. Material dropdown + +- [x] **A1 — Hierarchical, like the Industry dropdown.** Shipped in `6bf13d8`. + Group headings are tickable and collapsible, counts roll up from the + leaves. `HierarchicalSelect` now takes a generic `items: TreeItem[]` with + an optional explicit `parent`, so it serves both NAICS (prefix-derived + tree) and Material (explicit parents). + *Files:* `HierarchicalSelect/`, `SampleFilters.tsx`, `types/query.ts`, + `questionGenerator.ts` + +- [x] **A2 — Labels from the CosoExtension.** Done, but not the way the note + assumed. The four direct `coso:MaterialSample` subclasses + (`contaminoso_materialSample_ext.ttl`) are used as the **group headings**, + not as replacements for the option labels. Bucketing is + `MIN(?bucketPrio)` over Biota 1 / Solid 2 / Water 3 / Air 4, with + unmatched types falling to "Other". + +- [x] **A3 — Katrina: stop using the long names, narrow to a few categories.** + Closed by A2. The long source-vocabulary names are still there, but they + are now one fold-down below five short headings. Swapping the labels + outright was tried and reverted — it dropped real detail (fish species + collapsed into a single "Biota" row) for no gain. + +- [x] **A4 — Fix the dead material-type namespace.** `ef0c40b`. All six + `FALLBACK_MATERIAL_TYPES` IRIs and the one prebuilt-card filter moved from + `v1/me-egad-data#` to the live root `v1/me-egad#`; sludge code `.SO` → `.SU`. + +- [ ] **A5 — `FALLBACK_MATERIAL_TYPES` entries carry no `group`.** All six land + under "Other" if discovery ever fails over. Deliberate for now and + documented on the wiki as a tell that discovery failed. Add `group` if the + fallback ever becomes user-visible in practice. + +- [ ] **A6 — `useQuestionTotals.ts:17` calls `useMaterialTypes()` with no + region** while the dropdown calls it with one. "All material types" never + collapses to "any", so the question text stays verbose at region scope. + +--- + +## B. Production bug — Samples downstream of waste treatment, Indiana + +- [ ] **B1 — HTTP 500 from `federation`:** + `Tried to allocate 409.6 MB, but only 351 MB were available`. + Reproducible on an idle endpoint, so it is not load. + **Root cause identified:** the `FIND_TARGET_IRIS` step projects only + `?spC` but still binds `?observationC ?substanceC ?sampleC ?matTypeC + ?matTypeLabelC ?resultC ?unitC`. With no sample filters set, statewide + Indiana is large enough that the unused join blows the memory budget. + **Fix:** drop unbound-and-unprojected variables from that step. Trimming + two of them on the PFHpA card already took it from hard timeout to 24.7s. + +- [ ] **B2 — Same class of failure on the PFHpA Cumberland card.** Sample side + works now (65 points / 171 observations, 2.3s); the downstream hydrology + join still times out. Same fix likely applies. Note QLever reports a query + timeout as **HTTP 429**, which reads like rate limiting and is not — check + the response body. + +--- + +## C. Upstream breaking changes (Katrina, 2026-09-01) + +- [x] **C1 — Controlled vocabulary in the root namespaces** (`me_egad`, + `us_wqp`). This is what A4 fixed. Audited `src/` on 2026-09-11: no + `-data#` IRI is hardcoded anywhere. The only sawgraph prefix we ship is + `me_egad: `, which is correct. + +- [x] **C2 — Instance data moved to `v2/me-egad-data#` and + `v2/us-wqp-data#`.** Verified live 2026-09-11 on both `sawgraph` and + `federation`: the split is complete and nothing is dual-published. + Instance data is 100% v2 (63,744 Maine + 44,868 WQP samples; 833,201 + + 208,219 observations), vocabulary is 100% root v1 (86 `me-egad` + 85 + `us-wqp` material types = the 171 in the dropdown). No v1 instance IRI and + no `-data#` vocabulary IRI survives anywhere. + + No query change needed — we never pin an instance IRI, and the only URI + parsing in the app takes the fragment after `#`, which is + namespace-agnostic. The 2026-09-09 audit already ran all 8 pipelines + against this v2 data, so the pipelines are verified too. + + **One real gap found and fixed:** questions outlive the graph. Saved + questions (`localStorage`) and published workflows (server DB) store a + full `AnalysisQuestion`, vocabulary IRIs included. Anything saved before + the reload still pins the dead `v1/-data#` form and silently + returns an empty map — the same failure mode as A4, but persisted where a + code fix could not reach it. Added `src/utils/migrateQuestion.ts`, + applied in `queryStore.loadQuestion`, which every load path funnels + through. Rewrites on read, so no DB migration. + + *Files:* `src/utils/migrateQuestion.ts`, `src/store/queryStore.ts` + +- [ ] **C2a — Noticed while auditing, unrelated to the reload.** 10,014 WQP + sample points use geoconnex slash URIs (`https://geoconnex.us/iow/wqp/…`) + with no `#` at all. `MapPopup.tsx:70` shortens a URI with + `.split('#').pop()`, which returns the whole URL when there is no hash, so + those popups print a full link instead of a short ID. Cosmetic. + +- [ ] **C3 — Non-detect handling.** Open question, and the one with real + consequences: ~90,881 results hang on it. + We currently use `coso:NonDetectQuantityValue` + (`src/engine/templates/samples.ts:24`). Katrina's example filters on + `coso:NonQuantifiedQuantityValue`. Live counts: 723,410 vs 814,291. + **Action: ask Katrina which one "non-detect" means in the new model, and + whether the two are meant to nest.** + We already avoid `coso:measurementValue` for exactly the reason her note + flags — it is multi-valued for non-detects and returns both strings — so + that part needs no change. + +- [ ] **C4 — Re-run the full audit after the composite graph rebuild.** The + changes are live on the individual FRINK endpoints but not yet composited. + All 8 prebuilt pipelines and all 15 discovery queries. + +--- + +## D. David Kedrowski's note (2026-09-08) — no action + +- [x] **D1.** The PFAS2-on-GraphDB issue (moving + `?ar3 rdf:type kwg-ont:AdministrativeRegion_3` from the PFAS service to + the Spatial service) is GraphDB-specific. He says explicitly it is not an + issue against FRINK's federated endpoint, which is what we hit. Recorded + for context only. + +--- + +## E. Docs and publishing + +- [x] **E1 — Wiki pages rewritten** for the material tree, plus two new + `DEBUGGING.md` entries and the namespace split in `SCHEMA.md` (`c66febd`). +- [ ] **E2 — Merge `development` → `main` to publish the wiki.** + `.github/workflows/wiki-sync.yml` triggers only on push to `main` with + paths `docs/wiki/**`. Until then the GitHub Wiki still shows the old + Material page, and the `blob/main/...#L` deep links point at line numbers + that only exist on `development`. + +--- + +## Suggested order + +1. **C3** — blocked on Katrina, so ask now and work on the rest while waiting. +2. **B1** — real production 500, root cause already known. +3. **E2** — one merge, unblocks the wiki and ships A1–A4 to users. +4. **A6**, then **A5**, then **C2/C4** once the composite graph rebuilds. diff --git a/docs/plans/drafts/2026-09-13-team-email-429.md b/docs/plans/drafts/2026-09-13-team-email-429.md new file mode 100644 index 0000000..2db0377 --- /dev/null +++ b/docs/plans/drafts/2026-09-13-team-email-429.md @@ -0,0 +1,129 @@ +# Draft email: the 429 errors in the Explorer + +*Draft for review — not sent. Two audiences are marked; trim the section that +doesn't apply before sending.* + +--- + +**Subject:** Why the Explorer shows "Something went wrong" — it's a query timeout, not rate limiting + +Hi all, + +A few of us have hit "Something went wrong. You can edit the question and try +again." on the Explorer this week, most visibly on the downstream questions. +I dug into it today against the live endpoints. Here's what's happening, in +order. + +**1. The browser gets back HTTP 429 "Too Many Requests."** + +That status normally means we're sending requests too fast, which is what it +looks like in DevTools. That reading is wrong. + +**2. It isn't rate limiting — it's a query timeout.** + +QLever (the graph engine behind `apps.okn.us`) stops any query that runs longer +than **30 seconds**, and it reports that stop using the 429 status code. The +response body says so plainly: + +```json +{ "exception": "Operation timed out. Last operation: Join on ?s2neighbor" } +``` + +I confirmed this by sending eight requests at once — all returned 200. The +endpoint isn't throttling us. Single slow queries are being killed. + +**3. Our slowest queries sit right at that 30-second line.** + +For "samples in Maine near airport facilities," three of the six steps measured +20, 20, and 26 seconds against a 30-second limit. Whether a run succeeds +depends on whether the engine's cache happens to be warm — the identical query +took 26.5s cold and 1.5s warm. That's why it fails intermittently and why +retrying sometimes "fixes" it. + +**4. The downstream questions were over the line, not near it.** + +"Samples in Maine downstream of airports" failed on 7 of 7 attempts, in four +different ways: timeout, out-of-memory (`Tried to allocate 825.6 MB`), a +cancelled sort, and a timeout during query planning. That one was never +intermittent — it was broken. + +**5. The cause: the query asked for far more than it needed.** + +The step that failed answers "which sample points are downstream of these +airports," and returns a single column of IDs. But it also joined in every +chemical measurement at every sample point in Maine — substance, sample, +result, material type, unit — and then discarded all of it, because none of +those columns are in the SELECT. + +It's like asking "which houses are downstream of the airport?" by listing every +item of furniture in every room of every house, then reading back only the +street addresses. On top of a query that was already expensive, since tracing +every river path in the state is the actual work. + +**6. How big the problem was.** + +I swept every question the editor can build — 95 shapes, against the live +endpoints. **37 of them failed outright**, and 32 more ran over 15 seconds +against that 30-second limit, so they failed whenever the cache was cold. + +River-trace questions were the worst hit: only 23 of 50 worked. And Maine turned +out to be the one healthy state — the same plain question failed in 5 of 6 +others, Indiana included, which is one of our own dashboard queries. + +**7. Fixed, and verified.** + +Queries now run whole and, only when the engine refuses, get split into slices +that fit and merged back together. Splitting is not an approximation — every +combined answer matches the slow version exactly where the slow version could +produce one. + +| | Before | After | +| --- | --- | --- | +| Shapes failing | **37 of 124** | **3** | +| Regressions | — | **none** | +| Samples downstream of airports | 21.2s, fails cold | 16.1s | +| Upstream questions | mostly failing | working | +| Near, 3–4 miles | failing | working | +| Illinois downstream | always failed | 248s, complete | + +All eight dashboard queries pass, three of them markedly faster (62.7s → 33.4s +for Agricultural Chemical Facilities) because we no longer download 18–37 MB of +measurement data on every run just to fill popups that open one at a time. + +**8. What still doesn't work, and why.** + +Three questions remain too large, and they share one shape: the second block has +no filter and no region. That means "every facility in the graph" — all +**1,506,326** of them — traced through the national river network. + +Worth knowing, because it's counter-intuitive: narrowing the *first* block (the +"look at a smaller area" instinct) does not help at all. The cost is entirely on +the unconstrained second block. Adding an industry or a region there fixes it. + +The full picture is in `docs/QUERY-MATRIX.md`, and the plan for the remaining +work — running the pipeline on our own API server with a shared result cache, so +the first person to ask a question pays the cost and nobody else does — is in +`docs/plans/done/2026-09-13-query-execution-architecture.md`. + +--- + +## Ask for the endpoint maintainers + +*(Include only if sending to the okn.us / QLever maintainers.)* + +Two things on your side would help more than anything we can do in the client: + +1. **An access token to raise the query timeout.** Adding `?timeout=120s` + currently returns **403**. With a token we could let the genuinely large + traces finish instead of engineering around a 30-second ceiling. + +2. **A materialized downstream relation.** Every downstream question recomputes + the `hyf:downstreamFlowPathTC` closure from scratch, and that's static data. + A precomputed relation (facility or S2 cell → downstream S2 cells) would turn + the most expensive part of these queries into a lookup. + +Happy to share the exact queries, timings, and failure bodies — I have them all +recorded. + +Thanks, +Prayas diff --git a/docs/plans/drafts/2026-09-14-team-email.md b/docs/plans/drafts/2026-09-14-team-email.md new file mode 100644 index 0000000..02946eb --- /dev/null +++ b/docs/plans/drafts/2026-09-14-team-email.md @@ -0,0 +1,78 @@ +# Draft email to the team — the Explorer is working again + +*Draft for review, not sent. Plain-language version; the detailed write-up is in +`docs/QUERY-MATRIX.md` and the plans under `docs/plans/`.* + +--- + +**Subject:** SAWGraph Explorer is working again — what was wrong, and what changed + +Hi all, + +The Explorer is working again on the development site +(https://sawgraph-explorer-development.up.railway.app). Production gets it at +our next release. + +**The short version of what was wrong** + +Questions were failing with an error that said "Too Many Requests". That message +was misleading. We were not sending too many requests — each individual question +was simply taking longer than 30 seconds, which is the time limit the knowledge +graph gives any single query. When it hits that limit it gives up, and the code +it returns happens to be the same one used for rate limiting. + +Underneath that, our questions were asking for far more data than they needed. +One step in every question only needs a list of IDs — which sample points are +downstream of these facilities. But the query we sent also pulled every chemical +measurement at every one of those sample points, then threw all of it away. + +It's a bit like asking "which houses are downstream of the airport?" by listing +every item of furniture in every room of every house, and then reading back only +the street addresses. Combined with tracing every river in the state, that was +enough to run past the time limit. + +Two other things made it worse. Every question was answered from scratch every +single time, even when the same question had just been asked — and the graph is +about twenty times faster answering something it has seen recently. And opening +a shared link re-ran the whole thing in the visitor's browser rather than +showing the results the person who shared it had already produced. + +**What's different now** + +- Questions only ask for what they actually need. +- A question too big to answer in one go is automatically split into smaller + pieces and the answers are stitched back together. +- Results are saved, so the dashboard cards and shared links open more or less + instantly instead of running for a minute. +- When something does fail, the message says what to change rather than just + "Something went wrong". + +To put numbers on it: we tested every kind of question the editor can build — +156 queries covering 95 combinations. Before, **37 failed outright** and another +32 were slow enough to fail on a bad day. Now **34 of those 37 work**, and +nothing that previously worked has broken. The dashboard cards went from 10–70 +seconds to well under a second. + +**What still doesn't work, and why** + +Three questions are still too large to answer. They all have the same shape: the +second block is left with no filter and no region, which means "every facility +in the country" — about 1.5 million of them — traced through the national river +network. + +The useful thing to know is which end to narrow. Shrinking the *first* block (a +smaller area for the results you want to see) does not help at all. Adding an +industry, type, or region to the *second* block does. The error message now says +this. + +**One thing to be aware of** + +When a map is showing saved results rather than a fresh run, it says so at the +top, with the date it was computed and a "Re-run live" button. Worth knowing if +you are putting a screenshot in a report — if you want to be certain you are +looking at current data, press that button. + +Happy to walk anyone through it. + +Thanks, +Prayas diff --git a/docs/plans/drafts/2026-09-19-symmetric-cell-widening.md b/docs/plans/drafts/2026-09-19-symmetric-cell-widening.md new file mode 100644 index 0000000..49fa277 --- /dev/null +++ b/docs/plans/drafts/2026-09-19-symmetric-cell-widening.md @@ -0,0 +1,220 @@ +# Apply the one-cell widening to both sides of a hydrology trace, not whichever side is written second + +**Status**: draft +**Created**: 2026-09-19 + +## Problem + +Entities link to S2 Level-13 cells (~1 km square). Flowlines link to cells. To +connect a facility or a sample to the river network, a flowline has to be in +that entity's cell. Frequently there is none: the sample sits 400 m from the +river, on the far side of a cell boundary. + +`buildFusedWhereBody` papers over this with a one-ring expansion, +`kwg-ont:sfTouches | owl:sameAs`. The defect is that it applies the expansion to +**exactly one side**, and which side is an artefact of query construction rather +than a modelling decision. Whichever side is not widened silently loses every +entity whose own cell happens to contain no flowline. + +Measured in York County (federation, 2026-09-19): + +| Side | Total | Flowline in own cell | Within one ring | Lost if not widened | +| --- | ---: | ---: | ---: | ---: | +| PFOS sample points | 361 | 282 (78%) | 360 (99.7%) | **78 (22%)** | +| Facilities | 1,639 | 1,343 (82%) | 1,632 (99.6%) | **289 (18%)** | + +So roughly one entity in five, on each side, is invisible to the trace without +the expansion. The gap is about the same size on both sides, which is why the +choice of side moves the answer so hard. + +Measured on "What facilities are upstream from PFOS samples?" (block A +facilities, unconstrained; block C samples, PFOS, York County ME), with the +observation chain trimmed on both variants so the non-detect bug of +`2026-09-17-fused-seed-side-and-observation-joins.md` is not confounding it: + +| Variant | Sample points | Facilities | +| --- | ---: | ---: | +| Widen the sample side | **324** | 1,060 | +| Widen the facility side (shipped) | 200 | **1,497** | +| Union of the two | **330** | **1,507** | + +Each variant rescues its own widened side and drops about a fifth of the other. + +The sample-side variant is the form the project's PI independently arrived at +while trying to fix an unrelated symptom, so this is not a hypothetical +preference: two people writing the same query reached for the expansion on +different sides, which is the clearest evidence that the current placement is +undocumented and accidental. + +## What the missing data actually is + +Of the 130 sample points the shipped query drops: + +| | Extra 130 | Shipped 200 | +| --- | ---: | ---: | +| Points with quantified PFOS detections | **82** | 132 | +| Detect observations | **139** | 370 | +| Points with non-detects | 58 | n/a | +| Max concentration | 2,200 ng/L | 7,400 ng/L | + +Sample points carrying a confirmed PFOS detection go from **132 to 214, up +62%**. The dropped points do not hold the single highest reading, but 2,200 +ng/L is roughly 110x Maine's 20 ng/L interim drinking water standard, so these +are not marginal traces. + +On the facility side the union adds only 10, because that side is already the +widened one. Effectively all of the recovery is on samples. + +Worth stating plainly for review: the 1 km approximation is **already +accepted** on the facility side. Applying it to the sample side introduces no +new assumption, it applies the existing one consistently. + +## Approach + +Run both variants and union the results. This is an **executor** change, not a +template fix: the SPARQL text of each variant already works, what is missing is +a pipeline that issues both and merges. + +The executor already merges slice results as a set, deduping on +`JSON.stringify(row)` (`src/engine/scope.ts`), so the merge path exists. What is +new is issuing a second variant of the same step deliberately rather than as a +failure retry. + +Sketch, to be firmed up during implementation: + +- `buildFusedWhereBody` takes a `widen: 'anchor' | 'target'` option. Default + `'anchor'`, which is today's behaviour, so nothing moves until the executor + asks for the second form. +- `PipelineStep` gains a way to declare a second query variant for the same + step, distinct from `initialScopes` (which splits one query) and from the + deferred `buildRetryQuery` hook (which replaces a failed query). +- The executor issues both, unions the row sets, and reports one step. + +## Tasks + +1. Add the `widen` option to `buildFusedWhereBody` and thread it through + `buildFusedHydrologyQuery` and `buildFusedWellQuery`. Default preserves + current output; assert that in `scripts/check-query-joins.mts`. + **Restructure the body emission first.** `buildFusedWhereBody` currently + writes the whole body out twice, once anchor-first and once target-first, + with the streams-target case spelled in both. Adding `widen` on top of that + gives 2 orders x 2 widen sides = four hand-maintained renderings of the same + triples. Emitting from an ordered list of named fragments (`anchorSide`, + `hop`, `trace`, `targetSide`) with `lead` and `widen` deciding order and ring + placement makes it one definition. Output equality is checkable by diffing + generated SPARQL for all 72 shapes before and after, which the check scripts + already build. Doing this as part of task 1 is much cheaper than doing it + after. +2. Bound `targetReachClause` by the target *region* rather than the IRI list + when the list exceeds a threshold. Today it inlines the entire resolved + target set into one `VALUES` with no cap and, unlike `anchorIris`, cannot be + sliced: `anchorIris` partitions the answer (union of slices = whole) while + `targetIris` is a bound (each slice is wrong on its own). A question + resolving a few thousand targets puts that whole list in the request body + with no `divide` to rescue it. This is a latent hard failure, not a slow + path. +3. Decide the variant mechanism on `PipelineStep` and whether it shares + machinery with the deferred retry hook. See "Sequencing" below. +4. Executor: issue both variants, union, single step report. Partial failure of + one variant should degrade to the other's rows rather than failing the step, + matching how the flowline layer is already `optional`. +5. Extend `scripts/check-flowline-scope.mts` or add a sibling check asserting + both variants are emitted for all 72 hydrology shapes. +6. Re-run `npm run query-matrix` in engine mode and commit a dated CSV. Counts + will move upward across hydrology shapes; the sweep is how that is recorded + rather than discovered later. +7. Update `docs/QUERY-MATRIX.md` Part 3.2/3.3 costs, and `docs/SCHEMA.md` with + the cell-coverage numbers above, which are not currently written down + anywhere. + +## Impact on other query shapes + +**72 hydrology shapes. Zero `near` shapes.** Verified by building +`FIND_TARGET_IRIS` for all 108 shapes and grepping the emitted SPARQL: all 72 +downstream/upstream shapes emit +`kwg-ont:sfTouches | owl:sameAs ?s2neighbor`, none of the 36 `near` shapes do. +`near` uses the explicit user-chosen hop count (`neighborPath`), a different +mechanism that is not affected. + +Counts move **upward only** on the affected shapes, the same direction and for +the same class of reason as the non-detect fix in +`2026-09-17-fused-seed-side-and-observation-joins.md`. Dashboard and prebuilt +numbers will change. That is the fix landing, not a new defect. + +## Cost + +Three runs of each query, warm endpoint, federation: + +| Query | Run 1 | Run 2 | Run 3 | +| --- | ---: | ---: | ---: | +| Shipped, samples | 30.4s | 26.6s | 15.1s | +| Shipped, facilities | 15.4s | 14.4s | 18.1s | +| Sample-widened, samples | 19.2s | **1.4s** | **1.3s** | +| Sample-widened, facilities | 2.3s | **1.2s** | **1.4s** | + +Added cost is roughly **2 to 3 seconds**, not double, because the second +variant caches and the shipped one does not. QLever caches result sets up to a +size limit and the shipped form's intermediates appear to exceed it. That +pattern held across three runs of four queries but has not been confirmed +against QLever's cache configuration, so it should not be relied on until +someone checks it deliberately. + +## Rejected: widen both sides inside one query + +This is the theoretically correct form and it does not run. Two formulations +tried on the York question, both against federation: + +1. Flat, expansion on both sides in one body: `500`, "tried to allocate 2.6 GB, + but only 2.3 GB were available". The facility projection separately timed out + on "Join on ?s2flcell". +2. Target cell set materialised first in a `SELECT DISTINCT` sub-SELECT, then + expanded outward: same 2.6 GB allocation failure at 21s. + +The cell-by-flowline join is what blows up, and restructuring the query text +does not avoid it. This is why the approach above is a union of two queries +rather than one correct query. + +## Open questions + +1. **The union is an approximation.** It misses pairs where the sample *and* + the facility both need widening simultaneously. If the two are independent + that is roughly 4% of pairs, but this is an estimate and it **cannot be + validated**, because the true both-sides query does not run. Whether that is + acceptable is a call for the PI, not the engine. +2. **Is one ring the right radius?** Nothing measured justifies one hop over + two. One ring reaches 99.7% of samples and 99.6% of facilities in York, so + the marginal return looks small, but that is one county. +3. **The real fix may be upstream of the app.** Precomputing an + entity-to-nearest-flowline link in the graph would remove the cell-ring + guessing entirely and be exact rather than a 1 km approximation. That is a + graph-build change and a conversation with whoever maintains it, but it would + retire this plan rather than refine it. + +## Sequencing + +This is the second executor change queued against the same code path. The other +is the retry hook in +`2026-09-17-fused-seed-side-and-observation-joins.md` ("The retry variant, +measured and not implemented"), which needs `buildRetryQuery` on `PipelineStep` +and one branch in the executor's failure path. + +Both add a second query for one step. They should be designed together so the +codebase gets one mechanism rather than two similar ones, even if they ship +separately. + +Prerequisite: PR #55 (seed side and observation joins) and PR #56 (flowline +layer bounded at both ends) should merge first. The measurements above were all +taken on top of both. + +## Notes + +All figures measured against `https://apps.okn.us/federation/sparql` on +2026-09-19, on the branch carrying #55 and #56. + +Two measurement traps hit while producing these numbers, both worth knowing +before re-running any of this: QLever returned wrong results for nested +`OPTIONAL` blocks containing a `BIND` (a detect count came back 0 alongside a +non-zero `MAX` over the same variable), and it silently under-reported on an +`OPTIONAL` used to test predicate coverage. Every figure here was re-derived +with flat, separate `COUNT` queries. The same trap is already recorded against +aggregates over `UNION` at `fusedQueries.ts:222`. diff --git a/docs/query-matrix/2026-09-14-engine-9128aa9.csv.note b/docs/query-matrix/2026-09-14-engine-9128aa9.csv.note new file mode 100644 index 0000000..a197ea2 --- /dev/null +++ b/docs/query-matrix/2026-09-14-engine-9128aa9.csv.note @@ -0,0 +1,20 @@ +**Do not read the 29 failures as real.** This sweep measured its own load. + +M4 (the multi-hop distance sweep) ran for **eight hours on twenty queries**, +recording 1348-2095s each against a 300s step ceiling — recorded time equals +wall time, so those are genuine elapsed seconds, not a suspended process. Every +phase after M4 inherited a degraded endpoint: M5 failed two *dashboard* +questions at 1101s and 490s that `docs/health/history.jsonl` shows succeeding at +**14s and 19s** the evening before. + +What this sweep is good for: it proved engine mode had been crashing on its +first query since `partialSlices` was split into failed/skipped, and it is the +evidence that the 300s ceiling does not hold. Both are worth more than the CSV. + +What it is not good for: any pass/fail or timing comparison. Re-run once the +ceiling is fixed, under `caffeinate -i` or in Actions so it is not hostage to +one laptop, and let the new file supersede this one. + +The sweep also split across two files at UTC midnight — `runAt` is UTC while the +runner logged local time — and was merged back by hand. The runner should fix +the output path once and export it, as the warm-sweep runner does. diff --git a/docs/query-matrix/2026-09-14-engine-contaminated-9128aa9.csv b/docs/query-matrix/2026-09-14-engine-contaminated-9128aa9.csv new file mode 100644 index 0000000..adf0559 --- /dev/null +++ b/docs/query-matrix/2026-09-14-engine-contaminated-9128aa9.csv @@ -0,0 +1,125 @@ +runAt,commit,matrix,label,blockA,rel,hops,blockC,region,filters,step,endpoint,status,ms,rows,bytes,errorClass,errorMsg,chunksFailed,chunksSkipped,chunksMax +2026-09-14T23:21,9128aa9,M1,"samples near(1) samples [ME]",samples,near,1,samples,ME,"none",FIND_TARGET_IRIS,engine,success,1897,4398,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"samples near(1) facilities [ME]",samples,near,1,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,16629,2273,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"samples near(1) waterBodies [ME]",samples,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,1721,2199,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"samples near(1) wells [ME]",samples,near,1,wells,ME,"none",FIND_TARGET_IRIS,engine,success,5885,4279,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"samples near(1) aquifers [ME]",samples,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,2023,2759,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"facilities near(1) samples [ME]",facilities,near,1,samples,ME,"none",FIND_TARGET_IRIS,engine,success,3228,1358,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"facilities near(1) facilities [ME]",facilities,near,1,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,2982,2976,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"facilities near(1) waterBodies [ME]",facilities,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,996,1591,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"facilities near(1) wells [ME]",facilities,near,1,wells,ME,"none",FIND_TARGET_IRIS,engine,success,3429,2900,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"facilities near(1) aquifers [ME]",facilities,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,2472,1728,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"waterBodies near(1) samples [ME]",waterBodies,near,1,samples,ME,"none",FIND_TARGET_IRIS,engine,success,2056,591,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"waterBodies near(1) facilities [ME]",waterBodies,near,1,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,1158,1015,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"waterBodies near(1) waterBodies [ME]",waterBodies,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,3162,6612,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"waterBodies near(1) wells [ME]",waterBodies,near,1,wells,ME,"none",FIND_TARGET_IRIS,engine,success,9147,3553,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"waterBodies near(1) aquifers [ME]",waterBodies,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,1582,3165,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"wells near(1) samples [ME]",wells,near,1,samples,ME,"none",FIND_TARGET_IRIS,engine,success,54516,14897,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"wells near(1) facilities [ME]",wells,near,1,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,2400,25668,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"wells near(1) waterBodies [ME]",wells,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,2756,52861,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"wells near(1) wells [ME]",wells,near,1,wells,ME,"none",FIND_TARGET_IRIS,engine,success,9327,83038,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"wells near(1) aquifers [ME]",wells,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,3507,40080,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"aquifers near(1) samples [ME]",aquifers,near,1,samples,ME,"none",FIND_TARGET_IRIS,engine,success,8542,899,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"aquifers near(1) facilities [ME]",aquifers,near,1,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,1393,1504,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"aquifers near(1) waterBodies [ME]",aquifers,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,704,3712,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"aquifers near(1) wells [ME]",aquifers,near,1,wells,ME,"none",FIND_TARGET_IRIS,engine,success,995,3659,0,ok,"",0,0,0 +2026-09-14T23:21,9128aa9,M1,"aquifers near(1) aquifers [ME]",aquifers,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,833,4972,0,ok,"",0,0,0 +2026-09-14T23:23,9128aa9,M2,"samples downstream samples [ME]",samples,downstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,10646,3214,0,ok,"",0,0,0 +2026-09-14T23:23,9128aa9,M2,"samples downstream facilities [ME]",samples,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,13555,2412,0,ok,"",0,0,0 +2026-09-14T23:23,9128aa9,M2,"samples downstream waterBodies [ME]",samples,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,19306,2610,0,ok,"",0,0,0 +2026-09-14T23:23,9128aa9,M2,"samples downstream wells [ME]",samples,downstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,29650,3202,0,ok,"",0,0,0 +2026-09-14T23:23,9128aa9,M2,"samples downstream aquifers [ME]",samples,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,23254,2741,0,ok,"",0,0,0 +2026-09-14T23:23,9128aa9,M2,"facilities downstream samples [ME]",facilities,downstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,17971,1657,0,ok,"",0,0,0 +2026-09-14T23:23,9128aa9,M2,"facilities downstream facilities [ME]",facilities,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,308336,0,0,failed,"SPARQL timeout (429): Operation timed out. Last operation: Join on ?s2neighbor",0,0,16 +2026-09-14T23:23,9128aa9,M2,"facilities downstream waterBodies [ME]",facilities,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,223509,1608,0,ok-partial,"",1,0,16 +2026-09-14T23:23,9128aa9,M2,"facilities downstream wells [ME]",facilities,downstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,302239,1986,0,ok,"",0,0,16 +2026-09-14T23:23,9128aa9,M2,"facilities downstream aquifers [ME]",facilities,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,194273,1743,0,ok,"",0,0,16 +2026-09-14T23:23,9128aa9,M2,"waterBodies downstream samples [ME]",waterBodies,downstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,11476,1511,0,ok,"",0,0,0 +2026-09-14T23:23,9128aa9,M2,"waterBodies downstream facilities [ME]",waterBodies,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,1068534,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,16 +2026-09-14T23:23,9128aa9,M2,"waterBodies downstream waterBodies [ME]",waterBodies,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,65438,6095,0,ok,"",0,0,0 +2026-09-14T23:23,9128aa9,M2,"waterBodies downstream wells [ME]",waterBodies,downstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,error,1099025,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-14T23:23,9128aa9,M2,"waterBodies downstream aquifers [ME]",waterBodies,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,788639,2661,0,ok-partial,"",0,7,16 +2026-09-14T23:23,9128aa9,M2,"wells downstream samples [ME]",wells,downstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,50790,28920,0,ok,"",0,0,0 +2026-09-14T23:23,9128aa9,M2,"wells downstream facilities [ME]",wells,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,307324,26435,0,ok-partial,"",0,3,16 +2026-09-14T23:23,9128aa9,M2,"wells downstream waterBodies [ME]",wells,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,298088,44112,0,ok-partial,"",1,0,16 +2026-09-14T23:23,9128aa9,M2,"wells downstream wells [ME]",wells,downstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,341777,14936,0,ok-partial,"",1,10,16 +2026-09-14T23:23,9128aa9,M2,"wells downstream aquifers [ME]",wells,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,321213,39847,0,ok,"",0,0,16 +2026-09-14T23:23,9128aa9,M2,"aquifers downstream samples [ME]",aquifers,downstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,14004,2599,0,ok,"",0,0,0 +2026-09-14T23:23,9128aa9,M2,"aquifers downstream facilities [ME]",aquifers,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,29797,3242,0,ok,"",0,0,0 +2026-09-14T23:23,9128aa9,M2,"aquifers downstream waterBodies [ME]",aquifers,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,159808,4192,0,ok-partial,"",1,0,16 +2026-09-14T23:23,9128aa9,M2,"aquifers downstream wells [ME]",aquifers,downstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,279301,4159,0,ok,"",0,0,16 +2026-09-14T23:23,9128aa9,M2,"aquifers downstream aquifers [ME]",aquifers,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,301406,3117,0,ok-partial,"",3,1,23 +2026-09-15T01:08,9128aa9,M3,"samples upstream samples [ME]",samples,upstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,12518,3221,0,ok,"",0,0,0 +2026-09-15T01:08,9128aa9,M3,"samples upstream facilities [ME]",samples,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,14391,2739,0,ok,"",0,0,0 +2026-09-15T01:08,9128aa9,M3,"samples upstream waterBodies [ME]",samples,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,11728,6072,0,ok,"",0,0,0 +2026-09-15T01:08,9128aa9,M3,"samples upstream wells [ME]",samples,upstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,26239,47730,0,ok,"",0,0,0 +2026-09-15T01:08,9128aa9,M3,"samples upstream aquifers [ME]",samples,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,12787,4650,0,ok,"",0,0,0 +2026-09-15T01:08,9128aa9,M3,"facilities upstream samples [ME]",facilities,upstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,error,1888462,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T01:08,9128aa9,M3,"facilities upstream facilities [ME]",facilities,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,667593,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T01:08,9128aa9,M3,"facilities upstream waterBodies [ME]",facilities,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,257998,6168,0,ok-partial,"",1,0,16 +2026-09-15T01:08,9128aa9,M3,"facilities upstream wells [ME]",facilities,upstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,307088,37199,0,ok-partial,"",0,6,16 +2026-09-15T01:08,9128aa9,M3,"facilities upstream aquifers [ME]",facilities,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,232861,4698,0,ok,"",0,0,16 +2026-09-15T01:08,9128aa9,M3,"waterBodies upstream samples [ME]",waterBodies,upstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,9492,3064,0,ok,"",0,0,0 +2026-09-15T01:08,9128aa9,M3,"waterBodies upstream facilities [ME]",waterBodies,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,13720,2770,0,ok,"",0,0,0 +2026-09-15T01:08,9128aa9,M3,"waterBodies upstream waterBodies [ME]",waterBodies,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,22484,6504,0,ok,"",0,0,0 +2026-09-15T01:08,9128aa9,M3,"waterBodies upstream wells [ME]",waterBodies,upstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,27243,51437,0,ok,"",0,0,0 +2026-09-15T01:08,9128aa9,M3,"waterBodies upstream aquifers [ME]",waterBodies,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,15010,4764,0,ok,"",0,0,0 +2026-09-15T01:08,9128aa9,M3,"wells upstream samples [ME]",wells,upstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,45085,3221,0,ok,"",0,0,0 +2026-09-15T01:08,9128aa9,M3,"wells upstream facilities [ME]",wells,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,272145,2812,0,ok,"",0,0,16 +2026-09-15T01:08,9128aa9,M3,"wells upstream waterBodies [ME]",wells,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,290678,6466,0,ok-partial,"",1,0,16 +2026-09-15T01:08,9128aa9,M3,"wells upstream wells [ME]",wells,upstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,343277,32973,0,ok-partial,"",1,6,16 +2026-09-15T01:08,9128aa9,M3,"wells upstream aquifers [ME]",wells,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,307068,4768,0,ok,"",0,0,16 +2026-09-15T01:08,9128aa9,M3,"aquifers upstream samples [ME]",aquifers,upstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,24929,2935,0,ok,"",0,0,0 +2026-09-15T01:08,9128aa9,M3,"aquifers upstream facilities [ME]",aquifers,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,18398,1919,0,ok,"",0,0,0 +2026-09-15T01:08,9128aa9,M3,"aquifers upstream waterBodies [ME]",aquifers,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,error,1063826,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,16 +2026-09-15T01:08,9128aa9,M3,"aquifers upstream wells [ME]",aquifers,upstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,error,986071,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T01:08,9128aa9,M3,"aquifers upstream aquifers [ME]",aquifers,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,error,1076740,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"samples near(0) facilities [ME]",samples,near,0,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,1347976,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"samples near(0) wells [ME]",samples,near,0,wells,ME,"none",FIND_TARGET_IRIS,engine,success,2813,3254,0,ok,"",0,0,0 +2026-09-15T03:37,9128aa9,M4,"wells near(0) facilities [ME]",wells,near,0,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,1107,5462,0,ok,"",0,0,0 +2026-09-15T03:37,9128aa9,M4,"waterBodies near(0) facilities [ME]",waterBodies,near,0,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,507,352,0,ok,"",0,0,0 +2026-09-15T03:37,9128aa9,M4,"samples near(0) waterBodies [ME]",samples,near,0,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,639,709,0,ok,"",0,0,0 +2026-09-15T03:37,9128aa9,M4,"samples near(2) facilities [ME]",samples,near,2,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,1779805,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"samples near(2) wells [ME]",samples,near,2,wells,ME,"none",FIND_TARGET_IRIS,engine,error,1869081,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"wells near(2) facilities [ME]",wells,near,2,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,1790972,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"waterBodies near(2) facilities [ME]",waterBodies,near,2,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,2095006,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"samples near(2) waterBodies [ME]",samples,near,2,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,error,1889011,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"samples near(3) facilities [ME]",samples,near,3,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,1936941,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"samples near(3) wells [ME]",samples,near,3,wells,ME,"none",FIND_TARGET_IRIS,engine,error,1239174,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"wells near(3) facilities [ME]",wells,near,3,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,2047655,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"waterBodies near(3) facilities [ME]",waterBodies,near,3,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,1887823,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"samples near(3) waterBodies [ME]",samples,near,3,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,error,2073841,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"samples near(4) facilities [ME]",samples,near,4,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,1954842,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"samples near(4) wells [ME]",samples,near,4,wells,ME,"none",FIND_TARGET_IRIS,engine,error,1088531,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"wells near(4) facilities [ME]",wells,near,4,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,1968807,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"waterBodies near(4) facilities [ME]",waterBodies,near,4,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,2036863,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T03:37,9128aa9,M4,"samples near(4) waterBodies [ME]",samples,near,4,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,error,2047950,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T11:41,9128aa9,M5,"PREBUILT: Samples Near Agricultural Chemical Facilities in Maine",samples,near,1,facilities,23,"prebuilt",PIPELINE,engine,success,64008,31,0,ok,"",0,0,0 +2026-09-15T11:41,9128aa9,M5,"PREBUILT: Samples Near Landfills & DOD Sites in Penobscot and Knox County",samples,near,1,facilities,23019|23013,"prebuilt",PIPELINE,engine,success,10841,61,0,ok,"",0,0,0 +2026-09-15T11:41,9128aa9,M5,"PREBUILT: Surface Water Bodies Near Landfills & DOD Sites in Penobscot and Knox County",waterBodies,near,1,facilities,23019|23013,"prebuilt",PIPELINE,engine,success,28220,103,0,ok,"",0,0,0 +2026-09-15T11:41,9128aa9,M5,"PREBUILT: Samples Downstream of Waste Treatment Facilities in Indiana",samples,downstream,,facilities,18,"prebuilt",PIPELINE,engine,error,1101215,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T11:41,9128aa9,M5,"PREBUILT: Maine Private Wells Near Landfills & DoD Sites",wells,near,1,facilities,23,"prebuilt",PIPELINE,engine,error,490020,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T11:41,9128aa9,M5,"PREBUILT: Maine Private Wells Near Wastewater Treatment Facilities",wells,near,1,facilities,23,"prebuilt",PIPELINE,engine,success,15860,2431,0,ok,"",0,0,0 +2026-09-15T11:41,9128aa9,M5,"PREBUILT: Maine Private Wells Near Airports & Air Transportation Sites (AFFF)",wells,near,1,facilities,23,"prebuilt",PIPELINE,engine,success,33706,4425,0,ok,"",0,0,0 +2026-09-15T11:41,9128aa9,M5,"PREBUILT: PFHpA Groundwater Samples Downstream from Facilities in Cumberland County",samples,downstream,,facilities,23005,"prebuilt",PIPELINE,engine,success,159028,362,0,ok,"",0,0,3 +2026-09-15T12:13,9128aa9,M6,"samples downstream facilities [17]",samples,downstream,,facilities,17,"none",FIND_TARGET_IRIS,engine,success,225067,58,0,ok,"",0,0,5 +2026-09-15T12:13,9128aa9,M6,"samples downstream facilities [18]",samples,downstream,,facilities,18,"none",FIND_TARGET_IRIS,engine,success,19659,234,0,ok,"",0,0,0 +2026-09-15T12:13,9128aa9,M6,"samples downstream facilities [25]",samples,downstream,,facilities,25,"none",FIND_TARGET_IRIS,engine,success,296403,216,0,ok,"",0,0,16 +2026-09-15T12:13,9128aa9,M6,"samples downstream facilities [33]",samples,downstream,,facilities,33,"none",FIND_TARGET_IRIS,engine,error,912577,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T12:13,9128aa9,M6,"samples downstream facilities [01]",samples,downstream,,facilities,01,"none",FIND_TARGET_IRIS,engine,error,945830,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T12:13,9128aa9,M6,"samples downstream facilities [50]",samples,downstream,,facilities,50,"none",FIND_TARGET_IRIS,engine,success,36134,17,0,ok,"",0,0,0 +2026-09-15T12:54,9128aa9,M7,"samples near facilities [NO REGION]",samples,near,1,facilities,none,"none",FIND_TARGET_IRIS,engine,success,1544,4770,0,ok,"",0,0,0 +2026-09-15T12:54,9128aa9,M7,"samples downstream facilities [NO REGION]",samples,downstream,,facilities,none,"none",FIND_TARGET_IRIS,engine,error,1075258,0,0,failed,"SPARQL timeout (0): No response within 60s",0,0,0 +2026-09-15T12:54,9128aa9,M7,"wells near facilities [NO REGION]",wells,near,1,facilities,none,"none",FIND_TARGET_IRIS,engine,success,32370,219026,0,ok,"",0,0,0 +2026-09-15T13:12,9128aa9,M8,"substance filter (PFOS)",samples,near,1,facilities,ME,"substance",FIND_TARGET_IRIS,engine,success,301018,70,0,ok-partial,"",0,15,16 +2026-09-15T13:12,9128aa9,M8,"material filter (GW)",samples,near,1,facilities,ME,"material",FIND_TARGET_IRIS,engine,empty,12739,0,0,empty,"No results at step: Finding nearby samples",0,0,0 +2026-09-15T13:12,9128aa9,M8,"concentration range 10-1000",samples,near,1,facilities,ME,"range",FIND_TARGET_IRIS,engine,success,1793,947,0,ok,"",0,0,0 +2026-09-15T13:12,9128aa9,M8,"exclude non-detects",samples,near,1,facilities,ME,"nondetect",FIND_TARGET_IRIS,engine,success,2231,1892,0,ok,"",0,0,0 +2026-09-15T13:12,9128aa9,M8,"substance + downstream",samples,downstream,,facilities,ME,"substance+ds",FIND_TARGET_IRIS,engine,success,314751,9,0,ok-partial,"",0,20,22 +2026-09-15T13:12,9128aa9,M8,"NAICS 2-digit (whole sector 31)",samples,near,1,facilities,ME,"naics-sector",FIND_TARGET_IRIS,engine,success,12646,334,0,ok,"",0,0,0 +2026-09-15T13:12,9128aa9,M8,"aquifer type filter",samples,near,1,aquifers,ME,"aquifer-type",FIND_TARGET_IRIS,engine,success,30421,2759,0,ok,"",0,0,0 +2026-09-15T13:12,9128aa9,M8,"waterbody ftype filter",samples,near,1,waterBodies,ME,"wb-ftype",FIND_TARGET_IRIS,engine,success,2352,1583,0,ok,"",0,0,0 +2026-09-15T13:24,9128aa9,M9,"samples near(1) facilities [1 county (Cumberland)]",samples,near,1,facilities,1 county (Cumberland),"none",FIND_TARGET_IRIS,engine,success,1278,430,0,ok,"",0,0,0 +2026-09-15T13:24,9128aa9,M9,"samples near(1) facilities [3 counties]",samples,near,1,facilities,3 counties,"none",FIND_TARGET_IRIS,engine,success,1449,1048,0,ok,"",0,0,0 +2026-09-15T13:24,9128aa9,M9,"samples downstream facilities [1 county (Cumberland)]",samples,downstream,,facilities,1 county (Cumberland),"none",FIND_TARGET_IRIS,engine,success,10653,339,0,ok,"",0,0,0 +2026-09-15T13:24,9128aa9,M9,"samples downstream facilities [3 counties]",samples,downstream,,facilities,3 counties,"none",FIND_TARGET_IRIS,engine,success,15336,902,0,ok,"",0,0,0 diff --git a/docs/query-matrix/2026-09-14-engine.csv b/docs/query-matrix/2026-09-14-engine.csv new file mode 100644 index 0000000..2e587d1 --- /dev/null +++ b/docs/query-matrix/2026-09-14-engine.csv @@ -0,0 +1,125 @@ +matrix,label,blockA,rel,hops,blockC,region,filters,step,endpoint,status,ms,rows,bytes,errorClass,errorMsg,chunksMax,partialSlices +M1,"samples near(1) samples [ME]",samples,near,1,samples,ME,"none",FIND_TARGET_IRIS,engine,success,28821,4398,0,ok,"",0,0 +M1,"samples near(1) facilities [ME]",samples,near,1,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,1418,2273,0,ok,"",0,0 +M1,"samples near(1) waterBodies [ME]",samples,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,1643,2199,0,ok,"",0,0 +M1,"samples near(1) wells [ME]",samples,near,1,wells,ME,"none",FIND_TARGET_IRIS,engine,success,5290,4279,0,ok,"",0,0 +M1,"samples near(1) aquifers [ME]",samples,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,1811,2759,0,ok,"",0,0 +M1,"facilities near(1) samples [ME]",facilities,near,1,samples,ME,"none",FIND_TARGET_IRIS,engine,success,12509,1358,0,ok,"",0,0 +M1,"facilities near(1) facilities [ME]",facilities,near,1,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,1634,2976,0,ok,"",0,0 +M1,"facilities near(1) waterBodies [ME]",facilities,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,863,1591,0,ok,"",0,0 +M1,"facilities near(1) wells [ME]",facilities,near,1,wells,ME,"none",FIND_TARGET_IRIS,engine,success,2402,2900,0,ok,"",0,0 +M1,"facilities near(1) aquifers [ME]",facilities,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,1582,1728,0,ok,"",0,0 +M1,"waterBodies near(1) samples [ME]",waterBodies,near,1,samples,ME,"none",FIND_TARGET_IRIS,engine,success,18042,591,0,ok,"",0,0 +M1,"waterBodies near(1) facilities [ME]",waterBodies,near,1,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,902,1015,0,ok,"",0,0 +M1,"waterBodies near(1) waterBodies [ME]",waterBodies,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,1434,6612,0,ok,"",0,0 +M1,"waterBodies near(1) wells [ME]",waterBodies,near,1,wells,ME,"none",FIND_TARGET_IRIS,engine,success,3793,3553,0,ok,"",0,0 +M1,"waterBodies near(1) aquifers [ME]",waterBodies,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,2672,3165,0,ok,"",0,0 +M1,"wells near(1) samples [ME]",wells,near,1,samples,ME,"none",FIND_TARGET_IRIS,engine,success,17597,14897,0,ok,"",0,0 +M1,"wells near(1) facilities [ME]",wells,near,1,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,1917,25668,0,ok,"",0,0 +M1,"wells near(1) waterBodies [ME]",wells,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,3053,52861,0,ok,"",0,0 +M1,"wells near(1) wells [ME]",wells,near,1,wells,ME,"none",FIND_TARGET_IRIS,engine,success,9761,83038,0,ok,"",0,0 +M1,"wells near(1) aquifers [ME]",wells,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,3069,40080,0,ok,"",0,0 +M1,"aquifers near(1) samples [ME]",aquifers,near,1,samples,ME,"none",FIND_TARGET_IRIS,engine,success,6268,899,0,ok,"",0,0 +M1,"aquifers near(1) facilities [ME]",aquifers,near,1,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,1230,1504,0,ok,"",0,0 +M1,"aquifers near(1) waterBodies [ME]",aquifers,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,739,3712,0,ok,"",0,0 +M1,"aquifers near(1) wells [ME]",aquifers,near,1,wells,ME,"none",FIND_TARGET_IRIS,engine,success,1106,3659,0,ok,"",0,0 +M1,"aquifers near(1) aquifers [ME]",aquifers,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,724,4972,0,ok,"",0,0 +M9,"samples near(1) facilities [1 county (Cumberland)]",samples,near,1,facilities,1 county (Cumberland),"none",FIND_TARGET_IRIS,engine,success,848,430,0,ok,"",0,0 +M9,"samples near(1) facilities [3 counties]",samples,near,1,facilities,3 counties,"none",FIND_TARGET_IRIS,engine,success,1389,1048,0,ok,"",0,0 +M9,"samples downstream facilities [1 county (Cumberland)]",samples,downstream,,facilities,1 county (Cumberland),"none",FIND_TARGET_IRIS,engine,success,12166,339,0,ok,"",0,0 +M9,"samples downstream facilities [3 counties]",samples,downstream,,facilities,3 counties,"none",FIND_TARGET_IRIS,engine,success,16505,902,0,ok,"",0,0 +M4,"samples near(0) facilities [ME]",samples,near,0,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,755,985,0,ok,"",0,0 +M4,"samples near(0) wells [ME]",samples,near,0,wells,ME,"none",FIND_TARGET_IRIS,engine,success,501,3254,0,ok,"",0,0 +M4,"wells near(0) facilities [ME]",wells,near,0,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,527,5462,0,ok,"",0,0 +M4,"waterBodies near(0) facilities [ME]",waterBodies,near,0,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,364,352,0,ok,"",0,0 +M4,"samples near(0) waterBodies [ME]",samples,near,0,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,335,709,0,ok,"",0,0 +M4,"samples near(2) facilities [ME]",samples,near,2,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,7046,3061,0,ok,"",0,0 +M4,"samples near(2) wells [ME]",samples,near,2,wells,ME,"none",FIND_TARGET_IRIS,engine,success,12370,4438,0,ok,"",0,0 +M4,"wells near(2) facilities [ME]",wells,near,2,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,18817,45280,0,ok,"",0,0 +M4,"waterBodies near(2) facilities [ME]",waterBodies,near,2,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,6447,1628,0,ok,"",0,0 +M4,"samples near(2) waterBodies [ME]",samples,near,2,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,10823,3120,0,ok,"",0,0 +M4,"samples near(3) facilities [ME]",samples,near,3,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,20812,3734,0,ok,"",0,0 +M4,"samples near(3) wells [ME]",samples,near,3,wells,ME,"none",FIND_TARGET_IRIS,engine,success,21254,4500,0,ok,"",0,0 +M4,"wells near(3) facilities [ME]",wells,near,3,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,16681,59773,0,ok,"",0,0 +M4,"waterBodies near(3) facilities [ME]",waterBodies,near,3,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,9754,2245,0,ok,"",0,0 +M4,"samples near(3) waterBodies [ME]",samples,near,3,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,error,122626,0,0,failed,"SPARQL out-of-memory (500): Tried to allocate 1.4 GB, but only 227.8 MB were available",16,0 +M4,"samples near(4) facilities [ME]",samples,near,4,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,14519,4100,0,ok,"",0,0 +M4,"samples near(4) wells [ME]",samples,near,4,wells,ME,"none",FIND_TARGET_IRIS,engine,success,23713,4521,0,ok,"",0,0 +M4,"wells near(4) facilities [ME]",wells,near,4,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,130167,27668,0,ok-partial,"",16,11 +M4,"waterBodies near(4) facilities [ME]",waterBodies,near,4,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,105532,2727,0,ok,"",16,0 +M4,"samples near(4) waterBodies [ME]",samples,near,4,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,3913,4242,0,ok,"",0,0 +M8,"substance filter (PFOS)",samples,near,1,facilities,ME,"substance",FIND_TARGET_IRIS,engine,success,17282,1375,0,ok,"",0,0 +M8,"material filter (GW)",samples,near,1,facilities,ME,"material",FIND_TARGET_IRIS,engine,empty,995,0,0,empty,"No results at step: Finding nearby samples",0,0 +M8,"concentration range 10-1000",samples,near,1,facilities,ME,"range",FIND_TARGET_IRIS,engine,success,13511,944,0,ok,"",0,0 +M8,"exclude non-detects",samples,near,1,facilities,ME,"nondetect",FIND_TARGET_IRIS,engine,success,8113,1892,0,ok,"",0,0 +M8,"substance + downstream",samples,downstream,,facilities,ME,"substance+ds",FIND_TARGET_IRIS,engine,success,28260,1406,0,ok,"",0,0 +M8,"NAICS 2-digit (whole sector 31)",samples,near,1,facilities,ME,"naics-sector",FIND_TARGET_IRIS,engine,success,12370,334,0,ok,"",0,0 +M8,"aquifer type filter",samples,near,1,aquifers,ME,"aquifer-type",FIND_TARGET_IRIS,engine,success,121194,167,0,ok-partial,"",16,15 +M8,"waterbody ftype filter",samples,near,1,waterBodies,ME,"wb-ftype",FIND_TARGET_IRIS,engine,success,2291,1583,0,ok,"",0,0 +M2,"samples downstream samples [ME]",samples,downstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,12322,3214,0,ok,"",0,0 +M2,"samples downstream facilities [ME]",samples,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,13925,2412,0,ok,"",0,0 +M2,"samples downstream waterBodies [ME]",samples,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,21127,2610,0,ok,"",0,0 +M2,"samples downstream wells [ME]",samples,downstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,48404,3202,0,ok,"",0,0 +M2,"samples downstream aquifers [ME]",samples,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,26517,2741,0,ok,"",0,0 +M2,"facilities downstream samples [ME]",facilities,downstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,29074,1657,0,ok,"",0,0 +M2,"facilities downstream facilities [ME]",facilities,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,163342,0,0,failed,"SPARQL timeout (429): Operation timed out. Last operation: Join on ?s2neighbor",16,0 +M2,"facilities downstream waterBodies [ME]",facilities,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,133024,1068,0,ok-partial,"",16,7 +M2,"facilities downstream wells [ME]",facilities,downstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,123269,743,0,ok-partial,"",16,12 +M2,"facilities downstream aquifers [ME]",facilities,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,135441,1016,0,ok-partial,"",16,7 +M2,"waterBodies downstream samples [ME]",waterBodies,downstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,13564,1511,0,ok,"",0,0 +M2,"waterBodies downstream facilities [ME]",waterBodies,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,121757,1032,0,ok-partial,"",16,7 +M2,"waterBodies downstream waterBodies [ME]",waterBodies,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,33371,6095,0,ok,"",0,0 +M2,"waterBodies downstream wells [ME]",waterBodies,downstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,29810,3991,0,ok,"",0,0 +M2,"waterBodies downstream aquifers [ME]",waterBodies,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,101485,4041,0,ok,"",16,0 +M2,"wells downstream samples [ME]",wells,downstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,24669,28920,0,ok,"",0,0 +M2,"wells downstream facilities [ME]",wells,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,134449,3889,0,ok-partial,"",16,14 +M2,"wells downstream waterBodies [ME]",wells,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,132771,17375,0,ok-partial,"",16,11 +M2,"wells downstream wells [ME]",wells,downstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,127487,3105,0,ok-partial,"",16,15 +M2,"wells downstream aquifers [ME]",wells,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,124979,12064,0,ok-partial,"",16,13 +M2,"aquifers downstream samples [ME]",aquifers,downstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,12891,2599,0,ok,"",0,0 +M2,"aquifers downstream facilities [ME]",aquifers,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,29557,3242,0,ok,"",0,0 +M2,"aquifers downstream waterBodies [ME]",aquifers,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,122191,3031,0,ok-partial,"",16,6 +M2,"aquifers downstream wells [ME]",aquifers,downstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,123040,1776,0,ok-partial,"",16,9 +M2,"aquifers downstream aquifers [ME]",aquifers,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,128690,854,0,ok-partial,"",16,20 +M3,"samples upstream samples [ME]",samples,upstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,error,99678,0,0,failed,"SPARQL network (0): fetch failed",0,0 +M3,"samples upstream facilities [ME]",samples,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,13767,2739,0,ok,"",0,0 +M3,"samples upstream waterBodies [ME]",samples,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,12270,6072,0,ok,"",0,0 +M3,"samples upstream wells [ME]",samples,upstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,error,551866,0,0,failed,"SPARQL network (0): fetch failed",0,0 +M3,"samples upstream aquifers [ME]",samples,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,15097,4650,0,ok,"",0,0 +M3,"facilities upstream samples [ME]",facilities,upstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,28267,3195,0,ok,"",0,0 +M3,"facilities upstream facilities [ME]",facilities,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,error,1918322,0,0,failed,"SPARQL network (0): fetch failed",0,0 +M3,"facilities upstream waterBodies [ME]",facilities,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,error,958890,0,0,failed,"SPARQL network (0): fetch failed",0,0 +M3,"facilities upstream wells [ME]",facilities,upstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,error,209172,0,0,failed,"SPARQL network (0): fetch failed",0,0 +M3,"facilities upstream aquifers [ME]",facilities,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,122995,2690,0,ok-partial,"",16,12 +M3,"waterBodies upstream samples [ME]",waterBodies,upstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,9531,3064,0,ok,"",0,0 +M3,"waterBodies upstream facilities [ME]",waterBodies,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,12450,2770,0,ok,"",0,0 +M3,"waterBodies upstream waterBodies [ME]",waterBodies,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,27386,6504,0,ok,"",0,0 +M3,"waterBodies upstream wells [ME]",waterBodies,upstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,25719,51437,0,ok,"",0,0 +M3,"waterBodies upstream aquifers [ME]",waterBodies,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,14828,4764,0,ok,"",0,0 +M3,"wells upstream samples [ME]",wells,upstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,48346,3221,0,ok,"",0,0 +M3,"wells upstream facilities [ME]",wells,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,131202,1729,0,ok-partial,"",16,10 +M3,"wells upstream waterBodies [ME]",wells,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,129915,5028,0,ok-partial,"",16,10 +M3,"wells upstream wells [ME]",wells,upstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,191792,8834,0,ok-partial,"",16,14 +M3,"wells upstream aquifers [ME]",wells,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,127053,4172,0,ok-partial,"",16,11 +M3,"aquifers upstream samples [ME]",aquifers,upstream,,samples,ME,"none",FIND_TARGET_IRIS,engine,success,24083,2935,0,ok,"",0,0 +M3,"aquifers upstream facilities [ME]",aquifers,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,engine,success,17251,1919,0,ok,"",0,0 +M3,"aquifers upstream waterBodies [ME]",aquifers,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,engine,success,129101,5101,0,ok-partial,"",16,3 +M3,"aquifers upstream wells [ME]",aquifers,upstream,,wells,ME,"none",FIND_TARGET_IRIS,engine,success,121522,26679,0,ok-partial,"",16,11 +M3,"aquifers upstream aquifers [ME]",aquifers,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,engine,success,128409,4290,0,ok-partial,"",16,3 +M6,"samples downstream facilities [17]",samples,downstream,,facilities,17,"none",FIND_TARGET_IRIS,engine,error,124001,0,0,failed,"SPARQL timeout (429): Operation timed out. Last operation: Join on ?s2anchor",4,0 +M6,"samples downstream facilities [18]",samples,downstream,,facilities,18,"none",FIND_TARGET_IRIS,engine,success,19942,234,0,ok,"",0,0 +M6,"samples downstream facilities [25]",samples,downstream,,facilities,25,"none",FIND_TARGET_IRIS,engine,success,134271,115,0,ok-partial,"",14,8 +M6,"samples downstream facilities [33]",samples,downstream,,facilities,33,"none",FIND_TARGET_IRIS,engine,success,74450,43,0,ok,"",3,0 +M6,"samples downstream facilities [01]",samples,downstream,,facilities,01,"none",FIND_TARGET_IRIS,engine,empty,95736,0,0,empty,"No results at step: Finding downstream samples",3,0 +M6,"samples downstream facilities [50]",samples,downstream,,facilities,50,"none",FIND_TARGET_IRIS,engine,success,5012,17,0,ok,"",0,0 +M7,"samples near facilities [NO REGION]",samples,near,1,facilities,none,"none",FIND_TARGET_IRIS,engine,success,1166,4770,0,ok,"",0,0 +M7,"samples downstream facilities [NO REGION]",samples,downstream,,facilities,none,"none",FIND_TARGET_IRIS,engine,error,28640,0,0,failed,"SPARQL out-of-memory (500): Tried to allocate 2.6 GB, but only 1.3 GB were available",0,0 +M7,"wells near facilities [NO REGION]",wells,near,1,facilities,none,"none",FIND_TARGET_IRIS,engine,success,21728,219026,0,ok,"",0,0 +M5,"PREBUILT: Samples Near Agricultural Chemical Facilities in Maine",samples,near,1,facilities,23,"prebuilt",PIPELINE,engine,success,33375,31,0,ok,"",0,0 +M5,"PREBUILT: Samples Near Landfills & DOD Sites in Penobscot and Knox County",samples,near,1,facilities,23019|23013,"prebuilt",PIPELINE,engine,success,10618,61,0,ok,"",0,0 +M5,"PREBUILT: Surface Water Bodies Near Landfills & DOD Sites in Penobscot and Knox County",waterBodies,near,1,facilities,23019|23013,"prebuilt",PIPELINE,engine,success,24072,103,0,ok,"",0,0 +M5,"PREBUILT: Samples Downstream of Waste Treatment Facilities in Indiana",samples,downstream,,facilities,18,"prebuilt",PIPELINE,engine,success,70778,15696,0,ok,"",0,0 +M5,"PREBUILT: Maine Private Wells Near Landfills & DoD Sites",wells,near,1,facilities,23,"prebuilt",PIPELINE,engine,success,22779,751,0,ok,"",0,0 +M5,"PREBUILT: Maine Private Wells Near Wastewater Treatment Facilities",wells,near,1,facilities,23,"prebuilt",PIPELINE,engine,success,13742,2431,0,ok,"",0,0 +M5,"PREBUILT: Maine Private Wells Near Airports & Air Transportation Sites (AFFF)",wells,near,1,facilities,23,"prebuilt",PIPELINE,engine,success,13122,4425,0,ok,"",0,0 +M5,"PREBUILT: PFHpA Groundwater Samples Downstream from Facilities in Cumberland County",samples,downstream,,facilities,23005,"prebuilt",PIPELINE,engine,empty,2435,0,0,empty,"No results at step: Finding downstream samples",0,0 diff --git a/docs/query-matrix/2026-09-14-engine.csv.note b/docs/query-matrix/2026-09-14-engine.csv.note new file mode 100644 index 0000000..f0d136b --- /dev/null +++ b/docs/query-matrix/2026-09-14-engine.csv.note @@ -0,0 +1,9 @@ +**The 25 `upstream` rows measured the wrong question.** Every upstream shape +traced the relation backwards until 2026-09-16 (`docs/DEBUGGING.md`, +2026-09-16), so their status, timing and row counts describe the mirror +question. They are not a baseline: the corrected direction is materially more +expensive where block C is unfiltered. See `docs/QUERY-MATRIX.md` Part 9, and +re-sweep. + +The other 99 rows (62 `near`, 37 `downstream`) are unaffected, and are the control when +diffing this file against the next sweep. diff --git a/docs/query-matrix/2026-09-14-raw-baseline.csv b/docs/query-matrix/2026-09-14-raw-baseline.csv new file mode 100644 index 0000000..54aba6b --- /dev/null +++ b/docs/query-matrix/2026-09-14-raw-baseline.csv @@ -0,0 +1,157 @@ +matrix,label,blockA,rel,hops,blockC,region,filters,step,endpoint,status,ms,rows,bytes,errorClass,errorMsg +M1,"samples near(1) samples [ME]",samples,near,1,samples,ME,"none",FIND_TARGET_IRIS,federation,429,32372,0,145656,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?iri" +M1,"samples near(1) facilities [ME]",samples,near,1,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,15186,2273,226006,ok,"" +M1,"samples near(1) waterBodies [ME]",samples,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,200,1699,2199,219109,ok,"" +M1,"samples near(1) wells [ME]",samples,near,1,wells,ME,"none",FIND_TARGET_IRIS,federation,200,5140,4279,426312,ok,"" +M1,"samples near(1) aquifers [ME]",samples,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,federation,200,1606,2759,275124,ok,"" +M1,"facilities near(1) samples [ME]",facilities,near,1,samples,ME,"none",FIND_TARGET_IRIS,federation,200,16321,1358,131776,ok,"" +M1,"facilities near(1) facilities [ME]",facilities,near,1,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,2327,2976,288722,ok,"" +M1,"facilities near(1) waterBodies [ME]",facilities,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,200,856,1591,154377,ok,"" +M1,"facilities near(1) wells [ME]",facilities,near,1,wells,ME,"none",FIND_TARGET_IRIS,federation,200,2829,2900,281350,ok,"" +M1,"facilities near(1) aquifers [ME]",facilities,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,federation,200,1593,1728,167666,ok,"" +M1,"waterBodies near(1) samples [ME]",waterBodies,near,1,samples,ME,"none",FIND_TARGET_IRIS,federation,200,24730,591,46171,ok,"" +M1,"waterBodies near(1) facilities [ME]",waterBodies,near,1,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,965,1015,79236,ok,"" +M1,"waterBodies near(1) waterBodies [ME]",waterBodies,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,200,1475,6612,515329,ok,"" +M1,"waterBodies near(1) wells [ME]",waterBodies,near,1,wells,ME,"none",FIND_TARGET_IRIS,federation,200,3634,3553,277151,ok,"" +M1,"waterBodies near(1) aquifers [ME]",waterBodies,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,federation,200,2212,3165,246903,ok,"" +M1,"wells near(1) samples [ME]",wells,near,1,samples,ME,"none",FIND_TARGET_IRIS,federation,200,2390,14897,1419183,ok,"" +M1,"wells near(1) facilities [ME]",wells,near,1,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,1675,25668,2445455,ok,"" +M1,"wells near(1) waterBodies [ME]",wells,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,200,3126,52861,5039837,ok,"" +M1,"wells near(1) wells [ME]",wells,near,1,wells,ME,"none",FIND_TARGET_IRIS,federation,200,2462,83038,7915711,ok,"" +M1,"wells near(1) aquifers [ME]",wells,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,federation,200,1180,40080,3820012,ok,"" +M1,"aquifers near(1) samples [ME]",aquifers,near,1,samples,ME,"none",FIND_TARGET_IRIS,federation,200,6180,899,88152,ok,"" +M1,"aquifers near(1) facilities [ME]",aquifers,near,1,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,857,1504,147442,ok,"" +M1,"aquifers near(1) waterBodies [ME]",aquifers,near,1,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,200,553,3712,363826,ok,"" +M1,"aquifers near(1) wells [ME]",aquifers,near,1,wells,ME,"none",FIND_TARGET_IRIS,federation,200,5279,3659,358632,ok,"" +M1,"aquifers near(1) aquifers [ME]",aquifers,near,1,aquifers,ME,"none",FIND_TARGET_IRIS,federation,200,661,4972,487306,ok,"" +M9,"samples near(1) facilities [1 county (Cumberland)]",samples,near,1,facilities,1 county (Cumberland),"none",FIND_TARGET_IRIS,federation,200,848,430,42417,ok,"" +M9,"samples near(1) facilities [3 counties]",samples,near,1,facilities,3 counties,"none",FIND_TARGET_IRIS,federation,200,1398,1048,104024,ok,"" +M9,"samples downstream facilities [1 county (Cumberland)]",samples,downstream,,facilities,1 county (Cumberland),"none",FIND_TARGET_IRIS,federation,200,11275,339,33660,ok,"" +M9,"samples downstream facilities [3 counties]",samples,downstream,,facilities,3 counties,"none",FIND_TARGET_IRIS,federation,200,15012,902,89702,ok,"" +M4,"samples near(0) facilities [ME]",samples,near,0,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,689,985,97829,ok,"" +M4,"samples near(0) wells [ME]",samples,near,0,wells,ME,"none",FIND_TARGET_IRIS,federation,200,409,3254,324661,ok,"" +M4,"wells near(0) facilities [ME]",wells,near,0,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,460,5462,520181,ok,"" +M4,"waterBodies near(0) facilities [ME]",waterBodies,near,0,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,311,352,27529,ok,"" +M4,"samples near(0) waterBodies [ME]",samples,near,0,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,200,297,709,70653,ok,"" +M4,"samples near(2) facilities [ME]",samples,near,2,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,6526,3061,304522,ok,"" +M4,"samples near(2) wells [ME]",samples,near,2,wells,ME,"none",FIND_TARGET_IRIS,federation,200,11857,4438,442021,ok,"" +M4,"wells near(2) facilities [ME]",wells,near,2,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,18875,45280,4314627,ok,"" +M4,"waterBodies near(2) facilities [ME]",waterBodies,near,2,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,6735,1628,127046,ok,"" +M4,"samples near(2) waterBodies [ME]",samples,near,2,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,200,10562,3120,310874,ok,"" +M4,"samples near(3) facilities [ME]",samples,near,3,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,20865,3734,371680,ok,"" +M4,"samples near(3) wells [ME]",samples,near,3,wells,ME,"none",FIND_TARGET_IRIS,federation,200,21882,4500,448158,ok,"" +M4,"wells near(3) facilities [ME]",wells,near,3,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,16425,59773,5696279,ok,"" +M4,"waterBodies near(3) facilities [ME]",waterBodies,near,3,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,8600,2245,175154,ok,"" +M4,"samples near(3) waterBodies [ME]",samples,near,3,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,429,30735,0,98857,timeout-30s,"Operation timed out. Last operation: Join on ?_QLever_internal_variable_qp_1" +M4,"samples near(4) facilities [ME]",samples,near,4,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,14729,4100,408270,ok,"" +M4,"samples near(4) wells [ME]",samples,near,4,wells,ME,"none",FIND_TARGET_IRIS,federation,200,25625,4521,450253,ok,"" +M4,"wells near(4) facilities [ME]",wells,near,4,facilities,ME,"none",FIND_TARGET_IRIS,federation,429,33339,0,102148,timeout-30s,"Operation timed out. Last operation: Join on ?_QLever_internal_variable_qp_0" +M4,"waterBodies near(4) facilities [ME]",waterBodies,near,4,facilities,ME,"none",FIND_TARGET_IRIS,federation,429,24422,0,96239,timeout-sort-estimate,"Sort operation was canceled, because time estimate exceeded remaining time by a factor of 3 Last operation: Sort (internal order) on ?s2anchor" +M4,"samples near(4) waterBodies [ME]",samples,near,4,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,200,3438,4242,422366,ok,"" +M8,"substance filter (PFOS)",samples,near,1,facilities,ME,"substance",FIND_TARGET_IRIS,federation,200,16100,1375,137087,ok,"" +M8,"material filter (GW)",samples,near,1,facilities,ME,"material",FIND_TARGET_IRIS,federation,200,1005,0,51,ok,"" +M8,"concentration range 10-1000",samples,near,1,facilities,ME,"range",FIND_TARGET_IRIS,federation,200,13334,944,94142,ok,"" +M8,"exclude non-detects",samples,near,1,facilities,ME,"nondetect",FIND_TARGET_IRIS,federation,200,1533,1892,188313,ok,"" +M8,"substance + downstream",samples,downstream,,facilities,ME,"substance+ds",FIND_TARGET_IRIS,federation,200,27890,1406,140054,ok,"" +M8,"NAICS 2-digit (whole sector 31)",samples,near,1,facilities,ME,"naics-sector",FIND_TARGET_IRIS,federation,200,11647,334,32910,ok,"" +M8,"aquifer type filter",samples,near,1,aquifers,ME,"aquifer-type",FIND_TARGET_IRIS,federation,200,30021,2759,275124,ok,"" +M8,"waterbody ftype filter",samples,near,1,waterBodies,ME,"wb-ftype",FIND_TARGET_IRIS,federation,200,2049,1583,157769,ok,"" +M2,"samples downstream samples [ME]",samples,downstream,,samples,ME,"none",FIND_TARGET_IRIS,federation,200,9769,3214,320324,ok,"" +M2,"samples downstream facilities [ME]",samples,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,12085,2412,240234,ok,"" +M2,"samples downstream waterBodies [ME]",samples,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,200,19820,2610,260032,ok,"" +M2,"samples downstream wells [ME]",samples,downstream,,wells,ME,"none",FIND_TARGET_IRIS,federation,429,34614,0,97641,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?iri" +M2,"samples downstream aquifers [ME]",samples,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,federation,200,25410,2741,273105,ok,"" +M2,"facilities downstream samples [ME]",facilities,downstream,,samples,ME,"none",FIND_TARGET_IRIS,federation,200,17367,1657,160779,ok,"" +M2,"facilities downstream facilities [ME]",facilities,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,federation,500,30111,0,126070,engine-oom,"Tried to allocate 5.9 GB, but only 4.4 GB were available" +M2,"facilities downstream waterBodies [ME]",facilities,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,500,29218,0,173840,engine-oom,"Tried to allocate 6.1 GB, but only 6.1 GB were available" +M2,"facilities downstream wells [ME]",facilities,downstream,,wells,ME,"none",FIND_TARGET_IRIS,federation,429,31235,0,108297,timeout-30s,"Operation timed out. Last operation: Join on ?upstream_flowline" +M2,"facilities downstream aquifers [ME]",facilities,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,federation,500,30355,0,127956,engine-oom,"Tried to allocate 3.2 GB, but only 2.2 GB were available" +M2,"waterBodies downstream samples [ME]",waterBodies,downstream,,samples,ME,"none",FIND_TARGET_IRIS,federation,200,10886,1511,117916,ok,"" +M2,"waterBodies downstream facilities [ME]",waterBodies,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,federation,429,32300,0,128874,timeout-30s,"Operation timed out. Last operation: Join on ?ds_flowline" +M2,"waterBodies downstream waterBodies [ME]",waterBodies,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,200,28605,6095,474989,ok,"" +M2,"waterBodies downstream wells [ME]",waterBodies,downstream,,wells,ME,"none",FIND_TARGET_IRIS,federation,429,32946,0,96493,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?iri" +M2,"waterBodies downstream aquifers [ME]",waterBodies,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,federation,500,30067,0,107391,engine-oom,"Tried to allocate 3.2 GB, but only 2.4 GB were available" +M2,"wells downstream samples [ME]",wells,downstream,,samples,ME,"none",FIND_TARGET_IRIS,federation,200,24164,28920,2755971,ok,"" +M2,"wells downstream facilities [ME]",wells,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,federation,429,30254,0,111623,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +M2,"wells downstream waterBodies [ME]",wells,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,429,30674,0,107879,timeout-30s,"Operation timed out. Last operation: Join on ?upstream_flowline" +M2,"wells downstream wells [ME]",wells,downstream,,wells,ME,"none",FIND_TARGET_IRIS,federation,429,30710,0,101622,timeout-30s,"Operation timed out. Last operation: Join on ?upstream_flowline" +M2,"wells downstream aquifers [ME]",wells,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,federation,500,35284,0,111872,engine-oom,"Tried to allocate 3.2 GB, but only 2.2 GB were available" +M2,"aquifers downstream samples [ME]",aquifers,downstream,,samples,ME,"none",FIND_TARGET_IRIS,federation,200,13024,2599,254752,ok,"" +M2,"aquifers downstream facilities [ME]",aquifers,downstream,,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,28381,3242,317766,ok,"" +M2,"aquifers downstream waterBodies [ME]",aquifers,downstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,500,31856,0,104395,engine-oom,"Tried to allocate 1.6 GB, but only 949.9 MB were available" +M2,"aquifers downstream wells [ME]",aquifers,downstream,,wells,ME,"none",FIND_TARGET_IRIS,federation,429,30847,0,98415,timeout-30s,"Operation timed out. Last operation: Join on ?upstream_flowline" +M2,"aquifers downstream aquifers [ME]",aquifers,downstream,,aquifers,ME,"none",FIND_TARGET_IRIS,federation,500,30922,0,108665,engine-oom,"Tried to allocate 1.6 GB, but only 1.5 GB were available" +M3,"samples upstream samples [ME]",samples,upstream,,samples,ME,"none",FIND_TARGET_IRIS,federation,200,13108,3221,320942,ok,"" +M3,"samples upstream facilities [ME]",samples,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,13697,2739,265733,ok,"" +M3,"samples upstream waterBodies [ME]",samples,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,200,13481,6072,473293,ok,"" +M3,"samples upstream wells [ME]",samples,upstream,,wells,ME,"none",FIND_TARGET_IRIS,federation,200,24314,47730,4550182,ok,"" +M3,"samples upstream aquifers [ME]",samples,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,federation,200,12610,4650,455750,ok,"" +M3,"facilities upstream samples [ME]",facilities,upstream,,samples,ME,"none",FIND_TARGET_IRIS,federation,200,24333,3195,318366,ok,"" +M3,"facilities upstream facilities [ME]",facilities,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,federation,429,31640,0,115383,timeout-30s,"Operation timed out. Last operation: Join on ?ds_flowline" +M3,"facilities upstream waterBodies [ME]",facilities,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,500,23294,0,111777,engine-oom,"Tried to allocate 1.6 GB, but only 1 GB were available" +M3,"facilities upstream wells [ME]",facilities,upstream,,wells,ME,"none",FIND_TARGET_IRIS,federation,429,32067,0,117040,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?ds_flowline" +M3,"facilities upstream aquifers [ME]",facilities,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,federation,500,27780,0,111636,engine-oom,"Tried to allocate 1.6 GB, but only 1.1 GB were available" +M3,"waterBodies upstream samples [ME]",waterBodies,upstream,,samples,ME,"none",FIND_TARGET_IRIS,federation,200,8891,3064,305306,ok,"" +M3,"waterBodies upstream facilities [ME]",waterBodies,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,13035,2770,268740,ok,"" +M3,"waterBodies upstream waterBodies [ME]",waterBodies,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,200,20120,6504,506964,ok,"" +M3,"waterBodies upstream wells [ME]",waterBodies,upstream,,wells,ME,"none",FIND_TARGET_IRIS,federation,200,28050,51437,4903673,ok,"" +M3,"waterBodies upstream aquifers [ME]",waterBodies,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,federation,200,15534,4764,466922,ok,"" +M3,"wells upstream samples [ME]",wells,upstream,,samples,ME,"none",FIND_TARGET_IRIS,federation,429,36053,0,107578,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?iri" +M3,"wells upstream facilities [ME]",wells,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,federation,429,31332,0,116117,timeout-30s,"Operation timed out. Last operation: Join on ?s2anchor" +M3,"wells upstream waterBodies [ME]",wells,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,500,29900,0,107648,engine-oom,"Tried to allocate 1.6 GB, but only 1.3 GB were available" +M3,"wells upstream wells [ME]",wells,upstream,,wells,ME,"none",FIND_TARGET_IRIS,federation,429,31254,0,110507,timeout-30s,"Operation timed out. Last operation: Join on ?s2anchor" +M3,"wells upstream aquifers [ME]",wells,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,federation,500,28364,0,107524,engine-oom,"Tried to allocate 1.6 GB, but only 1.2 GB were available" +M3,"aquifers upstream samples [ME]",aquifers,upstream,,samples,ME,"none",FIND_TARGET_IRIS,federation,200,23243,2935,292622,ok,"" +M3,"aquifers upstream facilities [ME]",aquifers,upstream,,facilities,ME,"none",FIND_TARGET_IRIS,federation,200,17060,1919,186193,ok,"" +M3,"aquifers upstream waterBodies [ME]",aquifers,upstream,,waterBodies,ME,"none",FIND_TARGET_IRIS,federation,500,17979,0,114014,engine-oom,"Tried to allocate 1.6 GB, but only 1.6 GB were available" +M3,"aquifers upstream wells [ME]",aquifers,upstream,,wells,ME,"none",FIND_TARGET_IRIS,federation,429,32412,0,118747,timeout-30s,"Operation timed out. Last operation: BIND (?wellC AS ?iri)" +M3,"aquifers upstream aquifers [ME]",aquifers,upstream,,aquifers,ME,"none",FIND_TARGET_IRIS,federation,429,25938,0,114010,timeout-sort-estimate,"Sort operation was canceled, because time estimate exceeded remaining time by a factor of 3 Last operation: Sort (internal order) on ?iri" +M6,"samples downstream facilities [17]",samples,downstream,,facilities,17,"none",FIND_TARGET_IRIS,federation,429,31036,0,107262,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +M6,"samples downstream facilities [18]",samples,downstream,,facilities,18,"none",FIND_TARGET_IRIS,federation,429,31204,0,109540,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?iri" +M6,"samples downstream facilities [25]",samples,downstream,,facilities,25,"none",FIND_TARGET_IRIS,federation,500,23256,0,112394,engine-oom,"Tried to allocate 3.3 GB, but only 2.6 GB were available" +M6,"samples downstream facilities [33]",samples,downstream,,facilities,33,"none",FIND_TARGET_IRIS,federation,429,32054,0,112156,timeout-30s,"Operation timed out. Last operation: Join on ?s2target" +M6,"samples downstream facilities [01]",samples,downstream,,facilities,01,"none",FIND_TARGET_IRIS,federation,500,21701,0,112402,engine-oom,"Tried to allocate 3.3 GB, but only 2.6 GB were available" +M6,"samples downstream facilities [50]",samples,downstream,,facilities,50,"none",FIND_TARGET_IRIS,federation,200,20811,17,1544,ok,"" +M7,"samples near facilities [NO REGION]",samples,near,1,facilities,none,"none",FIND_TARGET_IRIS,federation,200,1444,4770,429430,ok,"" +M7,"samples downstream facilities [NO REGION]",samples,downstream,,facilities,none,"none",FIND_TARGET_IRIS,federation,500,37312,0,96658,engine-oom,"Tried to allocate 2.6 GB, but only 1.7 GB were available" +M7,"wells near facilities [NO REGION]",wells,near,1,facilities,none,"none",FIND_TARGET_IRIS,federation,200,21566,219026,22554679,ok,"" +M5,"PREBUILT: Samples Near Agricultural Chemical Facilities in Maine",samples,near,1,facilities,23,"prebuilt",FIND_TARGET_IRIS,federation,200,1620,31,3142,ok,"" +M5,"PREBUILT: Samples Near Agricultural Chemical Facilities in Maine",samples,near,1,facilities,23,"prebuilt",FIND_ANCHOR_IRIS,federation,200,22456,5,535,ok,"" +M5,"PREBUILT: Samples Near Agricultural Chemical Facilities in Maine",samples,near,1,facilities,23,"prebuilt",HYDRATE_TARGET_BY_IRI,federation,200,990,24,16263,ok,"" +M5,"PREBUILT: Samples Near Agricultural Chemical Facilities in Maine",samples,near,1,facilities,23,"prebuilt",HYDRATE_ANCHOR_BY_IRI,federation,200,664,11,6464,ok,"" +M5,"PREBUILT: Samples Near Agricultural Chemical Facilities in Maine",samples,near,1,facilities,23,"prebuilt",GET_SAMPLE_DETAILS,federation,200,11549,1904,1894113,ok,"" +M5,"PREBUILT: Samples Near Agricultural Chemical Facilities in Maine",samples,near,1,facilities,23,"prebuilt",GET_REGION_BOUNDARIES,spatialkg,200,25459,16,2550452,ok,"" +M5,"PREBUILT: Samples Near Landfills & DOD Sites in Penobscot and Knox County",samples,near,1,facilities,23019|23013,"prebuilt",FIND_TARGET_IRIS,federation,200,1347,61,6138,ok,"" +M5,"PREBUILT: Samples Near Landfills & DOD Sites in Penobscot and Knox County",samples,near,1,facilities,23019|23013,"prebuilt",FIND_ANCHOR_IRIS,federation,200,2755,8,826,ok,"" +M5,"PREBUILT: Samples Near Landfills & DOD Sites in Penobscot and Knox County",samples,near,1,facilities,23019|23013,"prebuilt",HYDRATE_TARGET_BY_IRI,federation,200,869,57,38232,ok,"" +M5,"PREBUILT: Samples Near Landfills & DOD Sites in Penobscot and Knox County",samples,near,1,facilities,23019|23013,"prebuilt",HYDRATE_ANCHOR_BY_IRI,federation,200,639,8,4620,ok,"" +M5,"PREBUILT: Samples Near Landfills & DOD Sites in Penobscot and Knox County",samples,near,1,facilities,23019|23013,"prebuilt",GET_SAMPLE_DETAILS,federation,200,9674,725,720167,ok,"" +M5,"PREBUILT: Samples Near Landfills & DOD Sites in Penobscot and Knox County",samples,near,1,facilities,23019|23013,"prebuilt",GET_REGION_BOUNDARIES,spatialkg,200,125,16,2550451,ok,"" +M5,"PREBUILT: Surface Water Bodies Near Landfills & DOD Sites in Penobscot and Knox County",waterBodies,near,1,facilities,23019|23013,"prebuilt",FIND_TARGET_IRIS,federation,200,1145,9,754,ok,"" +M5,"PREBUILT: Surface Water Bodies Near Landfills & DOD Sites in Penobscot and Knox County",waterBodies,near,1,facilities,23019|23013,"prebuilt",FIND_ANCHOR_IRIS,federation,200,1038,6,632,ok,"" +M5,"PREBUILT: Surface Water Bodies Near Landfills & DOD Sites in Penobscot and Knox County",waterBodies,near,1,facilities,23019|23013,"prebuilt",HYDRATE_TARGET_BY_IRI,hydrologykg,200,27534,103,2360070,ok,"" +M5,"PREBUILT: Surface Water Bodies Near Landfills & DOD Sites in Penobscot and Knox County",waterBodies,near,1,facilities,23019|23013,"prebuilt",HYDRATE_ANCHOR_BY_IRI,federation,200,792,6,3501,ok,"" +M5,"PREBUILT: Surface Water Bodies Near Landfills & DOD Sites in Penobscot and Knox County",waterBodies,near,1,facilities,23019|23013,"prebuilt",GET_REGION_BOUNDARIES,spatialkg,200,262,16,2550451,ok,"" +M5,"PREBUILT: Samples Downstream of Waste Treatment Facilities in Indiana",samples,downstream,,facilities,18,"prebuilt",FIND_TARGET_IRIS,federation,200,22205,136,10889,ok,"" +M5,"PREBUILT: Samples Downstream of Waste Treatment Facilities in Indiana",samples,downstream,,facilities,18,"prebuilt",FIND_ANCHOR_IRIS,federation,200,4555,415,40305,ok,"" +M5,"PREBUILT: Samples Downstream of Waste Treatment Facilities in Indiana",samples,downstream,,facilities,18,"prebuilt",GET_FLOWLINE_GEOMETRIES,federation,200,22533,15696,15122393,ok,"" +M5,"PREBUILT: Samples Downstream of Waste Treatment Facilities in Indiana",samples,downstream,,facilities,18,"prebuilt",HYDRATE_TARGET_BY_IRI,federation,200,1142,123,86977,ok,"" +M5,"PREBUILT: Samples Downstream of Waste Treatment Facilities in Indiana",samples,downstream,,facilities,18,"prebuilt",HYDRATE_ANCHOR_BY_IRI,federation,200,1787,882,498450,ok,"" +M5,"PREBUILT: Samples Downstream of Waste Treatment Facilities in Indiana",samples,downstream,,facilities,18,"prebuilt",GET_SAMPLE_DETAILS,federation,200,14502,2222,2328389,ok,"" +M5,"PREBUILT: Samples Downstream of Waste Treatment Facilities in Indiana",samples,downstream,,facilities,18,"prebuilt",GET_REGION_BOUNDARIES,spatialkg,200,477,92,3064709,ok,"" +M5,"PREBUILT: Maine Private Wells Near Landfills & DoD Sites",wells,near,1,facilities,23,"prebuilt",FIND_TARGET_IRIS,federation,200,3153,751,71552,ok,"" +M5,"PREBUILT: Maine Private Wells Near Landfills & DoD Sites",wells,near,1,facilities,23,"prebuilt",FIND_ANCHOR_IRIS,federation,200,1259,38,3736,ok,"" +M5,"PREBUILT: Maine Private Wells Near Landfills & DoD Sites",wells,near,1,facilities,23,"prebuilt",HYDRATE_TARGET_BY_IRI,federation,200,13384,751,567528,ok,"" +M5,"PREBUILT: Maine Private Wells Near Landfills & DoD Sites",wells,near,1,facilities,23,"prebuilt",HYDRATE_ANCHOR_BY_IRI,federation,200,754,38,21384,ok,"" +M5,"PREBUILT: Maine Private Wells Near Landfills & DoD Sites",wells,near,1,facilities,23,"prebuilt",GET_REGION_BOUNDARIES,spatialkg,200,273,16,2550451,ok,"" +M5,"PREBUILT: Maine Private Wells Near Wastewater Treatment Facilities",wells,near,1,facilities,23,"prebuilt",FIND_TARGET_IRIS,federation,200,1351,2431,231487,ok,"" +M5,"PREBUILT: Maine Private Wells Near Wastewater Treatment Facilities",wells,near,1,facilities,23,"prebuilt",FIND_ANCHOR_IRIS,federation,200,1267,135,13145,ok,"" +M5,"PREBUILT: Maine Private Wells Near Wastewater Treatment Facilities",wells,near,1,facilities,23,"prebuilt",HYDRATE_TARGET_BY_IRI,federation,200,9926,2431,1845301,ok,"" +M5,"PREBUILT: Maine Private Wells Near Wastewater Treatment Facilities",wells,near,1,facilities,23,"prebuilt",HYDRATE_ANCHOR_BY_IRI,federation,200,781,135,76705,ok,"" +M5,"PREBUILT: Maine Private Wells Near Wastewater Treatment Facilities",wells,near,1,facilities,23,"prebuilt",GET_REGION_BOUNDARIES,spatialkg,200,109,16,2550451,ok,"" +M5,"PREBUILT: Maine Private Wells Near Airports & Air Transportation Sites (AFFF)",wells,near,1,facilities,23,"prebuilt",FIND_TARGET_IRIS,federation,200,1385,4425,421382,ok,"" +M5,"PREBUILT: Maine Private Wells Near Airports & Air Transportation Sites (AFFF)",wells,near,1,facilities,23,"prebuilt",FIND_ANCHOR_IRIS,federation,200,1234,174,16928,ok,"" +M5,"PREBUILT: Maine Private Wells Near Airports & Air Transportation Sites (AFFF)",wells,near,1,facilities,23,"prebuilt",HYDRATE_TARGET_BY_IRI,federation,200,10910,4425,3391412,ok,"" +M5,"PREBUILT: Maine Private Wells Near Airports & Air Transportation Sites (AFFF)",wells,near,1,facilities,23,"prebuilt",HYDRATE_ANCHOR_BY_IRI,federation,200,738,174,95901,ok,"" +M5,"PREBUILT: Maine Private Wells Near Airports & Air Transportation Sites (AFFF)",wells,near,1,facilities,23,"prebuilt",GET_REGION_BOUNDARIES,spatialkg,200,157,16,2550451,ok,"" +M5,"PREBUILT: PFHpA Groundwater Samples Downstream from Facilities in Cumberland County",samples,downstream,,facilities,23005,"prebuilt",FIND_TARGET_IRIS,federation,200,2113,0,51,ok,"" diff --git a/docs/query-matrix/2026-09-20-raw-002e529.csv b/docs/query-matrix/2026-09-20-raw-002e529.csv new file mode 100644 index 0000000..dbcbcf6 --- /dev/null +++ b/docs/query-matrix/2026-09-20-raw-002e529.csv @@ -0,0 +1,33 @@ +runAt,commit,matrix,label,blockA,rel,hops,blockC,region,filters,step,endpoint,status,ms,rows,bytes,errorClass,errorMsg +2026-09-20T03:36,002e529,MD,"facilities upstream samples [ME on A] step0",facilities,upstream,,samples,ME on A,"none",FIND_TARGET_IRIS,federation,429,30442,0,111431,timeout-30s,"Operation timed out. Last operation: Join on ?ds_flowline" +2026-09-20T03:36,002e529,MD,"facilities upstream samples [ME on A] step1",facilities,upstream,,samples,ME on A,"none",FIND_ANCHOR_IRIS,federation,429,32609,0,111600,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?s2anchor" +2026-09-20T03:36,002e529,MD,"facilities upstream samples [ME on C] step0",facilities,upstream,,samples,ME on C,"none",FIND_TARGET_IRIS,federation,429,39826,0,108007,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T03:36,002e529,MD,"facilities upstream samples [ME on C] step1",facilities,upstream,,samples,ME on C,"none",FIND_ANCHOR_IRIS,federation,500,32117,0,108455,engine-oom,"Tried to allocate 1.7 GB, but only 499.5 MB were available" +2026-09-20T03:36,002e529,MD,"facilities upstream(30km) samples [ME on A] step0",facilities,upstream,,samples,ME on A,"30km",FIND_TARGET_IRIS,federation,200,22993,2399,238993,ok,"" +2026-09-20T03:36,002e529,MD,"facilities upstream(30km) samples [ME on A] step1",facilities,upstream,,samples,ME on A,"30km",FIND_ANCHOR_IRIS,federation,200,8647,2523,244781,ok,"" +2026-09-20T03:36,002e529,MD,"facilities upstream(30km) samples [ME on C] step0",facilities,upstream,,samples,ME on C,"30km",FIND_TARGET_IRIS,federation,429,30370,0,479268,timeout-30s,"Operation timed out. Last operation: Join on ?_flMid" +2026-09-20T03:36,002e529,MD,"facilities upstream(30km) samples [ME on C] step1",facilities,upstream,,samples,ME on C,"30km",FIND_ANCHOR_IRIS,federation,500,21553,0,479800,engine-oom,"Tried to allocate 2.1 GB, but only 1.2 GB were available" +2026-09-20T03:36,002e529,MD,"facilities upstream streams [ME on A] step0",facilities,upstream,,streams,ME on A,"none",FIND_TARGET_IRIS,federation,200,16106,9632,749884,ok,"" +2026-09-20T03:36,002e529,MD,"facilities upstream streams [ME on A] step1",facilities,upstream,,streams,ME on A,"none",FIND_ANCHOR_IRIS,federation,200,1117,2858,277276,ok,"" +2026-09-20T03:36,002e529,MD,"facilities upstream streams [ME on C] step0",facilities,upstream,,streams,ME on C,"none",FIND_TARGET_IRIS,federation,200,17928,9502,739652,ok,"" +2026-09-20T03:36,002e529,MD,"facilities upstream streams [ME on C] step1",facilities,upstream,,streams,ME on C,"none",FIND_ANCHOR_IRIS,federation,200,3760,4056,393482,ok,"" +2026-09-20T03:36,002e529,MD,"facilities upstream(30km) streams [ME on A] step0",facilities,upstream,,streams,ME on A,"30km",FIND_TARGET_IRIS,federation,200,12374,9110,709410,ok,"" +2026-09-20T03:36,002e529,MD,"facilities upstream(30km) streams [ME on A] step1",facilities,upstream,,streams,ME on A,"30km",FIND_ANCHOR_IRIS,federation,200,1583,2858,277276,ok,"" +2026-09-20T03:36,002e529,MD,"facilities upstream(30km) streams [ME on C] step0",facilities,upstream,,streams,ME on C,"30km",FIND_TARGET_IRIS,federation,429,32002,0,479100,timeout-30s,"Operation timed out. Last operation: Join on ?_flMid" +2026-09-20T03:36,002e529,MD,"facilities upstream(30km) streams [ME on C] step1",facilities,upstream,,streams,ME on C,"30km",FIND_ANCHOR_IRIS,federation,429,31369,0,478927,timeout-30s,"Operation timed out. Last operation: Join on ?_flMid" +2026-09-20T03:36,002e529,MD,"facilities upstream wells [ME on A] step0",facilities,upstream,,wells,ME on A,"none",FIND_TARGET_IRIS,federation,429,31171,0,117042,timeout-30s,"Operation timed out. Last operation: Join on ?ds_flowline" +2026-09-20T03:36,002e529,MD,"facilities upstream wells [ME on A] step1",facilities,upstream,,wells,ME on A,"none",FIND_ANCHOR_IRIS,federation,500,19623,0,117156,engine-oom,"Tried to allocate 1.6 GB, but only 911.8 MB were available" +2026-09-20T03:36,002e529,MD,"facilities upstream wells [ME on C] step0",facilities,upstream,,wells,ME on C,"none",FIND_TARGET_IRIS,federation,429,36758,0,111550,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T03:36,002e529,MD,"facilities upstream wells [ME on C] step1",facilities,upstream,,wells,ME on C,"none",FIND_ANCHOR_IRIS,federation,429,31463,0,111552,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T03:36,002e529,MD,"facilities upstream(30km) wells [ME on A] step0",facilities,upstream,,wells,ME on A,"30km",FIND_TARGET_IRIS,federation,429,30384,0,527792,timeout-30s,"Operation timed out. Last operation: Join on ?s2target" +2026-09-20T03:36,002e529,MD,"facilities upstream(30km) wells [ME on A] step1",facilities,upstream,,wells,ME on A,"30km",FIND_ANCHOR_IRIS,federation,429,31207,0,532435,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?s2anchor" +2026-09-20T03:36,002e529,MD,"facilities upstream(30km) wells [ME on C] step0",facilities,upstream,,wells,ME on C,"30km",FIND_TARGET_IRIS,federation,429,30329,0,522447,timeout-30s,"Operation timed out. Last operation: Join on ?s2anchor" +2026-09-20T03:36,002e529,MD,"facilities upstream(30km) wells [ME on C] step1",facilities,upstream,,wells,ME on C,"30km",FIND_ANCHOR_IRIS,federation,429,30501,0,527948,timeout-30s,"Operation timed out. Last operation: Join on ?upstream_flowline" +2026-09-20T03:36,002e529,MD,"samples downstream facilities [ME on A] step0",samples,downstream,,facilities,ME on A,"none",FIND_TARGET_IRIS,federation,500,23256,0,108086,engine-oom,"Tried to allocate 2.6 GB, but only 2.4 GB were available" +2026-09-20T03:36,002e529,MD,"samples downstream facilities [ME on A] step1",samples,downstream,,facilities,ME on A,"none",FIND_ANCHOR_IRIS,federation,429,31284,0,107969,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T03:36,002e529,MD,"samples downstream facilities [ME on C] step0",samples,downstream,,facilities,ME on C,"none",FIND_TARGET_IRIS,federation,429,33385,0,111524,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?s2anchor" +2026-09-20T03:36,002e529,MD,"samples downstream facilities [ME on C] step1",samples,downstream,,facilities,ME on C,"none",FIND_ANCHOR_IRIS,federation,200,25171,2652,257294,ok,"" +2026-09-20T03:36,002e529,MD,"samples downstream(30km) facilities [ME on A] step0",samples,downstream,,facilities,ME on A,"30km",FIND_TARGET_IRIS,federation,429,34451,0,478801,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?_flMid" +2026-09-20T03:36,002e529,MD,"samples downstream(30km) facilities [ME on A] step1",samples,downstream,,facilities,ME on A,"30km",FIND_ANCHOR_IRIS,federation,500,27607,0,479804,engine-oom,"Tried to allocate 2.1 GB, but only 1.2 GB were available" +2026-09-20T03:36,002e529,MD,"samples downstream(30km) facilities [ME on C] step0",samples,downstream,,facilities,ME on C,"30km",FIND_TARGET_IRIS,federation,200,22430,2399,238993,ok,"" +2026-09-20T03:36,002e529,MD,"samples downstream(30km) facilities [ME on C] step1",samples,downstream,,facilities,ME on C,"30km",FIND_ANCHOR_IRIS,federation,200,8317,2523,244781,ok,"" diff --git a/docs/query-matrix/2026-09-20-raw-002e529.csv.note b/docs/query-matrix/2026-09-20-raw-002e529.csv.note new file mode 100644 index 0000000..357b69e --- /dev/null +++ b/docs/query-matrix/2026-09-20-raw-002e529.csv.note @@ -0,0 +1,7 @@ +**Cold. Do not diff this against a later sweep on its own.** This was the first +MD sweep ever run, so every query in it missed the engine's cache, and the three +sweeps taken after it were all warm. One row moves on that difference alone: +`facilities upstream samples [ME on A] step1` times out here and answers in 15s +warm, with the generated SPARQL byte-identical (1,950 chars either side of +`ec221d9`). Read against `2026-09-20-raw-e84a11f.csv`, which re-runs the same +pre-fix engine warm, and is the honest before-half of that comparison. diff --git a/docs/query-matrix/2026-09-20-raw-e84a11f.csv b/docs/query-matrix/2026-09-20-raw-e84a11f.csv new file mode 100644 index 0000000..4867230 --- /dev/null +++ b/docs/query-matrix/2026-09-20-raw-e84a11f.csv @@ -0,0 +1,33 @@ +runAt,commit,matrix,label,blockA,rel,hops,blockC,region,filters,step,endpoint,status,ms,rows,bytes,errorClass,errorMsg +2026-09-20T04:57,4454b80,MD,"facilities upstream samples [ME on A] step0",facilities,upstream,,samples,ME on A,"none",FIND_TARGET_IRIS,federation,429,35192,0,111567,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?s2anchor" +2026-09-20T04:57,4454b80,MD,"facilities upstream samples [ME on A] step1",facilities,upstream,,samples,ME on A,"none",FIND_ANCHOR_IRIS,federation,200,15049,2652,257294,ok,"" +2026-09-20T04:57,4454b80,MD,"facilities upstream samples [ME on C] step0",facilities,upstream,,samples,ME on C,"none",FIND_TARGET_IRIS,federation,429,35304,0,108006,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T04:57,4454b80,MD,"facilities upstream samples [ME on C] step1",facilities,upstream,,samples,ME on C,"none",FIND_ANCHOR_IRIS,federation,429,31895,0,107974,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T04:57,4454b80,MD,"facilities upstream(30km) samples [ME on A] step0",facilities,upstream,,samples,ME on A,"30km",FIND_TARGET_IRIS,federation,200,22272,2399,238993,ok,"" +2026-09-20T04:57,4454b80,MD,"facilities upstream(30km) samples [ME on A] step1",facilities,upstream,,samples,ME on A,"30km",FIND_ANCHOR_IRIS,federation,200,8737,2523,244781,ok,"" +2026-09-20T04:57,4454b80,MD,"facilities upstream(30km) samples [ME on C] step0",facilities,upstream,,samples,ME on C,"30km",FIND_TARGET_IRIS,federation,429,30365,0,479272,timeout-30s,"Operation timed out. Last operation: Join on ?_flMid" +2026-09-20T04:57,4454b80,MD,"facilities upstream(30km) samples [ME on C] step1",facilities,upstream,,samples,ME on C,"30km",FIND_ANCHOR_IRIS,federation,500,22988,0,479803,engine-oom,"Tried to allocate 2.1 GB, but only 1.2 GB were available" +2026-09-20T04:57,4454b80,MD,"facilities upstream streams [ME on A] step0",facilities,upstream,,streams,ME on A,"none",FIND_TARGET_IRIS,federation,200,15741,9632,749884,ok,"" +2026-09-20T04:57,4454b80,MD,"facilities upstream streams [ME on A] step1",facilities,upstream,,streams,ME on A,"none",FIND_ANCHOR_IRIS,federation,200,1336,2858,277276,ok,"" +2026-09-20T04:57,4454b80,MD,"facilities upstream streams [ME on C] step0",facilities,upstream,,streams,ME on C,"none",FIND_TARGET_IRIS,federation,200,17914,9502,739652,ok,"" +2026-09-20T04:57,4454b80,MD,"facilities upstream streams [ME on C] step1",facilities,upstream,,streams,ME on C,"none",FIND_ANCHOR_IRIS,federation,200,3546,4056,393482,ok,"" +2026-09-20T04:57,4454b80,MD,"facilities upstream(30km) streams [ME on A] step0",facilities,upstream,,streams,ME on A,"30km",FIND_TARGET_IRIS,federation,200,11490,9110,709410,ok,"" +2026-09-20T04:57,4454b80,MD,"facilities upstream(30km) streams [ME on A] step1",facilities,upstream,,streams,ME on A,"30km",FIND_ANCHOR_IRIS,federation,200,1555,2858,277276,ok,"" +2026-09-20T04:57,4454b80,MD,"facilities upstream(30km) streams [ME on C] step0",facilities,upstream,,streams,ME on C,"30km",FIND_TARGET_IRIS,federation,429,31331,0,479098,timeout-30s,"Operation timed out. Last operation: Join on ?_flMid" +2026-09-20T04:57,4454b80,MD,"facilities upstream(30km) streams [ME on C] step1",facilities,upstream,,streams,ME on C,"30km",FIND_ANCHOR_IRIS,federation,429,31126,0,478929,timeout-30s,"Operation timed out. Last operation: Join on ?_flMid" +2026-09-20T04:57,4454b80,MD,"facilities upstream wells [ME on A] step0",facilities,upstream,,wells,ME on A,"none",FIND_TARGET_IRIS,federation,429,30580,0,117034,timeout-30s,"Operation timed out. Last operation: Join on ?ds_flowline" +2026-09-20T04:57,4454b80,MD,"facilities upstream wells [ME on A] step1",facilities,upstream,,wells,ME on A,"none",FIND_ANCHOR_IRIS,federation,500,18201,0,117149,engine-oom,"Tried to allocate 1.6 GB, but only 911.8 MB were available" +2026-09-20T04:57,4454b80,MD,"facilities upstream wells [ME on C] step0",facilities,upstream,,wells,ME on C,"none",FIND_TARGET_IRIS,federation,429,35003,0,111544,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T04:57,4454b80,MD,"facilities upstream wells [ME on C] step1",facilities,upstream,,wells,ME on C,"none",FIND_ANCHOR_IRIS,federation,429,35129,0,111554,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T04:57,4454b80,MD,"facilities upstream(30km) wells [ME on A] step0",facilities,upstream,,wells,ME on A,"30km",FIND_TARGET_IRIS,federation,429,30727,0,524032,timeout-30s,"Operation timed out. Last operation: GroupBy on ?_flEnd ?upstream_flowline" +2026-09-20T04:57,4454b80,MD,"facilities upstream(30km) wells [ME on A] step1",facilities,upstream,,wells,ME on A,"30km",FIND_ANCHOR_IRIS,federation,429,30515,0,532240,timeout-30s,"Operation timed out. Last operation: Join on ?upstream_flowline" +2026-09-20T04:57,4454b80,MD,"facilities upstream(30km) wells [ME on C] step0",facilities,upstream,,wells,ME on C,"30km",FIND_TARGET_IRIS,federation,429,31265,0,521767,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?s2neighbor" +2026-09-20T04:57,4454b80,MD,"facilities upstream(30km) wells [ME on C] step1",facilities,upstream,,wells,ME on C,"30km",FIND_ANCHOR_IRIS,federation,429,30485,0,526100,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T04:57,4454b80,MD,"samples downstream facilities [ME on A] step0",samples,downstream,,facilities,ME on A,"none",FIND_TARGET_IRIS,federation,500,26885,0,108100,engine-oom,"Tried to allocate 2.6 GB, but only 1.5 GB were available" +2026-09-20T04:57,4454b80,MD,"samples downstream facilities [ME on A] step1",samples,downstream,,facilities,ME on A,"none",FIND_ANCHOR_IRIS,federation,429,31087,0,107966,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T04:57,4454b80,MD,"samples downstream facilities [ME on C] step0",samples,downstream,,facilities,ME on C,"none",FIND_TARGET_IRIS,federation,429,33932,0,111521,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?s2anchor" +2026-09-20T04:57,4454b80,MD,"samples downstream facilities [ME on C] step1",samples,downstream,,facilities,ME on C,"none",FIND_ANCHOR_IRIS,federation,200,15537,2652,257294,ok,"" +2026-09-20T04:57,4454b80,MD,"samples downstream(30km) facilities [ME on A] step0",samples,downstream,,facilities,ME on A,"30km",FIND_TARGET_IRIS,federation,429,30809,0,478795,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?_flMid" +2026-09-20T04:57,4454b80,MD,"samples downstream(30km) facilities [ME on A] step1",samples,downstream,,facilities,ME on A,"30km",FIND_ANCHOR_IRIS,federation,500,27170,0,479799,engine-oom,"Tried to allocate 2.1 GB, but only 1.2 GB were available" +2026-09-20T04:57,4454b80,MD,"samples downstream(30km) facilities [ME on C] step0",samples,downstream,,facilities,ME on C,"30km",FIND_TARGET_IRIS,federation,200,22030,2399,238993,ok,"" +2026-09-20T04:57,4454b80,MD,"samples downstream(30km) facilities [ME on C] step1",samples,downstream,,facilities,ME on C,"30km",FIND_ANCHOR_IRIS,federation,200,8022,2523,244781,ok,"" diff --git a/docs/query-matrix/2026-09-20-raw-ec221d9.csv b/docs/query-matrix/2026-09-20-raw-ec221d9.csv new file mode 100644 index 0000000..ab2e982 --- /dev/null +++ b/docs/query-matrix/2026-09-20-raw-ec221d9.csv @@ -0,0 +1,33 @@ +runAt,commit,matrix,label,blockA,rel,hops,blockC,region,filters,step,endpoint,status,ms,rows,bytes,errorClass,errorMsg +2026-09-20T03:59,ec221d9,MD,"facilities upstream samples [ME on A] step0",facilities,upstream,,samples,ME on A,"none",FIND_TARGET_IRIS,federation,429,34883,0,111567,timeout-30s,"Operation timed out. Last operation: Sort (internal order) on ?s2anchor" +2026-09-20T03:59,ec221d9,MD,"facilities upstream samples [ME on A] step1",facilities,upstream,,samples,ME on A,"none",FIND_ANCHOR_IRIS,federation,200,15632,2652,257294,ok,"" +2026-09-20T03:59,ec221d9,MD,"facilities upstream samples [ME on C] step0",facilities,upstream,,samples,ME on C,"none",FIND_TARGET_IRIS,federation,429,32842,0,108003,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T03:59,ec221d9,MD,"facilities upstream samples [ME on C] step1",facilities,upstream,,samples,ME on C,"none",FIND_ANCHOR_IRIS,federation,429,33502,0,107965,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T03:59,ec221d9,MD,"facilities upstream(30km) samples [ME on A] step0",facilities,upstream,,samples,ME on A,"30km",FIND_TARGET_IRIS,federation,200,23001,2399,238993,ok,"" +2026-09-20T03:59,ec221d9,MD,"facilities upstream(30km) samples [ME on A] step1",facilities,upstream,,samples,ME on A,"30km",FIND_ANCHOR_IRIS,federation,200,9362,2523,244781,ok,"" +2026-09-20T03:59,ec221d9,MD,"facilities upstream(30km) samples [ME on C] step0",facilities,upstream,,samples,ME on C,"30km",FIND_TARGET_IRIS,federation,429,30290,0,366814,timeout-30s,"Operation timed out. Last operation: Join on ?s2anchor" +2026-09-20T03:59,ec221d9,MD,"facilities upstream(30km) samples [ME on C] step1",facilities,upstream,,samples,ME on C,"30km",FIND_ANCHOR_IRIS,federation,200,17243,3213,311711,ok,"" +2026-09-20T03:59,ec221d9,MD,"facilities upstream streams [ME on A] step0",facilities,upstream,,streams,ME on A,"none",FIND_TARGET_IRIS,federation,200,15779,9632,749884,ok,"" +2026-09-20T03:59,ec221d9,MD,"facilities upstream streams [ME on A] step1",facilities,upstream,,streams,ME on A,"none",FIND_ANCHOR_IRIS,federation,200,1242,2858,277276,ok,"" +2026-09-20T03:59,ec221d9,MD,"facilities upstream streams [ME on C] step0",facilities,upstream,,streams,ME on C,"none",FIND_TARGET_IRIS,federation,200,11135,9502,739652,ok,"" +2026-09-20T03:59,ec221d9,MD,"facilities upstream streams [ME on C] step1",facilities,upstream,,streams,ME on C,"none",FIND_ANCHOR_IRIS,federation,200,3565,4056,393482,ok,"" +2026-09-20T03:59,ec221d9,MD,"facilities upstream(30km) streams [ME on A] step0",facilities,upstream,,streams,ME on A,"30km",FIND_TARGET_IRIS,federation,200,11488,9110,709410,ok,"" +2026-09-20T03:59,ec221d9,MD,"facilities upstream(30km) streams [ME on A] step1",facilities,upstream,,streams,ME on A,"30km",FIND_ANCHOR_IRIS,federation,200,1433,2858,277276,ok,"" +2026-09-20T03:59,ec221d9,MD,"facilities upstream(30km) streams [ME on C] step0",facilities,upstream,,streams,ME on C,"30km",FIND_TARGET_IRIS,federation,500,23847,0,360813,engine-oom,"Tried to allocate 3.9 GB, but only 2.6 GB were available" +2026-09-20T03:59,ec221d9,MD,"facilities upstream(30km) streams [ME on C] step1",facilities,upstream,,streams,ME on C,"30km",FIND_ANCHOR_IRIS,federation,429,30612,0,361262,timeout-sort-estimate,"Sort operation was canceled, because time estimate exceeded remaining time by a factor of 3 Last operation: Sort (internal order) on ?_flEnd ?ds_flowline" +2026-09-20T03:59,ec221d9,MD,"facilities upstream wells [ME on A] step0",facilities,upstream,,wells,ME on A,"none",FIND_TARGET_IRIS,federation,429,30551,0,117000,timeout-30s,"Operation timed out. Last operation: Join on ?ds_flowline" +2026-09-20T03:59,ec221d9,MD,"facilities upstream wells [ME on A] step1",facilities,upstream,,wells,ME on A,"none",FIND_ANCHOR_IRIS,federation,500,17749,0,117117,engine-oom,"Tried to allocate 1.6 GB, but only 911.8 MB were available" +2026-09-20T03:59,ec221d9,MD,"facilities upstream wells [ME on C] step0",facilities,upstream,,wells,ME on C,"none",FIND_TARGET_IRIS,federation,429,34370,0,111544,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T03:59,ec221d9,MD,"facilities upstream wells [ME on C] step1",facilities,upstream,,wells,ME on C,"none",FIND_ANCHOR_IRIS,federation,429,34232,0,111553,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T03:59,ec221d9,MD,"facilities upstream(30km) wells [ME on A] step0",facilities,upstream,,wells,ME on A,"30km",FIND_TARGET_IRIS,federation,429,30417,0,532214,timeout-30s,"Operation timed out. Last operation: Join on ?upstream_flowline" +2026-09-20T03:59,ec221d9,MD,"facilities upstream(30km) wells [ME on A] step1",facilities,upstream,,wells,ME on A,"30km",FIND_ANCHOR_IRIS,federation,429,31453,0,532547,timeout-30s,"Operation timed out. Last operation: Join on ?s2anchor" +2026-09-20T03:59,ec221d9,MD,"facilities upstream(30km) wells [ME on C] step0",facilities,upstream,,wells,ME on C,"30km",FIND_TARGET_IRIS,federation,429,30844,0,415612,timeout-30s,"Operation timed out. Last operation: Join on ?_flMid" +2026-09-20T03:59,ec221d9,MD,"facilities upstream(30km) wells [ME on C] step1",facilities,upstream,,wells,ME on C,"30km",FIND_ANCHOR_IRIS,federation,429,30814,0,415634,timeout-30s,"Operation timed out. Last operation: Join on ?_flMid" +2026-09-20T03:59,ec221d9,MD,"samples downstream facilities [ME on A] step0",samples,downstream,,facilities,ME on A,"none",FIND_TARGET_IRIS,federation,429,31277,0,108000,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T03:59,ec221d9,MD,"samples downstream facilities [ME on A] step1",samples,downstream,,facilities,ME on A,"none",FIND_ANCHOR_IRIS,federation,429,31232,0,107964,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T03:59,ec221d9,MD,"samples downstream facilities [ME on C] step0",samples,downstream,,facilities,ME on C,"none",FIND_TARGET_IRIS,federation,429,30242,0,111522,timeout-30s,"Operation timed out. Last operation: Join on ?s2anchor" +2026-09-20T03:59,ec221d9,MD,"samples downstream facilities [ME on C] step1",samples,downstream,,facilities,ME on C,"none",FIND_ANCHOR_IRIS,federation,200,3934,2652,257294,ok,"" +2026-09-20T03:59,ec221d9,MD,"samples downstream(30km) facilities [ME on A] step0",samples,downstream,,facilities,ME on A,"30km",FIND_TARGET_IRIS,federation,429,30332,0,368309,timeout-30s,"Operation timed out. Last operation: Join on ?s2neighbor" +2026-09-20T03:59,ec221d9,MD,"samples downstream(30km) facilities [ME on A] step1",samples,downstream,,facilities,ME on A,"30km",FIND_ANCHOR_IRIS,federation,200,15649,3213,311711,ok,"" +2026-09-20T03:59,ec221d9,MD,"samples downstream(30km) facilities [ME on C] step0",samples,downstream,,facilities,ME on C,"30km",FIND_TARGET_IRIS,federation,200,19627,2399,238993,ok,"" +2026-09-20T03:59,ec221d9,MD,"samples downstream(30km) facilities [ME on C] step1",samples,downstream,,facilities,ME on C,"30km",FIND_ANCHOR_IRIS,federation,200,8464,2523,244781,ok,"" diff --git a/docs/query-matrix/README.md b/docs/query-matrix/README.md new file mode 100644 index 0000000..427f9e2 --- /dev/null +++ b/docs/query-matrix/README.md @@ -0,0 +1,47 @@ +# Query matrix sweeps + +Every run of `npm run query-matrix`, newest first. One CSV per sweep, named +for the day it ran — so `ls` answers "when was this last run", and comparing +two sweeps is a `diff` of two paths. + +``` +QUERY_MATRIX_MODE=engine npx tsx scripts/query-matrix.mts M1 init # start a sweep +QUERY_MATRIX_MODE=engine npx tsx scripts/query-matrix.mts M2 # each later phase +npx tsx scripts/query-matrix.mts --index # rebuild this file +``` + +`raw` posts each step's SPARQL directly and writes one row per step; `engine` +runs the real pipeline, one row per query, and is the mode to use after an +engine change. The two are not comparable row for row. + +| Sweep | Mode | Commit | Shapes | Pass | Fail | Since the previous sweep | +| --- | --- | --- | ---: | ---: | ---: | --- | +| [`2026-09-20`](./2026-09-20-raw-e84a11f.csv) | raw | `e84a11f` | 32 | 12 | 20 | **2 broke** (facilities upstream(30km) samples [ME on C] step1, samples downstream(30km) facilities [ME on A] step1) | +| [`2026-09-20`](./2026-09-20-raw-ec221d9.csv) | raw | `ec221d9` | 32 | 14 | 18 | 3 fixed | +| [`2026-09-20`](./2026-09-20-raw-002e529.csv) | raw | `002e529` | 32 | 11 | 21 | _first sweep in this mode_ | +| [`2026-09-14`](./2026-09-14-raw-baseline.csv) | raw-baseline | `unrecorded` | 124 | 87 | 37 | _first sweep in this mode_ | +| [`2026-09-14`](./2026-09-14-engine.csv) | engine | `unrecorded` | 124 | 112 | 9 | _first sweep in this mode_ | +| [`2026-09-14`](./2026-09-14-engine-contaminated-9128aa9.csv) | engine-contaminated | `9128aa9` | 124 | 94 | 29 | _first sweep in this mode_ | + +## Notes + +**[`2026-09-20-raw-002e529.csv`](./2026-09-20-raw-002e529.csv)** — **Cold. Do not diff this against a later sweep on its own.** This was the first +MD sweep ever run, so every query in it missed the engine's cache, and the three +sweeps taken after it were all warm. One row moves on that difference alone: +`facilities upstream samples [ME on A] step1` times out here and answers in 15s +warm, with the generated SPARQL byte-identical (1,950 chars either side of +`ec221d9`). Read against `2026-09-20-raw-e84a11f.csv`, which re-runs the same +pre-fix engine warm, and is the honest before-half of that comparison. + +**[`2026-09-14-engine.csv`](./2026-09-14-engine.csv)** — **The 25 `upstream` rows measured the wrong question.** Every upstream shape +traced the relation backwards until 2026-09-16 (`docs/DEBUGGING.md`, +2026-09-16), so their status, timing and row counts describe the mirror +question. They are not a baseline: the corrected direction is materially more +expensive where block C is unfiltered. See `docs/QUERY-MATRIX.md` Part 9, and +re-sweep. + +The other 99 rows (62 `near`, 37 `downstream`) are unaffected, and are the control when +diffing this file against the next sweep. + + +Generated 2026-09-20. diff --git a/docs/wiki/Dropdowns County.md b/docs/wiki/Dropdowns County.md index 4e99c4d..d015f19 100644 --- a/docs/wiki/Dropdowns County.md +++ b/docs/wiki/Dropdowns County.md @@ -65,7 +65,7 @@ Androscoggin, Aroostook, Cumberland. [`RegionSelector.tsx:47`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/RegionSelector.tsx#L47), inside a block that only renders when a state is set. * Its options come from - [`useCounties(stateCode)`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L142), + [`useCounties(stateCode)`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L166), called at [`RegionSelector.tsx:12`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/RegionSelector.tsx#L12). * The query text is built by @@ -82,7 +82,7 @@ Cached under `['counties', ]` with `staleTime: Infinity` and gated by `retry` override, which is what makes the loading state visible here and invisible elsewhere. The code derivation happens at -[`useDiscoveryQueries.ts:151`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L151). +[`useDiscoveryQueries.ts:151`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L166). ## If it looks wrong diff --git a/docs/wiki/Dropdowns Industry Counts.md b/docs/wiki/Dropdowns Industry Counts.md index a91b51c..d4523f6 100644 --- a/docs/wiki/Dropdowns Industry Counts.md +++ b/docs/wiki/Dropdowns Industry Counts.md @@ -84,7 +84,7 @@ stop appearing. `counts` prop at [`FacilityFilters.tsx:24`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/FacilityFilters.tsx#L24). * The data comes from - [`useIndustryCounts(region)`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L65), + [`useIndustryCounts(region)`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L76), called at [`FacilityFilters.tsx:13`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/FacilityFilters.tsx#L13). * The query text is built by @@ -94,7 +94,11 @@ stop appearing. against the `federation` URL in [`endpoints.ts`](https://github.com/SAWGraph/explorer-app/blob/main/src/constants/endpoints.ts). * The rollup is - [`rollupCounts()`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/HierarchicalSelect/useNaicsTree.ts#L138). + [`rollupCounts()`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/HierarchicalSelect/useNaicsTree.ts#L148), + now shared with the [Material](Dropdowns%20Material) dropdown. Summing children into a + parent is only sound when the children partition the parent. That holds for NAICS by + construction, and for material types because `MIN(?bucketPrio)` forces each one into + exactly one group. It would not hold for a set of overlapping categories. Cached under `['industryCounts', ]` with `staleTime: Infinity` and gated by `enabled: !!region?.stateCode`. The region key sorts the county codes before joining them, so diff --git a/docs/wiki/Dropdowns Industry.md b/docs/wiki/Dropdowns Industry.md index 86087e6..7d8be62 100644 --- a/docs/wiki/Dropdowns Industry.md +++ b/docs/wiki/Dropdowns Industry.md @@ -37,6 +37,12 @@ then for each code trims one character off the end at a time until it finds a co already exists, and attaches itself there. `325320` looks for `32532`, then `3253`, and stops at the first hit. Anything that never finds a parent becomes a root. +`buildTree` has a second mode, used by the Material dropdown: an item may name its `parent` +outright, and an explicit parent wins over prefix trimming. When any item does that, the +caller's ordering is kept as given rather than sorted by code length — material types arrive +sorted by observation count and sorting them by URI would throw that away. Industry supplies +no explicit parents, so it takes the trimming path and the sort exactly as described above. + This is why the tree structure depends entirely on which codes happen to be present. If an intermediate code is missing from the data, its children attach to whatever ancestor does exist, and the tree is a little flatter than the real NAICS hierarchy at that point. @@ -83,7 +89,7 @@ some labels carry trailing whitespace straight from the source data. ## How it is wired up -* The control is `HierarchicalSelect`, not the shared `FlatSelect`, rendered at +* The control is `HierarchicalSelect`, shared with the Material dropdown, rendered at [`FacilityFilters.tsx:19`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/FacilityFilters.tsx#L19). Its parts are [`HierarchicalSelect.tsx`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/HierarchicalSelect/HierarchicalSelect.tsx), @@ -91,7 +97,7 @@ some labels carry trailing whitespace straight from the source data. and [`useNaicsTree.ts`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/HierarchicalSelect/useNaicsTree.ts). * Its options come from - [`useIndustries()`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L14), + [`useIndustries()`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L25), called at [`FacilityFilters.tsx:12`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/FacilityFilters.tsx#L12). * The query text is built by diff --git a/docs/wiki/Dropdowns Material.md b/docs/wiki/Dropdowns Material.md index 53528a4..c658060 100644 --- a/docs/wiki/Dropdowns Material.md +++ b/docs/wiki/Dropdowns Material.md @@ -11,14 +11,62 @@ It sits directly under the Substance dropdown in the query editor, and appears w entity type is **Samples**, inside **+ Add Filters**. Like Substance, the list comes from the data rather than a fixed list, sorted by how many -observations use each material, with the count in brackets: `GROUNDWATER (609496)`. +observations use each material, with the count in brackets: `GROUNDWATER (609,496)`. Unfiltered it returns 171 distinct material types across the whole graph. Labels come straight from the graph, so they arrive in whatever case the source used. Maine data shouts in uppercase (`GROUNDWATER`, `WASTE WATER`), water quality portal data is title case (`Tissue`, `Water`). That inconsistency is upstream, not a rendering bug. +Those 171 are not shown as one long list. They sit under five headings, and each heading is +itself a checkbox you can tick to take everything beneath it, and an arrow you can click to +fold it away. That matters because the distribution is lopsided: 131 of the 171 are +individual fish species, all under Biota. + +| Group | Unfiltered | Maine | Cumberland County | +|---|---|---|---| +| Water | 14 | 13 | 12 | +| Biota | 131 | 26 | 7 | +| Solid Material | 15 | 9 | 3 | +| Air | 1 | — | — | +| Other | 10 | 6 | 3 | +| **Total** | **171** | **54** | **25** | + The list is region aware in the same way Substance is. Pick Cumberland County in Maine and -it narrows from 171 entries to 25. +it narrows from 171 entries to 25. Air disappears entirely below the national level: there +are no air samples in Maine. + +## Where the five groups come from + +The graph has no notion of "Water samples" as a category of material type. The grouping is +computed in the discovery query itself, by `MATERIAL_BUCKET_VALUES` in `regions.ts`: each +sample is left joined to the four direct subclasses of `coso:MaterialSample`, each tagged +with a priority, and `MIN(?prio)` picks one. + +``` +coso:BiotaSample 1 +coso:SolidMaterialSample 2 +coso:WaterSample 3 +coso:AirSample 4 +``` + +The tie break exists because the data is not cleanly disjoint — 171 material types produce +178 type-to-bucket links, so seven of them sit under more than one subclass and `MIN` picks +the lowest number. Anything that matches no subclass has no `?bucketPrio` at all and the hook +drops it into **Other**. + +Two consequences worth holding on to: + +* Because `MIN` forces exactly one bucket per material type, the groups partition the list. + That is what makes a group's count exactly the sum of its children's counts. Verified for + Maine: Water shows 556,269, and its thirteen children sum to 556,269. +* The priority order is a judgement call baked into the query, not something the ontology + says. A material type sampled as both biota and solid material is filed under Biota. + +**Ticking a group changes nothing about the SPARQL.** The group headings are a display +concept with no URI behind them. Selecting one expands to its children's real material type +URIs before anything is stored, so the query the pipeline sends is identical to the one you +would get by ticking every child by hand. Internally the headings carry synthetic codes like +`__group:Water`, and those are stripped before the selection is saved. Two quirks worth knowing about before you trust what you see: @@ -27,11 +75,15 @@ Two quirks worth knowing about before you trust what you see: Cumberland County surfaces `Mytilus edulis`, the blue mussel, sitting in the list next to `GROUNDWATER`. That is what the graph says, and the filter only excludes URIs outside the `http://w3id.org/` namespace. -* **The URIs change with the region.** Without a region the query hits `sawgraph`, which - names groundwater `me-egad#sampleMaterialType.GW`. With a region it hits `federation`, - which names the same thing `me-egad-data#sampleMaterialType.GW`. Same label, different URI. - A selection made before picking a state will therefore not match anything after picking - one. See [If it looks wrong](#if-it-looks-wrong). +* **Material type URIs live in the root namespace, not the `-data` one.** The August 2026 + reload split the graph in two directions at once. Instance data — individual samples and + sample points — moved to `v2/me-egad-data#` and `v2/us-wqp-data#`. The controlled + vocabulary went the other way, out of `-data` and into the plain roots `v1/me-egad#` and + `v1/us-wqp#`. A material type is vocabulary, so it is always the root form. Source of + truth is `pfas-kg`, `datasets/maine/egad/controlledVocab/sample_type.ttl`, which declares + `@prefix me_egad: ` and defines 47 terms. Checked + live on 2026-09-11: `v1/me-egad#sampleMaterialType.GW` has 46,110 triples and all three + other spellings have none. ## The SPARQL query @@ -43,10 +95,20 @@ written separately, and the difference matters. ```sparql SELECT ?matType (SAMPLE(?_label) AS ?label) (COUNT(DISTINCT ?observation) AS ?num) + (MIN(?prio) AS ?bucketPrio) WHERE { ?observation rdf:type coso:ContaminantObservation ; coso:analyzedSample ?sample . ?sample coso:sampleOfMaterialType ?matType . + OPTIONAL { + ?sample rdf:type ?bucketClass . + VALUES (?bucketClass ?prio) { + (coso:BiotaSample 1) + (coso:SolidMaterialSample 2) + (coso:WaterSample 3) + (coso:AirSample 4) + } + } OPTIONAL { ?matType rdfs:label ?_label . } FILTER(STRSTARTS(STR(?matType), "http://w3id.org/")) } GROUP BY ?matType @@ -62,7 +124,11 @@ Line by line: * `OPTIONAL { rdfs:label }` because not every material type has a label. Ones that do not fall back to the tail of their URI, done in the hook rather than in SPARQL. * The `FILTER` drops anything outside the `w3id.org` namespace, which is the crude way this - query keeps out URIs from source vocabularies that were never meant to be shown. + query keeps out URIs from source vocabularies that were never meant to be shown. As of + 2026-09-11 it excludes nothing at all — every material type in the graph is already under + `w3id.org` — so it is dead weight rather than an active filter. +* The `OPTIONAL` bucket block and `MIN(?prio)` are what produce the five groups, covered + above. Leave them out and you get the same 171 rows, ungrouped. Note that this variant never touches sample points at all. It walks observation to sample to material and stops. @@ -71,6 +137,7 @@ material and stops. ```sparql SELECT ?matType (SAMPLE(?_label) AS ?label) (COUNT(DISTINCT ?observation) AS ?num) + (MIN(?prio) AS ?bucketPrio) WHERE { ?sp rdf:type coso:SamplePoint . ?sp spatial:connectedTo ?_region . @@ -81,6 +148,15 @@ WHERE { coso:observedAtSamplePoint ?sp ; coso:analyzedSample ?sample . ?sample coso:sampleOfMaterialType ?matType . + OPTIONAL { + ?sample rdf:type ?bucketClass . + VALUES (?bucketClass ?prio) { + (coso:BiotaSample 1) + (coso:SolidMaterialSample 2) + (coso:WaterSample 3) + (coso:AirSample 4) + } + } OPTIONAL { ?matType rdfs:label ?_label . } FILTER(STRSTARTS(STR(?matType), "http://w3id.org/")) } GROUP BY ?matType @@ -92,27 +168,42 @@ The added part is the same region pattern the Substance dropdown uses, plus the Cumberland County, Maine. A whole state selection uses the two digit code instead, and the `administrativePartOf+` walk covers everything underneath it either way. -Verified against the live endpoints. Unfiltered returns 171 material types, led by -`GROUNDWATER` at 609496 observations, then `Tissue` at 96272 and `Water` at 95779. -Cumberland County returns 25. +Verified against the live endpoints on 2026-09-11. Unfiltered returns 171 material types, +led by `GROUNDWATER` at 609,496 observations, then `Tissue` at 96,272 and `Water` at 95,779. +Maine returns 54, Cumberland County 25. ## How it is wired up -* The control is a shared `FlatSelect`, rendered at - [`SampleFilters.tsx:52`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/SampleFilters.tsx#L52). +* The control is `HierarchicalSelect`, the same tree component the Industry dropdown uses, + rendered at + [`SampleFilters.tsx:91`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/SampleFilters.tsx#L91). + It used to be the shared `FlatSelect`, which is why the group headings were plain text. +* The synthetic group rows, the expansion back to real URIs and the derived collapse of a + fully selected group all live in `SampleFilters` itself, keyed off + [`GROUP_PREFIX`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/SampleFilters.tsx#L14). + `HierarchicalSelect` knows nothing about material types; it is handed a flat list of + `{ code, label, parent }` and builds the tree from that. * Its options come from - [`useMaterialTypes(region)`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L120), + [`useMaterialTypes(region)`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L143), called at - [`SampleFilters.tsx:20`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/SampleFilters.tsx#L20). + [`SampleFilters.tsx:28`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/SampleFilters.tsx#L28). + The group string is derived from `?bucketPrio` at + [`useDiscoveryQueries.ts:157`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L157). * The query text is built by - [`buildDiscoverMaterialTypesQuery()`](https://github.com/SAWGraph/explorer-app/blob/main/src/engine/templates/regions.ts#L94), + [`buildDiscoverMaterialTypesQuery()`](https://github.com/SAWGraph/explorer-app/blob/main/src/engine/templates/regions.ts#L110), + with the bucket block at + [`MATERIAL_BUCKET_VALUES`](https://github.com/SAWGraph/explorer-app/blob/main/src/engine/templates/regions.ts#L99), and the region part by [`buildSamplePointRegionPattern()`](https://github.com/SAWGraph/explorer-app/blob/main/src/engine/templates/regions.ts#L46). * It runs through [`executeSparql()`](https://github.com/SAWGraph/explorer-app/blob/main/src/engine/sparqlClient.ts#L4). * The fallback list is - [`FALLBACK_MATERIAL_TYPES`](https://github.com/SAWGraph/explorer-app/blob/main/src/constants/materialTypes.ts#L8), + [`FALLBACK_MATERIAL_TYPES`](https://github.com/SAWGraph/explorer-app/blob/main/src/constants/materialTypes.ts#L19), six entries covering groundwater, drinking water, surface water, soil, sludge and leachate. + It carries no `group`, so every entry lands under "Other" — see below. +* Group counts are summed by + [`rollupCounts()`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/HierarchicalSelect/useNaicsTree.ts#L148), + shared with the Industry dropdown. Cached under `['materialTypes', ]` with `staleTime: Infinity` and `retry: 1`, so one fetch per region per session. As with Substance, the fallback doubles as @@ -120,25 +211,51 @@ one fetch per region per session. As with Substance, the fallback doubles as is returned, with a region an empty list is. The missing label fallback happens in the hook, at -[`useDiscoveryQueries.ts:132`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L132), +[`useDiscoveryQueries.ts:155`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L155), by splitting the URI on `#` or `/` and taking the tail. ## If it looks wrong -**Exactly six materials with tidy title case labels and no counts.** That is -`FALLBACK_MATERIAL_TYPES`. Real results shout in uppercase and carry counts. +**One "Other" heading containing six title case materials, no counts.** That is +`FALLBACK_MATERIAL_TYPES`, so discovery failed. The giveaway is the shape as much as the +content: the fallback entries carry no `group`, so every one of them defaults to "Other" and +you get a single heading instead of five. Real results shout in uppercase, carry counts, and +spread across Water, Biota, Solid Material, Air and Other. + +**A group's count does not match how many results you get.** The number beside a heading is +observations, summed from its children. What comes back from a run is sample points or +samples. They are different units and will not line up. + +**A material disappeared from the list but results are still filtered by it.** Chips are +derived from the current option list, so a selection that falls out of that list after a +region change stops being displayed while remaining in the query. Pick a Maine-only species, +switch to Illinois, and the control reads "Any material type..." while quietly returning +nothing. Clear the control and reselect. This predates the tree and applies to the Substance +dropdown too. + +**Samples you can see on the map vanish as soon as you pick any material.** Fourteen samples, +carrying 177 observations, have no `coso:sampleOfMaterialType` at all. The filter matches on +that predicate, so anything lacking it is excluded by every possible selection. Nothing to +fix in the app; the upstream data simply does not say what those samples were made of. -**A selection stops matching after picking a state.** This is the `me-egad` versus -`me-egad-data` URI split described above. The two endpoints name the same material -differently, and the stored selection is a URI. Reselect the material after setting the -region. +**A hardcoded material URI returns an empty map and no error.** This is what broke the +"PFHpA Groundwater Samples Downstream from Facilities in Cumberland County" card until +`ef0c40b`. It pinned `v1/me-egad-data#sampleMaterialType.GW`, which matches zero triples. +The filter that gets built is `VALUES ?matType { }`, which is perfectly valid +SPARQL — the endpoint answers 200 with no rows, and the app has no way to tell that apart +from "there is genuinely nothing here". A dead URI does not error, it just quietly removes +everything. If a selection returns nothing, count the triples on the URI itself before +looking anywhere else. **Species names in a materials list.** Genuinely in the graph, under -`us-wqp-data#biologicalTaxon.*`. The namespace filter does not exclude them. If they should -not be offered, the filter needs to be narrower than `http://w3id.org/`. +`http://w3id.org/sawgraph/v1/us-wqp#biologicalTaxon.*`. The namespace filter does not exclude +them. If they should not be offered, the filter needs to be narrower than +`http://w3id.org/`. **Labels that are URI tails, like `sampleMaterialType.WW`.** That material has no -`rdfs:label`, so the hook fell back to the URI tail. +`rdfs:label`, so the hook fell back to the URI tail. As of 2026-09-11 this does not happen: +all 171 material types carry a label, and `.WW` in particular is `WASTE WATER`. If you do +see a raw tail, a term has been added upstream without a label. **Empty after picking a county.** No observations recorded there. Expected. diff --git a/docs/wiki/Dropdowns Substance.md b/docs/wiki/Dropdowns Substance.md index fe0fb61..c489cc0 100644 --- a/docs/wiki/Dropdowns Substance.md +++ b/docs/wiki/Dropdowns Substance.md @@ -12,12 +12,18 @@ It appears in the query editor whenever the entity type is **Samples**, inside The list is built from the data rather than hardcoded. It shows every substance that has at least one contaminant observation behind it, sorted by how many observations mention it, -with that number in brackets after the name, like `PFOA (15217)`. Labels prefer the short -acronym and fall back to the full chemical name when a substance has no acronym recorded. +with that number in brackets after the name, like `PFOA (20,120)`. Labels prefer the short +acronym, fall back to the full chemical name when a substance has no acronym recorded, then +to the name of the source data parameter it was matched to, and only then to the bare +DTXSID. In current data every one of the 101 substances resolves to a real name, so the +DTXSID step never fires. Counts are comma formatted. + +Being multi select, the list is headed by a Select all row carrying the number of options it +would tick, like `Select all (79)`. Type a search term and that number narrows to the matches. The list is region aware. Pick a state or some counties in the Region selector and it narrows to substances actually observed there, with the counts moving to match. Maine, for -example, returns 71 substances. Changing the region triggers a refetch, and each region gets +example, returns 79 substances. Changing the region triggers a refetch, and each region gets its own cache entry. When the query returns nothing, two things can happen: @@ -27,10 +33,6 @@ When the query returns nothing, two things can happen: * **A region is selected.** You get an empty list, on purpose. "No PFAS data for this county" is real information, and quietly showing national defaults there would be misleading. -> **Known issue.** As of the last check the no region query returns zero rows, so the -> unfiltered dropdown always shows the seven item fallback. See -> [If it looks wrong](#if-it-looks-wrong) below for why. - ## The SPARQL query Two endpoints, picked by whether a region is set. Without a region it goes to `sawgraph`. @@ -41,13 +43,15 @@ graph joined in and only `federation` has both graphs. SELECT ?substance (SAMPLE(?_label) AS ?label) (SAMPLE(?_short) AS ?short_label) + (MIN(?_viaParam) AS ?param_label) (COUNT(DISTINCT ?observation) AS ?num) WHERE { ?observation rdf:type coso:ContaminantObservation ; coso:ofDSSToxSubstance ?substance . - ?substance a comptox:ChemicalEntity ; - dcterms:alternative ?_label . + ?substance a comptox:ChemicalEntity . + OPTIONAL { ?substance rdfs:label ?_label . } OPTIONAL { ?substance skos:altLabel ?_short . } + OPTIONAL { ?pL comptox:sameAsDSSToxSubstance ?substance ; rdfs:label ?_viaParam . } } GROUP BY ?substance ORDER BY DESC(?num) ?label ``` @@ -57,11 +61,24 @@ Reading it a line at a time: * `?observation rdf:type coso:ContaminantObservation` is every recorded measurement in the graph. * `coso:ofDSSToxSubstance ?substance` is the chemical that measurement was for. * `?substance a comptox:ChemicalEntity` keeps only real chemical entities. -* `dcterms:alternative ?_label` is the full name, like "Perfluorooctanoic acid". -* `OPTIONAL { skos:altLabel ?_short }` is the acronym, like "PFOA". Not every substance has - one, which is why it is optional rather than required. +* `OPTIONAL { rdfs:label ?_label }` is the full name, like "Perfluorooctanoic acid". Only 69 + of the 101 substances have one. +* `OPTIONAL { skos:altLabel ?_short }` is the acronym, like "PFOA". Only 25 have one. +* `OPTIONAL { ?pL comptox:sameAsDSSToxSubstance ... }` reaches back to the source data + parameter the substance was matched to, and borrows its name. This is what covers the 32 + substances that have no name of their own, taking the list to 101 named out of 101. * `COUNT(DISTINCT ?observation)` is the number shown in brackets. +`MIN()` rather than `SAMPLE()` on the borrowed name, because 41 substances are matched by +more than one parameter and `SAMPLE()` would pick a different one from run to run. + +Both labels are `OPTIONAL` on purpose. A required label pattern does not return an unlabelled +substance, it returns nothing at all for that substance, so the row vanishes from the dropdown +and takes its observations with it. That single mistake broke this dropdown twice, first to +zero rows and then to 32 missing substances. The DTXSID fallback in the hook is the last +resort behind the borrowed name, and is unreachable in current data. It stays anyway, +precisely because a missing label must never delete a row. + `SAMPLE()` is used on both labels because a substance can carry more than one of each and the dropdown only has room for one. Any of them will do. @@ -74,6 +91,7 @@ chosen state or counties: SELECT ?substance (SAMPLE(?_label) AS ?label) (SAMPLE(?_short) AS ?short_label) + (MIN(?_viaParam) AS ?param_label) (COUNT(DISTINCT ?observation) AS ?num) WHERE { ?sp rdf:type coso:SamplePoint . @@ -84,9 +102,10 @@ WHERE { ?observation rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?sp ; coso:ofDSSToxSubstance ?substance . - ?substance a comptox:ChemicalEntity ; - dcterms:alternative ?_label . + ?substance a comptox:ChemicalEntity . + OPTIONAL { ?substance rdfs:label ?_label . } OPTIONAL { ?substance skos:altLabel ?_short . } + OPTIONAL { ?pL comptox:sameAsDSSToxSubstance ?substance ; rdfs:label ?_viaParam . } } GROUP BY ?substance ORDER BY DESC(?num) ?label ``` @@ -103,17 +122,18 @@ Sub county selections, meaning codes longer than five digits, take a different r entirely. They join with `kwg-ont:sfWithin|kwg-ont:sfTouches` against a Data Commons `geoId` URI rather than walking the administrative hierarchy. -Verified against the live endpoints. The Maine query returns 71 substances, topped by -PFOA at 15217 observations, PFOS at 15098, PFBS at 14922. +Verified against the live endpoints on 2026-09-09. The Maine query returns 79 substances, +topped by PFOA at 20120 observations, PFOS at 19988, PFBS at 19895. Unfiltered returns 101, +all of them named, none falling through to a DTXSID. ## How it is wired up * The control is a shared `FlatSelect`, rendered at - [`SampleFilters.tsx:35`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/SampleFilters.tsx#L35). + [`SampleFilters.tsx:74`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/SampleFilters.tsx#L74). * Its options come from - [`useSubstances(region)`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L97), + [`useSubstances(region)`](https://github.com/SAWGraph/explorer-app/blob/main/src/hooks/useDiscoveryQueries.ts#L116), called at - [`SampleFilters.tsx:19`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/SampleFilters.tsx#L19). + [`SampleFilters.tsx:27`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/SampleFilters.tsx#L27). * The query text is built by [`buildDiscoverSubstancesQuery()`](https://github.com/SAWGraph/explorer-app/blob/main/src/engine/templates/regions.ts#L71), and the region part by @@ -133,21 +153,45 @@ one fetch per region per session, and `retry: 1`. `FALLBACK_SUBSTANCES` doubles is still in flight. The label shown in the list is `shortLabel || label`, with the count appended by `withCount()` -at [`SampleFilters.tsx:14`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/SampleFilters.tsx#L14). +at [`SampleFilters.tsx:22`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/SampleFilters.tsx#L22). Selecting an option stores both the substance URI and its display label on the question, so the Analysis Question sentence can say "PFOA" instead of a DSSTox URI. +### One rule, two places + +The whole priority order, `skos:altLabel`, then `rdfs:label`, then the source parameter's +name with `***retired***` resolved, then the DTXSID, lives in `substanceLabel()` in +`src/constants/substances.ts`. The map popup's sample table uses the same function. + +It did not always. The dropdown had the source parameter step and the popup did not, so the +same substance read as "10-H-Perfluorodecanoic acid" in the dropdown and as a bare +`DTXSID10630918` in the popup, which looked like a broken query rather than a missing label. +The popup's query now projects the label parts instead of picking a winner in SPARQL, and +aggregates each one, which also stops a substance with two labels from duplicating its +observation's row. `npm run check-substance-labels` asserts the order. + ## If it looks wrong **Exactly seven PFAS substances and no counts.** You are looking at `FALLBACK_SUBSTANCES`. Either the endpoint failed, or the query genuinely returned zero rows. -**The unfiltered list is always the fallback.** This is the current state of things. The -`sawgraph` endpoint has 944541 `coso:ofDSSToxSubstance` triples and 101 `comptox:ChemicalEntity` -subjects, but zero `dcterms:alternative` triples. Substances there carry `rdfs:label` instead. -`dcterms:alternative` only exists on `federation`, which is why the region scoped version -works and the unfiltered one does not. Whoever fixes this should either point the no region -query at `federation` too, or relax the label pattern to accept `rdfs:label`. +**A bare DTXSID instead of a chemical name.** This should no longer happen. 32 substances +have no `rdfs:label` of their own, but all 32 are named by the parameter they were matched +to, so the list resolves 101 out of 101. Seeing a raw DTXSID means a substance now has +neither, which is new data rather than a code bug. + +**A full chemical name where you expected an acronym.** Only 25 substances carry +`skos:altLabel`, so the other 76 show their full name. The source parameters do carry +acronyms for another 44, but they are deliberately not used: the `_A` suffix on them marks +the acid as distinct from the anion, so `PFOS_A` is Perfluorooctanesulfonic acid while +`PFOS` is Perfluorooctanesulfonate, two different DTXSIDs. Adopting them collapsed 10 pairs +of distinct substances into identical looking rows. The full names keep them apart. + +**A substance in the list that is not a PFAS.** `Acetohydroxamic acid` shows up with 2 +observations. That is an upstream alignment error, not a display bug: the Maine EGAD +parameter `me-egad#parameter.PFECHS_A` is mapped to `DTXSID7022546`, which really is +acetohydroxamic acid. Belongs in an issue against +[pfas-kg](https://github.com/SAWGraph/pfas-kg). **Empty after picking a county.** There genuinely are no observations there. Expected, not a bug. @@ -161,6 +205,15 @@ graph. Nothing to fix in the app. **Stale after changing region.** The region is not reaching the hook. Check the `region` prop chain into `SampleFilters`, since the cache key is derived from it. +**A note on `dcterms:alternative`.** Earlier versions of this query, and of this page, read the +full name from `dcterms:alternative`. That predicate has zero triples on substances, on +`sawgraph` and on `federation` alike, so the query returned nothing at all and the dropdown sat +on its fallback. An earlier revision of this page blamed the outage on the predicate existing +only on `federation`. That was wrong, both variants were broken. The 3.8M `dcterms:alternative` +triples in `fiokg` are facility alternative names, which is the likely source of the mix up. +Substance names live on `rdfs:label`, which is what the maintainers' own competency question +[`CQ2.rq`](https://github.com/SAWGraph/contaminoso/blob/main/competencyQuestions/CQ2.rq) uses. + ## See also * [Dropdowns](Dropdowns), the index of all filter controls diff --git a/docs/wiki/Dropdowns.md b/docs/wiki/Dropdowns.md index dccc761..26737f3 100644 --- a/docs/wiki/Dropdowns.md +++ b/docs/wiki/Dropdowns.md @@ -13,7 +13,8 @@ Which PFAS chemicals to look for. Shown for Samples. Endpoint `sawgraph` with no **[Material](Dropdowns%20Material)** What the sample was taken from. Shown for Samples. Same endpoint switch as Substance. -Falls back to six material types. +Grouped into Water, Biota, Solid Material, Air and Other, and those headings are +themselves tickable and collapsible. Falls back to six material types. **[Industry](Dropdowns%20Industry)** NAICS codes, as a searchable tree. Shown for Facilities. Endpoint `fiokg`. Falls back to @@ -73,16 +74,38 @@ source that contradicts the selected state raises a warning. Everything on this page is one of two controls. [`FlatSelect`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/FlatSelect/FlatSelect.tsx) -is the shared one: a searchable list rendered through a portal, single or multi select, with -support for disabled options and a loading state. Every dropdown uses it except one. +is the flat one: a searchable list rendered through a portal, single or multi select, with +support for disabled options and a loading state. It can show group headings, but they are +plain text — you cannot tick or collapse them. + +Multi select lists are headed by a Select all row, which carries the number of options it +would tick, like `Select all (79)`. That number counts what the checkbox actually toggles, so +it excludes disabled options and narrows to the matches while a search term is typed. Counts +are comma formatted throughout, both on the Select all row and on individual options. [`HierarchicalSelect`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/HierarchicalSelect/HierarchicalSelect.tsx) -is the exception, used only by Industry, because NAICS codes are a hierarchy and a flat list -of 5596 of them is unusable. +is the tree: every node carries a checkbox and, if it has children, a fold arrow. Ticking a +parent takes everything under it, partial selections show an indeterminate box, and counts +roll up from the leaves. + +Which one a dropdown gets comes down to whether its options have a hierarchy worth +navigating. **Industry** uses the tree because NAICS codes nest and a flat list of 5,596 is +unusable. **Material** uses it because 171 options are lopsided — 131 of them are fish +species — and being able to say "all water samples" in one click, or fold Biota away, is the +difference between usable and not. Everything else is a flat list. + +The two arrive at their tree differently. Industry has no explicit parent in the data, so +the tree is derived from NAICS code prefixes. Material passes an explicit parent, because a +material type URI says nothing about which bucket it belongs to. `buildTree` handles both. ## Filters that are not dropdowns For completeness, the Samples filter panel also has Min and Max concentration number inputs in ng/L, and an "Include non-detects" checkbox. None of them query anything; they are applied inside the pipeline queries. + +The non-detects checkbox is ticked by default and moves the answer more than any dropdown on +this page, because non-detects are 70 to 77% of the observations. It filters both which +sample points appear and which rows appear inside their popups. See +[Include non-detects](Samples%20Non%20Detects). [`SampleFilters.tsx`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/SampleFilters.tsx) diff --git a/docs/wiki/Home.md b/docs/wiki/Home.md index 4de9673..1d5d3ae 100644 --- a/docs/wiki/Home.md +++ b/docs/wiki/Home.md @@ -18,6 +18,8 @@ Where the options in each filter control come from. * [Industry](Dropdowns%20Industry) * [Industry counts](Dropdowns%20Industry%20Counts) * [County](Dropdowns%20County) +* [Include non-detects](Samples%20Non%20Detects), the Samples checkbox that moves the + numbers most ## Elsewhere in the repository diff --git a/docs/wiki/Samples Non Detects.md b/docs/wiki/Samples Non Detects.md new file mode 100644 index 0000000..ed0fd7d --- /dev/null +++ b/docs/wiki/Samples Non Detects.md @@ -0,0 +1,165 @@ +# Include non-detects + +A checkbox in the Samples filter panel. Ticked by default. It decides whether the answer +counts clean results as well as contaminated ones, and it moves the numbers more than any +other filter on the page, because **non-detects are most of the data**. + +## What a non-detect is + +A non-detect is a measurement, not a gap. The lab tested for the substance and found less +than it is able to see. The record carries the detection limits instead of a value: + +| | A detect | A non-detect | +| --- | --- | --- | +| `coso:measurementUnit` | `NanoGM-PER-L` | **absent** | +| numeric value | `0.632` | absent | +| `methodDetectionLimit` | `0.486 ng/L` | `0.449 ng/L` | +| `reportingLimit` | `1.93 ng/L` | `1.78 ng/L` | +| typed `coso:NonDetectQuantityValue` | no | yes | + +The missing unit is the important row. There is nothing to put a unit on, because no +quantity was measured. That absence used to delete the record from every query. See +[Debugging](https://github.com/SAWGraph/explorer-app/blob/main/docs/DEBUGGING.md), +2026-09-17. + +How common they are, measured on `federation`: + +| Scope | Detects | Non-detects | Non-detect share | +| --- | ---: | ---: | ---: | +| York County, all substances | 7,110 | 16,420 | **70%** | +| Maine, all substances | 134,572 | 453,476 | **77%** | + +## What the checkbox does + +It filters at **two** levels, and both matter. + +1. **Which sample points appear on the map.** A point survives only if it has at least one + detection left. +2. **Which rows appear inside a popup.** Points that survive still lose their non-detect + rows. + +York County, no substance selected: + +| | Ticked (default) | Unticked | +| --- | ---: | ---: | +| Sample points on the map | **451** | **367** | +| Observations in popups | **23,530** | **7,110** | +| Points with at least one detect | 451 includes all 367 | 367 | +| Points where everything came back clean | 70 shown | dropped | +| Points with no measurements in the graph | 14 shown | dropped | +| Non-detect readings | 16,420 shown | none shown | + +The second row is the one people miss. The 367 surviving points hold 21,822 observations +between them, but unticking shows only the 7,110 detects among those. A well with 30 +readings of which 2 were detections shows 2 rows, not 30. + +With a substance selected the same thing happens inside that substance. York County PFOS: +361 points ticked, 230 unticked. + +## What a dot on the map means + +This is the part worth saying out loud, because the two readings of the map are different +claims: + +* **Ticked**: a dot means *someone sampled here*. +* **Unticked**: a dot means *PFAS was found here*. + +The misleading part is the absence of a dot. With the box unticked, 70 York County +locations that were tested and came back clean look exactly like ground nobody ever +visited. For a contamination map that is usually the wrong default, which is why the box +starts ticked. + +## Every sample point, classified + +Mutually exclusive, York County, all substances: + +| State | Points | In the answer when unticked? | +| --- | ---: | --- | +| No measurements in the graph at all | 14 | no | +| Tested, everything was a non-detect | 70 | no | +| Mixed: some detects, some non-detects | 366 | yes | +| Only detects | 1 | yes | +| **Total** | **451** | 367 | + +The 14 with no measurements are real registered locations, not bad rows. They are all soil +sampling points (`SB-*`, `SS-*`, `YO-*` in EGAD) with coordinates, a parent site and a +feature type of `SOIL AUGER`, whose lab results are not in the graph. At their parent site +every drinking-water and monitoring well has 24 to 30 observations and every soil point has +zero, so the gap is systematic rather than random. They currently render with an empty +popup. + +There is a fourth possible result state in the code, `"non-quantified"`, a result that is +neither a number nor typed as a non-detect. It is defensive: zero occurrences in York +County and zero across Maine. + +## Opening the filter panel changes nothing + +The checkbox only exists once **+ Add Filters** is expanded, but expanding it is a +display-only action: + +```tsx + +``` + +`setShowFilters` is local component state and never touches the question. The box draws as +ticked because it reads `value?.includeNondetects !== false`, and with no filters set at all +that is `true`. The emitted SPARQL is byte-identical before and after, and **Apply** stays +disabled. + +## The SPARQL + +Ticked, with no other sample filter, the whole samples block is two lines. Nothing asks +about measurements, so nothing can filter on them: + +```sparql +?spC rdf:type coso:SamplePoint ; + spatial:connectedTo ?s2target . +``` + +Unticked adds the result chain and one explicit filter: + +```sparql +?observationC coso:observedAtSamplePoint ?spC . +?observationC coso:hasResult ?resultC . +OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } +OPTIONAL { ?resultC qudt:quantityValue ?_qvC . + ?_qvC rdf:type coso:NonDetectQuantityValue . + BIND(true AS ?nonDetectC) } +BIND(COALESCE(STR(?numericResultC), + IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) +FILTER(BOUND(?numericResultC)) +``` + +`FILTER(BOUND(?numericResultC))` is the exclusion. Note it is written as an explicit filter +rather than achieved by requiring a field non-detects lack, which is what the old code did +by accident. + +Two details that bite anyone writing these by hand: + +* **Do not use `coso:measurementValue`.** It is multi-valued on non-detects, returning both + `"non-detect"` and `"non-quantified"`, which duplicates every non-detect row and makes + `MAX()` return a string. The app derives its displayed value from `qudt:quantityValue` + instead. +* **Do not require `coso:measurementUnit` unless a concentration range needs it.** Requiring + it is indistinguishable from unticking this box, except silent. + +## If the numbers look wrong + +* **Counts jumped up after a deploy.** Expected. Before 2026-09-17 the checkbox did nothing + in either position: a required unit join removed non-detects regardless. Any figure taken + off the app before that understates PFAS presence. +* **A popup is empty.** Likely one of the 14 points with no measurements in the graph. +* **Unticking removed more than expected.** It removes readings, not just points. Check the + popup row counts, not only the dot count. + +## In the code + +[`SampleFilters.tsx`](https://github.com/SAWGraph/explorer-app/blob/main/src/components/QueryEditor/SampleFilters.tsx) +renders the checkbox. +[`fusedQueries.ts`](https://github.com/SAWGraph/explorer-app/blob/main/src/engine/templates/fusedQueries.ts) +decides which joins each filter needs, in `sampleJoinsNeeded`. +[`samples.ts`](https://github.com/SAWGraph/explorer-app/blob/main/src/engine/templates/samples.ts) +holds `needsUnitJoin` and `resultValueClauses`. +`scripts/check-query-joins.mts` asserts the rule across all 108 question shapes in CI. diff --git a/docs/wiki/_Sidebar.md b/docs/wiki/_Sidebar.md index 1fc47e6..12c9a07 100644 --- a/docs/wiki/_Sidebar.md +++ b/docs/wiki/_Sidebar.md @@ -11,6 +11,10 @@ * [Industry counts](Dropdowns%20Industry%20Counts) * [County](Dropdowns%20County) +**Samples** + +* [Include non-detects](Samples%20Non%20Detects) + **In the repo** * [Architecture](https://github.com/SAWGraph/explorer-app/blob/main/docs/ARCHITECTURE.md) diff --git a/docs/wiki/images/dropdown_substance.png b/docs/wiki/images/dropdown_substance.png new file mode 100644 index 0000000..d780136 Binary files /dev/null and b/docs/wiki/images/dropdown_substance.png differ diff --git a/index.html b/index.html index e74a675..8b92eb4 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,11 @@ + + SAWGraph Query Editor diff --git a/package-lock.json b/package-lock.json index 6dd64d2..e4f6eb5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,6 +32,7 @@ "eslint-plugin-react-hooks": "^7.0.1", "eslint-plugin-react-refresh": "^0.4.24", "globals": "^16.5.0", + "tsx": "^4.23.13", "typescript": "~5.9.3", "typescript-eslint": "^8.48.0", "vite": "^7.3.1" @@ -67,6 +68,7 @@ "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.29.0", "@babel/generator": "^7.29.0", @@ -1643,6 +1645,7 @@ "integrity": "sha512-oH72nZRfDv9lADUBSo104Aq7gPHpQZc4BTx38r9xf9pg5LfP6EzSyH2n7qFmmxRQXh7YlUXODcYsg6PuTDSxGg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "undici-types": "~7.16.0" } @@ -1657,8 +1660,8 @@ "version": "19.2.14", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.14.tgz", "integrity": "sha512-ilcTH/UniCkMdtexkoCN0bI7pMcJDvmQFPvuPvmEaYA/NSfFTAgdUSLAoVjaRJm7+6PvcM+q1zYOwS4wTYMF9w==", - "dev": true, "license": "MIT", + "peer": true, "dependencies": { "csstype": "^3.2.2" } @@ -1727,6 +1730,7 @@ "integrity": "sha512-4z2nCSBfVIMnbuu8uinj+f0o4qOeggYJLbjpPHka3KH1om7e+H9yLKTYgksTaHcGco+NClhhY2vyO3HsMH1RGw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.55.0", "@typescript-eslint/types": "8.55.0", @@ -1978,6 +1982,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2098,6 +2103,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -2388,6 +2394,7 @@ "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -2942,7 +2949,8 @@ "version": "1.9.4", "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz", "integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==", - "license": "BSD-2-Clause" + "license": "BSD-2-Clause", + "peer": true }, "node_modules/levn": { "version": "0.4.1", @@ -3209,6 +3217,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -3281,6 +3290,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", "integrity": "sha512-9nfp2hYpCwOjAN+8TZFGhtWEwgvWHXqESH8qT89AT/lWklpLON22Lc8pEtnpsZz7VmawabSU0gCjnj8aC0euHQ==", "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -3290,6 +3300,7 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.4.tgz", "integrity": "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ==", "license": "MIT", + "peer": true, "dependencies": { "scheduler": "^0.27.0" }, @@ -3614,6 +3625,509 @@ "typescript": ">=4.8.4" } }, + "node_modules/tsx": { + "version": "4.23.13", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.23.13.tgz", + "integrity": "sha512-BL5MGkRln6aDYhb0xbQlEAGw743BaZYWdbWtdJOBriYJboKgUUYCadFp2/FpBBZquBC/ezNBn7wMMPx7FDZUDw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.28.0" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -3633,6 +4147,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -3733,6 +4248,7 @@ "integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.27.0", "fdir": "^6.5.0", @@ -3854,6 +4370,7 @@ "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", "dev": true, "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/package.json b/package.json index 59f2837..69af60f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,18 @@ "dev": "vite", "build": "tsc -b && vite build", "lint": "eslint .", - "preview": "vite preview" + "preview": "vite preview", + "build-thumbnails": "tsx scripts/build-thumbnails.mts", + "warm-cache": "tsx scripts/warm-cache.mts", + "check-cache-key": "tsx scripts/check-cache-key.mts", + "check-step-labels": "tsx scripts/check-step-labels.mts", + "check-trace-direction": "tsx scripts/check-trace-direction.mts", + "check-flowline-scope": "tsx scripts/check-flowline-scope.mts", + "check-substance-labels": "tsx scripts/check-substance-labels.mts", + "check-query-joins": "tsx scripts/check-query-joins.mts", + "check-query-snapshots": "tsx scripts/check-query-snapshots.mts", + "query-matrix": "tsx scripts/query-matrix.mts", + "health-check": "tsx scripts/health-check.mts" }, "dependencies": { "@tanstack/react-query": "^5.90.21", @@ -34,6 +45,7 @@ "eslint-plugin-react-hooks": "^7.0.1", "eslint-plugin-react-refresh": "^0.4.24", "globals": "^16.5.0", + "tsx": "^4.23.13", "typescript": "~5.9.3", "typescript-eslint": "^8.48.0", "vite": "^7.3.1" diff --git a/public/thumbs/facilities-upstream-pfhpa-gw-cumberland.svg b/public/thumbs/facilities-upstream-pfhpa-gw-cumberland.svg new file mode 100644 index 0000000..79e1785 --- /dev/null +++ b/public/thumbs/facilities-upstream-pfhpa-gw-cumberland.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/thumbs/facilities-upstream-streams-cook.svg b/public/thumbs/facilities-upstream-streams-cook.svg new file mode 100644 index 0000000..134ee23 --- /dev/null +++ b/public/thumbs/facilities-upstream-streams-cook.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/thumbs/samples-downstream-waste-indiana.svg b/public/thumbs/samples-downstream-waste-indiana.svg new file mode 100644 index 0000000..b30aa88 --- /dev/null +++ b/public/thumbs/samples-downstream-waste-indiana.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/thumbs/samples-near-agchem-maine.svg b/public/thumbs/samples-near-agchem-maine.svg new file mode 100644 index 0000000..710f44f --- /dev/null +++ b/public/thumbs/samples-near-agchem-maine.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/thumbs/samples-near-landfill-dod-penobscot-knox.svg b/public/thumbs/samples-near-landfill-dod-penobscot-knox.svg new file mode 100644 index 0000000..62aa118 --- /dev/null +++ b/public/thumbs/samples-near-landfill-dod-penobscot-knox.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/thumbs/waterbodies-near-landfill-dod-penobscot-knox.svg b/public/thumbs/waterbodies-near-landfill-dod-penobscot-knox.svg new file mode 100644 index 0000000..9a23091 --- /dev/null +++ b/public/thumbs/waterbodies-near-landfill-dod-penobscot-knox.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/thumbs/wells-near-landfill-dod-maine.svg b/public/thumbs/wells-near-landfill-dod-maine.svg new file mode 100644 index 0000000..f0d3308 --- /dev/null +++ b/public/thumbs/wells-near-landfill-dod-maine.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/thumbs/wells-near-wwtp-maine.svg b/public/thumbs/wells-near-wwtp-maine.svg new file mode 100644 index 0000000..fe8800e --- /dev/null +++ b/public/thumbs/wells-near-wwtp-maine.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/scripts/__snapshots__/query-shapes.txt b/scripts/__snapshots__/query-shapes.txt new file mode 100644 index 0000000..69cae52 --- /dev/null +++ b/scripts/__snapshots__/query-shapes.txt @@ -0,0 +1,3061 @@ +# Generated by scripts/check-query-snapshots.mts -- do not hand-edit. +# Re-record with: npm run check-query-snapshots -- --update + +## PREFIXES +SHARED [all] ae03777b4388 + PREFIX rdf: PREFIX rdfs: PREFIX owl: PREFIX xsd: PREFIX skos: PREFIX geo: PREFIX spatial: PREFIX kwg-ont: PREFIX kwgr: PREFIX hyf: PREFIX hyfo: PREFIX coso: PREFIX fio: PREFIX naics: PREFIX qudt: PREFIX comptox: PREFIX me_egad: PREFIX nhdplusv2: PREFIX il_isgs: PREFIX me_mgs: PREFIX gwml2: PREFIX saw_water: PREFIX schema: PREFIX sosa: PREFIX dcterms: +## samples near samples [ME on A] +FIND_TARGET_IRIS [federation] 0be21b7acfd7 +FIND_ANCHOR_IRIS [federation] 672355872582 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples near samples [ME on C] +FIND_TARGET_IRIS [federation] bea7dc72f773 +FIND_ANCHOR_IRIS [federation] f80f83193d16 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream samples [ME on A] +FIND_TARGET_IRIS [federation] 886826560be6 +FIND_ANCHOR_IRIS [federation] 25e35a116a7a +GET_FLOWLINE_GEOMETRIES [federation] 9e253e2c142d +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream samples [ME on C] +FIND_TARGET_IRIS [federation] c06847a4af0d +FIND_ANCHOR_IRIS [federation] 5f95683d03c3 +GET_FLOWLINE_GEOMETRIES [federation] 9e253e2c142d +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream samples [ME on A] +FIND_TARGET_IRIS [federation] c06847a4af0d +FIND_ANCHOR_IRIS [federation] 5f95683d03c3 +GET_FLOWLINE_GEOMETRIES [federation] 9e253e2c142d +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream samples [ME on C] +FIND_TARGET_IRIS [federation] 886826560be6 +FIND_ANCHOR_IRIS [federation] 25e35a116a7a +GET_FLOWLINE_GEOMETRIES [federation] 9e253e2c142d +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples near facilities [ME on A] +FIND_TARGET_IRIS [federation] 2ece82229dce +FIND_ANCHOR_IRIS [federation] f0c206010b68 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples near facilities [ME on C] +FIND_TARGET_IRIS [federation] 5abc07c304ad +FIND_ANCHOR_IRIS [federation] 1506d58ef072 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream facilities [ME on A] +FIND_TARGET_IRIS [federation] 714064e8e781 +FIND_ANCHOR_IRIS [federation] 6b0632214d35 +GET_FLOWLINE_GEOMETRIES [federation] 10a063aa6d84 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream facilities [ME on C] +FIND_TARGET_IRIS [federation] e68708fa1d30 +FIND_ANCHOR_IRIS [federation] 1b7a89412729 +GET_FLOWLINE_GEOMETRIES [federation] 10a063aa6d84 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream facilities [ME on A] +FIND_TARGET_IRIS [federation] 2a2add9e3c26 +FIND_ANCHOR_IRIS [federation] 7aa05f4cf432 +GET_FLOWLINE_GEOMETRIES [federation] 889f03c020e8 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream facilities [ME on C] +FIND_TARGET_IRIS [federation] faa0a03241cd +FIND_ANCHOR_IRIS [federation] a4e3147c72d7 +GET_FLOWLINE_GEOMETRIES [federation] 889f03c020e8 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples near waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 9c73285f224c +FIND_ANCHOR_IRIS [federation] 713a1f7f8ae5 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples near waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 73511fbb8c8f +FIND_ANCHOR_IRIS [federation] aec41960948e +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 8e23014aa73f +FIND_ANCHOR_IRIS [federation] d01ac74e4cc0 +GET_FLOWLINE_GEOMETRIES [federation] d7ee9691da5b +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 790b26da2a79 +FIND_ANCHOR_IRIS [federation] 832afed999c2 +GET_FLOWLINE_GEOMETRIES [federation] d7ee9691da5b +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 151ef1e41632 +FIND_ANCHOR_IRIS [federation] 0cb147205839 +GET_FLOWLINE_GEOMETRIES [federation] 60802b6a7386 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 25554a2d770e +FIND_ANCHOR_IRIS [federation] 70ac417804f8 +GET_FLOWLINE_GEOMETRIES [federation] 60802b6a7386 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples near wells [ME on A] +FIND_TARGET_IRIS [federation] b0f01594fdb4 +FIND_ANCHOR_IRIS [federation] ab4e12addc23 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] b948c1dadad5 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples near wells [ME on C] +FIND_TARGET_IRIS [federation] 2f7c9d07ed1a +FIND_ANCHOR_IRIS [federation] d271f8200100 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 8db700fbc3ba +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream wells [ME on A] +FIND_TARGET_IRIS [federation] b2a9610b7c52 +FIND_ANCHOR_IRIS [federation] 94d434376702 +GET_FLOWLINE_GEOMETRIES [federation] b6f61e4f4ff3 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 081ffe103105 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream wells [ME on C] +FIND_TARGET_IRIS [federation] e6eca666d07e +FIND_ANCHOR_IRIS [federation] b44db2e80018 +GET_FLOWLINE_GEOMETRIES [federation] b6f61e4f4ff3 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 631a69b1a6a7 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream wells [ME on A] +FIND_TARGET_IRIS [federation] e6e5f175099a +FIND_ANCHOR_IRIS [federation] 114ec252bd7e +GET_FLOWLINE_GEOMETRIES [federation] 6c90238c34b5 +HYDRATE_TARGET_BY_IRI [federation] 35e5e0379327 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream wells [ME on C] +FIND_TARGET_IRIS [federation] 01ac5b24c08f +FIND_ANCHOR_IRIS [federation] 542cd3bf0080 +GET_FLOWLINE_GEOMETRIES [federation] 6c90238c34b5 +HYDRATE_TARGET_BY_IRI [federation] 6e6e6eba070d +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples near aquifers [ME on A] +FIND_TARGET_IRIS [federation] 26597fe15d0e +FIND_ANCHOR_IRIS [federation] 192ca0747233 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples near aquifers [ME on C] +FIND_TARGET_IRIS [federation] 581c48ae304e +FIND_ANCHOR_IRIS [federation] 454a12d54a4b +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream aquifers [ME on A] +FIND_TARGET_IRIS [federation] 3735b227534b +FIND_ANCHOR_IRIS [federation] d1b9348ef98d +GET_FLOWLINE_GEOMETRIES [federation] 0d7cd31e6182 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream aquifers [ME on C] +FIND_TARGET_IRIS [federation] c8b9648ad9ad +FIND_ANCHOR_IRIS [federation] 6b13c5e7d199 +GET_FLOWLINE_GEOMETRIES [federation] 0d7cd31e6182 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream aquifers [ME on A] +FIND_TARGET_IRIS [federation] cd1d79f23ba8 +FIND_ANCHOR_IRIS [federation] 907b64185777 +GET_FLOWLINE_GEOMETRIES [federation] ebbacce57f0e +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream aquifers [ME on C] +FIND_TARGET_IRIS [federation] 54b1d508458d +FIND_ANCHOR_IRIS [federation] 7530ba837a17 +GET_FLOWLINE_GEOMETRIES [federation] ebbacce57f0e +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples near streams [ME on A] +FIND_TARGET_IRIS [federation] d2b20fc4e76d +FIND_ANCHOR_IRIS [federation] 42fba0d6b6e4 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples near streams [ME on C] +FIND_TARGET_IRIS [federation] 950c0e678218 +FIND_ANCHOR_IRIS [federation] 0c695b9c750b +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream streams [ME on A] +FIND_TARGET_IRIS [federation] 962a202132fc +FIND_ANCHOR_IRIS [federation] 62aa5619bc67 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream streams [ME on C] +FIND_TARGET_IRIS [federation] e8b95c8c5b5d +FIND_ANCHOR_IRIS [federation] 0d9fd4f4b10a +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream streams [ME on A] +FIND_TARGET_IRIS [federation] b22e14df0511 +FIND_ANCHOR_IRIS [federation] 7dad41fdfd60 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream streams [ME on C] +FIND_TARGET_IRIS [federation] 3bcbbc61caae +FIND_ANCHOR_IRIS [federation] a62588d4bcb9 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities near samples [ME on A] +FIND_TARGET_IRIS [federation] 0bb0f6a91db9 +FIND_ANCHOR_IRIS [federation] dd8ee4b54845 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities near samples [ME on C] +FIND_TARGET_IRIS [federation] 4ae27f7b3056 +FIND_ANCHOR_IRIS [federation] 08ee3e23c632 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream samples [ME on A] +FIND_TARGET_IRIS [federation] faa0a03241cd +FIND_ANCHOR_IRIS [federation] a4e3147c72d7 +GET_FLOWLINE_GEOMETRIES [federation] 889f03c020e8 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream samples [ME on C] +FIND_TARGET_IRIS [federation] 2a2add9e3c26 +FIND_ANCHOR_IRIS [federation] 7aa05f4cf432 +GET_FLOWLINE_GEOMETRIES [federation] 889f03c020e8 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream samples [ME on A] +FIND_TARGET_IRIS [federation] e68708fa1d30 +FIND_ANCHOR_IRIS [federation] 1b7a89412729 +GET_FLOWLINE_GEOMETRIES [federation] 10a063aa6d84 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream samples [ME on C] +FIND_TARGET_IRIS [federation] 714064e8e781 +FIND_ANCHOR_IRIS [federation] 6b0632214d35 +GET_FLOWLINE_GEOMETRIES [federation] 10a063aa6d84 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities near facilities [ME on A] +FIND_TARGET_IRIS [federation] a7b4475fa918 +FIND_ANCHOR_IRIS [federation] c449e2e870bf +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities near facilities [ME on C] +FIND_TARGET_IRIS [federation] 2b48a40c896d +FIND_ANCHOR_IRIS [federation] 9039e57855e1 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream facilities [ME on A] +FIND_TARGET_IRIS [federation] b43c08af1964 +FIND_ANCHOR_IRIS [federation] 8a0c2df70ce0 +GET_FLOWLINE_GEOMETRIES [federation] 81641e7d1349 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream facilities [ME on C] +FIND_TARGET_IRIS [federation] b0335b863895 +FIND_ANCHOR_IRIS [federation] 4786e399d0e3 +GET_FLOWLINE_GEOMETRIES [federation] 81641e7d1349 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream facilities [ME on A] +FIND_TARGET_IRIS [federation] b0335b863895 +FIND_ANCHOR_IRIS [federation] 4786e399d0e3 +GET_FLOWLINE_GEOMETRIES [federation] 81641e7d1349 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream facilities [ME on C] +FIND_TARGET_IRIS [federation] b43c08af1964 +FIND_ANCHOR_IRIS [federation] 8a0c2df70ce0 +GET_FLOWLINE_GEOMETRIES [federation] 81641e7d1349 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities near waterBodies [ME on A] +FIND_TARGET_IRIS [federation] dc18ede4eeac +FIND_ANCHOR_IRIS [federation] f2ec010e4080 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities near waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 5393441889bb +FIND_ANCHOR_IRIS [federation] 887006d733eb +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 6ddb9c48525a +FIND_ANCHOR_IRIS [federation] f7a2dba8957d +GET_FLOWLINE_GEOMETRIES [federation] cfe6f604cde9 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 32f1aa55d0ea +FIND_ANCHOR_IRIS [federation] 294457930c79 +GET_FLOWLINE_GEOMETRIES [federation] cfe6f604cde9 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 1084c720a6cc +FIND_ANCHOR_IRIS [federation] 642252450459 +GET_FLOWLINE_GEOMETRIES [federation] 4feabc0eeaca +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream waterBodies [ME on C] +FIND_TARGET_IRIS [federation] fbcba6bb42a9 +FIND_ANCHOR_IRIS [federation] ea51a457af43 +GET_FLOWLINE_GEOMETRIES [federation] 4feabc0eeaca +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities near wells [ME on A] +FIND_TARGET_IRIS [federation] 1bce75dee487 +FIND_ANCHOR_IRIS [federation] 659f6c7fa3f9 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 9575a458430b +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities near wells [ME on C] +FIND_TARGET_IRIS [federation] c668a2061d6c +FIND_ANCHOR_IRIS [federation] 4cd25d8b0a3e +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] be1b15d1b106 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream wells [ME on A] +FIND_TARGET_IRIS [federation] 50afef424c69 +FIND_ANCHOR_IRIS [federation] cbb05158da0c +GET_FLOWLINE_GEOMETRIES [federation] f015bfcba03e +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 3bce92acebce +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream wells [ME on C] +FIND_TARGET_IRIS [federation] 59b91de5e995 +FIND_ANCHOR_IRIS [federation] 9968e7786c81 +GET_FLOWLINE_GEOMETRIES [federation] f015bfcba03e +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 1084e9f48e96 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream wells [ME on A] +FIND_TARGET_IRIS [federation] f878bab0aeba +FIND_ANCHOR_IRIS [federation] 98d7c72d4aab +GET_FLOWLINE_GEOMETRIES [federation] 62f130505471 +HYDRATE_TARGET_BY_IRI [federation] e45a36c23efe +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream wells [ME on C] +FIND_TARGET_IRIS [federation] 141d81ecb9ec +FIND_ANCHOR_IRIS [federation] 20f966337069 +GET_FLOWLINE_GEOMETRIES [federation] 62f130505471 +HYDRATE_TARGET_BY_IRI [federation] e238ca8606c2 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities near aquifers [ME on A] +FIND_TARGET_IRIS [federation] cf073b1ce3f0 +FIND_ANCHOR_IRIS [federation] e9b13461268b +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities near aquifers [ME on C] +FIND_TARGET_IRIS [federation] 40c7bc3ecc04 +FIND_ANCHOR_IRIS [federation] a99936a88d0b +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream aquifers [ME on A] +FIND_TARGET_IRIS [federation] 1a0e0369b410 +FIND_ANCHOR_IRIS [federation] 32747a1b563b +GET_FLOWLINE_GEOMETRIES [federation] 5515bd777411 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream aquifers [ME on C] +FIND_TARGET_IRIS [federation] 2fdb9d27c845 +FIND_ANCHOR_IRIS [federation] b6983d91a529 +GET_FLOWLINE_GEOMETRIES [federation] 5515bd777411 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream aquifers [ME on A] +FIND_TARGET_IRIS [federation] 35eea760e846 +FIND_ANCHOR_IRIS [federation] 021c99bd21fe +GET_FLOWLINE_GEOMETRIES [federation] 23e64482073d +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream aquifers [ME on C] +FIND_TARGET_IRIS [federation] 4ca2878d179f +FIND_ANCHOR_IRIS [federation] 21aab4d7bdf7 +GET_FLOWLINE_GEOMETRIES [federation] 23e64482073d +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities near streams [ME on A] +FIND_TARGET_IRIS [federation] 25764463de3a +FIND_ANCHOR_IRIS [federation] 5005fd5c331c +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities near streams [ME on C] +FIND_TARGET_IRIS [federation] 935860c79d56 +FIND_ANCHOR_IRIS [federation] 84faebbbe4de +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream streams [ME on A] +FIND_TARGET_IRIS [federation] 88a05eee9640 +FIND_ANCHOR_IRIS [federation] eedde23983a6 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream streams [ME on C] +FIND_TARGET_IRIS [federation] f8ce75f3f7ee +FIND_ANCHOR_IRIS [federation] a7e872d51a0f +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream streams [ME on A] +FIND_TARGET_IRIS [federation] 81325b745fd1 +FIND_ANCHOR_IRIS [federation] 404c3355f3fd +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream streams [ME on C] +FIND_TARGET_IRIS [federation] ba8393ad2e9d +FIND_ANCHOR_IRIS [federation] d2cd8e8cafdf +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies near samples [ME on A] +FIND_TARGET_IRIS [federation] 3c4091f51398 +FIND_ANCHOR_IRIS [federation] cf808bb25a1f +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies near samples [ME on C] +FIND_TARGET_IRIS [federation] 0d49e383659d +FIND_ANCHOR_IRIS [federation] a735c3a3bff6 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream samples [ME on A] +FIND_TARGET_IRIS [federation] 25554a2d770e +FIND_ANCHOR_IRIS [federation] 70ac417804f8 +GET_FLOWLINE_GEOMETRIES [federation] 60802b6a7386 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream samples [ME on C] +FIND_TARGET_IRIS [federation] 151ef1e41632 +FIND_ANCHOR_IRIS [federation] 0cb147205839 +GET_FLOWLINE_GEOMETRIES [federation] 60802b6a7386 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream samples [ME on A] +FIND_TARGET_IRIS [federation] 790b26da2a79 +FIND_ANCHOR_IRIS [federation] 832afed999c2 +GET_FLOWLINE_GEOMETRIES [federation] d7ee9691da5b +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream samples [ME on C] +FIND_TARGET_IRIS [federation] 8e23014aa73f +FIND_ANCHOR_IRIS [federation] d01ac74e4cc0 +GET_FLOWLINE_GEOMETRIES [federation] d7ee9691da5b +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies near facilities [ME on A] +FIND_TARGET_IRIS [federation] 6203bb98fd9b +FIND_ANCHOR_IRIS [federation] 09c1cecf0048 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies near facilities [ME on C] +FIND_TARGET_IRIS [federation] 8abd2faf7bb0 +FIND_ANCHOR_IRIS [federation] 8e369b7deccc +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream facilities [ME on A] +FIND_TARGET_IRIS [federation] fbcba6bb42a9 +FIND_ANCHOR_IRIS [federation] ea51a457af43 +GET_FLOWLINE_GEOMETRIES [federation] 4feabc0eeaca +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream facilities [ME on C] +FIND_TARGET_IRIS [federation] 1084c720a6cc +FIND_ANCHOR_IRIS [federation] 642252450459 +GET_FLOWLINE_GEOMETRIES [federation] 4feabc0eeaca +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream facilities [ME on A] +FIND_TARGET_IRIS [federation] 32f1aa55d0ea +FIND_ANCHOR_IRIS [federation] 294457930c79 +GET_FLOWLINE_GEOMETRIES [federation] cfe6f604cde9 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream facilities [ME on C] +FIND_TARGET_IRIS [federation] 6ddb9c48525a +FIND_ANCHOR_IRIS [federation] f7a2dba8957d +GET_FLOWLINE_GEOMETRIES [federation] cfe6f604cde9 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies near waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 78dcb9fb3928 +FIND_ANCHOR_IRIS [federation] 409740b46fb7 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies near waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 09e5950369e5 +FIND_ANCHOR_IRIS [federation] 73934d7aae0d +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 0a29f890a209 +FIND_ANCHOR_IRIS [federation] 3a19b33e3025 +GET_FLOWLINE_GEOMETRIES [federation] c8295f7305c1 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 6ff4852b422e +FIND_ANCHOR_IRIS [federation] b2a4e26f4048 +GET_FLOWLINE_GEOMETRIES [federation] c8295f7305c1 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 6ff4852b422e +FIND_ANCHOR_IRIS [federation] b2a4e26f4048 +GET_FLOWLINE_GEOMETRIES [federation] c8295f7305c1 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 0a29f890a209 +FIND_ANCHOR_IRIS [federation] 3a19b33e3025 +GET_FLOWLINE_GEOMETRIES [federation] c8295f7305c1 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies near wells [ME on A] +FIND_TARGET_IRIS [federation] 934d8ac6f612 +FIND_ANCHOR_IRIS [federation] f58221d89287 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 6cab754cbe12 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies near wells [ME on C] +FIND_TARGET_IRIS [federation] 5ab06945d883 +FIND_ANCHOR_IRIS [federation] 80df1fdbcf14 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 90d0a0452943 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream wells [ME on A] +FIND_TARGET_IRIS [federation] 41ca24011057 +FIND_ANCHOR_IRIS [federation] 66b8cb8fd320 +GET_FLOWLINE_GEOMETRIES [federation] 7b5980388f2c +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] ff746e2b17d8 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream wells [ME on C] +FIND_TARGET_IRIS [federation] 6f09d7bbdcc7 +FIND_ANCHOR_IRIS [federation] 1efed1c496e5 +GET_FLOWLINE_GEOMETRIES [federation] 7b5980388f2c +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] ce0c65a4578d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream wells [ME on A] +FIND_TARGET_IRIS [federation] 8c6ab3d31bf7 +FIND_ANCHOR_IRIS [federation] 9813a80e0c5a +GET_FLOWLINE_GEOMETRIES [federation] 663f948f7bf0 +HYDRATE_TARGET_BY_IRI [federation] 9f5c1bba715e +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream wells [ME on C] +FIND_TARGET_IRIS [federation] b679bd47f6b1 +FIND_ANCHOR_IRIS [federation] e7e2854c8ae7 +GET_FLOWLINE_GEOMETRIES [federation] 663f948f7bf0 +HYDRATE_TARGET_BY_IRI [federation] 31d0f4e2be6f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies near aquifers [ME on A] +FIND_TARGET_IRIS [federation] 223115ac5eb1 +FIND_ANCHOR_IRIS [federation] c547f4e0656f +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies near aquifers [ME on C] +FIND_TARGET_IRIS [federation] d913d9d71840 +FIND_ANCHOR_IRIS [federation] 50885dc7a1b9 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream aquifers [ME on A] +FIND_TARGET_IRIS [federation] 99dd9196dcc8 +FIND_ANCHOR_IRIS [federation] 1beadb689ecd +GET_FLOWLINE_GEOMETRIES [federation] a28356585b79 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream aquifers [ME on C] +FIND_TARGET_IRIS [federation] 2ecade927c68 +FIND_ANCHOR_IRIS [federation] 48a5326856de +GET_FLOWLINE_GEOMETRIES [federation] a28356585b79 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream aquifers [ME on A] +FIND_TARGET_IRIS [federation] ba778257a97f +FIND_ANCHOR_IRIS [federation] 5c6cc33fae88 +GET_FLOWLINE_GEOMETRIES [federation] 137df84ed6d2 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream aquifers [ME on C] +FIND_TARGET_IRIS [federation] 4b6cc3a024ee +FIND_ANCHOR_IRIS [federation] 208b7a3a6317 +GET_FLOWLINE_GEOMETRIES [federation] 137df84ed6d2 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies near streams [ME on A] +FIND_TARGET_IRIS [federation] ebbb13c13f83 +FIND_ANCHOR_IRIS [federation] e466cf40dd85 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies near streams [ME on C] +FIND_TARGET_IRIS [federation] 2372d3380521 +FIND_ANCHOR_IRIS [federation] 14e83b4e30cd +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream streams [ME on A] +FIND_TARGET_IRIS [federation] d98072521790 +FIND_ANCHOR_IRIS [federation] bba7273cdba4 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream streams [ME on C] +FIND_TARGET_IRIS [federation] 94b023ca04bf +FIND_ANCHOR_IRIS [federation] 39f68d9178a5 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream streams [ME on A] +FIND_TARGET_IRIS [federation] 3a5de06aa701 +FIND_ANCHOR_IRIS [federation] 1890d6fd07a7 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream streams [ME on C] +FIND_TARGET_IRIS [federation] eeb6a4be8d87 +FIND_ANCHOR_IRIS [federation] 2bc13625bc04 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells near samples [ME on A] +FIND_TARGET_IRIS [federation] 0bf72e236353 +FIND_ANCHOR_IRIS [federation] 6cc73e470a1e +HYDRATE_TARGET_BY_IRI [federation] f2161e75506a +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells near samples [ME on C] +FIND_TARGET_IRIS [federation] f8a37eb37178 +FIND_ANCHOR_IRIS [federation] ef35db5ca18b +HYDRATE_TARGET_BY_IRI [federation] 8dfa184e0d2b +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream samples [ME on A] +FIND_TARGET_IRIS [federation] 01ac5b24c08f +FIND_ANCHOR_IRIS [federation] 542cd3bf0080 +GET_FLOWLINE_GEOMETRIES [federation] 6c90238c34b5 +HYDRATE_TARGET_BY_IRI [federation] 6e6e6eba070d +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream samples [ME on C] +FIND_TARGET_IRIS [federation] e6e5f175099a +FIND_ANCHOR_IRIS [federation] 114ec252bd7e +GET_FLOWLINE_GEOMETRIES [federation] 6c90238c34b5 +HYDRATE_TARGET_BY_IRI [federation] 35e5e0379327 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream samples [ME on A] +FIND_TARGET_IRIS [federation] e6eca666d07e +FIND_ANCHOR_IRIS [federation] b44db2e80018 +GET_FLOWLINE_GEOMETRIES [federation] b6f61e4f4ff3 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 631a69b1a6a7 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream samples [ME on C] +FIND_TARGET_IRIS [federation] b2a9610b7c52 +FIND_ANCHOR_IRIS [federation] 94d434376702 +GET_FLOWLINE_GEOMETRIES [federation] b6f61e4f4ff3 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 081ffe103105 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells near facilities [ME on A] +FIND_TARGET_IRIS [federation] c0f56f77ba8f +FIND_ANCHOR_IRIS [federation] 153a3a7992c8 +HYDRATE_TARGET_BY_IRI [federation] 73c37175d3a3 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells near facilities [ME on C] +FIND_TARGET_IRIS [federation] 6dda347a097f +FIND_ANCHOR_IRIS [federation] 78e1f8a446f0 +HYDRATE_TARGET_BY_IRI [federation] e0f406bc2dd6 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream facilities [ME on A] +FIND_TARGET_IRIS [federation] 141d81ecb9ec +FIND_ANCHOR_IRIS [federation] 20f966337069 +GET_FLOWLINE_GEOMETRIES [federation] 62f130505471 +HYDRATE_TARGET_BY_IRI [federation] e238ca8606c2 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream facilities [ME on C] +FIND_TARGET_IRIS [federation] f878bab0aeba +FIND_ANCHOR_IRIS [federation] 98d7c72d4aab +GET_FLOWLINE_GEOMETRIES [federation] 62f130505471 +HYDRATE_TARGET_BY_IRI [federation] e45a36c23efe +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream facilities [ME on A] +FIND_TARGET_IRIS [federation] 59b91de5e995 +FIND_ANCHOR_IRIS [federation] 9968e7786c81 +GET_FLOWLINE_GEOMETRIES [federation] f015bfcba03e +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 1084e9f48e96 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream facilities [ME on C] +FIND_TARGET_IRIS [federation] 50afef424c69 +FIND_ANCHOR_IRIS [federation] cbb05158da0c +GET_FLOWLINE_GEOMETRIES [federation] f015bfcba03e +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 3bce92acebce +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells near waterBodies [ME on A] +FIND_TARGET_IRIS [federation] d58893c96966 +FIND_ANCHOR_IRIS [federation] 63fd9d8c7d26 +HYDRATE_TARGET_BY_IRI [federation] 6b18905b32f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells near waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 39419051512e +FIND_ANCHOR_IRIS [federation] 30b8f06aa807 +HYDRATE_TARGET_BY_IRI [federation] a7b1fa7dc839 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream waterBodies [ME on A] +FIND_TARGET_IRIS [federation] b679bd47f6b1 +FIND_ANCHOR_IRIS [federation] e7e2854c8ae7 +GET_FLOWLINE_GEOMETRIES [federation] 663f948f7bf0 +HYDRATE_TARGET_BY_IRI [federation] 31d0f4e2be6f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 8c6ab3d31bf7 +FIND_ANCHOR_IRIS [federation] 9813a80e0c5a +GET_FLOWLINE_GEOMETRIES [federation] 663f948f7bf0 +HYDRATE_TARGET_BY_IRI [federation] 9f5c1bba715e +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 6f09d7bbdcc7 +FIND_ANCHOR_IRIS [federation] 1efed1c496e5 +GET_FLOWLINE_GEOMETRIES [federation] 7b5980388f2c +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] ce0c65a4578d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 41ca24011057 +FIND_ANCHOR_IRIS [federation] 66b8cb8fd320 +GET_FLOWLINE_GEOMETRIES [federation] 7b5980388f2c +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] ff746e2b17d8 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells near wells [ME on A] +FIND_TARGET_IRIS [federation] 920687fc77ed +FIND_ANCHOR_IRIS [federation] 6ede512b148d +HYDRATE_TARGET_BY_IRI [federation] c498321cc486 +HYDRATE_ANCHOR_BY_IRI [federation] 05cd3b39feaf +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells near wells [ME on C] +FIND_TARGET_IRIS [federation] 83d77a45d03c +FIND_ANCHOR_IRIS [federation] 187c48927d97 +HYDRATE_TARGET_BY_IRI [federation] 88b94aeb229d +HYDRATE_ANCHOR_BY_IRI [federation] c85fdb421ca6 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream wells [ME on A] +FIND_TARGET_IRIS [federation] ac87cac97a08 +FIND_ANCHOR_IRIS [federation] ee767dadbf6f +GET_FLOWLINE_GEOMETRIES [federation] 4bc79000b146 +HYDRATE_TARGET_BY_IRI [federation] c80d21e0d32d +HYDRATE_ANCHOR_BY_IRI [federation] cb961f64c07f +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream wells [ME on C] +FIND_TARGET_IRIS [federation] 968075df2792 +FIND_ANCHOR_IRIS [federation] fa96bd1b30f8 +GET_FLOWLINE_GEOMETRIES [federation] 4bc79000b146 +HYDRATE_TARGET_BY_IRI [federation] 258e1bb27b55 +HYDRATE_ANCHOR_BY_IRI [federation] 440f71464197 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream wells [ME on A] +FIND_TARGET_IRIS [federation] 968075df2792 +FIND_ANCHOR_IRIS [federation] fa96bd1b30f8 +GET_FLOWLINE_GEOMETRIES [federation] 4bc79000b146 +HYDRATE_TARGET_BY_IRI [federation] 258e1bb27b55 +HYDRATE_ANCHOR_BY_IRI [federation] 440f71464197 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream wells [ME on C] +FIND_TARGET_IRIS [federation] ac87cac97a08 +FIND_ANCHOR_IRIS [federation] ee767dadbf6f +GET_FLOWLINE_GEOMETRIES [federation] 4bc79000b146 +HYDRATE_TARGET_BY_IRI [federation] c80d21e0d32d +HYDRATE_ANCHOR_BY_IRI [federation] cb961f64c07f +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells near aquifers [ME on A] +FIND_TARGET_IRIS [federation] 4cf300178a3d +FIND_ANCHOR_IRIS [federation] 17938cd745d9 +HYDRATE_TARGET_BY_IRI [federation] 8a1266fbf3b4 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells near aquifers [ME on C] +FIND_TARGET_IRIS [federation] 1c5477f4a20d +FIND_ANCHOR_IRIS [federation] a1a3610cba42 +HYDRATE_TARGET_BY_IRI [federation] f1abbefd32dd +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream aquifers [ME on A] +FIND_TARGET_IRIS [federation] b6893ae200af +FIND_ANCHOR_IRIS [federation] b9d0126bda7a +GET_FLOWLINE_GEOMETRIES [federation] 79b82d9e0fe1 +HYDRATE_TARGET_BY_IRI [federation] c35d18356b27 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream aquifers [ME on C] +FIND_TARGET_IRIS [federation] 26bf05053779 +FIND_ANCHOR_IRIS [federation] ddfaa9f20f19 +GET_FLOWLINE_GEOMETRIES [federation] 79b82d9e0fe1 +HYDRATE_TARGET_BY_IRI [federation] ec935451ecfb +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream aquifers [ME on A] +FIND_TARGET_IRIS [federation] 22c02f8cd68b +FIND_ANCHOR_IRIS [federation] b9d52f76c5da +GET_FLOWLINE_GEOMETRIES [federation] 9a08433a48e0 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] dc4d5d46d3f1 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream aquifers [ME on C] +FIND_TARGET_IRIS [federation] c5ae9f5fc826 +FIND_ANCHOR_IRIS [federation] 4f5453f9e32d +GET_FLOWLINE_GEOMETRIES [federation] 9a08433a48e0 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] ca1086992b60 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells near streams [ME on A] +FIND_TARGET_IRIS [federation] 8952d69eebf7 +FIND_ANCHOR_IRIS [federation] 827004d998b2 +HYDRATE_TARGET_BY_IRI [federation] d335a3eda455 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells near streams [ME on C] +FIND_TARGET_IRIS [federation] e30770406b41 +FIND_ANCHOR_IRIS [federation] b0f1db6f8073 +HYDRATE_TARGET_BY_IRI [federation] 5e175b050654 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream streams [ME on A] +FIND_TARGET_IRIS [federation] e3bb217bc214 +FIND_ANCHOR_IRIS [federation] 032ea9425e6f +HYDRATE_TARGET_BY_IRI [federation] 32cbf641e1bc +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream streams [ME on C] +FIND_TARGET_IRIS [federation] f56b87fc7251 +FIND_ANCHOR_IRIS [federation] 67b90dec7f24 +HYDRATE_TARGET_BY_IRI [federation] 06c0038fb4ce +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream streams [ME on A] +FIND_TARGET_IRIS [federation] 8b7cd81ea5cf +FIND_ANCHOR_IRIS [federation] e5376ca0aa0a +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] bf6a1a426eb1 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream streams [ME on C] +FIND_TARGET_IRIS [federation] 1da7ac18c1ca +FIND_ANCHOR_IRIS [federation] 592bae86ed3a +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 95fe8b8c33ba +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers near samples [ME on A] +FIND_TARGET_IRIS [federation] b45c05b3136a +FIND_ANCHOR_IRIS [federation] 003f0f16f9b1 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers near samples [ME on C] +FIND_TARGET_IRIS [federation] 2f9aec17c4e9 +FIND_ANCHOR_IRIS [federation] 56c5b92ab83e +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream samples [ME on A] +FIND_TARGET_IRIS [federation] 54b1d508458d +FIND_ANCHOR_IRIS [federation] 7530ba837a17 +GET_FLOWLINE_GEOMETRIES [federation] ebbacce57f0e +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream samples [ME on C] +FIND_TARGET_IRIS [federation] cd1d79f23ba8 +FIND_ANCHOR_IRIS [federation] 907b64185777 +GET_FLOWLINE_GEOMETRIES [federation] ebbacce57f0e +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream samples [ME on A] +FIND_TARGET_IRIS [federation] c8b9648ad9ad +FIND_ANCHOR_IRIS [federation] 6b13c5e7d199 +GET_FLOWLINE_GEOMETRIES [federation] 0d7cd31e6182 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream samples [ME on C] +FIND_TARGET_IRIS [federation] 3735b227534b +FIND_ANCHOR_IRIS [federation] d1b9348ef98d +GET_FLOWLINE_GEOMETRIES [federation] 0d7cd31e6182 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers near facilities [ME on A] +FIND_TARGET_IRIS [federation] 5aedb347a53b +FIND_ANCHOR_IRIS [federation] b6d4297f115e +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers near facilities [ME on C] +FIND_TARGET_IRIS [federation] 88d952d2a2c5 +FIND_ANCHOR_IRIS [federation] 6316b038687c +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream facilities [ME on A] +FIND_TARGET_IRIS [federation] 4ca2878d179f +FIND_ANCHOR_IRIS [federation] 21aab4d7bdf7 +GET_FLOWLINE_GEOMETRIES [federation] 23e64482073d +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream facilities [ME on C] +FIND_TARGET_IRIS [federation] 35eea760e846 +FIND_ANCHOR_IRIS [federation] 021c99bd21fe +GET_FLOWLINE_GEOMETRIES [federation] 23e64482073d +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream facilities [ME on A] +FIND_TARGET_IRIS [federation] 2fdb9d27c845 +FIND_ANCHOR_IRIS [federation] b6983d91a529 +GET_FLOWLINE_GEOMETRIES [federation] 5515bd777411 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream facilities [ME on C] +FIND_TARGET_IRIS [federation] 1a0e0369b410 +FIND_ANCHOR_IRIS [federation] 32747a1b563b +GET_FLOWLINE_GEOMETRIES [federation] 5515bd777411 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers near waterBodies [ME on A] +FIND_TARGET_IRIS [federation] e2b3d9f8c117 +FIND_ANCHOR_IRIS [federation] 40a495b7a46a +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers near waterBodies [ME on C] +FIND_TARGET_IRIS [federation] e0d3a87dd863 +FIND_ANCHOR_IRIS [federation] 38cb444f42f8 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 4b6cc3a024ee +FIND_ANCHOR_IRIS [federation] 208b7a3a6317 +GET_FLOWLINE_GEOMETRIES [federation] 137df84ed6d2 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream waterBodies [ME on C] +FIND_TARGET_IRIS [federation] ba778257a97f +FIND_ANCHOR_IRIS [federation] 5c6cc33fae88 +GET_FLOWLINE_GEOMETRIES [federation] 137df84ed6d2 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 2ecade927c68 +FIND_ANCHOR_IRIS [federation] 48a5326856de +GET_FLOWLINE_GEOMETRIES [federation] a28356585b79 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 99dd9196dcc8 +FIND_ANCHOR_IRIS [federation] 1beadb689ecd +GET_FLOWLINE_GEOMETRIES [federation] a28356585b79 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers near wells [ME on A] +FIND_TARGET_IRIS [federation] a408ff1eb89d +FIND_ANCHOR_IRIS [federation] 33e4f401a9db +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 66c78fc2515a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers near wells [ME on C] +FIND_TARGET_IRIS [federation] 3e4c26e61ee4 +FIND_ANCHOR_IRIS [federation] cdddd6bdf1d7 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 46bc1db1c4db +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream wells [ME on A] +FIND_TARGET_IRIS [federation] c5ae9f5fc826 +FIND_ANCHOR_IRIS [federation] 4f5453f9e32d +GET_FLOWLINE_GEOMETRIES [federation] 9a08433a48e0 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] ca1086992b60 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream wells [ME on C] +FIND_TARGET_IRIS [federation] 22c02f8cd68b +FIND_ANCHOR_IRIS [federation] b9d52f76c5da +GET_FLOWLINE_GEOMETRIES [federation] 9a08433a48e0 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] dc4d5d46d3f1 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream wells [ME on A] +FIND_TARGET_IRIS [federation] 26bf05053779 +FIND_ANCHOR_IRIS [federation] ddfaa9f20f19 +GET_FLOWLINE_GEOMETRIES [federation] 79b82d9e0fe1 +HYDRATE_TARGET_BY_IRI [federation] ec935451ecfb +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream wells [ME on C] +FIND_TARGET_IRIS [federation] b6893ae200af +FIND_ANCHOR_IRIS [federation] b9d0126bda7a +GET_FLOWLINE_GEOMETRIES [federation] 79b82d9e0fe1 +HYDRATE_TARGET_BY_IRI [federation] c35d18356b27 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers near aquifers [ME on A] +FIND_TARGET_IRIS [federation] 4eb7e82611af +FIND_ANCHOR_IRIS [federation] 2bec684879ca +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers near aquifers [ME on C] +FIND_TARGET_IRIS [federation] 0667c0004f62 +FIND_ANCHOR_IRIS [federation] 8529b7fb6ffa +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream aquifers [ME on A] +FIND_TARGET_IRIS [federation] dc584e6cfe79 +FIND_ANCHOR_IRIS [federation] a3823ffd8794 +GET_FLOWLINE_GEOMETRIES [federation] 3cdf1859eeef +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream aquifers [ME on C] +FIND_TARGET_IRIS [federation] a963e5be882c +FIND_ANCHOR_IRIS [federation] 58c16900aa65 +GET_FLOWLINE_GEOMETRIES [federation] 3cdf1859eeef +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream aquifers [ME on A] +FIND_TARGET_IRIS [federation] a963e5be882c +FIND_ANCHOR_IRIS [federation] 58c16900aa65 +GET_FLOWLINE_GEOMETRIES [federation] 3cdf1859eeef +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream aquifers [ME on C] +FIND_TARGET_IRIS [federation] dc584e6cfe79 +FIND_ANCHOR_IRIS [federation] a3823ffd8794 +GET_FLOWLINE_GEOMETRIES [federation] 3cdf1859eeef +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers near streams [ME on A] +FIND_TARGET_IRIS [federation] 8f5c7dd5246f +FIND_ANCHOR_IRIS [federation] 07bcc0d2ef5b +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers near streams [ME on C] +FIND_TARGET_IRIS [federation] ef7f4d420285 +FIND_ANCHOR_IRIS [federation] 93c67796bf6d +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream streams [ME on A] +FIND_TARGET_IRIS [federation] e13c4295e7b0 +FIND_ANCHOR_IRIS [federation] bac0c29c4f57 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream streams [ME on C] +FIND_TARGET_IRIS [federation] 98b1603dafe4 +FIND_ANCHOR_IRIS [federation] 481ef65eaf6e +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream streams [ME on A] +FIND_TARGET_IRIS [federation] 132f284d8912 +FIND_ANCHOR_IRIS [federation] 629f7809931c +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream streams [ME on C] +FIND_TARGET_IRIS [federation] eb7c41d74f46 +FIND_ANCHOR_IRIS [federation] 2ab8259a58d6 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams near samples [ME on A] +FIND_TARGET_IRIS [federation] daaf4827bae1 +FIND_ANCHOR_IRIS [federation] bea267f2f762 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams near samples [ME on C] +FIND_TARGET_IRIS [federation] 377f854f6cc6 +FIND_ANCHOR_IRIS [federation] 6e59770323b3 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream samples [ME on A] +FIND_TARGET_IRIS [federation] 3bcbbc61caae +FIND_ANCHOR_IRIS [federation] a62588d4bcb9 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream samples [ME on C] +FIND_TARGET_IRIS [federation] b22e14df0511 +FIND_ANCHOR_IRIS [federation] 7dad41fdfd60 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream samples [ME on A] +FIND_TARGET_IRIS [federation] e8b95c8c5b5d +FIND_ANCHOR_IRIS [federation] 0d9fd4f4b10a +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream samples [ME on C] +FIND_TARGET_IRIS [federation] 962a202132fc +FIND_ANCHOR_IRIS [federation] 62aa5619bc67 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams near facilities [ME on A] +FIND_TARGET_IRIS [federation] 0d03523e6c23 +FIND_ANCHOR_IRIS [federation] e0f6624fc264 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams near facilities [ME on C] +FIND_TARGET_IRIS [federation] 8ef73aad6fa9 +FIND_ANCHOR_IRIS [federation] a3ac25aca5df +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream facilities [ME on A] +FIND_TARGET_IRIS [federation] ba8393ad2e9d +FIND_ANCHOR_IRIS [federation] d2cd8e8cafdf +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream facilities [ME on C] +FIND_TARGET_IRIS [federation] 81325b745fd1 +FIND_ANCHOR_IRIS [federation] 404c3355f3fd +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream facilities [ME on A] +FIND_TARGET_IRIS [federation] f8ce75f3f7ee +FIND_ANCHOR_IRIS [federation] a7e872d51a0f +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream facilities [ME on C] +FIND_TARGET_IRIS [federation] 88a05eee9640 +FIND_ANCHOR_IRIS [federation] eedde23983a6 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams near waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 6da1ed2de01d +FIND_ANCHOR_IRIS [federation] 320b9d0e5ff8 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams near waterBodies [ME on C] +FIND_TARGET_IRIS [federation] ade4600c7066 +FIND_ANCHOR_IRIS [federation] 2e32c0ffbc3c +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream waterBodies [ME on A] +FIND_TARGET_IRIS [federation] eeb6a4be8d87 +FIND_ANCHOR_IRIS [federation] 2bc13625bc04 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 3a5de06aa701 +FIND_ANCHOR_IRIS [federation] 1890d6fd07a7 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 94b023ca04bf +FIND_ANCHOR_IRIS [federation] 39f68d9178a5 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream waterBodies [ME on C] +FIND_TARGET_IRIS [federation] d98072521790 +FIND_ANCHOR_IRIS [federation] bba7273cdba4 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams near wells [ME on A] +FIND_TARGET_IRIS [federation] daae4206ce0f +FIND_ANCHOR_IRIS [federation] fb42af7be1f5 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] bc5e31538d28 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams near wells [ME on C] +FIND_TARGET_IRIS [federation] fcaea4147d56 +FIND_ANCHOR_IRIS [federation] 56ea6a34453b +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 2fe8928c9eac +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream wells [ME on A] +FIND_TARGET_IRIS [federation] 1da7ac18c1ca +FIND_ANCHOR_IRIS [federation] 592bae86ed3a +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 95fe8b8c33ba +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream wells [ME on C] +FIND_TARGET_IRIS [federation] 8b7cd81ea5cf +FIND_ANCHOR_IRIS [federation] e5376ca0aa0a +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] bf6a1a426eb1 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream wells [ME on A] +FIND_TARGET_IRIS [federation] f56b87fc7251 +FIND_ANCHOR_IRIS [federation] 67b90dec7f24 +HYDRATE_TARGET_BY_IRI [federation] 06c0038fb4ce +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream wells [ME on C] +FIND_TARGET_IRIS [federation] e3bb217bc214 +FIND_ANCHOR_IRIS [federation] 032ea9425e6f +HYDRATE_TARGET_BY_IRI [federation] 32cbf641e1bc +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams near aquifers [ME on A] +FIND_TARGET_IRIS [federation] 871365cea3c3 +FIND_ANCHOR_IRIS [federation] bd4eab4c6f66 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams near aquifers [ME on C] +FIND_TARGET_IRIS [federation] 26ef89af73d7 +FIND_ANCHOR_IRIS [federation] 7c9c4702ede4 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream aquifers [ME on A] +FIND_TARGET_IRIS [federation] eb7c41d74f46 +FIND_ANCHOR_IRIS [federation] 2ab8259a58d6 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream aquifers [ME on C] +FIND_TARGET_IRIS [federation] 132f284d8912 +FIND_ANCHOR_IRIS [federation] 629f7809931c +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream aquifers [ME on A] +FIND_TARGET_IRIS [federation] 98b1603dafe4 +FIND_ANCHOR_IRIS [federation] 481ef65eaf6e +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream aquifers [ME on C] +FIND_TARGET_IRIS [federation] e13c4295e7b0 +FIND_ANCHOR_IRIS [federation] bac0c29c4f57 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams near streams [ME on A] +FIND_TARGET_IRIS [federation] 7658df86ebfb +FIND_ANCHOR_IRIS [federation] 79e0bd042512 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams near streams [ME on C] +FIND_TARGET_IRIS [federation] 9ba66fec62a1 +FIND_ANCHOR_IRIS [federation] 9e8aee90f1eb +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream streams [ME on A] +FIND_TARGET_IRIS [federation] 24e2d640eb8b +FIND_ANCHOR_IRIS [federation] 14f6bfc3ef2b +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream streams [ME on C] +FIND_TARGET_IRIS [federation] 29735aa2afea +FIND_ANCHOR_IRIS [federation] 56f38a86aec7 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream streams [ME on A] +FIND_TARGET_IRIS [federation] 29735aa2afea +FIND_ANCHOR_IRIS [federation] 56f38a86aec7 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream streams [ME on C] +FIND_TARGET_IRIS [federation] 24e2d640eb8b +FIND_ANCHOR_IRIS [federation] 14f6bfc3ef2b +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream(30km) samples [ME on A] +FIND_TARGET_IRIS [federation] fa1833c58b13 +FIND_ANCHOR_IRIS [federation] 4d08a3f185ec +GET_FLOWLINE_GEOMETRIES [federation] 5a03f4f3aae3 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream(30km) samples [ME on C] +FIND_TARGET_IRIS [federation] f0d79c0a39c3 +FIND_ANCHOR_IRIS [federation] ece4d96de601 +GET_FLOWLINE_GEOMETRIES [federation] 5a03f4f3aae3 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream(30km) samples [ME on A] +FIND_TARGET_IRIS [federation] f0d79c0a39c3 +FIND_ANCHOR_IRIS [federation] ece4d96de601 +GET_FLOWLINE_GEOMETRIES [federation] 5a03f4f3aae3 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream(30km) samples [ME on C] +FIND_TARGET_IRIS [federation] fa1833c58b13 +FIND_ANCHOR_IRIS [federation] 4d08a3f185ec +GET_FLOWLINE_GEOMETRIES [federation] 5a03f4f3aae3 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream(30km) facilities [ME on A] +FIND_TARGET_IRIS [federation] 3dbb4fd45439 +FIND_ANCHOR_IRIS [federation] c6129be91792 +GET_FLOWLINE_GEOMETRIES [federation] 3c6a4d4ad1b9 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream(30km) facilities [ME on C] +FIND_TARGET_IRIS [federation] 59aee765110c +FIND_ANCHOR_IRIS [federation] 4a22e1a87031 +GET_FLOWLINE_GEOMETRIES [federation] 3c6a4d4ad1b9 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream(30km) facilities [ME on A] +FIND_TARGET_IRIS [federation] 7d7f1e7d7c60 +FIND_ANCHOR_IRIS [federation] 6e78232de987 +GET_FLOWLINE_GEOMETRIES [federation] a4f6491c0e2c +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream(30km) facilities [ME on C] +FIND_TARGET_IRIS [federation] 7604a06153a0 +FIND_ANCHOR_IRIS [federation] 666e8b5700a2 +GET_FLOWLINE_GEOMETRIES [federation] a4f6491c0e2c +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream(30km) waterBodies [ME on A] +FIND_TARGET_IRIS [federation] d4ff9a18f9cf +FIND_ANCHOR_IRIS [federation] 2c9b021c5ece +GET_FLOWLINE_GEOMETRIES [federation] 288129aa4dbe +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream(30km) waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 751b01f1248c +FIND_ANCHOR_IRIS [federation] 4e22903dafb8 +GET_FLOWLINE_GEOMETRIES [federation] 288129aa4dbe +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream(30km) waterBodies [ME on A] +FIND_TARGET_IRIS [federation] c36613529a50 +FIND_ANCHOR_IRIS [federation] 1195457ff6d4 +GET_FLOWLINE_GEOMETRIES [federation] 70123c8b61f0 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream(30km) waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 436d3320d910 +FIND_ANCHOR_IRIS [federation] 518849e03a5b +GET_FLOWLINE_GEOMETRIES [federation] 70123c8b61f0 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream(30km) wells [ME on A] +FIND_TARGET_IRIS [federation] c5ba856ac5a5 +FIND_ANCHOR_IRIS [federation] 802d35965666 +GET_FLOWLINE_GEOMETRIES [federation] 337d970b0f07 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] da7010fa25fd +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream(30km) wells [ME on C] +FIND_TARGET_IRIS [federation] 8a8df61dddeb +FIND_ANCHOR_IRIS [federation] 789f1ded1d8a +GET_FLOWLINE_GEOMETRIES [federation] 337d970b0f07 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 52f8acbda00d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream(30km) wells [ME on A] +FIND_TARGET_IRIS [federation] 776babccec7b +FIND_ANCHOR_IRIS [federation] 3484afc2016f +GET_FLOWLINE_GEOMETRIES [federation] 5de1200d2e01 +HYDRATE_TARGET_BY_IRI [federation] c9531cc6fbe2 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream(30km) wells [ME on C] +FIND_TARGET_IRIS [federation] 5dbe52083d8c +FIND_ANCHOR_IRIS [federation] 18515c96f78d +GET_FLOWLINE_GEOMETRIES [federation] 5de1200d2e01 +HYDRATE_TARGET_BY_IRI [federation] 878b7218cf7c +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream(30km) aquifers [ME on A] +FIND_TARGET_IRIS [federation] a548c30613f2 +FIND_ANCHOR_IRIS [federation] 123fa7029db0 +GET_FLOWLINE_GEOMETRIES [federation] a7ba4bf786b6 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream(30km) aquifers [ME on C] +FIND_TARGET_IRIS [federation] 66321d87ce37 +FIND_ANCHOR_IRIS [federation] 2bcc64889ee4 +GET_FLOWLINE_GEOMETRIES [federation] a7ba4bf786b6 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream(30km) aquifers [ME on A] +FIND_TARGET_IRIS [federation] 5109f240a9f0 +FIND_ANCHOR_IRIS [federation] fa5208b4f1f5 +GET_FLOWLINE_GEOMETRIES [federation] 934aca1f2f29 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream(30km) aquifers [ME on C] +FIND_TARGET_IRIS [federation] 296a0d00de9e +FIND_ANCHOR_IRIS [federation] 71f036d9cd02 +GET_FLOWLINE_GEOMETRIES [federation] 934aca1f2f29 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream(30km) streams [ME on A] +FIND_TARGET_IRIS [federation] 55f5714d004c +FIND_ANCHOR_IRIS [federation] 27a652bc4a63 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples downstream(30km) streams [ME on C] +FIND_TARGET_IRIS [federation] 614ca43f8807 +FIND_ANCHOR_IRIS [federation] 3ac013fb1120 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream(30km) streams [ME on A] +FIND_TARGET_IRIS [federation] ac7ebc96d761 +FIND_ANCHOR_IRIS [federation] fc48809955c6 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## samples upstream(30km) streams [ME on C] +FIND_TARGET_IRIS [federation] b4008588edaf +FIND_ANCHOR_IRIS [federation] 6ac9015a260c +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream(30km) samples [ME on A] +FIND_TARGET_IRIS [federation] 7604a06153a0 +FIND_ANCHOR_IRIS [federation] 666e8b5700a2 +GET_FLOWLINE_GEOMETRIES [federation] a4f6491c0e2c +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream(30km) samples [ME on C] +FIND_TARGET_IRIS [federation] 7d7f1e7d7c60 +FIND_ANCHOR_IRIS [federation] 6e78232de987 +GET_FLOWLINE_GEOMETRIES [federation] a4f6491c0e2c +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream(30km) samples [ME on A] +FIND_TARGET_IRIS [federation] 59aee765110c +FIND_ANCHOR_IRIS [federation] 4a22e1a87031 +GET_FLOWLINE_GEOMETRIES [federation] 3c6a4d4ad1b9 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream(30km) samples [ME on C] +FIND_TARGET_IRIS [federation] 3dbb4fd45439 +FIND_ANCHOR_IRIS [federation] c6129be91792 +GET_FLOWLINE_GEOMETRIES [federation] 3c6a4d4ad1b9 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream(30km) facilities [ME on A] +FIND_TARGET_IRIS [federation] eda7f49eaf9d +FIND_ANCHOR_IRIS [federation] f1e4ac3d1adc +GET_FLOWLINE_GEOMETRIES [federation] bf8ffdfa1ad9 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream(30km) facilities [ME on C] +FIND_TARGET_IRIS [federation] 8758a29be4cd +FIND_ANCHOR_IRIS [federation] 3de8c144de70 +GET_FLOWLINE_GEOMETRIES [federation] bf8ffdfa1ad9 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream(30km) facilities [ME on A] +FIND_TARGET_IRIS [federation] 8758a29be4cd +FIND_ANCHOR_IRIS [federation] 3de8c144de70 +GET_FLOWLINE_GEOMETRIES [federation] bf8ffdfa1ad9 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream(30km) facilities [ME on C] +FIND_TARGET_IRIS [federation] eda7f49eaf9d +FIND_ANCHOR_IRIS [federation] f1e4ac3d1adc +GET_FLOWLINE_GEOMETRIES [federation] bf8ffdfa1ad9 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream(30km) waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 6537d90d135f +FIND_ANCHOR_IRIS [federation] 69f0475ae80a +GET_FLOWLINE_GEOMETRIES [federation] fd28138d5b69 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream(30km) waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 8fbe3088c265 +FIND_ANCHOR_IRIS [federation] 060c1e184a76 +GET_FLOWLINE_GEOMETRIES [federation] fd28138d5b69 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream(30km) waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 9b750fdb6a09 +FIND_ANCHOR_IRIS [federation] 7ab11f2c9448 +GET_FLOWLINE_GEOMETRIES [federation] 9f955f3f75d5 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream(30km) waterBodies [ME on C] +FIND_TARGET_IRIS [federation] f560ebd6282b +FIND_ANCHOR_IRIS [federation] 86a26ec60121 +GET_FLOWLINE_GEOMETRIES [federation] 9f955f3f75d5 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream(30km) wells [ME on A] +FIND_TARGET_IRIS [federation] 5c5c06fd1d35 +FIND_ANCHOR_IRIS [federation] 1b7220b76dc0 +GET_FLOWLINE_GEOMETRIES [federation] 53706371792a +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 9c03aae08c7b +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream(30km) wells [ME on C] +FIND_TARGET_IRIS [federation] e5836fc46bf4 +FIND_ANCHOR_IRIS [federation] a0d6980914ac +GET_FLOWLINE_GEOMETRIES [federation] 53706371792a +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 5a01b1674751 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream(30km) wells [ME on A] +FIND_TARGET_IRIS [federation] ab7cba78e7a4 +FIND_ANCHOR_IRIS [federation] e710b494417c +GET_FLOWLINE_GEOMETRIES [federation] 8becca5939ec +HYDRATE_TARGET_BY_IRI [federation] 719474b95b24 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream(30km) wells [ME on C] +FIND_TARGET_IRIS [federation] 242afddb2669 +FIND_ANCHOR_IRIS [federation] 748a8ca41a32 +GET_FLOWLINE_GEOMETRIES [federation] 8becca5939ec +HYDRATE_TARGET_BY_IRI [federation] af3062364f60 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream(30km) aquifers [ME on A] +FIND_TARGET_IRIS [federation] be59394dac59 +FIND_ANCHOR_IRIS [federation] da77e9a226ae +GET_FLOWLINE_GEOMETRIES [federation] 5bb2d62da8a0 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream(30km) aquifers [ME on C] +FIND_TARGET_IRIS [federation] c1505f76d1a2 +FIND_ANCHOR_IRIS [federation] 78d85e00dcd9 +GET_FLOWLINE_GEOMETRIES [federation] 5bb2d62da8a0 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream(30km) aquifers [ME on A] +FIND_TARGET_IRIS [federation] 7087d0c06d24 +FIND_ANCHOR_IRIS [federation] dfffea098028 +GET_FLOWLINE_GEOMETRIES [federation] e0c43ef101a2 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream(30km) aquifers [ME on C] +FIND_TARGET_IRIS [federation] 027492953f58 +FIND_ANCHOR_IRIS [federation] e1ccb826ce9b +GET_FLOWLINE_GEOMETRIES [federation] e0c43ef101a2 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream(30km) streams [ME on A] +FIND_TARGET_IRIS [federation] 37c324b2fb11 +FIND_ANCHOR_IRIS [federation] dda55e8be700 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities downstream(30km) streams [ME on C] +FIND_TARGET_IRIS [federation] a7c3f2ccff0c +FIND_ANCHOR_IRIS [federation] cc4b39ebe0a2 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream(30km) streams [ME on A] +FIND_TARGET_IRIS [federation] e792abfe6ef8 +FIND_ANCHOR_IRIS [federation] 10dbee777757 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## facilities upstream(30km) streams [ME on C] +FIND_TARGET_IRIS [federation] 1f724fa39386 +FIND_ANCHOR_IRIS [federation] 8138a7e702af +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream(30km) samples [ME on A] +FIND_TARGET_IRIS [federation] 436d3320d910 +FIND_ANCHOR_IRIS [federation] 518849e03a5b +GET_FLOWLINE_GEOMETRIES [federation] 70123c8b61f0 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream(30km) samples [ME on C] +FIND_TARGET_IRIS [federation] c36613529a50 +FIND_ANCHOR_IRIS [federation] 1195457ff6d4 +GET_FLOWLINE_GEOMETRIES [federation] 70123c8b61f0 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream(30km) samples [ME on A] +FIND_TARGET_IRIS [federation] 751b01f1248c +FIND_ANCHOR_IRIS [federation] 4e22903dafb8 +GET_FLOWLINE_GEOMETRIES [federation] 288129aa4dbe +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream(30km) samples [ME on C] +FIND_TARGET_IRIS [federation] d4ff9a18f9cf +FIND_ANCHOR_IRIS [federation] 2c9b021c5ece +GET_FLOWLINE_GEOMETRIES [federation] 288129aa4dbe +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream(30km) facilities [ME on A] +FIND_TARGET_IRIS [federation] f560ebd6282b +FIND_ANCHOR_IRIS [federation] 86a26ec60121 +GET_FLOWLINE_GEOMETRIES [federation] 9f955f3f75d5 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream(30km) facilities [ME on C] +FIND_TARGET_IRIS [federation] 9b750fdb6a09 +FIND_ANCHOR_IRIS [federation] 7ab11f2c9448 +GET_FLOWLINE_GEOMETRIES [federation] 9f955f3f75d5 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream(30km) facilities [ME on A] +FIND_TARGET_IRIS [federation] 8fbe3088c265 +FIND_ANCHOR_IRIS [federation] 060c1e184a76 +GET_FLOWLINE_GEOMETRIES [federation] fd28138d5b69 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream(30km) facilities [ME on C] +FIND_TARGET_IRIS [federation] 6537d90d135f +FIND_ANCHOR_IRIS [federation] 69f0475ae80a +GET_FLOWLINE_GEOMETRIES [federation] fd28138d5b69 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream(30km) waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 8c90b6016e50 +FIND_ANCHOR_IRIS [federation] 090aa1368fc6 +GET_FLOWLINE_GEOMETRIES [federation] cd57b7a763e6 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream(30km) waterBodies [ME on C] +FIND_TARGET_IRIS [federation] b7423f86a11e +FIND_ANCHOR_IRIS [federation] 6ed5aed4968a +GET_FLOWLINE_GEOMETRIES [federation] cd57b7a763e6 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream(30km) waterBodies [ME on A] +FIND_TARGET_IRIS [federation] b7423f86a11e +FIND_ANCHOR_IRIS [federation] 6ed5aed4968a +GET_FLOWLINE_GEOMETRIES [federation] cd57b7a763e6 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream(30km) waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 8c90b6016e50 +FIND_ANCHOR_IRIS [federation] 090aa1368fc6 +GET_FLOWLINE_GEOMETRIES [federation] cd57b7a763e6 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream(30km) wells [ME on A] +FIND_TARGET_IRIS [federation] 77f682fb65ef +FIND_ANCHOR_IRIS [federation] 13bb3ff18f50 +GET_FLOWLINE_GEOMETRIES [federation] b97f4349ba61 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 1b55c84eb49b +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream(30km) wells [ME on C] +FIND_TARGET_IRIS [federation] 8d3c6166926c +FIND_ANCHOR_IRIS [federation] 3a2bb0cd96e0 +GET_FLOWLINE_GEOMETRIES [federation] b97f4349ba61 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 74340ac75507 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream(30km) wells [ME on A] +FIND_TARGET_IRIS [federation] ca528e8925b8 +FIND_ANCHOR_IRIS [federation] 3691010af47d +GET_FLOWLINE_GEOMETRIES [federation] 22b41e20cf91 +HYDRATE_TARGET_BY_IRI [federation] 19c1603fd525 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream(30km) wells [ME on C] +FIND_TARGET_IRIS [federation] 07f85ea74c11 +FIND_ANCHOR_IRIS [federation] e93784de47f2 +GET_FLOWLINE_GEOMETRIES [federation] 22b41e20cf91 +HYDRATE_TARGET_BY_IRI [federation] 83a09bfc0c0a +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream(30km) aquifers [ME on A] +FIND_TARGET_IRIS [federation] ee66561a00f7 +FIND_ANCHOR_IRIS [federation] 02fc7f5ebfab +GET_FLOWLINE_GEOMETRIES [federation] b3c1864cf554 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream(30km) aquifers [ME on C] +FIND_TARGET_IRIS [federation] 96f67a03be24 +FIND_ANCHOR_IRIS [federation] 90d82873e3c0 +GET_FLOWLINE_GEOMETRIES [federation] b3c1864cf554 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream(30km) aquifers [ME on A] +FIND_TARGET_IRIS [federation] bd10519b155e +FIND_ANCHOR_IRIS [federation] 6ad2a8fa8e74 +GET_FLOWLINE_GEOMETRIES [federation] 1b2c8dc5e4e2 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream(30km) aquifers [ME on C] +FIND_TARGET_IRIS [federation] c1711127344f +FIND_ANCHOR_IRIS [federation] 794a5c139565 +GET_FLOWLINE_GEOMETRIES [federation] 1b2c8dc5e4e2 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream(30km) streams [ME on A] +FIND_TARGET_IRIS [federation] 970a4ae75376 +FIND_ANCHOR_IRIS [federation] b57ca9e8c32e +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies downstream(30km) streams [ME on C] +FIND_TARGET_IRIS [federation] b6f2102221d1 +FIND_ANCHOR_IRIS [federation] 9a0037a928d9 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream(30km) streams [ME on A] +FIND_TARGET_IRIS [federation] 82022c612381 +FIND_ANCHOR_IRIS [federation] 5151a972eede +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## waterBodies upstream(30km) streams [ME on C] +FIND_TARGET_IRIS [federation] c339d1c42d50 +FIND_ANCHOR_IRIS [federation] 423d5033fc48 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream(30km) samples [ME on A] +FIND_TARGET_IRIS [federation] 5dbe52083d8c +FIND_ANCHOR_IRIS [federation] 18515c96f78d +GET_FLOWLINE_GEOMETRIES [federation] 5de1200d2e01 +HYDRATE_TARGET_BY_IRI [federation] 878b7218cf7c +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream(30km) samples [ME on C] +FIND_TARGET_IRIS [federation] 776babccec7b +FIND_ANCHOR_IRIS [federation] 3484afc2016f +GET_FLOWLINE_GEOMETRIES [federation] 5de1200d2e01 +HYDRATE_TARGET_BY_IRI [federation] c9531cc6fbe2 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream(30km) samples [ME on A] +FIND_TARGET_IRIS [federation] 8a8df61dddeb +FIND_ANCHOR_IRIS [federation] 789f1ded1d8a +GET_FLOWLINE_GEOMETRIES [federation] 337d970b0f07 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] 52f8acbda00d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream(30km) samples [ME on C] +FIND_TARGET_IRIS [federation] c5ba856ac5a5 +FIND_ANCHOR_IRIS [federation] 802d35965666 +GET_FLOWLINE_GEOMETRIES [federation] 337d970b0f07 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] da7010fa25fd +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream(30km) facilities [ME on A] +FIND_TARGET_IRIS [federation] 242afddb2669 +FIND_ANCHOR_IRIS [federation] 748a8ca41a32 +GET_FLOWLINE_GEOMETRIES [federation] 8becca5939ec +HYDRATE_TARGET_BY_IRI [federation] af3062364f60 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream(30km) facilities [ME on C] +FIND_TARGET_IRIS [federation] ab7cba78e7a4 +FIND_ANCHOR_IRIS [federation] e710b494417c +GET_FLOWLINE_GEOMETRIES [federation] 8becca5939ec +HYDRATE_TARGET_BY_IRI [federation] 719474b95b24 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream(30km) facilities [ME on A] +FIND_TARGET_IRIS [federation] e5836fc46bf4 +FIND_ANCHOR_IRIS [federation] a0d6980914ac +GET_FLOWLINE_GEOMETRIES [federation] 53706371792a +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 5a01b1674751 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream(30km) facilities [ME on C] +FIND_TARGET_IRIS [federation] 5c5c06fd1d35 +FIND_ANCHOR_IRIS [federation] 1b7220b76dc0 +GET_FLOWLINE_GEOMETRIES [federation] 53706371792a +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 9c03aae08c7b +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream(30km) waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 07f85ea74c11 +FIND_ANCHOR_IRIS [federation] e93784de47f2 +GET_FLOWLINE_GEOMETRIES [federation] 22b41e20cf91 +HYDRATE_TARGET_BY_IRI [federation] 83a09bfc0c0a +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream(30km) waterBodies [ME on C] +FIND_TARGET_IRIS [federation] ca528e8925b8 +FIND_ANCHOR_IRIS [federation] 3691010af47d +GET_FLOWLINE_GEOMETRIES [federation] 22b41e20cf91 +HYDRATE_TARGET_BY_IRI [federation] 19c1603fd525 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream(30km) waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 8d3c6166926c +FIND_ANCHOR_IRIS [federation] 3a2bb0cd96e0 +GET_FLOWLINE_GEOMETRIES [federation] b97f4349ba61 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 74340ac75507 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream(30km) waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 77f682fb65ef +FIND_ANCHOR_IRIS [federation] 13bb3ff18f50 +GET_FLOWLINE_GEOMETRIES [federation] b97f4349ba61 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [federation] 1b55c84eb49b +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream(30km) wells [ME on A] +FIND_TARGET_IRIS [federation] 163001e80cdb +FIND_ANCHOR_IRIS [federation] dcf4ba3a467c +GET_FLOWLINE_GEOMETRIES [federation] f9af91a7570a +HYDRATE_TARGET_BY_IRI [federation] aa5fdb59ec6f +HYDRATE_ANCHOR_BY_IRI [federation] 24b7baa84045 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream(30km) wells [ME on C] +FIND_TARGET_IRIS [federation] 7d5fd908795e +FIND_ANCHOR_IRIS [federation] 119afb444b62 +GET_FLOWLINE_GEOMETRIES [federation] f9af91a7570a +HYDRATE_TARGET_BY_IRI [federation] 29547f75bee0 +HYDRATE_ANCHOR_BY_IRI [federation] 977ce19228f3 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream(30km) wells [ME on A] +FIND_TARGET_IRIS [federation] 7d5fd908795e +FIND_ANCHOR_IRIS [federation] 119afb444b62 +GET_FLOWLINE_GEOMETRIES [federation] f9af91a7570a +HYDRATE_TARGET_BY_IRI [federation] 29547f75bee0 +HYDRATE_ANCHOR_BY_IRI [federation] 977ce19228f3 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream(30km) wells [ME on C] +FIND_TARGET_IRIS [federation] 163001e80cdb +FIND_ANCHOR_IRIS [federation] dcf4ba3a467c +GET_FLOWLINE_GEOMETRIES [federation] f9af91a7570a +HYDRATE_TARGET_BY_IRI [federation] aa5fdb59ec6f +HYDRATE_ANCHOR_BY_IRI [federation] 24b7baa84045 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream(30km) aquifers [ME on A] +FIND_TARGET_IRIS [federation] f9a94dc1bcc9 +FIND_ANCHOR_IRIS [federation] c90f839ad3a4 +GET_FLOWLINE_GEOMETRIES [federation] 02e163a42cfe +HYDRATE_TARGET_BY_IRI [federation] 000f97199f10 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream(30km) aquifers [ME on C] +FIND_TARGET_IRIS [federation] 93ba832c29d7 +FIND_ANCHOR_IRIS [federation] 8c23d3755445 +GET_FLOWLINE_GEOMETRIES [federation] 02e163a42cfe +HYDRATE_TARGET_BY_IRI [federation] bf2ceb812bdb +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream(30km) aquifers [ME on A] +FIND_TARGET_IRIS [federation] 50a3fd88e46f +FIND_ANCHOR_IRIS [federation] 50e13b4749a3 +GET_FLOWLINE_GEOMETRIES [federation] e4b7f27cdd3e +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 90f83102d132 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream(30km) aquifers [ME on C] +FIND_TARGET_IRIS [federation] 276ce6ba94f0 +FIND_ANCHOR_IRIS [federation] 57420cc1d1e2 +GET_FLOWLINE_GEOMETRIES [federation] e4b7f27cdd3e +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 01821ca119a9 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream(30km) streams [ME on A] +FIND_TARGET_IRIS [federation] 7cb722edd17a +FIND_ANCHOR_IRIS [federation] be142639d65c +HYDRATE_TARGET_BY_IRI [federation] 251a657c96b2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells downstream(30km) streams [ME on C] +FIND_TARGET_IRIS [federation] ceaa643cf456 +FIND_ANCHOR_IRIS [federation] c1449fc486a8 +HYDRATE_TARGET_BY_IRI [federation] ac1966b9691f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream(30km) streams [ME on A] +FIND_TARGET_IRIS [federation] 2fc1e89df154 +FIND_ANCHOR_IRIS [federation] f8efc6828155 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 898bd716c54a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## wells upstream(30km) streams [ME on C] +FIND_TARGET_IRIS [federation] 167778822ddb +FIND_ANCHOR_IRIS [federation] aae1eb735bf1 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 0ab0a62dc232 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream(30km) samples [ME on A] +FIND_TARGET_IRIS [federation] 296a0d00de9e +FIND_ANCHOR_IRIS [federation] 71f036d9cd02 +GET_FLOWLINE_GEOMETRIES [federation] 934aca1f2f29 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream(30km) samples [ME on C] +FIND_TARGET_IRIS [federation] 5109f240a9f0 +FIND_ANCHOR_IRIS [federation] fa5208b4f1f5 +GET_FLOWLINE_GEOMETRIES [federation] 934aca1f2f29 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream(30km) samples [ME on A] +FIND_TARGET_IRIS [federation] 66321d87ce37 +FIND_ANCHOR_IRIS [federation] 2bcc64889ee4 +GET_FLOWLINE_GEOMETRIES [federation] a7ba4bf786b6 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream(30km) samples [ME on C] +FIND_TARGET_IRIS [federation] a548c30613f2 +FIND_ANCHOR_IRIS [federation] 123fa7029db0 +GET_FLOWLINE_GEOMETRIES [federation] a7ba4bf786b6 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream(30km) facilities [ME on A] +FIND_TARGET_IRIS [federation] 027492953f58 +FIND_ANCHOR_IRIS [federation] e1ccb826ce9b +GET_FLOWLINE_GEOMETRIES [federation] e0c43ef101a2 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream(30km) facilities [ME on C] +FIND_TARGET_IRIS [federation] 7087d0c06d24 +FIND_ANCHOR_IRIS [federation] dfffea098028 +GET_FLOWLINE_GEOMETRIES [federation] e0c43ef101a2 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream(30km) facilities [ME on A] +FIND_TARGET_IRIS [federation] c1505f76d1a2 +FIND_ANCHOR_IRIS [federation] 78d85e00dcd9 +GET_FLOWLINE_GEOMETRIES [federation] 5bb2d62da8a0 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream(30km) facilities [ME on C] +FIND_TARGET_IRIS [federation] be59394dac59 +FIND_ANCHOR_IRIS [federation] da77e9a226ae +GET_FLOWLINE_GEOMETRIES [federation] 5bb2d62da8a0 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream(30km) waterBodies [ME on A] +FIND_TARGET_IRIS [federation] c1711127344f +FIND_ANCHOR_IRIS [federation] 794a5c139565 +GET_FLOWLINE_GEOMETRIES [federation] 1b2c8dc5e4e2 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream(30km) waterBodies [ME on C] +FIND_TARGET_IRIS [federation] bd10519b155e +FIND_ANCHOR_IRIS [federation] 6ad2a8fa8e74 +GET_FLOWLINE_GEOMETRIES [federation] 1b2c8dc5e4e2 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream(30km) waterBodies [ME on A] +FIND_TARGET_IRIS [federation] 96f67a03be24 +FIND_ANCHOR_IRIS [federation] 90d82873e3c0 +GET_FLOWLINE_GEOMETRIES [federation] b3c1864cf554 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream(30km) waterBodies [ME on C] +FIND_TARGET_IRIS [federation] ee66561a00f7 +FIND_ANCHOR_IRIS [federation] 02fc7f5ebfab +GET_FLOWLINE_GEOMETRIES [federation] b3c1864cf554 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream(30km) wells [ME on A] +FIND_TARGET_IRIS [federation] 276ce6ba94f0 +FIND_ANCHOR_IRIS [federation] 57420cc1d1e2 +GET_FLOWLINE_GEOMETRIES [federation] e4b7f27cdd3e +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 01821ca119a9 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream(30km) wells [ME on C] +FIND_TARGET_IRIS [federation] 50a3fd88e46f +FIND_ANCHOR_IRIS [federation] 50e13b4749a3 +GET_FLOWLINE_GEOMETRIES [federation] e4b7f27cdd3e +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [federation] 90f83102d132 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream(30km) wells [ME on A] +FIND_TARGET_IRIS [federation] 93ba832c29d7 +FIND_ANCHOR_IRIS [federation] 8c23d3755445 +GET_FLOWLINE_GEOMETRIES [federation] 02e163a42cfe +HYDRATE_TARGET_BY_IRI [federation] bf2ceb812bdb +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream(30km) wells [ME on C] +FIND_TARGET_IRIS [federation] f9a94dc1bcc9 +FIND_ANCHOR_IRIS [federation] c90f839ad3a4 +GET_FLOWLINE_GEOMETRIES [federation] 02e163a42cfe +HYDRATE_TARGET_BY_IRI [federation] 000f97199f10 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream(30km) aquifers [ME on A] +FIND_TARGET_IRIS [federation] d0422a3a1b39 +FIND_ANCHOR_IRIS [federation] 5a98acf98b84 +GET_FLOWLINE_GEOMETRIES [federation] 18a6e65f767f +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream(30km) aquifers [ME on C] +FIND_TARGET_IRIS [federation] e933a835c975 +FIND_ANCHOR_IRIS [federation] 19a47153e361 +GET_FLOWLINE_GEOMETRIES [federation] 18a6e65f767f +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream(30km) aquifers [ME on A] +FIND_TARGET_IRIS [federation] e933a835c975 +FIND_ANCHOR_IRIS [federation] 19a47153e361 +GET_FLOWLINE_GEOMETRIES [federation] 18a6e65f767f +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream(30km) aquifers [ME on C] +FIND_TARGET_IRIS [federation] d0422a3a1b39 +FIND_ANCHOR_IRIS [federation] 5a98acf98b84 +GET_FLOWLINE_GEOMETRIES [federation] 18a6e65f767f +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream(30km) streams [ME on A] +FIND_TARGET_IRIS [federation] 5dfec1ecf571 +FIND_ANCHOR_IRIS [federation] 74f6726cb460 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers downstream(30km) streams [ME on C] +FIND_TARGET_IRIS [federation] bba05a0302fc +FIND_ANCHOR_IRIS [federation] 6a8f8b9351bc +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream(30km) streams [ME on A] +FIND_TARGET_IRIS [federation] 36f3da58361d +FIND_ANCHOR_IRIS [federation] a79808637aab +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## aquifers upstream(30km) streams [ME on C] +FIND_TARGET_IRIS [federation] 1c7638f408b9 +FIND_ANCHOR_IRIS [federation] b58c8c35f1eb +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream(30km) samples [ME on A] +FIND_TARGET_IRIS [federation] b4008588edaf +FIND_ANCHOR_IRIS [federation] 6ac9015a260c +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream(30km) samples [ME on C] +FIND_TARGET_IRIS [federation] ac7ebc96d761 +FIND_ANCHOR_IRIS [federation] fc48809955c6 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream(30km) samples [ME on A] +FIND_TARGET_IRIS [federation] 614ca43f8807 +FIND_ANCHOR_IRIS [federation] 3ac013fb1120 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream(30km) samples [ME on C] +FIND_TARGET_IRIS [federation] 55f5714d004c +FIND_ANCHOR_IRIS [federation] 27a652bc4a63 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream(30km) facilities [ME on A] +FIND_TARGET_IRIS [federation] 1f724fa39386 +FIND_ANCHOR_IRIS [federation] 8138a7e702af +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream(30km) facilities [ME on C] +FIND_TARGET_IRIS [federation] e792abfe6ef8 +FIND_ANCHOR_IRIS [federation] 10dbee777757 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream(30km) facilities [ME on A] +FIND_TARGET_IRIS [federation] a7c3f2ccff0c +FIND_ANCHOR_IRIS [federation] cc4b39ebe0a2 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream(30km) facilities [ME on C] +FIND_TARGET_IRIS [federation] 37c324b2fb11 +FIND_ANCHOR_IRIS [federation] dda55e8be700 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream(30km) waterBodies [ME on A] +FIND_TARGET_IRIS [federation] c339d1c42d50 +FIND_ANCHOR_IRIS [federation] 423d5033fc48 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream(30km) waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 82022c612381 +FIND_ANCHOR_IRIS [federation] 5151a972eede +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 196733917305 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream(30km) waterBodies [ME on A] +FIND_TARGET_IRIS [federation] b6f2102221d1 +FIND_ANCHOR_IRIS [federation] 9a0037a928d9 +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream(30km) waterBodies [ME on C] +FIND_TARGET_IRIS [federation] 970a4ae75376 +FIND_ANCHOR_IRIS [federation] b57ca9e8c32e +HYDRATE_TARGET_BY_IRI [hydrologykg] 3b88da2bc6f2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream(30km) wells [ME on A] +FIND_TARGET_IRIS [federation] 167778822ddb +FIND_ANCHOR_IRIS [federation] aae1eb735bf1 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 0ab0a62dc232 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream(30km) wells [ME on C] +FIND_TARGET_IRIS [federation] 2fc1e89df154 +FIND_ANCHOR_IRIS [federation] f8efc6828155 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [federation] 898bd716c54a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream(30km) wells [ME on A] +FIND_TARGET_IRIS [federation] ceaa643cf456 +FIND_ANCHOR_IRIS [federation] c1449fc486a8 +HYDRATE_TARGET_BY_IRI [federation] ac1966b9691f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream(30km) wells [ME on C] +FIND_TARGET_IRIS [federation] 7cb722edd17a +FIND_ANCHOR_IRIS [federation] be142639d65c +HYDRATE_TARGET_BY_IRI [federation] 251a657c96b2 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream(30km) aquifers [ME on A] +FIND_TARGET_IRIS [federation] 1c7638f408b9 +FIND_ANCHOR_IRIS [federation] b58c8c35f1eb +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream(30km) aquifers [ME on C] +FIND_TARGET_IRIS [federation] 36f3da58361d +FIND_ANCHOR_IRIS [federation] a79808637aab +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream(30km) aquifers [ME on A] +FIND_TARGET_IRIS [federation] bba05a0302fc +FIND_ANCHOR_IRIS [federation] 6a8f8b9351bc +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream(30km) aquifers [ME on C] +FIND_TARGET_IRIS [federation] 5dfec1ecf571 +FIND_ANCHOR_IRIS [federation] 74f6726cb460 +HYDRATE_TARGET_BY_IRI [hydrologykg] eb3b32e6b88d +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream(30km) streams [ME on A] +FIND_TARGET_IRIS [federation] ff4f5433385d +FIND_ANCHOR_IRIS [federation] 8e0f26314aa4 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams downstream(30km) streams [ME on C] +FIND_TARGET_IRIS [federation] 13b885df21d2 +FIND_ANCHOR_IRIS [federation] 2b58e51b6c3d +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream(30km) streams [ME on A] +FIND_TARGET_IRIS [federation] 13b885df21d2 +FIND_ANCHOR_IRIS [federation] 2b58e51b6c3d +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## streams upstream(30km) streams [ME on C] +FIND_TARGET_IRIS [federation] ff4f5433385d +FIND_ANCHOR_IRIS [federation] 8e0f26314aa4 +HYDRATE_TARGET_BY_IRI [hydrologykg] 373c4f087d16 +HYDRATE_ANCHOR_BY_IRI [hydrologykg] aeb350c37047 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## VARIANT: near hops=0 +FIND_TARGET_IRIS [federation] a01b1b84351c +FIND_ANCHOR_IRIS [federation] 5c0972841eb9 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## VARIANT: near hops=2 +FIND_TARGET_IRIS [federation] 396a2519092b +FIND_ANCHOR_IRIS [federation] aadf4d36b6ad +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## VARIANT: near hops=4 +FIND_TARGET_IRIS [federation] c8190383299a +FIND_ANCHOR_IRIS [federation] edaa65a35aac +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## VARIANT: downstream maxDistanceKm=10 +FIND_TARGET_IRIS [federation] 3325fb88c1d7 +FIND_ANCHOR_IRIS [federation] 74c3d0bb8bf8 +GET_FLOWLINE_GEOMETRIES [federation] 91f383f2621e +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## VARIANT: upstream maxDistanceKm=10 +FIND_TARGET_IRIS [federation] 061fd7e20e08 +FIND_ANCHOR_IRIS [federation] 875d5698ab94 +GET_FLOWLINE_GEOMETRIES [federation] d7635cc00d76 +HYDRATE_TARGET_BY_IRI [federation] 7b8a451b6ce6 +HYDRATE_ANCHOR_BY_IRI [federation] 48bc512f5a3a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## VARIANT: PI question: facilities upstream from PFOS samples in York, detections only +FIND_TARGET_IRIS [federation] 8cb4f136fa6e +FIND_ANCHOR_IRIS [federation] aa8204e520fc +GET_FLOWLINE_GEOMETRIES [federation] 10a063aa6d84 +HYDRATE_TARGET_BY_IRI [federation] 4ef4712a6813 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## VARIANT: PI question, bounded to 30km of flow +FIND_TARGET_IRIS [federation] 1f6c48b09155 +FIND_ANCHOR_IRIS [federation] f996426f75e0 +GET_FLOWLINE_GEOMETRIES [federation] 3c6a4d4ad1b9 +HYDRATE_TARGET_BY_IRI [federation] 4ef4712a6813 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## VARIANT: samples substance filter only +FIND_TARGET_IRIS [federation] fe93660f9298 +FIND_ANCHOR_IRIS [federation] 9ef048145cc3 +GET_FLOWLINE_GEOMETRIES [federation] 10a063aa6d84 +HYDRATE_TARGET_BY_IRI [federation] abac476ba422 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## VARIANT: samples include-nondetects off only +FIND_TARGET_IRIS [federation] 1d4fff471300 +FIND_ANCHOR_IRIS [federation] 64a08a171f7d +GET_FLOWLINE_GEOMETRIES [federation] 10a063aa6d84 +HYDRATE_TARGET_BY_IRI [federation] 18f27c194233 +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## VARIANT: no region either side +FIND_TARGET_IRIS [federation] 129a5d0e306a +FIND_ANCHOR_IRIS [federation] 4dee4c0f482e +GET_FLOWLINE_GEOMETRIES [federation] 10a063aa6d84 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +## VARIANT: county-scoped both sides +FIND_TARGET_IRIS [federation] 8e74bfffca28 +FIND_ANCHOR_IRIS [federation] ea51101cddd0 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [federation] ec6ed949be4d +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## VARIANT: sample filters +FIND_TARGET_IRIS [federation] 3ae8e5cca3a7 +FIND_ANCHOR_IRIS [federation] d9a6c533c502 +GET_FLOWLINE_GEOMETRIES [federation] 10a063aa6d84 +HYDRATE_TARGET_BY_IRI [federation] 225ebb47d1ba +HYDRATE_ANCHOR_BY_IRI [federation] f15a49a11b96 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## VARIANT: facility + water body + well + aquifer filters +FIND_TARGET_IRIS [federation] ff0e8a4e0a65 +FIND_ANCHOR_IRIS [federation] 24db169bc111 +HYDRATE_TARGET_BY_IRI [federation] 9498222e580a +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 025d57e51b2a +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa +## VARIANT: stream ftype filter as target +FIND_TARGET_IRIS [federation] a8825c1ad3c8 +FIND_ANCHOR_IRIS [federation] 744604955bf5 +HYDRATE_TARGET_BY_IRI [federation] 86920d0a3b5f +HYDRATE_ANCHOR_BY_IRI [hydrologykg] 3da8119633c2 +GET_REGION_BOUNDARIES [spatialkg] d52aaecf97fa + +# ---- query bodies, one line per distinct query ---- +000f97199f10 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +003f0f16f9b1 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +01821ca119a9 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +01ac5b24c08f SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +021c99bd21fe SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +025d57e51b2a SELECT DISTINCT ?aquifer ?aquiferType WHERE { VALUES ?aquifer { } ?aquifer rdf:type gwml2:GW_Aquifer . OPTIONAL { ?aquifer saw_water:aquiferType ?aquiferType . } } +027492953f58 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +02e163a42cfe SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?aquiferA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?wellC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +02fc7f5ebfab SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +032ea9425e6f SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +05cd3b39feaf SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +060c1e184a76 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +061fd7e20e08 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(10)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +0667c0004f62 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +06c0038fb4ce SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +07bcc0d2ef5b SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +07f85ea74c11 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +081ffe103105 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?spC ; coso:ofDSSToxSubstance ?substanceC ; coso:analyzedSample ?sampleC ; coso:hasResult ?resultC . ?sampleC coso:sampleOfMaterialType ?matTypeC . ?matTypeC rdfs:label ?matTypeLabelC . ?resultC coso:measurementUnit ?unitC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +08ee3e23c632 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +090aa1368fc6 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +09c1cecf0048 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +09e5950369e5 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +0a29f890a209 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +0ab0a62dc232 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +0bb0f6a91db9 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +0be21b7acfd7 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +0bf72e236353 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +0c695b9c750b SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +0cb147205839 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +0d03523e6c23 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +0d49e383659d SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +0d7cd31e6182 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?aquiferA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?spC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2celltarget . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +0d9fd4f4b10a SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +1084c720a6cc SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +1084e9f48e96 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +10a063aa6d84 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?facilityA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?spC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2celltarget . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +10dbee777757 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } BIND(?ds_flowline AS ?streamC) } +114ec252bd7e SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +1195457ff6d4 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +119afb444b62 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +123fa7029db0 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +129a5d0e306a SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +132f284d8912 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . BIND(?ds_flowline AS ?streamC) } +137df84ed6d2 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?waterBodyA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?aquiferC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +13b885df21d2 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } BIND(?ds_flowline AS ?streamC) } +13bb3ff18f50 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +141d81ecb9ec SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +14e83b4e30cd SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +14f6bfc3ef2b SELECT DISTINCT (?streamA AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +1506d58ef072 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +151ef1e41632 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +153a3a7992c8 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +163001e80cdb SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +167778822ddb SELECT DISTINCT (?streamC AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +17938cd745d9 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +18515c96f78d SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +187c48927d97 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +1890d6fd07a7 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . BIND(?ds_flowline AS ?streamC) } +18a6e65f767f SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?aquiferA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?aquiferC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +18f27c194233 SELECT (COUNT(DISTINCT ?observation) as ?resultCount) (COUNT(DISTINCT ?sample) as ?sampleCount) (MAX(?numericResult) as ?max) (GROUP_CONCAT(DISTINCT ?substance; separator="; ") as ?substances) (GROUP_CONCAT(DISTINCT ?matTypeLabel; separator="; ") as ?materials) (SAMPLE(?spName) as ?samplePointName) ?sp ?spWKT ?s2cell WHERE { VALUES ?sp { } ?sp spatial:connectedTo ?s2cell ; geo:hasGeometry/geo:asWKT ?spWKT . OPTIONAL { ?sp rdfs:label ?spName } ?s2cell rdf:type kwg-ont:S2Cell_Level13 . ?observation rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?sp ; coso:ofDSSToxSubstance ?substance ; coso:analyzedSample ?sample ; coso:hasResult ?result . ?sample rdfs:label ?sampleLabel ; coso:sampleOfMaterialType ?matType . ?matType rdfs:label ?matTypeLabel . OPTIONAL { ?result qudt:quantityValue/qudt:numericValue ?numericResult } OPTIONAL { ?result qudt:quantityValue ?_qv . ?_qv rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetect) } BIND(COALESCE(STR(?numericResult), IF(BOUND(?nonDetect), "non-detect", "non-quantified")) AS ?result_value) FILTER(BOUND(?numericResult)) } GROUP BY ?sp ?spWKT ?s2cell +192ca0747233 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +196733917305 SELECT DISTINCT ?waterBody ?wbWKT ?wbName ?ftype ?comid ?reachcode ?fcode ?s2cell WHERE { VALUES ?waterBody { } ?s2cell spatial:connectedTo ?waterBody ; rdf:type kwg-ont:S2Cell_Level13 . ?waterBody rdf:type hyf:HY_WaterBody ; geo:hasGeometry/geo:asWKT ?wbWKT . OPTIONAL { ?waterBody schema:name ?wbName . } OPTIONAL { ?waterBody nhdplusv2:hasFTYPE ?ftype . } OPTIONAL { ?waterBody nhdplusv2:hasCOMID ?comid . } OPTIONAL { ?waterBody nhdplusv2:hasReachCode ?reachcode . } OPTIONAL { ?waterBody nhdplusv2:hasFCODE ?fcode . } } +19a47153e361 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +19c1603fd525 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +1a0e0369b410 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +1b2c8dc5e4e2 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?waterBodyA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?aquiferC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +1b55c84eb49b SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +1b7220b76dc0 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +1b7a89412729 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +1bce75dee487 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +1beadb689ecd SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +1c5477f4a20d SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +1c7638f408b9 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +1d4fff471300 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC coso:observedAtSamplePoint ?spC . ?observationC coso:hasResult ?resultC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) FILTER(BOUND(?numericResultC)) ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +1da7ac18c1ca SELECT DISTINCT (?streamC AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +1efed1c496e5 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +1f6c48b09155 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23031 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC coso:observedAtSamplePoint ?spC . ?observationC coso:ofDSSToxSubstance ?substanceC . ?observationC coso:hasResult ?resultC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) VALUES ?substanceC { } FILTER(BOUND(?numericResultC)) ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23031 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC coso:observedAtSamplePoint ?spC . ?observationC coso:ofDSSToxSubstance ?substanceC . ?observationC coso:hasResult ?resultC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) VALUES ?substanceC { } FILTER(BOUND(?numericResultC)) ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +1f724fa39386 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +208b7a3a6317 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +20f966337069 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +21aab4d7bdf7 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +223115ac5eb1 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +225ebb47d1ba SELECT (COUNT(DISTINCT ?observation) as ?resultCount) (COUNT(DISTINCT ?sample) as ?sampleCount) (MAX(?numericResult) as ?max) (GROUP_CONCAT(DISTINCT ?substance; separator="; ") as ?substances) (GROUP_CONCAT(DISTINCT ?matTypeLabel; separator="; ") as ?materials) (SAMPLE(?spName) as ?samplePointName) ?sp ?spWKT ?s2cell WHERE { VALUES ?sp { } ?sp spatial:connectedTo ?s2cell ; geo:hasGeometry/geo:asWKT ?spWKT . OPTIONAL { ?sp rdfs:label ?spName } ?s2cell rdf:type kwg-ont:S2Cell_Level13 . ?observation rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?sp ; coso:ofDSSToxSubstance ?substance ; coso:analyzedSample ?sample ; coso:hasResult ?result . ?sample rdfs:label ?sampleLabel ; coso:sampleOfMaterialType ?matType . ?matType rdfs:label ?matTypeLabel . ?result coso:measurementUnit ?unit . OPTIONAL { ?result qudt:quantityValue/qudt:numericValue ?numericResult } OPTIONAL { ?result qudt:quantityValue ?_qv . ?_qv rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetect) } BIND(COALESCE(STR(?numericResult), IF(BOUND(?nonDetect), "non-detect", "non-quantified")) AS ?result_value) VALUES ?substance { } VALUES ?matType { } BIND(xsd:decimal(?numericResult) as ?numericValue) FILTER(BOUND(?numericValue) && ?unit = && ?numericValue >= 4 && ?numericValue <= 100) } GROUP BY ?sp ?spWKT ?s2cell +22b41e20cf91 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?waterBodyA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?wellC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +22c02f8cd68b SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +2372d3380521 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +23e64482073d SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?facilityA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?aquiferC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +242afddb2669 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +24b7baa84045 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +24db169bc111 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?aquiferA saw_water:aquiferType ?aqTypeA . VALUES ?aqTypeA { "bedrock" } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type me_mgs:MGS-Well . ?wellC me_mgs:hasUse ?wuC . VALUES ?wuC { } } } +24e2d640eb8b SELECT DISTINCT (?streamC AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +251a657c96b2 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +25554a2d770e SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +25764463de3a SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +258e1bb27b55 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +25e35a116a7a SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +26597fe15d0e SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +26bf05053779 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +26ef89af73d7 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +276ce6ba94f0 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +27a652bc4a63 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +288129aa4dbe SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?waterBodyA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?spC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2celltarget . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +294457930c79 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +29547f75bee0 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +296a0d00de9e SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +29735aa2afea SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . BIND(?ds_flowline AS ?streamC) } +2a2add9e3c26 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +2ab8259a58d6 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +2b48a40c896d SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +2b58e51b6c3d SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } BIND(?ds_flowline AS ?streamC) } +2bc13625bc04 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +2bcc64889ee4 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +2bec684879ca SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +2c9b021c5ece SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +2e32c0ffbc3c SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +2ecade927c68 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +2ece82229dce SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +2f7c9d07ed1a SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +2f9aec17c4e9 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +2fc1e89df154 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } BIND(?ds_flowline AS ?streamC) } +2fdb9d27c845 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +2fe8928c9eac SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +30b8f06aa807 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +31d0f4e2be6f SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +320b9d0e5ff8 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +32747a1b563b SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +32cbf641e1bc SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +32f1aa55d0ea SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +3325fb88c1d7 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(10)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +337d970b0f07 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?wellA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?spC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2celltarget . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +33e4f401a9db SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +3484afc2016f SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +35e5e0379327 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?observationA rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?spA ; coso:ofDSSToxSubstance ?substanceA ; coso:analyzedSample ?sampleA ; coso:hasResult ?resultA . ?sampleA coso:sampleOfMaterialType ?matTypeA . ?matTypeA rdfs:label ?matTypeLabelA . ?resultA coso:measurementUnit ?unitA . OPTIONAL { ?resultA qudt:quantityValue/qudt:numericValue ?numericResultA } OPTIONAL { ?resultA qudt:quantityValue ?_qvA . ?_qvA rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectA) } BIND(COALESCE(STR(?numericResultA), IF(BOUND(?nonDetectA), "non-detect", "non-quantified")) AS ?result_valueA) ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +35eea760e846 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +3691010af47d SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +36f3da58361d SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } BIND(?ds_flowline AS ?streamC) } +3735b227534b SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +373c4f087d16 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { VALUES ?flowline { } ?flowline rdf:type hyf:HY_FlowPath ; geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +377f854f6cc6 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +37c324b2fb11 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +38cb444f42f8 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +39419051512e SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +396a2519092b SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor (kwg-ont:sfTouches | owl:sameAs)/(kwg-ont:sfTouches | owl:sameAs) ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +39f68d9178a5 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +3a19b33e3025 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +3a2bb0cd96e0 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +3a5de06aa701 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . BIND(?ds_flowline AS ?streamC) } +3ac013fb1120 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +3ae8e5cca3a7 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC coso:observedAtSamplePoint ?spC . ?observationC coso:ofDSSToxSubstance ?substanceC . ?observationC coso:analyzedSample ?sampleC . ?sampleC coso:sampleOfMaterialType ?matTypeC . ?observationC coso:hasResult ?resultC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) ?resultC coso:measurementUnit ?unitC . VALUES ?substanceC { } VALUES ?matTypeC { } BIND(xsd:decimal(?numericResultC) as ?numericValueC) FILTER(BOUND(?numericValueC) && ?unitC = && ?numericValueC >= 4 && ?numericValueC <= 100) ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . VALUES ?selectedIndustryA { naics:NAICS-562212 } FILTER(?industryCodeA = ?selectedIndustryA || EXISTS { ?industryCodeA fio:subcodeOf ?selectedIndustryA }) } +3b88da2bc6f2 SELECT DISTINCT ?waterBody ?wbWKT ?wbName ?ftype ?comid ?reachcode ?fcode ?s2cell WHERE { VALUES ?waterBody { } ?s2cell spatial:connectedTo ?waterBody ; rdf:type kwg-ont:S2Cell_Level13 . ?waterBody rdf:type hyf:HY_WaterBody ; geo:hasGeometry/geo:asWKT ?wbWKT . OPTIONAL { ?waterBody schema:name ?wbName . } OPTIONAL { ?waterBody nhdplusv2:hasFTYPE ?ftype . } OPTIONAL { ?waterBody nhdplusv2:hasCOMID ?comid . } OPTIONAL { ?waterBody nhdplusv2:hasReachCode ?reachcode . } OPTIONAL { ?waterBody nhdplusv2:hasFCODE ?fcode . } } +3bcbbc61caae SELECT DISTINCT (?streamC AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +3bce92acebce SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +3c4091f51398 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +3c6a4d4ad1b9 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?facilityA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?spC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2celltarget . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +3cdf1859eeef SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?aquiferA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?aquiferC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +3da8119633c2 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { VALUES ?flowline { } ?flowline rdf:type hyf:HY_FlowPath ; geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } VALUES ?fl_type { "460" } } +3dbb4fd45439 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +3de8c144de70 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +3e4c26e61ee4 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +404c3355f3fd SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . BIND(?ds_flowline AS ?streamC) } +409740b46fb7 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +40a495b7a46a SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +40c7bc3ecc04 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +41ca24011057 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +423d5033fc48 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +42fba0d6b6e4 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +436d3320d910 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +440f71464197 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +454a12d54a4b SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +46bc1db1c4db SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +4786e399d0e3 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +481ef65eaf6e SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +48a5326856de SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +48bc512f5a3a SELECT (COUNT(DISTINCT ?observation) as ?resultCount) (COUNT(DISTINCT ?sample) as ?sampleCount) (MAX(?numericResult) as ?max) (GROUP_CONCAT(DISTINCT ?substance; separator="; ") as ?substances) (GROUP_CONCAT(DISTINCT ?matTypeLabel; separator="; ") as ?materials) (SAMPLE(?spName) as ?samplePointName) ?sp ?spWKT ?s2cell WHERE { VALUES ?sp { } ?sp spatial:connectedTo ?s2cell ; geo:hasGeometry/geo:asWKT ?spWKT . OPTIONAL { ?sp rdfs:label ?spName } ?s2cell rdf:type kwg-ont:S2Cell_Level13 . ?observation rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?sp ; coso:ofDSSToxSubstance ?substance ; coso:analyzedSample ?sample ; coso:hasResult ?result . ?sample rdfs:label ?sampleLabel ; coso:sampleOfMaterialType ?matType . ?matType rdfs:label ?matTypeLabel . OPTIONAL { ?result qudt:quantityValue/qudt:numericValue ?numericResult } OPTIONAL { ?result qudt:quantityValue ?_qv . ?_qv rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetect) } BIND(COALESCE(STR(?numericResult), IF(BOUND(?nonDetect), "non-detect", "non-quantified")) AS ?result_value) } GROUP BY ?sp ?spWKT ?s2cell +4a22e1a87031 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +4ae27f7b3056 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +4b6cc3a024ee SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +4bc79000b146 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?wellA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?wellC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +4ca2878d179f SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +4cd25d8b0a3e SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +4cf300178a3d SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +4d08a3f185ec SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +4dee4c0f482e SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +4e22903dafb8 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +4eb7e82611af SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +4ef4712a6813 SELECT (COUNT(DISTINCT ?observation) as ?resultCount) (COUNT(DISTINCT ?sample) as ?sampleCount) (MAX(?numericResult) as ?max) (GROUP_CONCAT(DISTINCT ?substance; separator="; ") as ?substances) (GROUP_CONCAT(DISTINCT ?matTypeLabel; separator="; ") as ?materials) (SAMPLE(?spName) as ?samplePointName) ?sp ?spWKT ?s2cell WHERE { VALUES ?sp { } ?sp spatial:connectedTo ?s2cell ; geo:hasGeometry/geo:asWKT ?spWKT . OPTIONAL { ?sp rdfs:label ?spName } ?s2cell rdf:type kwg-ont:S2Cell_Level13 . ?observation rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?sp ; coso:ofDSSToxSubstance ?substance ; coso:analyzedSample ?sample ; coso:hasResult ?result . ?sample rdfs:label ?sampleLabel ; coso:sampleOfMaterialType ?matType . ?matType rdfs:label ?matTypeLabel . OPTIONAL { ?result qudt:quantityValue/qudt:numericValue ?numericResult } OPTIONAL { ?result qudt:quantityValue ?_qv . ?_qv rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetect) } BIND(COALESCE(STR(?numericResult), IF(BOUND(?nonDetect), "non-detect", "non-quantified")) AS ?result_value) VALUES ?substance { } FILTER(BOUND(?numericResult)) } GROUP BY ?sp ?spWKT ?s2cell +4f5453f9e32d SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +4feabc0eeaca SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?facilityA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?waterBodyC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +5005fd5c331c SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +50885dc7a1b9 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +50a3fd88e46f SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +50afef424c69 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +50e13b4749a3 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +5109f240a9f0 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +5151a972eede SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } BIND(?ds_flowline AS ?streamC) } +518849e03a5b SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +52f8acbda00d SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?spC ; coso:ofDSSToxSubstance ?substanceC ; coso:analyzedSample ?sampleC ; coso:hasResult ?resultC . ?sampleC coso:sampleOfMaterialType ?matTypeC . ?matTypeC rdfs:label ?matTypeLabelC . ?resultC coso:measurementUnit ?unitC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +53706371792a SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?wellA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?facilityC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +5393441889bb SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +542cd3bf0080 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +54b1d508458d SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +5515bd777411 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?aquiferA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?facilityC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +55f5714d004c SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +56c5b92ab83e SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +56ea6a34453b SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +56f38a86aec7 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . BIND(?ds_flowline AS ?streamC) } +57420cc1d1e2 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +581c48ae304e SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +58c16900aa65 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +592bae86ed3a SELECT DISTINCT (?wellA AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +59aee765110c SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +59b91de5e995 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +5a01b1674751 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +5a03f4f3aae3 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?spA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?spC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2celltarget . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +5a98acf98b84 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +5ab06945d883 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +5abc07c304ad SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +5aedb347a53b SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +5bb2d62da8a0 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?aquiferA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?facilityC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +5c0972841eb9 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . BIND(?s2anchor AS ?s2target) ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +5c5c06fd1d35 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +5c6cc33fae88 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +5dbe52083d8c SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +5de1200d2e01 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?spA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?wellC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +5dfec1ecf571 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +5e175b050654 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +5f95683d03c3 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +60802b6a7386 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?spA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?waterBodyC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +614ca43f8807 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +6203bb98fd9b SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +629f7809931c SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . BIND(?ds_flowline AS ?streamC) } +62aa5619bc67 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +62f130505471 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?facilityA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?wellC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +6316b038687c SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +631a69b1a6a7 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?spC ; coso:ofDSSToxSubstance ?substanceC ; coso:analyzedSample ?sampleC ; coso:hasResult ?resultC . ?sampleC coso:sampleOfMaterialType ?matTypeC . ?matTypeC rdfs:label ?matTypeLabelC . ?resultC coso:measurementUnit ?unitC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +63fd9d8c7d26 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +642252450459 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +64a08a171f7d SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC coso:observedAtSamplePoint ?spC . ?observationC coso:hasResult ?resultC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) FILTER(BOUND(?numericResultC)) ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +6537d90d135f SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +659f6c7fa3f9 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +66321d87ce37 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +663f948f7bf0 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?waterBodyA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?wellC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +666e8b5700a2 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +66b8cb8fd320 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +66c78fc2515a SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +672355872582 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +67b90dec7f24 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +69f0475ae80a SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +6a8f8b9351bc SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +6ac9015a260c SELECT DISTINCT (?spA AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +6ad2a8fa8e74 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +6b0632214d35 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +6b13c5e7d199 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +6b18905b32f2 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +6c90238c34b5 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?spA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?wellC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +6cab754cbe12 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +6cc73e470a1e SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +6da1ed2de01d SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +6dda347a097f SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +6ddb9c48525a SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +6e59770323b3 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +6e6e6eba070d SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?observationA rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?spA ; coso:ofDSSToxSubstance ?substanceA ; coso:analyzedSample ?sampleA ; coso:hasResult ?resultA . ?sampleA coso:sampleOfMaterialType ?matTypeA . ?matTypeA rdfs:label ?matTypeLabelA . ?resultA coso:measurementUnit ?unitA . OPTIONAL { ?resultA qudt:quantityValue/qudt:numericValue ?numericResultA } OPTIONAL { ?resultA qudt:quantityValue ?_qvA . ?_qvA rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectA) } BIND(COALESCE(STR(?numericResultA), IF(BOUND(?nonDetectA), "non-detect", "non-quantified")) AS ?result_valueA) ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +6e78232de987 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +6ed5aed4968a SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +6ede512b148d SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +6f09d7bbdcc7 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +6ff4852b422e SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +70123c8b61f0 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?spA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?waterBodyC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +7087d0c06d24 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +70ac417804f8 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +713a1f7f8ae5 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +714064e8e781 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +719474b95b24 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +71f036d9cd02 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +73511fbb8c8f SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +73934d7aae0d SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +73c37175d3a3 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +74340ac75507 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +744604955bf5 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?streamA nhdplusv2:hasFTYPE ?flFtypeA . VALUES ?flFtypeA { "460" } } +748a8ca41a32 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +74c3d0bb8bf8 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(10)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +74f6726cb460 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +751b01f1248c SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +7530ba837a17 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +7604a06153a0 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +7658df86ebfb SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +776babccec7b SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +77f682fb65ef SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +789f1ded1d8a SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +78d85e00dcd9 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +78dcb9fb3928 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +78e1f8a446f0 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +790b26da2a79 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +794a5c139565 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +79b82d9e0fe1 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?aquiferA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?wellC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +79e0bd042512 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +7aa05f4cf432 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +7ab11f2c9448 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +7b5980388f2c SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?wellA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?waterBodyC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +7b8a451b6ce6 SELECT DISTINCT ?facility ?facWKT ?facilityName ?industryCode ?industryName ?s2cell WHERE { VALUES ?facility { } ?s2cell kwg-ont:sfContains ?facility ; rdf:type kwg-ont:S2Cell_Level13 . ?facility fio:ofIndustry ?industryCode ; geo:hasGeometry/geo:asWKT ?facWKT ; rdfs:label ?facilityName . ?industryCode a naics:NAICS-IndustryCode ; rdfs:label ?industryName . } +7c9c4702ede4 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +7cb722edd17a SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +7d5fd908795e SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +7d7f1e7d7c60 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +7dad41fdfd60 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . BIND(?ds_flowline AS ?streamC) } +802d35965666 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +80df1fdbcf14 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +81325b745fd1 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . BIND(?ds_flowline AS ?streamC) } +8138a7e702af SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +81641e7d1349 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?facilityA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?facilityC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +82022c612381 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } BIND(?ds_flowline AS ?streamC) } +827004d998b2 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +832afed999c2 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +83a09bfc0c0a SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +83d77a45d03c SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +84faebbbe4de SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +8529b7fb6ffa SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +86920d0a3b5f SELECT (COUNT(DISTINCT ?observation) as ?resultCount) (COUNT(DISTINCT ?sample) as ?sampleCount) (MAX(?numericResult) as ?max) (GROUP_CONCAT(DISTINCT ?substance; separator="; ") as ?substances) (GROUP_CONCAT(DISTINCT ?matTypeLabel; separator="; ") as ?materials) (SAMPLE(?spName) as ?samplePointName) ?sp ?spWKT ?s2cell WHERE { VALUES ?sp { } ?sp spatial:connectedTo ?s2cell ; geo:hasGeometry/geo:asWKT ?spWKT . OPTIONAL { ?sp rdfs:label ?spName } ?s2cell rdf:type kwg-ont:S2Cell_Level13 . ?observation rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?sp ; coso:ofDSSToxSubstance ?substance ; coso:analyzedSample ?sample ; coso:hasResult ?result . ?sample rdfs:label ?sampleLabel ; coso:sampleOfMaterialType ?matType . ?matType rdfs:label ?matTypeLabel . OPTIONAL { ?result qudt:quantityValue/qudt:numericValue ?numericResult } OPTIONAL { ?result qudt:quantityValue ?_qv . ?_qv rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetect) } BIND(COALESCE(STR(?numericResult), IF(BOUND(?nonDetect), "non-detect", "non-quantified")) AS ?result_value) } GROUP BY ?sp ?spWKT ?s2cell +86a26ec60121 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +871365cea3c3 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +8758a29be4cd SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +875d5698ab94 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(10)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +878b7218cf7c SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?observationA rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?spA ; coso:ofDSSToxSubstance ?substanceA ; coso:analyzedSample ?sampleA ; coso:hasResult ?resultA . ?sampleA coso:sampleOfMaterialType ?matTypeA . ?matTypeA rdfs:label ?matTypeLabelA . ?resultA coso:measurementUnit ?unitA . OPTIONAL { ?resultA qudt:quantityValue/qudt:numericValue ?numericResultA } OPTIONAL { ?resultA qudt:quantityValue ?_qvA . ?_qvA rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectA) } BIND(COALESCE(STR(?numericResultA), IF(BOUND(?nonDetectA), "non-detect", "non-quantified")) AS ?result_valueA) ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +886826560be6 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +887006d733eb SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +889f03c020e8 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?spA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?facilityC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +88a05eee9640 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +88b94aeb229d SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +88d952d2a2c5 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +8952d69eebf7 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +898bd716c54a SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } BIND(?ds_flowline AS ?streamC) ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +8a0c2df70ce0 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +8a1266fbf3b4 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +8a8df61dddeb SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +8abd2faf7bb0 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +8b7cd81ea5cf SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . BIND(?ds_flowline AS ?streamC) } +8becca5939ec SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?facilityA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?wellC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +8c23d3755445 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +8c6ab3d31bf7 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +8c90b6016e50 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +8cb4f136fa6e SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23031 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC coso:observedAtSamplePoint ?spC . ?observationC coso:ofDSSToxSubstance ?substanceC . ?observationC coso:hasResult ?resultC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) VALUES ?substanceC { } FILTER(BOUND(?numericResultC)) ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +8d3c6166926c SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +8db700fbc3ba SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?spC ; coso:ofDSSToxSubstance ?substanceC ; coso:analyzedSample ?sampleC ; coso:hasResult ?resultC . ?sampleC coso:sampleOfMaterialType ?matTypeC . ?matTypeC rdfs:label ?matTypeLabelC . ?resultC coso:measurementUnit ?unitC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +8dfa184e0d2b SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?observationA rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?spA ; coso:ofDSSToxSubstance ?substanceA ; coso:analyzedSample ?sampleA ; coso:hasResult ?resultA . ?sampleA coso:sampleOfMaterialType ?matTypeA . ?matTypeA rdfs:label ?matTypeLabelA . ?resultA coso:measurementUnit ?unitA . OPTIONAL { ?resultA qudt:quantityValue/qudt:numericValue ?numericResultA } OPTIONAL { ?resultA qudt:quantityValue ?_qvA . ?_qvA rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectA) } BIND(COALESCE(STR(?numericResultA), IF(BOUND(?nonDetectA), "non-detect", "non-quantified")) AS ?result_valueA) ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +8e0f26314aa4 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +8e23014aa73f SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +8e369b7deccc SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +8e74bfffca28 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . VALUES ?_regionA { kwgr:administrativeRegion.USA.23005 kwgr:administrativeRegion.USA.23019 } ?s2anchor spatial:connectedTo ?_regionA . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23019 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +8ef73aad6fa9 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +8f5c7dd5246f SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +8fbe3088c265 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +9039e57855e1 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +907b64185777 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +90d0a0452943 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +90d82873e3c0 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +90f83102d132 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +91f383f2621e SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?facilityA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(10)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?spC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2celltarget . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +920687fc77ed SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +934aca1f2f29 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?spA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?aquiferC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +934d8ac6f612 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +935860c79d56 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +93ba832c29d7 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +93c67796bf6d SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +9498222e580a SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?aquiferA saw_water:aquiferType ?aqTypeA . VALUES ?aqTypeA { "bedrock" } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type me_mgs:MGS-Well . ?wellC me_mgs:hasUse ?wuC . VALUES ?wuC { } } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +94b023ca04bf SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +94d434376702 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +950c0e678218 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +9575a458430b SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +95fe8b8c33ba SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +962a202132fc SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +968075df2792 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +96f67a03be24 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +970a4ae75376 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +977ce19228f3 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +9813a80e0c5a SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +98b1603dafe4 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +98d7c72d4aab SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +9968e7786c81 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +99dd9196dcc8 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +9a0037a928d9 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +9a08433a48e0 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?wellA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?aquiferC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +9b750fdb6a09 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +9ba66fec62a1 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +9c03aae08c7b SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +9c73285f224c SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +9e253e2c142d SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?spA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?spC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2celltarget . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +9e8aee90f1eb SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +9ef048145cc3 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC coso:observedAtSamplePoint ?spC . ?observationC coso:ofDSSToxSubstance ?substanceC . VALUES ?substanceC { } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +9f5c1bba715e SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +9f955f3f75d5 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?facilityA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?waterBodyC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +a01b1b84351c SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . BIND(?s2anchor AS ?s2target) ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +a0d6980914ac SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +a1a3610cba42 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +a28356585b79 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?aquiferA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?waterBodyC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +a3823ffd8794 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +a3ac25aca5df SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +a408ff1eb89d SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +a4e3147c72d7 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +a4f6491c0e2c SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?spA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?facilityC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +a548c30613f2 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +a62588d4bcb9 SELECT DISTINCT (?spA AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +a735c3a3bff6 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +a79808637aab SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } BIND(?ds_flowline AS ?streamC) } +a7b1fa7dc839 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +a7b4475fa918 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +a7ba4bf786b6 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?aquiferA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?spC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2celltarget . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +a7c3f2ccff0c SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +a7e872d51a0f SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +a8825c1ad3c8 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?streamA nhdplusv2:hasFTYPE ?flFtypeA . VALUES ?flFtypeA { "460" } } +a963e5be882c SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +a99936a88d0b SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +aa5fdb59ec6f SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +aa8204e520fc SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23031 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC coso:observedAtSamplePoint ?spC . ?observationC coso:ofDSSToxSubstance ?substanceC . ?observationC coso:hasResult ?resultC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) VALUES ?substanceC { } FILTER(BOUND(?numericResultC)) ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +aadf4d36b6ad SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor (kwg-ont:sfTouches | owl:sameAs)/(kwg-ont:sfTouches | owl:sameAs) ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +aae1eb735bf1 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +ab4e12addc23 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +ab7cba78e7a4 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +abac476ba422 SELECT (COUNT(DISTINCT ?observation) as ?resultCount) (COUNT(DISTINCT ?sample) as ?sampleCount) (MAX(?numericResult) as ?max) (GROUP_CONCAT(DISTINCT ?substance; separator="; ") as ?substances) (GROUP_CONCAT(DISTINCT ?matTypeLabel; separator="; ") as ?materials) (SAMPLE(?spName) as ?samplePointName) ?sp ?spWKT ?s2cell WHERE { VALUES ?sp { } ?sp spatial:connectedTo ?s2cell ; geo:hasGeometry/geo:asWKT ?spWKT . OPTIONAL { ?sp rdfs:label ?spName } ?s2cell rdf:type kwg-ont:S2Cell_Level13 . ?observation rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?sp ; coso:ofDSSToxSubstance ?substance ; coso:analyzedSample ?sample ; coso:hasResult ?result . ?sample rdfs:label ?sampleLabel ; coso:sampleOfMaterialType ?matType . ?matType rdfs:label ?matTypeLabel . OPTIONAL { ?result qudt:quantityValue/qudt:numericValue ?numericResult } OPTIONAL { ?result qudt:quantityValue ?_qv . ?_qv rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetect) } BIND(COALESCE(STR(?numericResult), IF(BOUND(?nonDetect), "non-detect", "non-quantified")) AS ?result_value) VALUES ?substance { } } GROUP BY ?sp ?spWKT ?s2cell +ac1966b9691f SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +ac7ebc96d761 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } BIND(?ds_flowline AS ?streamC) } +ac87cac97a08 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +ade4600c7066 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +aeb350c37047 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { VALUES ?flowline { } ?flowline rdf:type hyf:HY_FlowPath ; geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +aec41960948e SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +af3062364f60 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +b0335b863895 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +b0f01594fdb4 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +b0f1db6f8073 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +b22e14df0511 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . BIND(?ds_flowline AS ?streamC) } +b2a4e26f4048 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +b2a9610b7c52 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +b3c1864cf554 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?aquiferA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?waterBodyC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +b4008588edaf SELECT DISTINCT (?streamC AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +b43c08af1964 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +b44db2e80018 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +b45c05b3136a SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +b57ca9e8c32e SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +b58c8c35f1eb SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +b679bd47f6b1 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +b6893ae200af SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +b6983d91a529 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +b6d4297f115e SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +b6f2102221d1 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +b6f61e4f4ff3 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?wellA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?spC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2celltarget . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +b7423f86a11e SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +b948c1dadad5 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?spC ; coso:ofDSSToxSubstance ?substanceC ; coso:analyzedSample ?sampleC ; coso:hasResult ?resultC . ?sampleC coso:sampleOfMaterialType ?matTypeC . ?matTypeC rdfs:label ?matTypeLabelC . ?resultC coso:measurementUnit ?unitC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +b97f4349ba61 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?wellA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?waterBodyC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +b9d0126bda7a SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +b9d52f76c5da SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +ba778257a97f SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +ba8393ad2e9d SELECT DISTINCT (?streamC AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +bac0c29c4f57 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +bba05a0302fc SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +bba7273cdba4 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +bc5e31538d28 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +bd10519b155e SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +bd4eab4c6f66 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +be142639d65c SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +be1b15d1b106 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +be59394dac59 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +bea267f2f762 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +bea7dc72f773 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +bf2ceb812bdb SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +bf6a1a426eb1 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . BIND(?ds_flowline AS ?streamC) ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +bf8ffdfa1ad9 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?facilityA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?facilityC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +c06847a4af0d SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +c0f56f77ba8f SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +c1449fc486a8 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +c1505f76d1a2 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +c1711127344f SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +c339d1c42d50 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +c35d18356b27 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +c36613529a50 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +c449e2e870bf SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +c498321cc486 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +c547f4e0656f SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +c5ae9f5fc826 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +c5ba856ac5a5 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +c6129be91792 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +c668a2061d6c SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +c80d21e0d32d SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +c8190383299a SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches/kwg-ont:sfTouches/kwg-ont:sfTouches/kwg-ont:sfTouches ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +c8295f7305c1 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?waterBodyA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?waterBodyC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +c85fdb421ca6 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +c8b9648ad9ad SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +c90f839ad3a4 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +c9531cc6fbe2 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?observationA rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?spA ; coso:ofDSSToxSubstance ?substanceA ; coso:analyzedSample ?sampleA ; coso:hasResult ?resultA . ?sampleA coso:sampleOfMaterialType ?matTypeA . ?matTypeA rdfs:label ?matTypeLabelA . ?resultA coso:measurementUnit ?unitA . OPTIONAL { ?resultA qudt:quantityValue/qudt:numericValue ?numericResultA } OPTIONAL { ?resultA qudt:quantityValue ?_qvA . ?_qvA rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectA) } BIND(COALESCE(STR(?numericResultA), IF(BOUND(?nonDetectA), "non-detect", "non-quantified")) AS ?result_valueA) ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?observationA rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?spA ; coso:ofDSSToxSubstance ?substanceA ; coso:analyzedSample ?sampleA ; coso:hasResult ?resultA . ?sampleA coso:sampleOfMaterialType ?matTypeA . ?matTypeA rdfs:label ?matTypeLabelA . ?resultA coso:measurementUnit ?unitA . OPTIONAL { ?resultA qudt:quantityValue/qudt:numericValue ?numericResultA } OPTIONAL { ?resultA qudt:quantityValue ?_qvA . ?_qvA rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectA) } BIND(COALESCE(STR(?numericResultA), IF(BOUND(?nonDetectA), "non-detect", "non-quantified")) AS ?result_valueA) ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +ca1086992b60 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +ca528e8925b8 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +cb961f64c07f SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +cbb05158da0c SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +cc4b39ebe0a2 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +cd1d79f23ba8 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +cd57b7a763e6 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?waterBodyA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?waterBodyC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +cdddd6bdf1d7 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +ce0c65a4578d SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +ceaa643cf456 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +cf073b1ce3f0 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +cf808bb25a1f SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +cfe6f604cde9 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?waterBodyA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?facilityC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +d01ac74e4cc0 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +d0422a3a1b39 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +d1b9348ef98d SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +d271f8200100 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +d2b20fc4e76d SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +d2cd8e8cafdf SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +d335a3eda455 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +d4ff9a18f9cf SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +d52aaecf97fa SELECT ?region (SAMPLE(?_name) AS ?regionName) (SAMPLE(?_wkt) AS ?regionWKT) WHERE { ?region kwg-ont:administrativePartOf kwgr:administrativeRegion.USA.23 ; rdfs:label ?_name ; geo:hasGeometry/geo:asWKT ?_wkt . FILTER(STRSTARTS(STR(?region), STR(kwgr:))) } GROUP BY ?region +d58893c96966 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +d7635cc00d76 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?spA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(10)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?facilityC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +d7ee9691da5b SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?waterBodyA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?spC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2celltarget . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +d913d9d71840 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +d98072521790 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +d9a6c533c502 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC coso:observedAtSamplePoint ?spC . ?observationC coso:ofDSSToxSubstance ?substanceC . ?observationC coso:analyzedSample ?sampleC . ?sampleC coso:sampleOfMaterialType ?matTypeC . ?observationC coso:hasResult ?resultC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) ?resultC coso:measurementUnit ?unitC . VALUES ?substanceC { } VALUES ?matTypeC { } BIND(xsd:decimal(?numericResultC) as ?numericValueC) FILTER(BOUND(?numericValueC) && ?unitC = && ?numericValueC >= 4 && ?numericValueC <= 100) ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . VALUES ?selectedIndustryA { naics:NAICS-562212 } FILTER(?industryCodeA = ?selectedIndustryA || EXISTS { ?industryCodeA fio:subcodeOf ?selectedIndustryA }) } +da7010fa25fd SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?spC ; coso:ofDSSToxSubstance ?substanceC ; coso:analyzedSample ?sampleC ; coso:hasResult ?resultC . ?sampleC coso:sampleOfMaterialType ?matTypeC . ?matTypeC rdfs:label ?matTypeLabelC . ?resultC coso:measurementUnit ?unitC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?spC ; coso:ofDSSToxSubstance ?substanceC ; coso:analyzedSample ?sampleC ; coso:hasResult ?resultC . ?sampleC coso:sampleOfMaterialType ?matTypeC . ?matTypeC rdfs:label ?matTypeLabelC . ?resultC coso:measurementUnit ?unitC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +da77e9a226ae SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +daae4206ce0f SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +daaf4827bae1 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +dc18ede4eeac SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +dc4d5d46d3f1 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } +dc584e6cfe79 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +dcf4ba3a467c SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +dd8ee4b54845 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +dda55e8be700 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +ddfaa9f20f19 SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +dfffea098028 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +e0c43ef101a2 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?facilityA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?aquiferC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +e0d3a87dd863 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +e0f406bc2dd6 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +e0f6624fc264 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +e13c4295e7b0 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +e1ccb826ce9b SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +e238ca8606c2 SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +e2b3d9f8c117 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +e30770406b41 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +e3bb217bc214 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +e45a36c23efe SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +e466cf40dd85 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +e4b7f27cdd3e SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?wellA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?aquiferC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +e5376ca0aa0a SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . BIND(?ds_flowline AS ?streamC) } +e5836fc46bf4 SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +e68708fa1d30 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +e6e5f175099a SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +e6eca666d07e SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +e710b494417c SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +e792abfe6ef8 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } BIND(?ds_flowline AS ?streamC) } +e7e2854c8ae7 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +e8b95c8c5b5d SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +e933a835c975 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +e93784de47f2 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +e9b13461268b SELECT DISTINCT (?aquiferA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +ea51101cddd0 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . VALUES ?_regionA { kwgr:administrativeRegion.USA.23005 kwgr:administrativeRegion.USA.23019 } ?s2anchor spatial:connectedTo ?_regionA . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23019 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +ea51a457af43 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +eb3b32e6b88d SELECT DISTINCT ?aquifer ?aquiferType WHERE { VALUES ?aquifer { } ?aquifer rdf:type gwml2:GW_Aquifer . OPTIONAL { ?aquifer saw_water:aquiferType ?aquiferType . } } +eb7c41d74f46 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +ebbacce57f0e SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?spA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?aquiferC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +ebbb13c13f83 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +ec6ed949be4d SELECT DISTINCT ?facility ?facWKT ?facilityName ?industryCode ?industryName ?s2cell WHERE { VALUES ?facility { } ?s2cell kwg-ont:sfContains ?facility ; rdf:type kwg-ont:S2Cell_Level13 . ?facility fio:ofIndustry ?industryCode ; geo:hasGeometry/geo:asWKT ?facWKT ; rdfs:label ?facilityName . ?industryCode a naics:NAICS-IndustryCode ; rdfs:label ?industryName . } +ec935451ecfb SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +ece4d96de601 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +eda7f49eaf9d SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +edaa65a35aac SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches/kwg-ont:sfTouches/kwg-ont:sfTouches/kwg-ont:sfTouches ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +ee66561a00f7 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +ee767dadbf6f SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } } +eeb6a4be8d87 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +eedde23983a6 SELECT DISTINCT (?streamA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +ef35db5ca18b SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +ef7f4d420285 SELECT DISTINCT (?aquiferC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +f015bfcba03e SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName WHERE { { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?wellA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus ; hyf:downstreamFlowPathTC ?flowline . } } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?facilityC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +f0c206010b68 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +f0d79c0a39c3 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +f15a49a11b96 SELECT DISTINCT ?facility ?facWKT ?facilityName ?industryCode ?industryName ?s2cell WHERE { VALUES ?facility { } ?s2cell kwg-ont:sfContains ?facility ; rdf:type kwg-ont:S2Cell_Level13 . ?facility fio:ofIndustry ?industryCode ; geo:hasGeometry/geo:asWKT ?facWKT ; rdfs:label ?facilityName . ?industryCode a naics:NAICS-IndustryCode ; rdfs:label ?industryName . VALUES ?selectedIndustry { naics:NAICS-562212 } FILTER(?industryCode = ?selectedIndustry || EXISTS { ?industryCode fio:subcodeOf ?selectedIndustry }) } +f1abbefd32dd SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +f1e4ac3d1adc SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +f2161e75506a SELECT DISTINCT (?wellC AS ?well) ?wellWKT (?s2target AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?observationA rdf:type coso:ContaminantObservation ; coso:observedAtSamplePoint ?spA ; coso:ofDSSToxSubstance ?substanceA ; coso:analyzedSample ?sampleA ; coso:hasResult ?resultA . ?sampleA coso:sampleOfMaterialType ?matTypeA . ?matTypeA rdfs:label ?matTypeLabelA . ?resultA coso:measurementUnit ?unitA . OPTIONAL { ?resultA qudt:quantityValue/qudt:numericValue ?numericResultA } OPTIONAL { ?resultA qudt:quantityValue ?_qvA . ?_qvA rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectA) } BIND(COALESCE(STR(?numericResultA), IF(BOUND(?nonDetectA), "non-detect", "non-quantified")) AS ?result_valueA) ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?wellC geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellC rdfs:label ?wellName . } OPTIONAL { ?wellC me_mgs:hasUse ?meUse . } OPTIONAL { ?wellC me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellC me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellC me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellC il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellC il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellC il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellC il_isgs:wellYield/qudt:numericValue ?ilYield . } } +f2ec010e4080 SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +f560ebd6282b SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +f56b87fc7251 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +f58221d89287 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . } +f7a2dba8957d SELECT DISTINCT (?waterBodyA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . } +f80f83193d16 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . } +f878bab0aeba SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +f8a37eb37178 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +f8ce75f3f7ee SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } +f8efc6828155 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } BIND(?ds_flowline AS ?streamC) } +f996426f75e0 SELECT DISTINCT (?facilityA AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23031 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC coso:observedAtSamplePoint ?spC . ?observationC coso:ofDSSToxSubstance ?substanceC . ?observationC coso:hasResult ?resultC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) VALUES ?substanceC { } FILTER(BOUND(?numericResultC)) ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23031 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC coso:observedAtSamplePoint ?spC . ?observationC coso:ofDSSToxSubstance ?substanceC . ?observationC coso:hasResult ?resultC . OPTIONAL { ?resultC qudt:quantityValue/qudt:numericValue ?numericResultC } OPTIONAL { ?resultC qudt:quantityValue ?_qvC . ?_qvC rdf:type coso:NonDetectQuantityValue . BIND(true AS ?nonDetectC) } BIND(COALESCE(STR(?numericResultC), IF(BOUND(?nonDetectC), "non-detect", "non-quantified")) AS ?result_valueC) VALUES ?substanceC { } FILTER(BOUND(?numericResultC)) ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +f9a94dc1bcc9 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . } +f9af91a7570a SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?wellA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?wellC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +fa1833c58b13 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?s2target spatial:connectedTo ?ds_flowline . } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +fa5208b4f1f5 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?aquiferC . ?aquiferC rdf:type gwml2:GW_Aquifer . } +fa96bd1b30f8 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type il_isgs:ISGS-Well } UNION { ?wellC rdf:type me_mgs:MGS-Well } } +faa0a03241cd SELECT DISTINCT (?facilityC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . } +fb42af7be1f5 SELECT DISTINCT (?wellA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +fbcba6bb42a9 SELECT DISTINCT (?waterBodyC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +fc48809955c6 SELECT DISTINCT (?spA AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?upstream_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?upstream_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?upstream_flowline WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spA rdf:type coso:SamplePoint ; spatial:connectedTo ?s2anchor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2neighbor spatial:connectedTo ?upstream_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath . } } ?upstream_flowline hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?upstream_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd hyf:downstreamFlowPath? ?ds_flowline . } } BIND(?ds_flowline AS ?streamC) } +fcaea4147d56 SELECT DISTINCT (?streamC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo ?streamC . ?streamC rdf:type hyf:HY_FlowPath . } +fd28138d5b69 SELECT DISTINCT ?flowline ?flowlineWKT ?fl_type ?streamName ?path_length WHERE { { SELECT ?flowline (MIN(?_ptotal) AS ?path_length) WHERE { { SELECT ?_flSeed ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?_flSeed ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?_flSeed WHERE { { SELECT DISTINCT ?s2cellus WHERE { VALUES ?waterBodyA { } ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?waterBodyA . ?waterBodyA rdf:type hyf:HY_WaterBody . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2cellus . } } ?_flSeed rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2cellus . } } ?_flSeed hyf:downstreamFlowPathTC ?_flMid . ?_flMid hyf:downstreamFlowPathTC ?_flEnd . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?_flSeed ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?_flEnd nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_endLen . ?_flEnd hyf:downstreamFlowPath? ?flowline . BIND(IF(?flowline = ?_flEnd, 0.0, ?_endLen) AS ?_extra) BIND(xsd:float(?_plen) + xsd:float(?_extra) AS ?_ptotal) } GROUP BY ?flowline } { SELECT DISTINCT ?flowline WHERE { { SELECT DISTINCT ?s2celltarget WHERE { VALUES ?facilityC { } ?s2celltarget rdf:type kwg-ont:S2Cell_Level13 . ?s2celltarget kwg-ont:sfContains ?facilityC . ?facilityC fio:ofIndustry ?industryCodeC . ?industryCodeC a naics:NAICS-IndustryCode . } } ?_flTarget spatial:connectedTo ?s2celltarget . ?flowline hyf:downstreamFlowPathTC ?_flTarget . } } ?flowline geo:hasGeometry/geo:asWKT ?flowlineWKT ; nhdplusv2:hasFTYPE ?fl_type . OPTIONAL { ?flowline rdfs:label ?streamName } } +fe93660f9298 SELECT DISTINCT (?spC AS ?iri) WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?spC rdf:type coso:SamplePoint ; spatial:connectedTo ?s2target . ?observationC coso:observedAtSamplePoint ?spC . ?observationC coso:ofDSSToxSubstance ?substanceC . VALUES ?substanceC { } ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor kwg-ont:sfContains ?facilityA . ?facilityA fio:ofIndustry ?industryCodeA . ?industryCodeA a naics:NAICS-IndustryCode . } +ff0e8a4e0a65 SELECT DISTINCT (?wellC AS ?iri) WHERE { ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?aquiferA . ?aquiferA rdf:type gwml2:GW_Aquifer . ?aquiferA saw_water:aquiferType ?aqTypeA . VALUES ?aqTypeA { "bedrock" } ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2target . ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?wellC . { ?wellC rdf:type me_mgs:MGS-Well . ?wellC me_mgs:hasUse ?wuC . VALUES ?wuC { } } } +ff4f5433385d SELECT DISTINCT (?streamC AS ?iri) WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) { SELECT DISTINCT ?upstream_flowline ?ds_flowline WHERE { { SELECT ?ds_flowline ?_flEnd (SUM(?_flLen) AS ?_plen) WHERE { { SELECT ?ds_flowline ?_flMid ?_flEnd WHERE { { SELECT DISTINCT ?ds_flowline WHERE { ?ds_flowline rdf:type hyf:HY_FlowPath . ?s2target spatial:connectedTo ?ds_flowline ; rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . BIND(?ds_flowline AS ?streamC) } } ?_flMid hyf:downstreamFlowPathTC ?ds_flowline . ?_flEnd hyf:downstreamFlowPathTC ?_flMid . } } ?_flMid nhdplusv2:hasFlowPathLength/qudt:quantityValue/qudt:numericValue ?_flLen . } GROUP BY ?ds_flowline ?_flEnd } FILTER (xsd:float(?_plen) < xsd:float(30)) ?upstream_flowline hyf:downstreamFlowPath? ?_flEnd . } } ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?streamA . ?streamA rdf:type hyf:HY_FlowPath . } +ff746e2b17d8 SELECT DISTINCT (?wellA AS ?well) ?wellWKT (?s2anchor AS ?s2cell) ?wellName ?meUse ?meWellType ?meDepth ?meOverburden ?ilOwner ?ilDepth ?ilPurpose ?ilYield WHERE { ?s2target rdf:type kwg-ont:S2Cell_Level13 . ?s2target spatial:connectedTo kwgr:administrativeRegion.USA.23 . ?s2target spatial:connectedTo ?waterBodyC . ?waterBodyC rdf:type hyf:HY_WaterBody . ?s2target spatial:connectedTo ?ds_flowline . ?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline . ?upstream_flowline rdf:type hyf:HY_FlowPath ; spatial:connectedTo ?s2neighbor . ?s2anchor kwg-ont:sfTouches | owl:sameAs ?s2neighbor . ?s2anchor rdf:type kwg-ont:S2Cell_Level13 . ?s2anchor spatial:connectedTo ?wellA . { ?wellA rdf:type il_isgs:ISGS-Well } UNION { ?wellA rdf:type me_mgs:MGS-Well } ?wellA geo:hasGeometry/geo:asWKT ?wellWKT . OPTIONAL { ?wellA rdfs:label ?wellName . } OPTIONAL { ?wellA me_mgs:hasUse ?meUse . } OPTIONAL { ?wellA me_mgs:ofWellType ?meWellType . } OPTIONAL { ?wellA me_mgs:wellDepth/qudt:numericValue ?meDepth . } OPTIONAL { ?wellA me_mgs:wellOverburden/qudt:numericValue ?meOverburden . } OPTIONAL { ?wellA il_isgs:hasOwner ?ilOwner . } OPTIONAL { ?wellA il_isgs:wellDepth/qudt:numericValue ?ilDepth . } OPTIONAL { ?wellA il_isgs:wellPurpose ?ilPurpose . } OPTIONAL { ?wellA il_isgs:wellYield/qudt:numericValue ?ilYield . } } diff --git a/scripts/build-thumbnails.mts b/scripts/build-thumbnails.mts new file mode 100644 index 0000000..d352d20 --- /dev/null +++ b/scripts/build-thumbnails.mts @@ -0,0 +1,171 @@ +// Renders one map thumbnail per prebuilt analysis into public/thumbs/.svg, +// so the dashboard cards show the actual answer rather than a generic map. +// +// npx tsx scripts/build-thumbnails.mts [id ...] +// +// Offline and manual, like the query matrix: it runs the real pipeline against +// the live endpoints, which takes minutes. Re-run it when a prebuilt question +// changes shape. The output is committed, so the dashboard costs one static +// file per card and no queries at all. +// +// The basemap is Esri's ocean canvas, requested in EPSG:4326 (imageSR=4326) so +// that plotting a point is a linear map from degrees to pixels. Ask for it in +// the service's native Mercator and every latitude lands slightly wrong. +// +// It is inlined as a JPEG rather than a PNG: the same 440x300 tile is ~25KB +// against ~90KB, and the marks are drawn as SVG on top, so the compression +// artefacts land on terrain nobody is reading. +import { mkdirSync, writeFileSync } from 'node:fs'; +import { PREBUILT_QUERIES } from '../src/constants/prebuiltQueries'; +import { planPipeline } from '../src/engine/planner'; +import { executePipeline } from '../src/engine/executor'; +import { questionThumbnailUrl, boundsForQuestion } from '../src/constants/regionBounds'; + +const W = 440; +const H = 300; +const OUT = 'public/thumbs'; +// A thumbnail is 110px wide on screen. Past a few hundred marks it is a solid +// blob that costs bytes to no effect. +const MAX_POINTS = 400; +const MAX_LINES = 150; + +type Pt = [number, number]; + +const COLORS: Record = { + sp: '#f1a340', // samples + fac: '#cb181d', // facilities + wb: '#2b8cbe', // water bodies + well: '#045a8d', // wells +}; + +function coordsIn(wkt: string): Pt[] { + const out: Pt[] = []; + const re = /(-?\d+\.\d+)\s+(-?\d+\.\d+)/g; + let m; + while ((m = re.exec(wkt))) out.push([Number(m[1]), Number(m[2])]); + return out; +} + +interface Marks { + points: { at: Pt; color: string }[]; + lines: Pt[][]; +} + +function collect(data: Record): Marks { + const points: Marks['points'] = []; + const lines: Marks['lines'] = []; + for (const [key, rows] of Object.entries(data)) { + if (key === 'GET_REGION_BOUNDARIES') continue; // county outlines are noise at this size + for (const row of rows ?? []) { + for (const [field, value] of Object.entries(row)) { + if (typeof value !== 'string' || !/^\s*(POINT|LINESTRING|MULTILINESTRING|POLYGON|MULTIPOLYGON)/i.test(value)) continue; + const pts = coordsIn(value); + if (pts.length === 0) continue; + if (/^POINT/i.test(value.trim())) { + const prefix = field.replace(/WKT$/i, '').toLowerCase(); + points.push({ at: pts[0], color: COLORS[prefix] ?? COLORS.sp }); + } else { + lines.push(pts); + } + } + } + } + return { points, lines }; +} + +/** Grow a bbox to the image aspect ratio, so Esri does not adjust it on us. */ +function toAspect(b: [number, number, number, number]): [number, number, number, number] { + const [w, s, e, n] = b; + const want = W / H; + let width = e - w; + let height = n - s; + if (width / height > want) height = width / want; + else width = height * want; + const cx = (w + e) / 2; + const cy = (s + n) / 2; + return [cx - width / 2, cy - height / 2, cx + width / 2, cy + height / 2]; +} + +async function basemap(bbox: number[]): Promise { + const url = + 'https://server.arcgisonline.com/ArcGIS/rest/services/Ocean/World_Ocean_Base/MapServer/export' + + `?bbox=${bbox.join(',')}&bboxSR=4326&imageSR=4326&size=${W},${H}&format=jpg&f=image`; + const res = await fetch(url); + if (!res.ok) throw new Error(`basemap ${res.status}`); + return Buffer.from(await res.arrayBuffer()).toString('base64'); +} + +function everyNth(items: T[], max: number): T[] { + if (items.length <= max) return items; + const step = Math.ceil(items.length / max); + return items.filter((_, i) => i % step === 0); +} + +async function render(id: string, marks: Marks, fallback: [number, number, number, number]) { + // Walked rather than spread: a statewide trace carries a few hundred thousand + // coordinates, and Math.min(...arr) blows the call stack well before that. + let w = Infinity, e = -Infinity, s = Infinity, n = -Infinity; + let seen = 0; + const see = ([lon, lat]: Pt) => { + seen++; + if (lon < w) w = lon; + if (lon > e) e = lon; + if (lat < s) s = lat; + if (lat > n) n = lat; + }; + for (const p of marks.points) see(p.at); + for (const line of marks.lines) for (const p of line) see(p); + + let box = fallback; + if (seen > 0) { + const pad = 0.08; + // A single point has no extent; give it a ~5km window to sit in. + const dx = Math.max((e - w) * pad, 0.05); + const dy = Math.max((n - s) * pad, 0.05); + box = [w - dx, s - dy, e + dx, n + dy]; + } + const bbox = toAspect(box); + const x = (lon: number) => ((lon - bbox[0]) / (bbox[2] - bbox[0])) * W; + const y = (lat: number) => H - ((lat - bbox[1]) / (bbox[3] - bbox[1])) * H; + + const png = await basemap(bbox); + const paths = everyNth(marks.lines, MAX_LINES) + .map((line) => { + const d = everyNth(line, 60).map((p, i) => `${i ? 'L' : 'M'}${x(p[0]).toFixed(1)} ${y(p[1]).toFixed(1)}`).join(''); + return ``; + }) + .join(''); + const dots = everyNth(marks.points, MAX_POINTS) + .map((p) => ``) + .join(''); + + const svg = + `` + + `` + + paths + + dots + + ''; + writeFileSync(`${OUT}/${id}.svg`, svg); + return { points: marks.points.length, lines: marks.lines.length, bytes: svg.length }; +} + +const wanted = process.argv.slice(2).filter((a) => !a.startsWith('-')); +const queries = wanted.length ? PREBUILT_QUERIES.filter((q) => wanted.includes(q.id)) : PREBUILT_QUERIES; + +mkdirSync(OUT, { recursive: true }); +let failures = 0; +for (const q of queries) { + const started = Date.now(); + try { + const result = await executePipeline(planPipeline(q.question), q.question, () => {}); + if (result.status !== 'success') throw new Error(result.status); + const marks = collect(result.data); + const stats = await render(q.id, marks, boundsForQuestion(q.question)); + const secs = ((Date.now() - started) / 1000).toFixed(0); + console.log(`ok ${q.id} ${stats.points}pts ${stats.lines}lines ${(stats.bytes / 1024).toFixed(0)}KB ${secs}s`); + } catch (err) { + failures++; + console.log(`FAIL ${q.id} ${(err as Error).message} (card falls back to ${questionThumbnailUrl(q.question).slice(0, 60)}...)`); + } +} +process.exit(failures === queries.length ? 1 : 0); diff --git a/scripts/check-cache-key.mts b/scripts/check-cache-key.mts new file mode 100644 index 0000000..39d7df0 --- /dev/null +++ b/scripts/check-cache-key.mts @@ -0,0 +1,104 @@ +// Self-check for the result-cache key (src/engine/cacheKey.ts). +// +// npx tsx scripts/check-cache-key.mts +// +// Cache-key bugs are silent in both directions and neither shows up in the UI: +// too-strict canonicalisation means a question never hits its own cached result, +// too-loose means two different questions share an answer and the map shows data +// for a question nobody asked. Hence a runnable check rather than a comment. +import assert from 'node:assert/strict'; +import { cacheKey } from '../src/engine/cacheKey'; +import { PREBUILT_QUERIES } from '../src/constants/prebuiltQueries'; +import type { AnalysisQuestion } from '../src/types/query'; + +const q = (over: Record = {}): AnalysisQuestion => + ({ + blockA: { type: 'samples', region: { stateCode: '23' }, ...(over.a ?? {}) }, + relationship: over.rel ?? { type: 'near', hops: 1 }, + blockC: { type: 'facilities', ...(over.c ?? {}) }, + }) as AnalysisQuestion; + +let checks = 0; +async function same(name: string, a: AnalysisQuestion, b: AnalysisQuestion) { + assert.equal(await cacheKey(a), await cacheKey(b), `expected same key: ${name}`); + checks++; +} +async function differs(name: string, a: AnalysisQuestion, b: AnalysisQuestion) { + assert.notEqual(await cacheKey(a), await cacheKey(b), `expected different keys: ${name}`); + checks++; +} + +// Same question, incidental differences — must share a key. +await same( + 'block key order', + { blockA: q().blockA, relationship: q().relationship, blockC: q().blockC }, + { blockC: q().blockC, relationship: q().relationship, blockA: q().blockA } as AnalysisQuestion, +); +await same( + 'display-only label maps', + q({ a: { region: { stateCode: '23', countyCodes: ['23005'], countyLabels: { '23005': 'Cumberland' } } } }), + q({ a: { region: { stateCode: '23', countyCodes: ['23005'], countyLabels: { '23005': 'CUMBERLAND, ME' } } } }), +); +await same( + 'filter array order', + q({ c: { facilityFilters: { industryCodes: ['481111', '488119'] } } }), + q({ c: { facilityFilters: { industryCodes: ['488119', '481111'] } } }), +); +await same('cleared filter vs never set', q({ c: { facilityFilters: { industryCodes: [] } } }), q()); +await same('undefined filter vs absent', q({ a: { sampleFilters: { substances: undefined } } }), q()); +// hops is only read on the near path, so a value left over from switching the +// relationship dropdown must not split the key. +await same('stale hops on downstream', q({ rel: { type: 'downstream', hops: 3 } }), q({ rel: { type: 'downstream' } })); +await same('near hops defaults to 1', q({ rel: { type: 'near' } }), q({ rel: { type: 'near', hops: 1 } })); + +// Different questions — must not collide. +await differs('hops on near', q({ rel: { type: 'near', hops: 1 } }), q({ rel: { type: 'near', hops: 3 } })); +await differs('near vs downstream', q({ rel: { type: 'near', hops: 1 } }), q({ rel: { type: 'downstream' } })); +await differs('state', q(), q({ a: { region: { stateCode: '17' } } })); +await differs( + 'industry filter', + q({ c: { facilityFilters: { industryCodes: ['481111'] } } }), + q({ c: { facilityFilters: { industryCodes: ['562212'] } } }), +); +await differs('entity type', q(), { ...q(), blockC: { type: 'wells' } } as AnalysisQuestion); +await differs( + 'county added', + q({ a: { region: { stateCode: '23', countyCodes: ['23005'] } } }), + q({ a: { region: { stateCode: '23', countyCodes: ['23005', '23019'] } } }), +); + +// A distance bound changes the answer, so it must change the key. This is the +// case that was wrong once: canonicalQuestion rebuilt the relationship as +// `{ type }` for traces, silently dropping maxDistanceKm, so a bounded and an +// unbounded question collided. +await differs( + 'maxDistanceKm vs unbounded', + q({ rel: { type: 'upstream' } }), + q({ rel: { type: 'upstream', maxDistanceKm: 30 } }), +); +await differs( + 'different maxDistanceKm', + q({ rel: { type: 'upstream', maxDistanceKm: 30 } }), + q({ rel: { type: 'upstream', maxDistanceKm: 10 } }), +); +await differs( + 'maxDistanceKm on downstream', + q({ rel: { type: 'downstream' } }), + q({ rel: { type: 'downstream', maxDistanceKm: 30 } }), +); +// ...while an unbounded trace keeps the key it had before maxDistanceKm existed, +// so entries cached earlier stay reachable. +await same( + 'unbounded trace key is unchanged', + q({ rel: { type: 'downstream' } }), + q({ rel: { type: 'downstream', hops: 3 } }), +); + +// The dashboard questions are what the warm-cache script writes: they must be +// distinct from each other and stable between runs. +const keys = await Promise.all(PREBUILT_QUERIES.map((p) => cacheKey(p.question))); +assert.equal(new Set(keys).size, keys.length, 'dashboard questions must have distinct keys'); +assert.equal(await cacheKey(PREBUILT_QUERIES[0].question), keys[0], 'key must be stable across calls'); +checks += 2; + +console.log(`cache key: ${checks} checks passed`); diff --git a/scripts/check-flowline-scope.mts b/scripts/check-flowline-scope.mts new file mode 100644 index 0000000..6eea46b --- /dev/null +++ b/scripts/check-flowline-scope.mts @@ -0,0 +1,99 @@ +// Self-check: the supporting flowline layer must be bounded at BOTH ends. +// +// npx tsx scripts/check-flowline-scope.mts +// +// buildFusedFlowlineQuery traces a transitive closure out of the anchor cells. +// Left one-sided it runs to the end of the network, so an anchor near a +// drainage divide drags in the neighbouring basin: "facilities upstream from +// PFOS samples in York County, ME" drew 122 segments of the Merrimack and 21 +// of the Winnipesaukee, in a basin no York sample drains from. Nothing looked +// broken -- the map just had extra rivers on it, and they were real rivers. +// +// The fix intersects that closure with the set of flowlines that actually +// reach the resolved targets. This asserts the intersection is present in +// every shape that draws the layer, bounded and unbounded, so a future edit to +// either branch cannot drop it silently. +// +// No network: the pipeline steps only build query strings. +import assert from 'node:assert/strict'; +import { planPipeline, type PipelineContext } from '../src/engine/planner'; +import type { AnalysisQuestion, EntityType, SpatialRelationship } from '../src/types/query'; + +const ENTITY_TYPES: EntityType[] = [ + 'samples', + 'facilities', + 'waterBodies', + 'wells', + 'aquifers', + 'streams', +]; +const HYDROLOGY: SpatialRelationship['type'][] = ['downstream', 'upstream']; +// Unbounded, and one bounded value to cover the aggregate branch. +const DISTANCES: (number | undefined)[] = [undefined, 25]; + +const context = (): PipelineContext => ({ + question: {} as AnalysisQuestion, + targetIris: ['https://example.org/t1', 'https://example.org/t2'], + anchorIris: ['https://example.org/a1', 'https://example.org/a2'], + results: {}, +}); + +let checks = 0; +let drawn = 0; + +for (const blockA of ENTITY_TYPES) { + for (const blockC of ENTITY_TYPES) { + for (const rel of HYDROLOGY) { + for (const maxDistanceKm of DISTANCES) { + const question: AnalysisQuestion = { + blockA: { type: blockA }, + relationship: { type: rel, maxDistanceKm }, + blockC: { type: blockC }, + }; + const step = planPipeline(question).find((s) => s.type === 'GET_FLOWLINE_GEOMETRIES'); + // Skipped when a side is streams: those flowlines are the answer set. + if (!step) { + assert.ok( + blockA === 'streams' || blockC === 'streams', + `${blockA} ${rel} ${blockC}: no flowline step, but neither side is streams`, + ); + continue; + } + drawn++; + const sparql = step.buildQuery(context()); + const where = `${blockA} ${rel} ${blockC} ${maxDistanceKm ?? 'unbounded'}`; + + // The target IRIs have to reach the query, or the closure is one-sided. + assert.ok( + sparql.includes('https://example.org/t1'), + `${where}: flowline query does not bind the resolved targets`, + ); + // Both ends present: a closure out of the anchor cells, and a closure + // into the targets, joined on ?flowline. + assert.ok( + sparql.includes('?_flTarget spatial:connectedTo ?s2celltarget'), + `${where}: missing the target reach clause`, + ); + assert.match( + sparql, + /\?flowline hyf:downstreamFlowPathTC \?_flTarget|\?_flTarget hyf:downstreamFlowPathTC \?flowline/, + `${where}: target reach clause does not close on ?flowline`, + ); + // The reach clause must be a bare TC. hyf:downstreamFlowPathTC is + // already reflexive, so `TC?` is the same relation spelled more + // expensively: measured at 0 extra flowlines and +8s. + // Bare `includes`, not the downstream spelling: the form is + // `?flowline TC? ?_flTarget` downstream and `?_flTarget TC? ?flowline` + // upstream, and matching only the first left the upstream shape + // unguarded by a check whose whole point is the `TC?` regression. + assert.ok( + !sparql.includes('downstreamFlowPathTC?'), + `${where}: reflexive target reach, measured to add nothing`, + ); + checks += 4; + } + } + } +} + +console.log(`flowline scope: ${drawn} shapes draw the layer, ${checks} checks passed`); diff --git a/scripts/check-query-joins.mts b/scripts/check-query-joins.mts new file mode 100644 index 0000000..1d659c6 --- /dev/null +++ b/scripts/check-query-joins.mts @@ -0,0 +1,331 @@ +// Self-check for the two rules in +// docs/plans/done/2026-09-17-fused-seed-side-and-observation-joins.md. +// +// npx tsx scripts/check-query-joins.mts +// +// 1. Join order. QLever follows the query text at these body sizes, so the +// constrained side of a hydrology question has to be written first. Leading +// with an unfiltered side is what made "facilities upstream from PFOS +// samples in York and Cumberland" fail with 500 out-of-memory. +// +// 2. Observation joins. Every required triple is also a filter. A samples block +// may only join the observation detail its active filters actually read: the +// coso:measurementUnit join in particular deletes non-detects, which have no +// unit, and it was being emitted for substance-only questions that had +// "include non-detects" ticked. +// +// No network: these only build query strings. +import assert from 'node:assert/strict'; +import { planPipeline } from '../src/engine/planner'; +import { buildFusedHydrologyQuery, buildFusedNearQuery } from '../src/engine/templates/fusedQueries'; +import { PREBUILT_QUERIES } from '../src/constants/prebuiltQueries'; +import type { AnalysisQuestion, EntityBlock, EntityType, SampleFilters } from '../src/types/query'; + +const ENTITY_TYPES: EntityType[] = [ + 'samples', + 'facilities', + 'waterBodies', + 'wells', + 'aquifers', + 'streams', +]; +const PFOS = 'http://w3id.org/DSSTox/v1/DTXSID3031864'; +const GROUNDWATER = 'http://w3id.org/sawgraph/v1/me-egad#sampleMaterialType.GW'; + +let checks = 0; +const check = (cond: boolean, msg: string) => { + assert.ok(cond, msg); + checks++; +}; + +// Which side the body leads with. The first variable after WHERE { decides the +// plan; anything else in the body can follow. +function leadsWith(query: string): 'anchor' | 'target' | 'other' { + const body = query.slice(query.indexOf('WHERE {') + 'WHERE {'.length).trimStart(); + if (body.startsWith('?s2target') || body.startsWith('?ds_flowline')) return 'target'; + if (body.startsWith('?s2anchor')) return 'anchor'; + // A pinned side leads with its VALUES block, so neither branch above matches. + // That is the 'other' case and the pinned assertions below allow for it. + return 'other'; +} + +// Which end the distance-bounded aggregate walks outward from, read off the +// innermost sub-SELECT that boundedTrace wraps its seed in. Unbounded queries +// have no such block and report 'none'. +function seedsFrom(query: string): 'anchor' | 'target' | 'none' { + if (query.includes('SELECT DISTINCT ?upstream_flowline WHERE {')) return 'anchor'; + if (query.includes('SELECT DISTINCT ?ds_flowline WHERE {')) return 'target'; + return 'none'; +} + +const filtersFor = (type: EntityType): Partial => { + switch (type) { + case 'samples': + return { sampleFilters: { substances: [PFOS], includeNondetects: true } }; + case 'facilities': + return { facilityFilters: { industryCodes: ['5622'] } }; + case 'waterBodies': + return { waterBodyFilters: { ftypes: ['StreamRiver'] } }; + case 'streams': + return { streamFilters: { ftypes: ['StreamRiver'] } }; + case 'aquifers': + return { aquiferFilters: { aquiferTypes: ['bedrock'] } }; + case 'wells': + return {}; + } +}; + +// --- 1. Join order, every hydrology pair, both projections. +for (const targetType of ENTITY_TYPES) { + for (const anchorType of ENTITY_TYPES) { + for (const project of ['target', 'anchor'] as const) { + const scopedTarget = buildFusedHydrologyQuery({ + anchor: { type: anchorType }, + target: { type: targetType, ...filtersFor(targetType) }, + targetRegion: ['23005'], + project, + direction: 'downstream', + }); + check( + leadsWith(scopedTarget) === 'target', + `${targetType} <- ${anchorType} (project ${project}): target is the only constrained side, so it must lead the body`, + ); + + const scopedAnchor = buildFusedHydrologyQuery({ + anchor: { type: anchorType, ...filtersFor(anchorType) }, + target: { type: targetType }, + anchorRegion: ['23005'], + project, + direction: 'downstream', + }); + check( + leadsWith(scopedAnchor) === 'anchor', + `${targetType} <- ${anchorType} (project ${project}): anchor is the constrained side, so the body must keep the anchor-first order`, + ); + + // An IRI pin from chunking counts as constrained: re-seeding from the + // other side would throw the slice away. + const pinned = buildFusedHydrologyQuery({ + anchor: { type: anchorType }, + target: { type: targetType, ...filtersFor(targetType) }, + targetRegion: ['23005'], + anchorIris: ['http://example.org/facility/1'], + project, + direction: 'downstream', + }); + check( + leadsWith(pinned) !== 'target', + `${targetType} <- ${anchorType} (project ${project}): an anchorIris pin must keep the anchor-first order`, + ); + } + } +} + +// Distance-bounded traces follow the same rule, and lean on it harder: the +// bounded block embeds its seed inside an aggregate that sums path lengths, so +// seeding the wide-open side sums them across the national flowline graph. +// Every bounded shape whose constrained side was the target failed before the +// reorder covered them — 30s query-planning timeouts and 4.3 GB allocation +// failures, recorded in docs/query-matrix/2026-09-20-raw-002e529.csv. +// +// Both halves are checked. A query can read target-first while the aggregate +// inside still starts from the anchor, which would move the text and leave the +// cost exactly where it was. +for (const targetType of ENTITY_TYPES) { + for (const maxDistanceKm of [30, 50]) { + const targetScoped = buildFusedHydrologyQuery({ + anchor: { type: 'facilities' }, + target: { type: targetType, ...filtersFor(targetType) }, + targetRegion: ['23005'], + project: 'target', + direction: 'downstream', + maxDistanceKm, + }); + check( + leadsWith(targetScoped) === 'target', + `${targetType} <- facilities, bounded ${maxDistanceKm}km: target is the only constrained side, so it must lead the body`, + ); + check( + seedsFrom(targetScoped) === 'target', + `${targetType} <- facilities, bounded ${maxDistanceKm}km: the bounded aggregate must seed from the target too`, + ); + + const anchorScoped = buildFusedHydrologyQuery({ + anchor: { type: 'facilities', ...filtersFor('facilities') }, + target: { type: targetType }, + anchorRegion: ['23005'], + project: 'target', + direction: 'downstream', + maxDistanceKm, + }); + check( + leadsWith(anchorScoped) === 'anchor', + `${targetType} <- facilities, bounded ${maxDistanceKm}km: anchor is the constrained side, so the body must keep the anchor-first order`, + ); + check( + seedsFrom(anchorScoped) === 'anchor', + `${targetType} <- facilities, bounded ${maxDistanceKm}km: the bounded aggregate must seed from the anchor`, + ); + } +} + +// --- 2. Observation joins, driven by the filters that are actually set. +const UNIT_JOIN = 'coso:measurementUnit'; +const OBS_JOIN = 'coso:observedAtSamplePoint'; +const MATERIAL_JOIN = 'coso:sampleOfMaterialType'; +const MATERIAL_LABEL = '?matTypeLabelC'; + +interface JoinCase { + name: string; + filters: SampleFilters | undefined; + unit: boolean; + observation: boolean; + material: boolean; +} + +const joinCases: JoinCase[] = [ + { name: 'no filters', filters: undefined, unit: false, observation: false, material: false }, + { + name: 'substance only', + filters: { substances: [PFOS], includeNondetects: true }, + unit: false, + observation: true, + material: false, + }, + { + name: 'material only', + filters: { materialTypes: [GROUNDWATER] }, + unit: false, + observation: true, + material: true, + }, + { + name: 'concentration range', + filters: { substances: [PFOS], minConcentration: 10, maxConcentration: 1000 }, + unit: true, + observation: true, + material: false, + }, + { + name: 'detects only', + filters: { substances: [PFOS], includeNondetects: false }, + unit: false, + observation: true, + material: false, + }, +]; + +for (const c of joinCases) { + const queries = [ + ['hydrology', buildFusedHydrologyQuery({ + anchor: { type: 'facilities', facilityFilters: { industryCodes: ['5622'] } }, + target: { type: 'samples', sampleFilters: c.filters }, + anchorRegion: ['23005'], + project: 'target', + direction: 'downstream', + })], + ['near', buildFusedNearQuery({ + anchor: { type: 'facilities', facilityFilters: { industryCodes: ['5622'] } }, + target: { type: 'samples', sampleFilters: c.filters }, + hops: 1, + project: 'anchor', + })], + ] as const; + + for (const [kind, query] of queries) { + check( + query.includes(UNIT_JOIN) === c.unit, + `${kind}, ${c.name}: the unit join must appear only for a concentration range (it deletes non-detects)`, + ); + check( + query.includes(OBS_JOIN) === c.observation, + `${kind}, ${c.name}: the observation join must appear only when a filter reads it`, + ); + check( + query.includes(MATERIAL_JOIN) === c.material, + `${kind}, ${c.name}: the material join must appear only when material types are picked`, + ); + check( + !query.includes(MATERIAL_LABEL), + `${kind}, ${c.name}: the material label is display-only and must never appear in an IRI-finding query`, + ); + } +} + +// --- 2b. Narrowness is a ranking, not a boolean. A region beats a bare entity +// filter, because a filter with no region is selective in kind and unbounded in +// extent: "all sewage treatment facilities" is a nationwide set. Getting this +// wrong is not a slow query, it is no query at all. Adding an industry filter +// to block A of "facilities upstream from PFOS samples in York" used to turn a +// 3s answer into a 30s timeout in query planning, because the filter alone +// counted as constrained and switched the reorder off. +for (const targetType of ENTITY_TYPES) { + for (const maxDistanceKm of [undefined, 30]) { + const base = { project: 'target' as const, direction: 'downstream' as const, ...(maxDistanceKm ? { maxDistanceKm } : {}) }; + const label = `${targetType} <- facilities${maxDistanceKm ? `, bounded ${maxDistanceKm}km` : ''}`; + + // Anchor filtered but unscoped, target scoped: the region wins. + const filteredAnchor = buildFusedHydrologyQuery({ + ...base, + anchor: { type: 'facilities', ...filtersFor('facilities') }, + target: { type: targetType, ...filtersFor(targetType) }, + targetRegion: ['23005'], + }); + check( + leadsWith(filteredAnchor) === 'target', + `${label}: a bare industry filter must not outrank a region, or the seed is nationwide`, + ); + if (maxDistanceKm) { + check( + seedsFrom(filteredAnchor) === 'target', + `${label}: the bounded aggregate must seed from the region-scoped side`, + ); + } + + // The mirror: anchor scoped, target only filtered. The anchor keeps it. + const filteredTarget = buildFusedHydrologyQuery({ + ...base, + anchor: { type: 'facilities' }, + target: { type: targetType, ...filtersFor(targetType) }, + anchorRegion: ['23005'], + }); + check( + leadsWith(filteredTarget) === 'anchor', + `${label}: a region on the anchor outranks a bare filter on the target`, + ); + } +} + +// --- 3. The prebuilt dashboard questions lead with their narrower side. +// +// This used to assert that no prebuilt reorders, on the grounds that every one +// of them has a constrained anchor. That was a description of the old boolean +// predicate rather than a rule, and it stopped being true when "constrained" +// became a ranking: an industry filter with no region is constrained but not +// narrow. One prebuilt legitimately reorders under the ranking. +// +// `samples-downstream-waste-indiana` has samples scoped to Indiana on block A +// and NAICS 5622 with no region on block C, so the anchor is every waste +// treatment facility in the country and the target is one state. Both orders +// were measured on the live endpoint: identical answers, 136 samples and 415 +// facilities either way, with the reordered form no slower (13s and 2s against +// 16s and 3s). It reorders because the rule says the state-scoped side is the +// narrower one, and the measurement agrees. +const EXPECTED_REORDER = new Set(['samples-downstream-waste-indiana']); + +for (const prebuilt of PREBUILT_QUERIES) { + const question: AnalysisQuestion = prebuilt.question; + if (question.relationship.type === 'near') continue; + const step = planPipeline(question)[0]; + const query = step.buildQuery( + { question, targetIris: [], anchorIris: [], results: {} } as never, + undefined, + ); + const expected = EXPECTED_REORDER.has(prebuilt.id) ? 'target' : 'anchor'; + check( + leadsWith(query) === expected, + `${prebuilt.id}: expected the body to lead with the ${expected}, the narrower of its two sides`, + ); +} + +console.log(`query joins: ${checks} checks passed`); diff --git a/scripts/check-query-snapshots.mts b/scripts/check-query-snapshots.mts new file mode 100644 index 0000000..c49ac59 --- /dev/null +++ b/scripts/check-query-snapshots.mts @@ -0,0 +1,333 @@ +// Golden-file snapshot of the SPARQL the planner generates, for every shape. +// +// npx tsx scripts/check-query-snapshots.mts # verify +// npx tsx scripts/check-query-snapshots.mts --update # re-record +// +// Why this exists: near and downstream/upstream share one query builder +// (buildFusedWhereBody in src/engine/templates/fusedQueries.ts takes a `mode` +// and differs only in the middle hop). Everything else -- entity binding, +// region clauses, IRI pinning, sample-observation joins -- is common. So a fix +// aimed at a trace bug silently rewrites the `near` queries too, and the only +// thing that noticed until now was a live sweep taking ~30 minutes. +// +// This records the generated SPARQL for every shape and fails on any diff. The +// diff is the point: an intentional change shows exactly which other shapes +// moved with it, then you --update. No network, runs in about a second. +// +// The grid has four axes, and every one of them earned its place by hiding a +// bug that the others could not see: +// +// entity pair (36) one builder serves all of them, so a fix aimed at +// one pair rewrites the rest +// relationship (3) near and the two hydrology directions share +// buildFusedWhereBody +// region placement (2) which block carries the region decides which side is +// "constrained", which decides the join order. An +// earlier version of this grid put the region on block +// A always; for an upstream question that makes the +// anchor the constrained side, so the target-first +// order was never recorded, and neither was the +// question that broke in the app (block A wide open, +// block C scoped to a county). +// flow-distance bound the bounded trace is a different query, not a +// (2, hydrology only) filtered one: it seeds an aggregate. With one bounded +// variant in the grid, the fix that moved every bounded +// shape showed up here as a single moved line. +// +// 6 x 6 x 3 x 2 = 216 unbounded, plus 6 x 6 x 2 x 2 = 144 bounded, plus the +// variants below that reach clauses the grid does not vary. +import assert from 'node:assert/strict'; +import { readFileSync, writeFileSync, existsSync } from 'node:fs'; +import { createHash } from 'node:crypto'; +import { planPipeline, type PipelineContext } from '../src/engine/planner'; +import { PREFIXES } from '../src/constants/prefixes'; +import type { AnalysisQuestion, EntityType, SpatialRelationship } from '../src/types/query'; + +const SNAPSHOT = new URL('./__snapshots__/query-shapes.txt', import.meta.url); + +const ENTITY_TYPES: EntityType[] = [ + 'samples', + 'facilities', + 'waterBodies', + 'wells', + 'aquifers', + 'streams', +]; +// 'within' is in the type union but RelationshipSelector never offers it. +const RELATIONSHIPS: SpatialRelationship['type'][] = ['near', 'downstream', 'upstream']; +const HYDROLOGY: SpatialRelationship['type'][] = ['downstream', 'upstream']; +// Which block carries the region. See the header: this is the axis that decides +// the join order, and it is not symmetric between the two relationship +// directions, because the planner maps block A to the anchor for an upstream +// question and to the target for a downstream one. +const REGION_ON = ['A', 'C'] as const; + +// Fixed IRIs so pinValues output is deterministic. Two entries: enough to show +// the VALUES clause and its ordering, short enough to stay readable. +const context = (question: AnalysisQuestion): PipelineContext => ({ + question, + targetIris: ['http://example.org/target/1', 'http://example.org/target/2'], + anchorIris: ['http://example.org/anchor/1', 'http://example.org/anchor/2'], + results: {}, +}); + +// Collapse whitespace: indentation churn is not a behaviour change and would +// bury the diffs that are. +// +// The shared PREFIX preamble is stripped for the same reason, plus one of its +// own: it is byte-identical in every query and was 66% of this file, so it made +// the snapshot three times the size it needs to be and pushed the part that +// varies off the side of every diff. It is recorded once, on its own, so a +// change to the prefix list still shows up as exactly one moved entry instead +// of moving all 360. +const collapse = (q: string) => q.replace(/\s+/g, ' ').trim(); +const PREFIX_BLOCK = collapse(PREFIXES); +const normalise = (q: string) => collapse(q).replace(PREFIX_BLOCK, '').trim(); + +// Query bodies are written once each, in a table at the end, and referenced by +// hash from the shapes above. 375 shapes reference 2,078 step queries but only +// 603 distinct ones — the region-boundary query alone is identical in 373 of +// them — so inlining every body made the file 2.6x larger and turned a one-line +// change to a shared query into 373 lines of diff. +const bodies = new Map(); +const BODIES_MARKER = '# ---- query bodies, one line per distinct query ----'; + +function record(name: string, question: AnalysisQuestion): string[] { + const lines = [`## ${name}`]; + const ctx = context(question); + for (const step of planPipeline(question)) { + const query = normalise(step.buildQuery(ctx)); + assert.ok(query.length > 0, `empty query: ${name} / ${step.type}`); + const hash = createHash('sha256').update(query).digest('hex').slice(0, 12); + bodies.set(hash, query); + lines.push(`${step.type} [${step.endpoint}] ${hash}`); + } + return lines; +} + +const shape = ( + a: EntityType, + rel: SpatialRelationship['type'], + c: EntityType, + relExtra: Partial = {}, + regionOn: (typeof REGION_ON)[number] = 'A', +): AnalysisQuestion => { + const region = { region: { stateCode: '23' } }; + return { + blockA: { type: a, ...(regionOn === 'A' ? region : {}) }, + relationship: { type: rel, ...(rel === 'near' ? { hops: 1 } : {}), ...relExtra }, + blockC: { type: c, ...(regionOn === 'C' ? region : {}) }, + } as AnalysisQuestion; +}; + +const out: string[] = [ + '# Generated by scripts/check-query-snapshots.mts -- do not hand-edit.', + '# Re-record with: npm run check-query-snapshots -- --update', + '', +]; + +// 0. The prefix preamble, recorded once because normalise() strips it. +out.push( + '## PREFIXES', + `SHARED [all] ${createHash('sha256').update(PREFIX_BLOCK).digest('hex').slice(0, 12)}`, + ` ${PREFIX_BLOCK}`, +); + +// 1. Every entity pair x relationship x region placement: 6 x 6 x 3 x 2 = 216. +for (const a of ENTITY_TYPES) { + for (const c of ENTITY_TYPES) { + for (const rel of RELATIONSHIPS) { + for (const on of REGION_ON) { + out.push(...record(`${a} ${rel} ${c} [ME on ${on}]`, shape(a, rel, c, {}, on))); + } + } + } +} + +// 2. The hydrology pairs again with a flow-distance bound: 6 x 6 x 2 x 2 = 144. +// `near` has no flow bound; its distance axis is hops, covered in the variants. +for (const a of ENTITY_TYPES) { + for (const c of ENTITY_TYPES) { + for (const rel of HYDROLOGY) { + for (const on of REGION_ON) { + out.push( + ...record(`${a} ${rel}(30km) ${c} [ME on ${on}]`, shape(a, rel, c, { maxDistanceKm: 30 }, on)), + ); + } + } + } +} + +// 3. The variants that reach clauses the grid above does not vary: hop counts, +// the per-type filter blocks, and the exact questions that have broken in the +// app. A change to any of these is the class of change that crosses +// relationship boundaries. +const PFOS = 'http://w3id.org/DSSTox/v1/DTXSID3031864'; +const YORK = { stateCode: '23', countyCodes: ['23031'] }; +const variants: Array<[string, AnalysisQuestion]> = [ + ['near hops=0', shape('samples', 'near', 'facilities', { hops: 0 })], + ['near hops=2', shape('samples', 'near', 'facilities', { hops: 2 })], + ['near hops=4', shape('samples', 'near', 'facilities', { hops: 4 })], + ['downstream maxDistanceKm=10', shape('samples', 'downstream', 'facilities', { maxDistanceKm: 10 })], + ['upstream maxDistanceKm=10', shape('samples', 'upstream', 'facilities', { maxDistanceKm: 10 })], + // The question behind #55 and #57, in the two states it is asked in. Block A + // carries nothing at all, which is what makes it the expensive shape: the + // trace has to be seeded from block C or it starts from every facility in + // the graph. Recorded bounded and unbounded because those are two different + // queries, not one query with a filter. + [ + 'PI question: facilities upstream from PFOS samples in York, detections only', + { + blockA: { type: 'facilities' }, + relationship: { type: 'upstream' }, + blockC: { + type: 'samples', + region: YORK, + sampleFilters: { substances: [PFOS], includeNondetects: false }, + }, + } as AnalysisQuestion, + ], + [ + 'PI question, bounded to 30km of flow', + { + blockA: { type: 'facilities' }, + relationship: { type: 'upstream', maxDistanceKm: 30 }, + blockC: { + type: 'samples', + region: YORK, + sampleFilters: { substances: [PFOS], includeNondetects: false }, + }, + } as AnalysisQuestion, + ], + // The two sample-filter shapes that decide whether the observation chain is + // joined at all. Substance-only is the common case and is what the + // coso:measurementUnit join silently filtered; non-detects-off is the only + // filter that adds the result clauses without adding the unit join. + [ + 'samples substance filter only', + { + blockA: { type: 'samples', region: { stateCode: '23' }, sampleFilters: { substances: [PFOS] } }, + relationship: { type: 'downstream' }, + blockC: { type: 'facilities' }, + } as AnalysisQuestion, + ], + [ + 'samples include-nondetects off only', + { + blockA: { type: 'samples', region: { stateCode: '23' }, sampleFilters: { includeNondetects: false } }, + relationship: { type: 'downstream' }, + blockC: { type: 'facilities' }, + } as AnalysisQuestion, + ], + [ + 'no region either side', + { + blockA: { type: 'samples' }, + relationship: { type: 'downstream' }, + blockC: { type: 'facilities' }, + } as AnalysisQuestion, + ], + [ + 'county-scoped both sides', + { + blockA: { type: 'samples', region: { stateCode: '23', countyCodes: ['23019'] } }, + relationship: { type: 'near', hops: 1 }, + blockC: { type: 'facilities', region: { stateCode: '23', countyCodes: ['23005', '23019'] } }, + } as AnalysisQuestion, + ], + [ + 'sample filters', + { + blockA: { + type: 'samples', + region: { stateCode: '23' }, + sampleFilters: { + substances: ['http://sawgraph.spatialai.org/v1/pfas#PFHpA'], + materialTypes: ['http://sawgraph.spatialai.org/v1/me-egad-data#Groundwater'], + minConcentration: 4, + maxConcentration: 100, + unit: 'ng/L', + includeNondetects: false, + }, + }, + relationship: { type: 'downstream' }, + blockC: { type: 'facilities', facilityFilters: { industryCodes: ['562212'] } }, + } as AnalysisQuestion, + ], + [ + 'facility + water body + well + aquifer filters', + { + blockA: { type: 'wells', region: { stateCode: '23' }, wellFilters: { wellCategories: ['meUse||http://example.org/use/Domestic'] } }, + relationship: { type: 'near', hops: 1 }, + blockC: { type: 'aquifers', aquiferFilters: { aquiferTypes: ['bedrock'] } }, + } as AnalysisQuestion, + ], + [ + 'stream ftype filter as target', + { + blockA: { type: 'samples', region: { stateCode: '23' } }, + relationship: { type: 'downstream' }, + blockC: { type: 'streams', streamFilters: { ftypes: ['460'] } }, + } as AnalysisQuestion, + ], +]; +for (const [name, question] of variants) out.push(...record(`VARIANT: ${name}`, question)); + +// Every distinct query body, sorted by hash so the table has a stable order and +// a new query lands as one added line rather than reshuffling the file. +out.push('', BODIES_MARKER); +for (const [hash, query] of [...bodies].sort(([a], [b]) => a.localeCompare(b))) { + out.push(`${hash} ${query}`); +} + +const next = out.join('\n') + '\n'; +const update = process.argv.includes('--update'); + +if (update || !existsSync(SNAPSHOT)) { + writeFileSync(SNAPSHOT, next); + console.log(`${update ? 'Re-recorded' : 'Recorded'} ${out.filter((l) => l.startsWith('## ')).length} shapes.`); + process.exit(0); +} + +const prev = readFileSync(SNAPSHOT, 'utf8'); +if (prev === next) { + console.log(`OK: ${out.filter((l) => l.startsWith('## ')).length} shapes match the snapshot.`); + process.exit(0); +} + +// Report which shapes moved, grouped by relationship, so a "downstream fix" +// that also moved 36 near shapes says so in the first line of output. +// Shapes only: the body table at the end is keyed by content hash, so any +// change to a query already moves the hash of every shape that references it. +// Reporting the table as well would add a line of noise to every diff. +const headings = (text: string) => { + const map = new Map(); + let current = ''; + for (const line of text.split('\n')) { + if (line === BODIES_MARKER) break; + if (line.startsWith('## ')) current = line.slice(3); + else if (current) map.set(current, (map.get(current) ?? '') + line + '\n'); + } + return map; +}; +const before = headings(prev); +const after = headings(next); +const moved = [...after.keys()].filter((k) => before.get(k) !== after.get(k)); +const gone = [...before.keys()].filter((k) => !after.has(k)); + +// Bucket by every axis of the grid, not just the relationship: a change that +// moves only the bounded shapes, or only the ones scoped on block C, is saying +// something quite different from one that moves a whole relationship, and the +// first line of output should be enough to tell them apart. +const count = (names: string[], re: RegExp) => names.filter((n) => re.test(n)).length; +console.error(`Generated SPARQL changed for ${moved.length} shape(s)${gone.length ? `, ${gone.length} removed` : ''}:`); +console.error( + ` near ${count(moved, / near /)} downstream ${count(moved, / downstream[( ]/)} upstream ${count(moved, / upstream[( ]/)}` + + ` bounded ${count(moved, /\(30km\)/)} region on A ${count(moved, /\[ME on A\]/)} region on C ${count(moved, /\[ME on C\]/)}` + + ` variants ${count(moved, /^VARIANT/)}`, +); +for (const name of moved.slice(0, 40)) console.error(` - ${name}`); +if (moved.length > 40) console.error(` ... and ${moved.length - 40} more`); +console.error('\nIf every one of those is intended, re-record:'); +console.error(' npm run check-query-snapshots -- --update'); +process.exit(1); diff --git a/scripts/check-step-labels.mts b/scripts/check-step-labels.mts new file mode 100644 index 0000000..2871da9 --- /dev/null +++ b/scripts/check-step-labels.mts @@ -0,0 +1,181 @@ +// Self-check for the user-facing pipeline step labels (src/engine/planner.ts). +// +// npx tsx scripts/check-step-labels.mts +// +// The dashboard exercises 4 of the 108 entity x entity x relationship shapes +// the editor can build, and never exercises `upstream` at all. That matters +// here because the planner's anchor/target mapping flips for `upstream`: the +// step that returns block A is FIND_TARGET_IRIS for near and downstream, and +// FIND_ANCHOR_IRIS for upstream. A label keyed off the target/anchor role +// instead of off the block the step returns comes out swapped for a third of +// the question space, and nothing in the app would catch it. +// +// No network: planPipeline only builds query strings. +import assert from 'node:assert/strict'; +import { planPipeline } from '../src/engine/planner'; +import { entityTypeLabel } from '../src/utils/questionGenerator'; +import type { AnalysisQuestion, EntityType, SpatialRelationship } from '../src/types/query'; + +const ENTITY_TYPES: EntityType[] = [ + 'samples', + 'facilities', + 'waterBodies', + 'wells', + 'aquifers', + 'streams', +]; +// The three RelationshipSelector offers. 'within' is in the type union but is +// never selectable and never planned for. +const RELATIONSHIPS: SpatialRelationship['type'][] = ['near', 'downstream', 'upstream']; + +const question = ( + a: EntityType, + rel: SpatialRelationship['type'], + c: EntityType, + withRegion = true, +): AnalysisQuestion => + ({ + blockA: withRegion ? { type: a, region: { stateCode: '23' } } : { type: a }, + relationship: { type: rel, ...(rel === 'near' ? { hops: 1 } : {}) }, + blockC: { type: c }, + }) as AnalysisQuestion; + +let checks = 0; +let combinations = 0; + +for (const a of ENTITY_TYPES) { + for (const c of ENTITY_TYPES) { + for (const rel of RELATIONSHIPS) { + const where = `${a} ${rel} ${c}`; + const steps = planPipeline(question(a, rel, c)); + combinations++; + + const labels = steps.map((s) => s.description); + + // Nothing unlabelled, and no raw camelCase type name leaking through. + for (const label of labels) { + assert.ok(label.trim().length > 0, `empty description: ${where}`); + for (const type of ENTITY_TYPES) { + if (type !== entityTypeLabel(type)) { + assert.ok(!label.includes(type), `raw type name "${type}" in "${label}": ${where}`); + } + } + } + + // Both discovery labels name both blocks. + const aLabel = entityTypeLabel(a); + const cLabel = entityTypeLabel(c); + const target = steps.find((s) => s.type === 'FIND_TARGET_IRIS')!; + const anchor = steps.find((s) => s.type === 'FIND_ANCHOR_IRIS')!; + for (const step of [target, anchor]) { + assert.ok( + step.description.includes(aLabel) && step.description.includes(cLabel), + `discovery label names only one block: "${step.description}" (${where})`, + ); + } + + // The step that returns block A carries the block-A phrasing. This is the + // assertion that catches the upstream flip: "with ... them" marks the + // step that returns block C. + const returnsBlockA = rel === 'upstream' ? anchor : target; + const returnsBlockC = rel === 'upstream' ? target : anchor; + assert.ok( + !returnsBlockA.description.includes(' with '), + `step returning block A got the block C phrasing: "${returnsBlockA.description}" (${where})`, + ); + assert.ok( + returnsBlockC.description.includes(' with '), + `step returning block C got the block A phrasing: "${returnsBlockC.description}" (${where})`, + ); + + // Hydrate labels name their own entity type and drop the planner jargon. + for (const step of steps) { + if (step.type === 'HYDRATE_TARGET_BY_IRI' || step.type === 'HYDRATE_ANCHOR_BY_IRI') { + assert.ok( + !/\b(target|anchor)\b/.test(step.description), + `planner jargon in "${step.description}": ${where}`, + ); + } + } + + // Step set, per the conditions in buildFusedSteps. Pinned so a label + // change is never mistaken for a step change. + const types = steps.map((s) => s.type); + const wantsFlowlines = rel !== 'near' && a !== 'streams' && c !== 'streams'; + assert.equal( + types.includes('GET_FLOWLINE_GEOMETRIES'), + wantsFlowlines, + `flowline step presence wrong: ${where}`, + ); + assert.ok(types.includes('GET_REGION_BOUNDARIES'), `region step missing: ${where}`); + assert.equal(steps.length, wantsFlowlines ? 6 : 5, `step count wrong: ${where}`); + + // Without a region the boundary step goes away, and 4 is the floor. + const noRegion = planPipeline(question(a, rel, c, false)); + assert.ok( + !noRegion.some((s) => s.type === 'GET_REGION_BOUNDARIES'), + `region step present without a region: ${where}`, + ); + assert.equal(noRegion.length, wantsFlowlines ? 5 : 4, `step count wrong, no region: ${where}`); + + checks += 6; + } + } +} + +// The reported question, spelled out. planner.ts maps downstream to +// anchor=blockC, so FIND_TARGET_IRIS is the step that returns the samples. +const reported = planPipeline({ + blockA: { type: 'samples', region: { stateCode: '18' } }, + relationship: { type: 'downstream' }, + blockC: { type: 'facilities', facilityFilters: { industryCodes: ['488119', '481111'] } }, +} as AnalysisQuestion); +assert.deepEqual( + reported.map((s) => s.description), + [ + 'Finding samples downstream of facilities', + 'Finding facilities with samples downstream of them', + 'Loading downstream stream geometries', + 'Loading details for samples', + 'Loading details for facilities', + 'Loading region boundaries', + ], +); +checks++; + +// Same question upstream: the labels must swap steps, not swap words. +const up = planPipeline({ + blockA: { type: 'samples', region: { stateCode: '18' } }, + relationship: { type: 'upstream' }, + blockC: { type: 'facilities' }, +} as AnalysisQuestion); +assert.equal( + up.find((s) => s.type === 'FIND_ANCHOR_IRIS')!.description, + 'Finding samples upstream from facilities', +); +assert.equal( + up.find((s) => s.type === 'FIND_TARGET_IRIS')!.description, + 'Finding facilities with samples upstream from them', +); +checks += 2; + +// One sample of the table, for the eyeball pass that assertions cannot do. +if (process.argv.includes('--print')) { + for (const rel of RELATIONSHIPS) { + for (const [a, c] of [ + ['samples', 'facilities'], + ['waterBodies', 'facilities'], + ['facilities', 'facilities'], + ['streams', 'wells'], + ] as [EntityType, EntityType][]) { + console.log(`\n${a} ${rel} ${c}`); + for (const [i, s] of planPipeline(question(a, rel, c)).entries()) { + console.log(` Step ${i + 1}: ${s.description}`); + } + } + } +} + +console.log( + `step labels: ${combinations} combinations, ${checks} checks passed (--print to see the labels)`, +); diff --git a/scripts/check-substance-labels.mts b/scripts/check-substance-labels.mts new file mode 100644 index 0000000..323b6b0 --- /dev/null +++ b/scripts/check-substance-labels.mts @@ -0,0 +1,104 @@ +// Self-check for the substance naming rule and for the popup's per-substance +// grouping (src/constants/substances.ts, src/engine/resultTransformer.ts). +// +// npx tsx scripts/check-substance-labels.mts +// +// Both are silent when wrong. A drifting naming rule shows the same substance +// as "10-H-Perfluorodecanoic acid" in the filter dropdown and as a bare +// "DTXSID10630918" in the map popup, which reads as a broken query. Grouping +// that keys on the label instead of the URI merges two substances that happen +// to share a name; grouping that forgets to append merges away real results. +import assert from 'node:assert/strict'; +import { substanceLabel, resolveRetired } from '../src/constants/substances'; +import { buildSamplePointDetail } from '../src/engine/resultTransformer'; +import type { SparqlRow } from '../src/types/sparql'; + +let checks = 0; +function check(name: string, fn: () => void) { + fn(); + checks++; + void name; +} + +const PFDA = 'http://w3id.org/DSSTox/v1/DTXSID10630918'; + +// The naming rule, in priority order. +check('short form wins', () => + assert.equal( + substanceLabel({ uri: PFDA, shortLabel: 'PFDA', label: 'Perfluorodecanoic acid', paramLabel: 'x' }), + 'PFDA', + ), +); +check('full name when there is no short form', () => + assert.equal(substanceLabel({ uri: PFDA, label: 'Perfluorodecanoic acid' }), 'Perfluorodecanoic acid'), +); +// 33 of the 172 DSSTox substances in the graph carry no label of their own; +// every one of them is named by its source parameter. +check('source parameter names the unlabelled substances', () => + assert.equal( + substanceLabel({ uri: PFDA, paramLabel: '10-H-Perfluorodecanoic acid' }), + '10-H-Perfluorodecanoic acid', + ), +); +check('DTXSID is the last resort', () => assert.equal(substanceLabel({ uri: PFDA }), 'DTXSID10630918')); + +// Retired source parameters name their own replacement. +check('retired parameter resolves to its replacement', () => + assert.equal(resolveRetired('PFOS***retired***use Perfluorooctanesulfonate'), 'Perfluorooctanesulfonate'), +); +check('retired parameter with no replacement keeps its name', () => + assert.equal(resolveRetired('PFOS ***retired***'), 'PFOS'), +); + +// The popup's grouping. These rows mirror sample +// d.wqp.sample.INSTOR_WQX-AB35759FISHPREP at sample point INSTOR_WQX-8112: +// two observations of one substance, same date, same unit, differing only in +// value, which is what looked like a duplicated row. +const row = (over: Partial): SparqlRow => + ({ + sp: 'https://geoconnex.us/iow/wqp/INSTOR_WQX-8112', + spWKT: 'POINT(-86.9 39.7)', + samplePointName: 'UMK030-0023', + sample: 'sample.AB35759FISHPREP', + sampleIdentifier: 'INSTOR_WQX-AB35759.FISHPREP', + date: '2020-01-17', + unit_sym: 'μg/kg', + ...over, + }) as SparqlRow; + +const detail = buildSamplePointDetail([ + row({ observation: 'o1', substanceUri: PFDA, substanceParamLabel: '10-H-Perfluorodecanoic acid', result_value: '0.249' }), + row({ observation: 'o2', substanceUri: PFDA, substanceParamLabel: '10-H-Perfluorodecanoic acid', result_value: '0.285' }), + row({ observation: 'o3', substanceUri: 'http://w3id.org/DSSTox/v1/DTXSID3031864', substanceShortLabel: 'PFOS', result_value: '3.16' }), + // A non-detect: no numeric value, so it is not a result to list. + row({ observation: 'o4', substanceUri: 'http://w3id.org/DSSTox/v1/DTXSID3040148', substanceShortLabel: 'PFDS', result_value: 'non-detect' }), +]); + +assert.ok(detail, 'expected a detail object'); +check('one sample section', () => assert.equal(detail.samples.length, 1)); +const obs = detail.samples[0].observations; +check('repeat observations collapse to one row per substance', () => assert.equal(obs.length, 2)); +check('both values are kept', () => + assert.deepEqual(obs[0], { + substance: '10-H-Perfluorodecanoic acid', + substanceUri: PFDA, + results: [0.249, 0.285], + unit: 'μg/kg', + }), +); +check('grouping keys on the URI, not the label', () => assert.equal(obs[1].substance, 'PFOS')); +check('max is reported with the shared label', () => + assert.equal(detail.maxResult?.substance, 'PFOS'), +); +check('max is the largest value', () => assert.equal(detail.maxResult?.value, 3.16)); + +// Two substances sharing a display name must stay on separate rows. +const shared = buildSamplePointDetail([ + row({ observation: 'o1', substanceUri: 'http://w3id.org/DSSTox/v1/DTXSID1', substanceShortLabel: 'PFOS', result_value: '1' }), + row({ observation: 'o2', substanceUri: 'http://w3id.org/DSSTox/v1/DTXSID2', substanceShortLabel: 'PFOS', result_value: '2' }), +]); +check('same name, different URI, two rows', () => + assert.equal(shared?.samples[0].observations.length, 2), +); + +console.log(`substance labels: ${checks} checks passed`); diff --git a/scripts/check-trace-direction.mts b/scripts/check-trace-direction.mts new file mode 100644 index 0000000..d92a92d --- /dev/null +++ b/scripts/check-trace-direction.mts @@ -0,0 +1,163 @@ +// Self-check for the direction of every hydrology trace the planner can build +// (src/engine/planner.ts, src/engine/templates/fusedQueries.ts). +// +// npx tsx scripts/check-trace-direction.mts +// +// The templates trace one way only: the target comes out `direction` of the +// anchor, seeded from the anchor's S2 cells. The planner puts the anchor on the +// upstream side of the question — block C for "A downstream from C", block A +// for "A upstream from C" — so every trace it builds must run *downstream from +// the seed*. Pairing anchor=blockA with direction='upstream', which the planner +// did until 2026-09-16, answered the mirror question for all 36 upstream +// shapes, and nothing in the app looked wrong enough to catch it: both layers +// still rendered, still near the right rivers. +// +// Three builders trace, and a question can use all three at once (discovery, +// the supporting flowline layer, and well hydration, which re-derives the trace +// server-side instead of hydrating by IRI). They have to agree, so this checks +// the SPARQL they emit rather than the direction flag they were handed. +// +// No network: the pipeline steps only build query strings. +import assert from 'node:assert/strict'; +import { planPipeline, type PipelineContext } from '../src/engine/planner'; +import type { AnalysisQuestion, EntityType, SpatialRelationship } from '../src/types/query'; + +const ENTITY_TYPES: EntityType[] = [ + 'samples', + 'facilities', + 'waterBodies', + 'wells', + 'aquifers', + 'streams', +]; +const HYDROLOGY: SpatialRelationship['type'][] = ['downstream', 'upstream']; + +// Every way the templates write the transitive closure. The chain variable that +// comes *first* is the upstream one, so the seed has to be on the left. +const FORWARD = [ + '?upstream_flowline hyf:downstreamFlowPathTC ?ds_flowline', // discovery, unbounded + '?upstream_flowline hyf:downstreamFlowPathTC ?_flMid', // discovery, bounded + '?_flSeed hyf:downstreamFlowPathTC ?_flMid', // flowline layer, bounded + 'hyf:downstreamFlowPathTC ?flowline', // flowline layer, unbounded +]; +const REVERSED = [ + '?ds_flowline hyf:downstreamFlowPathTC ?upstream_flowline', + '?flowline hyf:downstreamFlowPathTC ?downstream_flowline', +]; + +// `?_flEnd hyf:downstreamFlowPathTC ?_flMid` used to sit in REVERSED. It cannot +// any more: a bounded block seeded from the target writes that exact triple +// while tracing perfectly correctly, because it walks outward from the target +// instead of from the anchor. One string is now correct or reversed depending +// on which side seeds, so the queries that name both ends are checked by +// reachability instead, which is what the string was standing in for. +// +// Both predicates carry direction, and `?a ?b` always means a flows into +// b: hyf:downstreamFlowPathTC is the closure, hyf:downstreamFlowPath? is one +// segment. Subject-first triples only, which is every trace in the discovery +// and well queries; the flowline layer writes one of its closures in a +// predicate-object list and keeps the string check above. +const FLOW_EDGE = /(\?\w+)\s+hyf:downstreamFlowPath(?:TC)?\??\s+(\?\w+)/g; + +function flowsInto(sparql: string, from: string, to: string): boolean { + const edges = new Map>(); + for (const [, a, b] of sparql.matchAll(FLOW_EDGE)) { + if (!edges.has(a)) edges.set(a, new Set()); + edges.get(a)!.add(b); + } + const seen = new Set([from]); + const queue = [from]; + while (queue.length) { + const v = queue.shift()!; + if (v === to) return true; + for (const n of edges.get(v) ?? []) if (!seen.has(n)) { seen.add(n); queue.push(n); } + } + return false; +} + +const context = (): PipelineContext => ({ + question: {} as AnalysisQuestion, + // The flowline step traces from the anchors discovery resolved; give it two + // so its query is built rather than skipped. + targetIris: ['https://example.org/t1', 'https://example.org/t2'], + anchorIris: ['https://example.org/a1', 'https://example.org/a2'], + results: {}, +}); + +let checks = 0; +let combinations = 0; + +for (const a of ENTITY_TYPES) { + for (const c of ENTITY_TYPES) { + for (const rel of HYDROLOGY) { + for (const maxDistanceKm of [undefined, 30]) { + const question: AnalysisQuestion = { + blockA: { type: a, region: { stateCode: '23' } }, + relationship: { type: rel, ...(maxDistanceKm ? { maxDistanceKm } : {}) }, + blockC: { type: c }, + }; + const where = `${a} ${rel} ${c}${maxDistanceKm ? ` (${maxDistanceKm}km)` : ''}`; + combinations++; + + let traced = 0; + for (const step of planPipeline(question)) { + const sparql = step.buildQuery(context()); + if (!sparql.includes('downstreamFlowPathTC')) continue; + traced++; + + if (sparql.includes('?upstream_flowline') && sparql.includes('?ds_flowline')) { + // The anchor's flowline has to reach the target's, whichever end + // the bounded block seeds from. This is the property the whole + // direction rule exists to protect: pairing anchor=blockA with + // direction='upstream' reverses the chain and fails here. + assert.ok( + flowsInto(sparql, '?upstream_flowline', '?ds_flowline'), + `${step.type} has no directed path from the anchor's flowline to the target's: ${where}`, + ); + checks++; + } else { + for (const pattern of REVERSED) { + assert.ok( + !sparql.includes(pattern), + `${step.type} traces upstream from the seed ("${pattern}"): ${where}`, + ); + checks++; + } + assert.ok( + FORWARD.some((pattern) => sparql.includes(pattern)), + `${step.type} has no recognisable trace pattern: ${where}`, + ); + checks++; + } + } + + // A hydrology question that traced nowhere would pass the loop above + // by doing nothing at all. + assert.ok(traced > 0, `no step traced: ${where}`); + checks++; + } + } + } +} + +// And the relationship the user picked must still reach the templates intact: +// 'near' never traces. +for (const a of ENTITY_TYPES) { + for (const c of ENTITY_TYPES) { + const question: AnalysisQuestion = { + blockA: { type: a, region: { stateCode: '23' } }, + relationship: { type: 'near', hops: 1 }, + blockC: { type: c }, + }; + combinations++; + for (const step of planPipeline(question)) { + assert.ok( + !step.buildQuery(context()).includes('downstreamFlowPathTC'), + `near question traces flow paths: ${a} near ${c} (${step.type})`, + ); + checks++; + } + } +} + +console.log(`trace direction: ${combinations} combinations, ${checks} checks passed`); diff --git a/scripts/flow-distance-check.mjs b/scripts/flow-distance-check.mjs new file mode 100644 index 0000000..735a961 --- /dev/null +++ b/scripts/flow-distance-check.mjs @@ -0,0 +1,114 @@ +// Checks the distance-bounded downstream trace against the live SPARQL +// endpoints, using the same planner the app runs. +// +// Reference values come from UC1_CQ2c (New Hampshire, NAICS 488119 airports, +// 30 km): the notebook returns 162 flowlines, but only because it requires +// schema1:address on facilities — a predicate 13 of 144 NH airport facilities +// have. Without that accidental filter its answer is 1,547 flowlines, and ours +// is a superset of exactly that set (we also expand to neighbouring S2 cells +// and add the "+1" segment past the cutoff). +// +// Run: node scripts/flow-distance-check.mjs +import assert from 'node:assert/strict'; +import { build } from 'esbuild'; + +const bundle = await build({ + entryPoints: ['src/engine/planner.ts'], + bundle: true, + format: 'esm', + platform: 'neutral', + write: false, +}); +const { planPipeline } = await import( + 'data:text/javascript;base64,' + Buffer.from(bundle.outputFiles[0].text).toString('base64') +); + +const ENDPOINTS = { + sawgraph: 'https://frink.apps.renci.org/sawgraph/sparql', + spatialkg: 'https://frink.apps.renci.org/spatialkg/sparql', + hydrologykg: 'https://frink.apps.renci.org/hydrologykg/sparql', + federation: 'https://frink.apps.renci.org/federation/sparql', +}; + +async function run(endpoint, query) { + const res = await fetch(ENDPOINTS[endpoint], { + method: 'POST', + headers: { + Accept: 'application/sparql-results+json', + 'Content-Type': 'application/sparql-query', + }, + body: query, + }); + if (!res.ok) throw new Error(`${endpoint} ${res.status}: ${await res.text()}`); + const json = await res.json(); + return json.results.bindings.map((row) => + Object.fromEntries(Object.entries(row).map(([k, v]) => [k, v.value])), + ); +} + +// "What streams are within 30 km downstream of 488119 (Airports) facilities +// in New Hampshire?" — the notebook's question, expressed in the app's model. +const question = { + blockA: { type: 'streams' }, + relationship: { type: 'downstream', maxDistanceKm: 30 }, + blockC: { + type: 'facilities', + region: { stateCode: '33' }, + facilityFilters: { industryCodes: ['488119'] }, + }, +}; + +const steps = planPipeline(question); +const stepTypes = steps.map((s) => s.type); + +// The answer set *is* the flowlines, so the supporting stream layer is skipped. +assert.ok( + !stepTypes.includes('GET_FLOWLINE_GEOMETRIES'), + `expected no supporting flowline step, got ${stepTypes.join(', ')}`, +); + +const ctx = { question, targetIris: [], anchorIris: [], results: {} }; +for (const step of steps) { + const rows = await run(step.endpoint, step.buildQuery(ctx)); + ctx.results[step.type] = rows; + if (step.type === 'FIND_TARGET_IRIS') ctx.targetIris = [...new Set(rows.map((r) => r.iri))]; + if (step.type === 'FIND_ANCHOR_IRIS') ctx.anchorIris = [...new Set(rows.map((r) => r.iri))]; + console.log(`${step.type}: ${rows.length} rows`); +} + +const streams = ctx.targetIris.length; +const facilities = ctx.anchorIris.length; +console.log(`\n${streams} streams within 30 km downstream of ${facilities} NH airport facilities`); + +// The "+1" fringe must land past the cutoff, so some flowlines carry a +// distance above the threshold — that is the point of it. +const overThreshold = (ctx.results['GET_FLOWLINE_GEOMETRIES'] ?? []) + .concat(ctx.results['HYDRATE_TARGET_BY_IRI'] ?? []) + .filter((r) => r.path_length !== undefined && Number(r.path_length) >= 30); +console.log(`${overThreshold.length} flowlines past the 30 km cutoff (the "+1" fringe)`); + +// The bound has to actually bind: unbounded, this trace runs to the coast. +const unbounded = planPipeline({ ...question, relationship: { type: 'downstream' } }); +const unboundedRows = await run(unbounded[0].endpoint, unbounded[0].buildQuery(ctx)); +const unboundedStreams = new Set(unboundedRows.map((r) => r.iri)).size; +console.log(`${unboundedStreams} streams with no distance bound`); + +assert.ok(streams > 1547, `expected a superset of the notebook's 1547, got ${streams}`); +// The bound must actually exclude flowlines the unbounded trace reaches. +// Observed 2026-08: 2784 bounded (2757 within the cutoff + 27 fringe) vs 3490 +// unbounded — downstreamFlowPathTC in this KG does not reach as far as the +// coast, so the gap is smaller than the notebook's parameters suggest. +assert.ok( + unboundedStreams > streams, + `bound had no effect: ${streams} bounded vs ${unboundedStreams} unbounded`, +); + +// Every hydrated stream carries geometry the map can draw. +const hydrated = ctx.results['HYDRATE_TARGET_BY_IRI'] ?? []; +assert.ok(hydrated.length > 0, 'no hydrated streams'); +assert.ok( + hydrated.every((r) => r.flowlineWKT?.startsWith('LINESTRING')), + 'hydrated streams missing LINESTRING geometry', +); + +console.log('\nOK'); diff --git a/scripts/health-check.mts b/scripts/health-check.mts new file mode 100644 index 0000000..9fd71d3 --- /dev/null +++ b/scripts/health-check.mts @@ -0,0 +1,266 @@ +// Runs the dashboard questions and writes down what happened, so a regression +// has a date attached to it instead of being noticed weeks later. +// +// npx tsx scripts/health-check.mts [--out docs/health/history.jsonl] +// npx tsx scripts/health-check.mts --render-only # rebuild STATUS.md, no queries +// +// Deliberately takes no token and writes nothing to the API. It is pure +// measurement: every run goes through the real pipeline against the live +// endpoints, never the result cache, because a cached answer would tell us +// about the cache rather than the graph. +// +// Exit codes: 0 fine, 1 the script itself broke, 2 a question that worked last +// time does not work now. +// +// Every failure is retried once. Measured while building this: three questions +// failed in the first run (3-13s each) and all three succeeded immediately +// afterwards at 22-52s. The endpoint is shared and gets busy, and a check that +// opens an issue on a single bad request would cry wolf until it was ignored. +import { execSync } from 'node:child_process'; +import { appendFileSync, mkdirSync, readFileSync, writeFileSync, existsSync } from 'node:fs'; +import { dirname } from 'node:path'; +import { PREBUILT_QUERIES } from '../src/constants/prebuiltQueries'; +import { planPipeline } from '../src/engine/planner'; +import { executePipeline } from '../src/engine/executor'; + +// The keys useMapLayers renders (wire.ts RENDERED_KEYS). Counting anything else +// would flag drift in intermediate bookkeeping the user never sees. +const COUNTED = ['FIND_TARGET_ENTITIES', 'GET_ANCHOR_DETAILS', 'GET_REGION_BOUNDARIES', 'GET_FLOWLINE_GEOMETRIES'] as const; + +interface HealthRecord { + runAt: string; + ref: string; + commit: string; + id: string; + title: string; + status: 'success' | 'empty' | 'error'; + ms: number; + counts: Record; + partialFailed: string[]; + partialSkipped: string[]; + error: string | null; + // 2 means the first try failed. Worth recording: a question that needs the + // retry every week is degrading even while it still counts as working. + attempts: number; +} + +const renderOnly = process.argv.includes('--render-only'); +const ref = renderOnly ? '' : process.argv[2]; +const outArg = process.argv.indexOf('--out'); +const HISTORY = outArg > -1 ? process.argv[outArg + 1] : 'docs/health/history.jsonl'; +const STATUS = `${dirname(HISTORY)}/STATUS.md`; + +if (!ref && !renderOnly) { + console.error('Usage: health-check.mts [--out path] | --render-only'); + process.exit(1); +} + +const commit = (() => { + try { + return execSync('git rev-parse --short HEAD', { encoding: 'utf8' }).trim(); + } catch { + return 'unknown'; + } +})(); + +function readHistory(): HealthRecord[] { + if (!existsSync(HISTORY)) return []; + return readFileSync(HISTORY, 'utf8') + .split('\n') + .filter(Boolean) + .map((line) => JSON.parse(line) as HealthRecord); +} + +const history = readHistory(); +// The run this one is compared against: the most recent for the same branch. +const previousRunAt = [...new Set(history.filter((r) => r.ref === ref).map((r) => r.runAt))].sort().pop(); +const previous = new Map(history.filter((r) => r.ref === ref && r.runAt === previousRunAt).map((r) => [r.id, r])); + +if (renderOnly) { + writeFileSync(STATUS, renderStatus(history)); + console.log(`Rebuilt ${STATUS} from ${history.length} records.`); + process.exit(0); +} + +const runAt = new Date().toISOString(); +const records: HealthRecord[] = []; + +console.log(`Dashboard health — ${ref} @ ${commit}, ${PREBUILT_QUERIES.length} questions\n`); + +for (const prebuilt of PREBUILT_QUERIES) { + const started = Date.now(); + process.stdout.write(` ${prebuilt.title.slice(0, 54).padEnd(56)}`); + + let record = await attempt(prebuilt, 1); + if (record.status === 'error') { + process.stdout.write('retrying… '); + record = await attempt(prebuilt, 2); + } + record.ms = Date.now() - started; + + records.push(record); + console.log(`${icon(record)} ${(record.ms / 1000).toFixed(0).padStart(4)}s ${summarise(record, previous.get(record.id))}`); +} + +mkdirSync(dirname(HISTORY), { recursive: true }); +appendFileSync(HISTORY, records.map((r) => JSON.stringify(r)).join('\n') + '\n'); +writeFileSync(STATUS, renderStatus([...history, ...records])); + +// A question that worked last week and does not work now. Drift in row counts +// is not a regression: the knowledge graph reloads, and numbers move for +// legitimate reasons. Only a status going backwards is worth waking someone for. +// A question with no previous record cannot have regressed — a first run, or a +// newly added question, must not open an issue for something that was never +// seen working. +const regressions = records.filter((r) => { + const was = previous.get(r.id); + return r.status === 'error' && was !== undefined && was.status !== 'error'; +}); +const working = records.filter((r) => r.status !== 'error').length; + +console.log(`\n${working} of ${records.length} working, ${(records.reduce((n, r) => n + r.ms, 0) / 1000).toFixed(0)}s total`); +console.log(`History: ${HISTORY} Status page: ${STATUS}`); + +if (regressions.length) { + console.log(`\nREGRESSIONS (${regressions.length}):`); + for (const r of regressions) { + const was = previous.get(r.id); + console.log(` ${r.title}`); + console.log(` now: error — ${r.error}`); + console.log(` was: ${was!.status} in ${(was!.ms / 1000).toFixed(0)}s on ${was!.runAt.slice(0, 10)}`); + } + process.exit(2); +} + +async function attempt(prebuilt: (typeof PREBUILT_QUERIES)[number], n: number): Promise { + const started = Date.now(); + const base = { runAt, ref, commit, id: prebuilt.id, title: prebuilt.title, attempts: n }; + try { + const result = await executePipeline(planPipeline(prebuilt.question), prebuilt.question, () => {}); + const counts: Record = {}; + if (result.status === 'success') { + for (const key of COUNTED) if (result.data[key]?.length) counts[key] = result.data[key].length; + } + return { + ...base, + status: result.status, + ms: Date.now() - started, + counts, + partialFailed: result.status === 'success' ? (result.partial ?? []).flatMap((p) => p.failed) : [], + partialSkipped: result.status === 'success' ? (result.partial ?? []).flatMap((p) => p.skipped) : [], + error: result.status === 'error' ? result.message.slice(0, 200) : null, + }; + } catch (err) { + // A thrown error is still a data point — the question is broken either way. + return { + ...base, + status: 'error', + ms: Date.now() - started, + counts: {}, + partialFailed: [], + partialSkipped: [], + error: err instanceof Error ? err.message.slice(0, 200) : String(err), + }; + } +} + +function icon(r: HealthRecord): string { + return r.status === 'success' ? (r.partialFailed.length || r.partialSkipped.length ? '⚠️' : '✅') : r.status === 'empty' ? '⬜' : '❌'; +} + +function total(r: HealthRecord): number { + return Object.values(r.counts).reduce((n, v) => n + v, 0); +} + +function summarise(r: HealthRecord, was?: HealthRecord): string { + if (r.status === 'error') return (r.error ?? '').slice(0, 50); + const now = total(r); + if (!was || was.status === 'error') return `${now} rows`; + const drift = now - total(was); + return drift === 0 ? `${now} rows` : `${now} rows (${drift > 0 ? '+' : ''}${drift})`; +} + +function renderStatus(all: HealthRecord[]): string { + const refs = [...new Set(all.map((r) => r.ref))].sort(); + const out = [ + '# Dashboard health', + '', + '_Generated by `npm run health-check` — see the weekly workflow in', + '`.github/workflows/health-check.yml`. Every run goes through the live pipeline,', + 'never the result cache._', + '', + '**Targets** are the entities the question asks for, **anchors** the ones it', + 'relates them to, **reaches** the river segments drawn for a trace. Region', + 'boundaries are recorded in the history but not shown — they are the county', + 'outline, not an answer.', + '', + 'A moved count is not automatically a bug: the knowledge graph reloads and', + 'numbers change for real reasons. It is flagged so that when something *does*', + 'look wrong, there is a date to point at.', + '', + ]; + + for (const r of refs) { + const runs = [...new Set(all.filter((x) => x.ref === r).map((x) => x.runAt))].sort(); + const latest = all.filter((x) => x.ref === r && x.runAt === runs[runs.length - 1]); + const prior = new Map(all.filter((x) => x.ref === r && x.runAt === runs[runs.length - 2]).map((x) => [x.id, x])); + if (!latest.length) continue; + + const ok = latest.filter((x) => x.status !== 'error').length; + out.push( + `## ${r}`, + '', + `**${ok} of ${latest.length} working** · ${latest[0].runAt.slice(0, 16).replace('T', ' ')} UTC · \`${latest[0].commit}\``, + '', + '| | Question | Time | Targets | Anchors | Reaches | Change since last run |', + '| --- | --- | ---: | ---: | ---: | ---: | --- |', + ); + for (const x of latest) { + const was = prior.get(x.id); + const cell = (k: string) => (x.status === 'error' ? '—' : (x.counts[k] ?? 0) || '—'); + out.push( + `| ${icon(x)} | ${x.title} | ${(x.ms / 1000).toFixed(0)}s | ${cell('FIND_TARGET_ENTITIES')} | ${cell('GET_ANCHOR_DETAILS')} | ${cell('GET_FLOWLINE_GEOMETRIES')} | ${change(x, was)} |`, + ); + } + out.push(''); + + const notes = latest.filter((x) => x.partialFailed.length || x.partialSkipped.length); + if (notes.length) { + out.push('**Incomplete answers:**', ''); + for (const x of notes) { + const bits = [ + x.partialFailed.length ? `could not answer ${x.partialFailed.join(', ')}` : '', + x.partialSkipped.length ? `ran out of time before ${x.partialSkipped.join(', ')}` : '', + ].filter(Boolean); + out.push(`- ${x.title} — ${bits.join('; ')}`); + } + out.push(''); + } + + const errors = latest.filter((x) => x.status === 'error'); + if (errors.length) { + out.push('**Errors:**', ''); + for (const x of errors) out.push(`- ${x.title} — \`${x.error}\``); + out.push(''); + } + } + + out.push('---', '', `Full history: [\`${HISTORY.split('/').pop()}\`](./${HISTORY.split('/').pop()}) — one JSON line per question per run.`, ''); + return out.join('\n'); +} + +function change(now: HealthRecord, was?: HealthRecord): string { + if (!was) return '_first run_'; + if (was.status !== now.status) return `**was ${was.status}** on ${was.runAt.slice(0, 10)}`; + if (now.status === 'error') return 'still failing'; + const drift = total(now) - total(was); + if (drift === 0) return '—'; + const perKey = COUNTED.filter((k) => (now.counts[k] ?? 0) !== (was.counts[k] ?? 0)) + .map((k) => `${label(k)} ${was.counts[k] ?? 0} → ${now.counts[k] ?? 0}`) + .join(', '); + return `**${perKey}**`; +} + +function label(key: string): string { + return { FIND_TARGET_ENTITIES: 'targets', GET_ANCHOR_DETAILS: 'anchors', GET_REGION_BOUNDARIES: 'boundaries', GET_FLOWLINE_GEOMETRIES: 'reaches' }[key] ?? key; +} diff --git a/scripts/query-matrix.mts b/scripts/query-matrix.mts new file mode 100644 index 0000000..2245c90 --- /dev/null +++ b/scripts/query-matrix.mts @@ -0,0 +1,461 @@ +// Query-matrix harness: runs every question shape the editor can build against +// the live endpoints and writes one CSV row per query. +// +// This is the tool behind docs/QUERY-MATRIX.md. Re-run it after any change to +// the query engine and diff the output against docs/query-matrix/2026-09-14-raw-baseline.csv — no shape +// may regress from working to failing. +// +// npx tsx scripts/query-matrix.mts M1 init # first phase truncates the CSV +// npx tsx scripts/query-matrix.mts M2 # subsequent phases append +// +// Phases: M1 near(1) all 25 entity pairs | M2 downstream all pairs +// M3 upstream all pairs | M4 near-hop distance | M5 dashboard queries +// M6 six states | M7 no region | M8 filters | M9 county scopes +// MD flow-distance bounds +// +// M4 sweeps the `near` relationship's hop distance (miles). MD sweeps the +// hydrology relationship's flow-distance bound (km), which is a different +// control and was swept by nothing until MD existed. +// +// How long it takes depends entirely on MODE, and the difference is large: +// +// raw ~156 step-queries, ~37 min (measured 2026-09-14) +// engine 124 full pipelines, ~95 min (measured 2026-09-14 at 144 min, but +// 48 of those were two requests that hung for 1918s and 959s before +// sparqlClient gained its 60s cap — those shapes now fail fast) +// +// Nearly all of it is M2 and M3: the downstream and upstream sweeps are 50 of +// the 124 queries and about two thirds of the wall time. M1, M7 and M9 together +// finish in under four minutes. +// +// Run phases one at a time and sequentially — running them in parallel distorts +// timings and provokes failures that are artefacts of your own load. If you run +// this while a GitHub workflow is querying, you will measure the contention. +// Each query is capped at 45s client-side per request. +// +// Results are cache-sensitive: the engine answers the same query 10-20x faster +// when warm, so run a sweep twice (cold, then warm) before trusting a number. + +import { execSync } from 'node:child_process'; +import { appendFileSync, existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from 'node:fs'; +import { planPipeline } from '../src/engine/planner'; +import { executePipeline } from '../src/engine/executor'; +import { ENDPOINTS } from '../src/constants/endpoints'; +import { PREBUILT_QUERIES } from '../src/constants/prebuiltQueries'; +import type { AnalysisQuestion, EntityType } from '../src/types/query'; + +// 'raw' posts each step's SPARQL directly — measures the endpoint, not us, and +// is how the pre-Phase-2 baseline was recorded. 'engine' runs the real pipeline +// so splitting, merging, partial results and the step budget are all exercised; +// that is the mode to use for an after-the-change sweep. +const MODE = (process.env.QUERY_MATRIX_MODE ?? 'raw') as 'raw' | 'engine'; + +// Stamp every row with when it ran and which commit it ran against. A snapshot +// is only useful later if you can tell what code produced it — the 2026-09-14 +// sweep was briefly ambiguous for exactly this reason. +const RUN_AT = new Date().toISOString().slice(0, 16); +const COMMIT = (() => { + try { return execSync('git rev-parse --short HEAD').toString().trim(); } + catch { return 'unknown'; } +})(); +// One file per sweep, named for the day it ran and the mode it ran in. The name +// is the metadata: `ls docs/query-matrix/` answers "when was this last run", and +// comparing two sweeps is `diff` of two paths. An earlier layout used +// `query-matrix/2026-09-14-engine.csv`, which named a moment rather than a date and went +// stale the week after it was written. +const DIR = 'docs/query-matrix'; +// Date, mode and commit. The commit is in the name for two reasons: two sweeps +// on the same day would otherwise collide (which happened the first time this +// layout was used), and every phase of one sweep derives the same path without +// needing a state file to remember which sweep is in progress. Commit mid-sweep +// and the remaining phases land in a new file — which is the honest outcome, +// since the code changed underneath them. +const OUT = process.env.QUERY_MATRIX_OUT ?? `${DIR}/${RUN_AT.slice(0, 10)}-${MODE}-${COMMIT}.csv`; + +// Regenerate the index and stop. Cheap, runs no queries. +if (process.argv[2] === '--index') { + writeIndex(); + process.exit(0); +} + +mkdirSync(DIR, { recursive: true }); + +// `init` truncates. Every sweep file is committed history the moment it lands, +// so refuse to overwrite one that already has rows — including today's, if a +// sweep is already in progress and you meant to append the next phase. +if (process.argv[3] === 'init' && existsSync(OUT) && readFileSync(OUT, 'utf8').split('\n').length > 2 && !process.env.QUERY_MATRIX_OVERWRITE) { + console.error( + `Refusing to truncate ${OUT}, which already has rows.\n` + + 'Drop `init` to append the next phase of the same sweep,\n' + + 'or set QUERY_MATRIX_OVERWRITE=1 to start it over.', + ); + process.exit(1); +} +if (process.argv[3] === 'init') { + writeFileSync( + OUT, + MODE === 'engine' + ? 'runAt,commit,matrix,label,blockA,rel,hops,blockC,region,filters,step,endpoint,status,ms,rows,bytes,errorClass,errorMsg,chunksFailed,chunksSkipped,chunksMax\n' + : 'runAt,commit,matrix,label,blockA,rel,hops,blockC,region,filters,step,endpoint,status,ms,rows,bytes,errorClass,errorMsg\n', + ); +} + +const classify = (status: number, ex: string): string => { + if (status === 200) return 'ok'; + if (status === 413) return 'payload-too-large'; + if (/Tried to allocate/.test(ex)) return 'engine-oom'; + if (/Operation timed out/.test(ex)) return 'timeout-30s'; + if (/Sort operation was canceled/.test(ex)) return 'timeout-sort-estimate'; + if (/Waited for a result from another thread/.test(ex)) return 'sibling-failure'; + if (status === 0) return 'client-timeout-45s'; + return `other-${status}`; +}; + +const csv = (s: unknown) => `"${String(s).replace(/"/g, "'").replace(/\s+/g, ' ').slice(0, 180)}"`; + +// Runs through the real engine. For phases that measured only the discovery +// step in the baseline, the step list is truncated to that step so the two +// sweeps compare like with like — discovery is where almost every failure was. +async function runViaEngine( + matrix: string, + label: string, + q: AnalysisQuestion, + meta: Record, + stepIdx: number | 'all', +) { + const all = planPipeline(q); + const steps = stepIdx === 'all' ? all : all.slice(0, (stepIdx as number) + 1); + let chunksMax = 0; + const t0 = Date.now(); + const result = await executePipeline(steps, q, (p) => { + if ((p.chunksTotal ?? 0) > chunksMax) chunksMax = p.chunksTotal ?? 0; + }); + const ms = Date.now() - t0; + + const rows = + result.status === 'success' + ? Object.values(result.data).reduce((n, r) => Math.max(n, r.length), 0) + : 0; + const chunksFailed = + result.status === 'success' ? (result.partial ?? []).reduce((n, p) => n + p.failed.length, 0) : 0; + const chunksSkipped = + result.status === 'success' ? (result.partial ?? []).reduce((n, p) => n + p.skipped.length, 0) : 0; + const errorClass = + result.status === 'success' + ? chunksFailed + chunksSkipped > 0 + ? 'ok-partial' + : 'ok' + : result.status === 'empty' + ? 'empty' + : 'failed'; + const detail = + result.status === 'error' ? result.error.message : result.status === 'empty' ? result.message : ''; + + appendFileSync( + OUT, + [RUN_AT, COMMIT, matrix, csv(label), meta.blockA, meta.rel, meta.hops, meta.blockC, meta.region, csv(meta.filters), + stepIdx === 'all' ? 'PIPELINE' : steps[steps.length - 1].type, 'engine', + result.status, ms, rows, 0, errorClass, csv(detail), chunksFailed, chunksSkipped, chunksMax].join(',') + '\n', + ); + console.log( + `${matrix} ${label.padEnd(44).slice(0, 44)} ${result.status.padEnd(8)} ${String(ms).padStart(7)}ms rows=${String(rows).padStart(5)} chunks=${chunksMax} failed=${chunksFailed} skipped=${chunksSkipped}`, + ); +} + +async function run(matrix: string, label: string, q: AnalysisQuestion, meta: Record, stepIdx: number | 'all') { + if (MODE === 'engine') return runViaEngine(matrix, label, q, meta, stepIdx); + const steps = planPipeline(q); + const ctx: any = { question: q, targetIris: [], anchorIris: [], results: {} }; + const idxs = stepIdx === 'all' ? steps.map((_, i) => i) : [stepIdx]; + for (const i of idxs) { + if (i >= steps.length) break; + const step = steps[i]; + let body: string; + try { body = step.buildQuery(ctx); } catch (e: any) { + appendFileSync(OUT, [RUN_AT, COMMIT, matrix, csv(label), meta.blockA, meta.rel, meta.hops, meta.blockC, meta.region, csv(meta.filters), step.type, step.endpoint, 'BUILD_FAIL', 0, 0, 0, 'build-error', csv(e.message)].join(',') + '\n'); + return; + } + const ac = new AbortController(); + const timer = setTimeout(() => ac.abort(), 45000); + const t0 = Date.now(); + let status = 0, ex = '', rows: any[] = [], bytes = 0; + try { + const r = await fetch(ENDPOINTS[step.endpoint], { + method: 'POST', signal: ac.signal, + headers: { 'Content-Type': 'application/sparql-query', Accept: 'application/sparql-results+json' }, + body, + }); + status = r.status; + const t = await r.text(); + bytes = t.length; + try { const j = JSON.parse(t); ex = j.exception ?? ''; rows = j.results?.bindings ?? []; } catch { ex = 'unparseable-json'; } + } catch (e: any) { ex = e.name === 'AbortError' ? 'client abort at 45s' : e.message; } + clearTimeout(timer); + const ms = Date.now() - t0; + const cls = classify(status, ex); + appendFileSync(OUT, [RUN_AT, COMMIT, matrix, csv(label), meta.blockA, meta.rel, meta.hops, meta.blockC, meta.region, csv(meta.filters), step.type, step.endpoint, status, ms, rows.length, bytes, cls, csv(ex)].join(',') + '\n'); + console.log(`${matrix} ${label.padEnd(44).slice(0,44)} ${step.type.padEnd(24)} ${String(status).padStart(3)} ${String(ms).padStart(6)}ms rows=${String(rows.length).padStart(5)} ${cls}`); + // thread context for full-pipeline runs + if (status === 200) { + ctx.results[step.type] = rows.map((b: any) => Object.fromEntries(Object.entries(b).map(([k, v]: any) => [k, v.value]))); + if (step.type === 'FIND_TARGET_IRIS') ctx.targetIris = [...new Set(ctx.results[step.type].map((r: any) => r.iri).filter(Boolean))]; + if (step.type === 'FIND_ANCHOR_IRIS') ctx.anchorIris = [...new Set(ctx.results[step.type].map((r: any) => r.iri).filter(Boolean))]; + if (step.type === 'HYDRATE_TARGET_BY_IRI') ctx.results['FIND_TARGET_ENTITIES'] = ctx.results[step.type]; + if (stepIdx === 'all' && (step.type === 'FIND_TARGET_IRIS') && ctx.targetIris.length === 0) return; // early exit like executor + } else if (stepIdx === 'all') return; // pipeline aborts on failure + } +} + +const TYPES: EntityType[] = ['samples', 'facilities', 'waterBodies', 'wells', 'aquifers']; +// `regionOn` picks which block carries the region, and defaults to 'A', which +// is what every phase written before MD assumed. That default is not neutral: +// for an upstream question the planner maps block A to the anchor, so a region +// on A always left the *anchor* as the constrained side, and the target-first +// join order — which only fires when the target is narrowed and the anchor is +// not — was unreachable from this harness. So was every bounded question that +// leaves block A wide open, which is the shape users actually build. +const mk = ( + a: EntityType, + rel: 'near'|'downstream'|'upstream', + c: EntityType, + hops: number|undefined, + state: string|undefined, + counties?: string[], + opts?: { km?: number; regionOn?: 'A' | 'C' }, +): AnalysisQuestion => { + const region = state ? { region: { stateCode: state, ...(counties ? { countyCodes: counties } : {}) } } : {}; + const onC = opts?.regionOn === 'C'; + return { + blockA: { type: a, ...(onC ? {} : region) }, + relationship: { + type: rel, + ...(hops !== undefined ? { hops } : {}), + ...(opts?.km !== undefined ? { maxDistanceKm: opts.km } : {}), + }, + blockC: { type: c, ...(onC ? region : {}) }, + } as AnalysisQuestion; +}; + +const phase = process.argv[2]; + +if (phase === 'M1') for (const a of TYPES) for (const c of TYPES) + await run('M1', `${a} near(1) ${c} [ME]`, mk(a, 'near', c, 1, '23'), { blockA: a, rel: 'near', hops: 1, blockC: c, region: 'ME', filters: 'none' }, 0); + +if (phase === 'M2') for (const a of TYPES) for (const c of TYPES) + await run('M2', `${a} downstream ${c} [ME]`, mk(a, 'downstream', c, undefined, '23'), { blockA: a, rel: 'downstream', hops: '', blockC: c, region: 'ME', filters: 'none' }, 0); + +if (phase === 'M3') for (const a of TYPES) for (const c of TYPES) + await run('M3', `${a} upstream ${c} [ME]`, mk(a, 'upstream', c, undefined, '23'), { blockA: a, rel: 'upstream', hops: '', blockC: c, region: 'ME', filters: 'none' }, 0); + +if (phase === 'M4') for (const h of [0, 2, 3, 4]) for (const [a, c] of [['samples','facilities'],['samples','wells'],['wells','facilities'],['waterBodies','facilities'],['samples','waterBodies']] as [EntityType,EntityType][]) + await run('M4', `${a} near(${h}) ${c} [ME]`, mk(a, 'near', c, h, '23'), { blockA: a, rel: 'near', hops: h, blockC: c, region: 'ME', filters: 'none' }, 0); + +if (phase === 'M5') for (const p of PREBUILT_QUERIES) + await run('M5', `PREBUILT: ${p.title}`, p.question, { blockA: p.question.blockA.type, rel: p.question.relationship.type, hops: p.question.relationship.hops ?? '', blockC: p.question.blockC.type, region: p.question.blockA.region?.countyCodes?.join('|') ?? p.question.blockA.region?.stateCode ?? 'none', filters: 'prebuilt' }, 'all'); + +if (phase === 'M6') for (const st of ['17','18','25','33','01','50']) + await run('M6', `samples downstream facilities [${st}]`, mk('samples', 'downstream', 'facilities', undefined, st), { blockA: 'samples', rel: 'downstream', hops: '', blockC: 'facilities', region: st, filters: 'none' }, 0); + +if (phase === 'M7') { // no region at all — the largest possible + for (const [a, rel, c] of [['samples','near','facilities'],['samples','downstream','facilities'],['wells','near','facilities']] as [EntityType,any,EntityType][]) + await run('M7', `${a} ${rel} ${c} [NO REGION]`, mk(a, rel, c, rel === 'near' ? 1 : undefined, undefined), { blockA: a, rel, hops: rel==='near'?1:'', blockC: c, region: 'none', filters: 'none' }, 0); +} + +if (phase === 'M8') { + const PFOS = 'http://w3id.org/DSSTox/v1/DTXSID3031864'; + const GW = 'http://w3id.org/sawgraph/v1/me-egad-data#sampleMaterialType.GW'; + const cases: [string, AnalysisQuestion, string][] = [ + ['substance filter (PFOS)', { blockA: { type: 'samples', region: { stateCode: '23' }, sampleFilters: { substances: [PFOS] } }, relationship: { type: 'near', hops: 1 }, blockC: { type: 'facilities' } } as any, 'substance'], + ['material filter (GW)', { blockA: { type: 'samples', region: { stateCode: '23' }, sampleFilters: { materialTypes: [GW] } }, relationship: { type: 'near', hops: 1 }, blockC: { type: 'facilities' } } as any, 'material'], + ['concentration range 10-1000', { blockA: { type: 'samples', region: { stateCode: '23' }, sampleFilters: { minConcentration: 10, maxConcentration: 1000 } }, relationship: { type: 'near', hops: 1 }, blockC: { type: 'facilities' } } as any, 'range'], + ['exclude non-detects', { blockA: { type: 'samples', region: { stateCode: '23' }, sampleFilters: { includeNondetects: false } }, relationship: { type: 'near', hops: 1 }, blockC: { type: 'facilities' } } as any, 'nondetect'], + ['substance + downstream', { blockA: { type: 'samples', region: { stateCode: '23' }, sampleFilters: { substances: [PFOS] } }, relationship: { type: 'downstream' }, blockC: { type: 'facilities' } } as any, 'substance+ds'], + ['NAICS 2-digit (whole sector 31)', { blockA: { type: 'samples', region: { stateCode: '23' } }, relationship: { type: 'near', hops: 1 }, blockC: { type: 'facilities', facilityFilters: { industryCodes: ['31'] } } } as any, 'naics-sector'], + ['aquifer type filter', { blockA: { type: 'samples', region: { stateCode: '23' } }, relationship: { type: 'near', hops: 1 }, blockC: { type: 'aquifers', aquiferFilters: { aquiferTypes: ['surficial'] } } } as any, 'aquifer-type'], + ['waterbody ftype filter', { blockA: { type: 'samples', region: { stateCode: '23' } }, relationship: { type: 'near', hops: 1 }, blockC: { type: 'waterBodies', waterBodyFilters: { ftypes: ['LakePond'] } } } as any, 'wb-ftype'], + ]; + for (const [label, q, f] of cases) + await run('M8', label, q, { blockA: q.blockA.type, rel: q.relationship.type, hops: q.relationship.hops ?? '', blockC: q.blockC.type, region: 'ME', filters: f }, 0); +} + +if (phase === 'M9') { // county-scoped (smallest realistic) + multi-county + for (const [label, counties] of [['1 county (Cumberland)', ['23005']], ['3 counties', ['23005','23019','23003']]] as [string, string[]][]) + await run('M9', `samples near(1) facilities [${label}]`, mk('samples', 'near', 'facilities', 1, '23', counties), { blockA: 'samples', rel: 'near', hops: 1, blockC: 'facilities', region: label, filters: 'none' }, 0); + for (const [label, counties] of [['1 county (Cumberland)', ['23005']], ['3 counties', ['23005','23019','23003']]] as [string, string[]][]) + await run('M9', `samples downstream facilities [${label}]`, mk('samples', 'downstream', 'facilities', undefined, '23', counties), { blockA: 'samples', rel: 'downstream', hops: '', blockC: 'facilities', region: label, filters: 'none' }, 0); +} + +if (phase === 'MD') { // flow-distance bounds, both narrowing directions + // Four shapes, each run bounded and unbounded, with the region on block A and + // on block C, and on both discovery steps. Every axis here is one the bounded + // path can behave differently on, and none of them were covered before: + // + // - region on A vs C decides which side is constrained, which decides the + // join order. Bounded queries currently keep the anchor-first order + // whatever the answer, which is the thing under test. + // - both steps, not just step 0 like M1-M4. The two projections share a + // WHERE clause but not a fate: on "facilities upstream from PFOS samples + // in York" at 30 km, the samples projection answered in 25s while the + // facilities projection ran out of memory at 32s. Measuring step 0 alone + // would have recorded that shape as working. + // - the unbounded twin of every bounded row, so "did the bound remove rows" + // is answerable from this file alone rather than by joining against M2/M3, + // which scope their regions differently. + const SHAPES: [EntityType, 'upstream' | 'downstream', EntityType][] = [ + ['facilities', 'upstream', 'samples'], // block A wide open: what fails in the app today + ['facilities', 'upstream', 'streams'], // the one bounded dashboard question's shape + ['facilities', 'upstream', 'wells'], // the known-expensive far end (W38 entry 12) + ['samples', 'downstream', 'facilities'], // downstream, where A and C swap anchor/target + ]; + for (const [a, rel, c] of SHAPES) + for (const km of [undefined, 30]) + for (const regionOn of ['A', 'C'] as const) + for (const step of [0, 1]) + await run( + 'MD', + `${a} ${rel}${km ? `(${km}km)` : ''} ${c} [ME on ${regionOn}] step${step}`, + mk(a, rel, c, undefined, '23', undefined, { km, regionOn }), + { blockA: a, rel, hops: '', blockC: c, region: `ME on ${regionOn}`, filters: km ? `${km}km` : 'none' }, + step, + ); +} + +// --- the index ------------------------------------------------------------- +// +// One row per sweep: when, which commit, how many query shapes passed, and what +// moved since the previous sweep in the same mode. Regenerate with +// `npx tsx scripts/query-matrix.mts --index` — it reads the CSVs, runs nothing. + +interface Sweep { + file: string; + date: string; + mode: string; + commit: string; + // label -> worst status seen for that query. Raw mode writes one row per + // step, so a query is only a pass if every one of its steps passed. + byLabel: Map; +} + +function readSweeps(): Sweep[] { + if (!existsSync(DIR)) return []; + return readdirSync(DIR) + .filter((f) => f.endsWith('.csv') && statSync(`${DIR}/${f}`).size > 0) + // Order by when the sweep actually ran, not by filename. Two sweeps on the + // same day sort wrongly by name — `-9128aa9.csv` precedes `.csv` — which + // silently inverted the delta column: shapes the newer sweep had fixed were + // reported as newly broken. + .map((file) => ({ file, at: sweepStartedAt(file) })) + .sort((a, b) => a.at.localeCompare(b.at)) + .map(({ file }) => { + const lines = readFileSync(`${DIR}/${file}`, 'utf8').split('\n').filter(Boolean); + const header = lines[0].split(','); + const iCommit = header.indexOf('commit'); + const iLabel = header.indexOf('label'); + const iStatus = header.indexOf('status'); + const iClass = header.indexOf('errorClass'); + const byLabel = new Map(); + let commit = ''; + for (const line of lines.slice(1)) { + const cols = line.split(','); + // Labels are quoted and contain no commas (csv() strips whitespace runs + // and quotes), so a plain split is safe here. + const label = (cols[iLabel] ?? '').replace(/"/g, ''); + // The two modes report outcome differently: `engine` writes the + // pipeline status, `raw` writes the HTTP code and puts the verdict in + // errorClass. Reading the wrong one scores a clean raw sweep as 7 of + // 124 passing, which is how this was caught. + const raw = cols[iStatus] ?? ''; + const status = /^\d+$/.test(raw) ? (cols[iClass] === 'ok' ? 'success' : 'error') : raw; + if (iCommit > -1 && cols[iCommit]) commit = cols[iCommit]; + const worse = (a: string, b: string) => (a === 'error' || b === 'error' ? 'error' : a === 'empty' || b === 'empty' ? 'empty' : 'success'); + byLabel.set(label, byLabel.has(label) ? worse(byLabel.get(label)!, status) : status); + } + // `2026-09-14-engine-a119e16.csv` -> date, mode, commit. Older files have + // no commit in the name; fall back to the column, then to admitting it. + const m = file.match(/^(\d{4}-\d{2}-\d{2})-(.+?)(?:-([0-9a-f]{7,40}))?\.csv$/); + return { + file, + date: m?.[1] ?? file, + mode: m?.[2] ?? '?', + commit: m?.[3] || commit || 'unrecorded', + byLabel, + }; + }); +} + +// When a sweep ran. The first row's runAt is authoritative; files written +// before that column existed fall back to their mtime. +function sweepStartedAt(file: string): string { + const first = readFileSync(`${DIR}/${file}`, 'utf8').split('\n')[1] ?? ''; + const stamp = first.split(',')[0]; + return /^\d{4}-\d{2}-\d{2}T/.test(stamp) ? stamp : new Date(statSync(`${DIR}/${file}`).mtimeMs).toISOString(); +} + +function writeIndex(): void { + const sweeps = readSweeps(); + const out = [ + '# Query matrix sweeps', + '', + 'Every run of `npm run query-matrix`, newest first. One CSV per sweep, named', + 'for the day it ran — so `ls` answers "when was this last run", and comparing', + 'two sweeps is a `diff` of two paths.', + '', + '```', + 'QUERY_MATRIX_MODE=engine npx tsx scripts/query-matrix.mts M1 init # start a sweep', + 'QUERY_MATRIX_MODE=engine npx tsx scripts/query-matrix.mts M2 # each later phase', + 'npx tsx scripts/query-matrix.mts --index # rebuild this file', + '```', + '', + '`raw` posts each step\'s SPARQL directly and writes one row per step; `engine`', + 'runs the real pipeline, one row per query, and is the mode to use after an', + 'engine change. The two are not comparable row for row.', + '', + '| Sweep | Mode | Commit | Shapes | Pass | Fail | Since the previous sweep |', + '| --- | --- | --- | ---: | ---: | ---: | --- |', + ]; + + for (let i = sweeps.length - 1; i >= 0; i--) { + const s = sweeps[i]; + const pass = [...s.byLabel.values()].filter((v) => v === 'success').length; + const fail = [...s.byLabel.values()].filter((v) => v === 'error').length; + const prev = sweeps.slice(0, i).reverse().find((p) => p.mode === s.mode); + out.push( + `| [\`${s.date}\`](./${s.file}) | ${s.mode} | \`${s.commit}\` | ${s.byLabel.size} | ${pass} | ${fail} | ${delta(s, prev)} |`, + ); + } + + // A sweep can be invalid for reasons no column can express — the endpoint was + // under load, a phase ran away, the run spanned an outage. Drop a `.note` + // file beside the CSV and it shows up here, next to the numbers it qualifies, + // rather than in a document nobody opens before trusting a figure. + const noted = sweeps.filter((x) => existsSync(`${DIR}/${x.file}.note`)).reverse(); + if (noted.length) { + out.push('', '## Notes', ''); + for (const x of noted) { + out.push(`**[\`${x.file}\`](./${x.file})** — ${readFileSync(`${DIR}/${x.file}.note`, 'utf8').trim()}`, ''); + } + } + + out.push('', `Generated ${new Date().toISOString().slice(0, 10)}.`, ''); + writeFileSync(`${DIR}/README.md`, out.join('\n')); + console.log(`Wrote ${DIR}/README.md — ${sweeps.length} sweep(s).`); +} + +function delta(now: Sweep, prev?: Sweep): string { + if (!prev) return '_first sweep in this mode_'; + const fixed: string[] = []; + const broke: string[] = []; + for (const [label, status] of now.byLabel) { + const was = prev.byLabel.get(label); + if (was === undefined) continue; + if (was === 'error' && status !== 'error') fixed.push(label); + if (was !== 'error' && status === 'error') broke.push(label); + } + const added = [...now.byLabel.keys()].filter((l) => !prev.byLabel.has(l)).length; + const bits = [ + broke.length ? `**${broke.length} broke** (${broke.slice(0, 2).join(', ')}${broke.length > 2 ? ', …' : ''})` : '', + fixed.length ? `${fixed.length} fixed` : '', + added ? `${added} new shape${added > 1 ? 's' : ''}` : '', + ].filter(Boolean); + return bits.length ? bits.join(' · ') : 'no change'; +} diff --git a/scripts/warm-cache.mts b/scripts/warm-cache.mts new file mode 100644 index 0000000..0cc5471 --- /dev/null +++ b/scripts/warm-cache.mts @@ -0,0 +1,85 @@ +// Warms the result cache for the dashboard questions. +// +// CACHE_WRITE_TOKEN=... API_BASE=https://sawgraph-explorer-api-development.up.railway.app \ +// npx tsx scripts/warm-cache.mts +// +// Run this by hand after a knowledge-graph reload (and bump DATA_VERSION in +// src/engine/cacheKey.ts first, which makes every existing entry unreachable). +// Deliberately not a cron job: there is no scheduler in this service, and the +// thing a nightly run would guard against is a TTL we control. +// +// This is a trusted writer — it runs the real pipeline and uploads what it got, +// so nothing untrusted ever reaches another user's map. +import { planPipeline } from '../src/engine/planner'; +import { executePipeline } from '../src/engine/executor'; +import { cacheKey } from '../src/engine/cacheKey'; +import { toWire } from '../src/engine/wire'; +import { PREBUILT_QUERIES } from '../src/constants/prebuiltQueries'; + +const API_BASE = (process.env.API_BASE ?? 'http://localhost:3001').replace(/\/$/, ''); +const TOKEN = process.env.CACHE_WRITE_TOKEN; +const ONLY = process.argv[2]; // optional substring filter on the title +// A partial result means some slices failed. Serving one to every visitor for +// the next few hours is worse than letting them run it live and possibly get a +// complete answer, so prewarm skips them unless asked not to. +const ALLOW_PARTIAL = process.env.ALLOW_PARTIAL === '1'; + +if (!TOKEN) { + console.error('CACHE_WRITE_TOKEN is required (must match the API service).'); + process.exit(1); +} + +const targets = PREBUILT_QUERIES.filter((q) => !ONLY || q.title.toLowerCase().includes(ONLY.toLowerCase())); +console.log(`Warming ${targets.length} question(s) against ${API_BASE}\n`); + +let warmed = 0; +let skipped = 0; + +for (const prebuilt of targets) { + const label = prebuilt.title.slice(0, 58); + const startedAt = Date.now(); + process.stdout.write(` ${label.padEnd(60)} `); + + try { + const result = await executePipeline(planPipeline(prebuilt.question), prebuilt.question, () => {}); + const elapsed = ((Date.now() - startedAt) / 1000).toFixed(0); + + if (result.status !== 'success') { + console.log(`skipped after ${elapsed}s (${result.status})`); + skipped++; + continue; + } + + const wire = toWire(result); + if (wire.partial?.length && !ALLOW_PARTIAL) { + const missing = wire.partial.reduce((n, p) => n + p.failed.length + p.skipped.length, 0); + console.log(`skipped after ${elapsed}s (partial: ${missing} slices missing; ALLOW_PARTIAL=1 to cache anyway)`); + skipped++; + continue; + } + + const key = await cacheKey(prebuilt.question); + const res = await fetch(`${API_BASE}/api/results/${key}`, { + method: 'PUT', + headers: { 'Content-Type': 'application/json', 'X-Cache-Token': TOKEN }, + body: JSON.stringify({ question: prebuilt.question, result: wire }), + }); + + if (!res.ok) { + console.log(`upload failed after ${elapsed}s (${res.status} ${(await res.text()).slice(0, 60)})`); + skipped++; + continue; + } + + const { bytes } = (await res.json()) as { bytes: number }; + const partial = wire.partial?.length ? ' [partial]' : ''; + console.log(`cached in ${elapsed}s, ${(bytes / 1024).toFixed(0)}KB${partial}`); + warmed++; + } catch (err) { + console.log(`error: ${err instanceof Error ? err.message.slice(0, 70) : String(err)}`); + skipped++; + } +} + +console.log(`\n${warmed} cached, ${skipped} skipped`); +process.exit(skipped > 0 && warmed === 0 ? 1 : 0); diff --git a/scripts/warm-questions.mts b/scripts/warm-questions.mts new file mode 100644 index 0000000..6d90ff7 --- /dev/null +++ b/scripts/warm-questions.mts @@ -0,0 +1,56 @@ +// Warms the cache for a list of questions given as JSON, for demos or any other +// set that is not in prebuiltQueries.ts. +// +// CACHE_WRITE_TOKEN=... API_BASE=https://... npx tsx scripts/warm-questions.mts demo-questions.json +// +// The file is a JSON array of { title, question }. Same trusted-writer path as +// warm-cache.mts: the real pipeline runs here, and only the result is uploaded. +import { readFileSync } from 'node:fs'; +import { planPipeline } from '../src/engine/planner'; +import { executePipeline } from '../src/engine/executor'; +import { cacheKey } from '../src/engine/cacheKey'; +import { toWire } from '../src/engine/wire'; +import type { AnalysisQuestion } from '../src/types/query'; + +const API_BASE = (process.env.API_BASE ?? 'http://localhost:3001').replace(/\/$/, ''); +const TOKEN = process.env.CACHE_WRITE_TOKEN; +const ALLOW_PARTIAL = process.env.ALLOW_PARTIAL === '1'; +const FILE = process.argv[2]; + +if (!TOKEN) { console.error('CACHE_WRITE_TOKEN is required.'); process.exit(1); } +if (!FILE) { console.error('Usage: warm-questions.mts '); process.exit(1); } + +const items = JSON.parse(readFileSync(FILE, 'utf8')) as { title: string; question: AnalysisQuestion }[]; +console.log(`Warming ${items.length} question(s) against ${API_BASE}\n`); + +let warmed = 0, skipped = 0; +for (const item of items) { + const started = Date.now(); + process.stdout.write(` ${item.title.slice(0, 52).padEnd(54)}`); + try { + const result = await executePipeline(planPipeline(item.question), item.question, () => {}); + const elapsed = ((Date.now() - started) / 1000).toFixed(0); + if (result.status !== 'success') { console.log(`skipped after ${elapsed}s (${result.status})`); skipped++; continue; } + + const wire = toWire(result); + if (wire.partial?.length && !ALLOW_PARTIAL) { + const missing = wire.partial.reduce((n, p) => n + p.failed.length + p.skipped.length, 0); + console.log(`skipped after ${elapsed}s (partial: ${missing} slices missing)`); + skipped++; continue; + } + + const res = await fetch(`${API_BASE}/api/results/${await cacheKey(item.question)}`, { + method: 'PUT', + headers: { 'Content-Type': 'application/json', 'X-Cache-Token': TOKEN }, + body: JSON.stringify({ question: item.question, result: wire }), + }); + if (!res.ok) { console.log(`upload failed after ${elapsed}s (${res.status})`); skipped++; continue; } + const { bytes } = (await res.json()) as { bytes: number }; + console.log(`cached in ${elapsed}s, ${(bytes / 1024).toFixed(0)}KB`); + warmed++; + } catch (err) { + console.log(`error: ${err instanceof Error ? err.message.slice(0, 60) : String(err)}`); + skipped++; + } +} +console.log(`\n${warmed} cached, ${skipped} skipped`); diff --git a/server/.gitignore b/server/.gitignore index b1640b5..0d7b2fb 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -2,3 +2,6 @@ node_modules dist .env .env.local + +# local backups of env files — may contain credentials +.env.backup* diff --git a/server/src/index.ts b/server/src/index.ts index 839927c..7fce3a8 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -2,6 +2,8 @@ import cors from 'cors'; import express from 'express'; import { runMigrations } from './db.js'; import { publishRouter } from './routes/publish.js'; +import { resultsRouter } from './routes/results.js'; +import { sweepExpired } from './resultCache.js'; const app = express(); @@ -10,18 +12,36 @@ app.use( origin: process.env.FRONTEND_ORIGIN ?? true, }), ); -app.use(express.json({ limit: '64kb' })); +// Result uploads carry megabytes and are parsed by their own route-scoped +// parser (routes/results.ts, routes/publish.ts). A global parser would reject +// them at 64kb before the route ever ran, so it has to skip those two paths — +// everything else keeps the small default. +const smallJson = express.json({ limit: '64kb' }); +const isResultUpload = (method: string, path: string) => + method === 'PUT' && (/\/result$/.test(path) || path.startsWith('/api/results/')); + +app.use((req, res, next) => + isResultUpload(req.method, req.path) ? next() : smallJson(req, res, next), +); app.get('/health', (_req, res) => { res.json({ ok: true }); }); app.use('/api/publish', publishRouter); +app.use('/api/results', resultsRouter); const port = Number(process.env.PORT ?? 3001); runMigrations() - .then(() => { + .then(async () => { + // Cheap enough to do inline at boot; there is no scheduler in this service. + const swept = await sweepExpired().catch((err) => { + console.error('cache sweep failed', err); + return 0; + }); + if (swept > 0) console.log(`swept ${swept} expired cached results`); + app.listen(port, () => { console.log(`sawgraph-api listening on :${port}`); }); diff --git a/server/src/resultCache.ts b/server/src/resultCache.ts new file mode 100644 index 0000000..0e0fbd4 --- /dev/null +++ b/server/src/resultCache.ts @@ -0,0 +1,95 @@ +import { gzipSync } from 'node:zlib'; +import { pool } from './db.js'; + +// Payload budget for a single cached result. Measured pipelines run 3-7MB of +// JSON once the internal IRI lists are trimmed client-side; the largest observed +// (a statewide downstream trace with 15MB of river geometry) reached 21MB. +// Anything past this is skipped rather than stored — publishing still succeeds. +export const MAX_RESULT_BYTES = 25 * 1024 * 1024; + +// A clean result is stable until the graph reloads. A partial one is not: it +// means slices failed, and a warmer engine may answer them, so it must not be +// frozen for a month. +const TTL_DAYS_COMPLETE = 30; +const TTL_HOURS_PARTIAL = 6; + +export interface StoredResult { + payload: Buffer; + computedAt: Date; + partial: boolean; +} + +export async function putResult(params: { + cacheKey: string; + question: unknown; + body: string; + partial: boolean; + source: 'publish' | 'prewarm'; +}): Promise<{ bytes: number }> { + const payload = gzipSync(Buffer.from(params.body, 'utf8')); + const ttl = params.partial + ? `${TTL_HOURS_PARTIAL} hours` + : `${TTL_DAYS_COMPLETE} days`; + + await pool.query( + `INSERT INTO query_results + (cache_key, question, payload, payload_bytes, source, partial, expires_at) + VALUES ($1, $2, $3, $4, $5, $6, now() + $7::interval) + ON CONFLICT (cache_key) DO UPDATE SET + question = EXCLUDED.question, + payload = EXCLUDED.payload, + payload_bytes = EXCLUDED.payload_bytes, + source = EXCLUDED.source, + partial = EXCLUDED.partial, + created_at = now(), + expires_at = EXCLUDED.expires_at`, + [ + params.cacheKey, + params.question, + payload, + payload.length, + params.source, + params.partial, + ttl, + ], + ); + + return { bytes: payload.length }; +} + +export async function getResult(cacheKey: string): Promise { + // Expired rows are treated as a miss immediately, without waiting for the + // sweeper to reach them. + const result = await pool.query( + `UPDATE query_results + SET hit_count = hit_count + 1, last_hit_at = now() + WHERE cache_key = $1 AND expires_at > now() + RETURNING payload, created_at, partial`, + [cacheKey], + ); + if (result.rowCount === 0) return null; + const row = result.rows[0]; + return { payload: row.payload, computedAt: row.created_at, partial: row.partial }; +} + +export async function sweepExpired(): Promise { + const result = await pool.query(`DELETE FROM query_results WHERE expires_at < now()`); + return result.rowCount ?? 0; +} + +// The stored bytes are served exactly as they are stored — never decompressed +// here and re-compressed by the framework. The browser inflates transparently. +export function sendGzipJson( + res: { + setHeader: (k: string, v: string) => void; + end: (chunk: Buffer) => void; + }, + stored: StoredResult, +): void { + res.setHeader('Content-Type', 'application/json'); + res.setHeader('Content-Encoding', 'gzip'); + res.setHeader('Content-Length', String(stored.payload.length)); + res.setHeader('X-Result-Computed-At', stored.computedAt.toISOString()); + res.setHeader('X-Result-Partial', stored.partial ? '1' : '0'); + res.end(stored.payload); +} diff --git a/server/src/routes/publish.ts b/server/src/routes/publish.ts index 1146c74..2c9f75d 100644 --- a/server/src/routes/publish.ts +++ b/server/src/routes/publish.ts @@ -1,6 +1,11 @@ import { createHash, randomBytes, timingSafeEqual } from 'node:crypto'; -import { Router, type Request, type Response } from 'express'; +import express, { Router, type Request, type Response } from 'express'; import { pool } from '../db.js'; +import { getResult, putResult, sendGzipJson, MAX_RESULT_BYTES } from '../resultCache.js'; + +// Route-scoped: the app-wide JSON limit stays 64kb (index.ts), only the result +// upload accepts megabytes. +const largeJson = express.json({ limit: `${Math.ceil(MAX_RESULT_BYTES / (1024 * 1024))}mb` }); function hashToken(token: string): string { return createHash('sha256').update(token).digest('hex'); @@ -125,6 +130,62 @@ publishRouter.patch('/:id', async (req: Request, res: Response) => { } }); +// The result the publisher's browser already computed. Cached under the publish +// id so every later visitor to /p/:id gets it without re-running the pipeline. +publishRouter.put('/:id/result', largeJson, async (req: Request, res: Response) => { + const id = String(req.params.id); + const body = req.body as { editToken?: unknown; result?: unknown }; + const editToken = typeof body.editToken === 'string' ? body.editToken : ''; + if (!editToken) return res.status(401).json({ error: 'editToken is required' }); + if (!body.result) return res.status(400).json({ error: 'result is required' }); + + const serialized = JSON.stringify(body.result); + if (Buffer.byteLength(serialized, 'utf8') > MAX_RESULT_BYTES) { + return res.status(413).json({ error: 'result too large to cache' }); + } + + try { + const existing = await pool.query( + `SELECT question, edit_token_hash FROM published_workflows WHERE id = $1`, + [id], + ); + if (existing.rowCount === 0) return res.status(404).json({ error: 'not found' }); + const storedHash: string | null = existing.rows[0].edit_token_hash; + if (!storedHash || !tokensMatch(editToken, storedHash)) { + return res.status(403).json({ error: 'invalid editToken' }); + } + + const cacheKey = `publish:${id}`; + await putResult({ + cacheKey, + // The stored question, never one supplied by the caller. + question: existing.rows[0].question, + body: serialized, + partial: Boolean((body.result as { partial?: unknown }).partial), + source: 'publish', + }); + await pool.query(`UPDATE published_workflows SET result_key = $1 WHERE id = $2`, [ + cacheKey, + id, + ]); + return res.status(201).json({ key: cacheKey }); + } catch (err) { + console.error('publish result write failed', err); + return res.status(500).json({ error: 'failed to store result' }); + } +}); + +publishRouter.get('/:id/result', async (req: Request, res: Response) => { + try { + const stored = await getResult(`publish:${String(req.params.id)}`); + if (!stored) return res.status(404).json({ error: 'not cached' }); + return sendGzipJson(res, stored); + } catch (err) { + console.error('publish result fetch failed', err); + return res.status(500).json({ error: 'failed to fetch result' }); + } +}); + publishRouter.get('/:id', async (req: Request, res: Response) => { const { id } = req.params; try { @@ -132,7 +193,7 @@ publishRouter.get('/:id', async (req: Request, res: Response) => { `UPDATE published_workflows SET view_count = view_count + 1 WHERE id = $1 - RETURNING id, author, title, description, tags, question, created_at, view_count`, + RETURNING id, author, title, description, tags, question, created_at, view_count, result_key`, [id], ); if (result.rowCount === 0) { diff --git a/server/src/routes/results.ts b/server/src/routes/results.ts new file mode 100644 index 0000000..06aee6e --- /dev/null +++ b/server/src/routes/results.ts @@ -0,0 +1,68 @@ +import { createHash, timingSafeEqual } from 'node:crypto'; +import express, { Router, type Request, type Response } from 'express'; +import { getResult, putResult, sendGzipJson, MAX_RESULT_BYTES } from '../resultCache.js'; + +export const resultsRouter = Router(); + +// Route-scoped body limit. The app-wide limit stays at 64kb (index.ts) — only +// these two routes accept a multi-megabyte result. +const largeJson = express.json({ limit: `${Math.ceil(MAX_RESULT_BYTES / (1024 * 1024))}mb` }); + +function writeTokenValid(provided: string | undefined): boolean { + const expected = process.env.CACHE_WRITE_TOKEN; + // No token configured means no one can write. Failing closed matters here: + // these entries are rendered on other people's maps. + if (!expected || !provided) return false; + const a = createHash('sha256').update(provided).digest(); + const b = createHash('sha256').update(expected).digest(); + return timingSafeEqual(a, b); +} + +// Public read. +resultsRouter.get('/:key', async (req: Request, res: Response) => { + try { + const stored = await getResult(String(req.params.key)); + if (!stored) return res.status(404).json({ error: 'not cached' }); + return sendGzipJson(res, stored); + } catch (err) { + console.error('result fetch failed', err); + return res.status(500).json({ error: 'failed to fetch result' }); + } +}); + +// Write, for the warm-cache script only (scripts/warm-cache.mts). The publisher +// path is PUT /api/publish/:id/result, guarded by the editToken instead. +resultsRouter.put('/:key', largeJson, async (req: Request, res: Response) => { + const key = String(req.params.key); + + if (!writeTokenValid(req.header('x-cache-token'))) { + return res.status(401).json({ error: 'invalid cache write token' }); + } + + const body = req.body as { question?: unknown; result?: unknown }; + if (!body?.question || !body?.result) { + return res.status(400).json({ error: 'question and result are required' }); + } + if (!key.startsWith('q:')) { + return res.status(400).json({ error: 'key must be in the q: namespace' }); + } + + const serialized = JSON.stringify(body.result); + if (Buffer.byteLength(serialized, 'utf8') > MAX_RESULT_BYTES) { + return res.status(413).json({ error: 'result too large to cache' }); + } + + try { + const { bytes } = await putResult({ + cacheKey: key, + question: body.question, + body: serialized, + partial: Boolean((body.result as { partial?: unknown }).partial), + source: 'prewarm', + }); + return res.status(201).json({ key, bytes }); + } catch (err) { + console.error('result write failed', err); + return res.status(500).json({ error: 'failed to store result' }); + } +}); diff --git a/server/src/schema.sql b/server/src/schema.sql index 364856c..92ed325 100644 --- a/server/src/schema.sql +++ b/server/src/schema.sql @@ -14,3 +14,26 @@ CREATE INDEX IF NOT EXISTS published_workflows_created_at_idx ALTER TABLE published_workflows ADD COLUMN IF NOT EXISTS edit_token_hash TEXT; + +-- Cached pipeline results. Written only by trusted paths: the publisher (via +-- their editToken) and the warm-cache script (via CACHE_WRITE_TOKEN). Reads are +-- public. Keys are namespaced: 'publish:' or 'q:'. +CREATE TABLE IF NOT EXISTS query_results ( + cache_key TEXT PRIMARY KEY, + question JSONB NOT NULL, + payload BYTEA NOT NULL, + payload_bytes INTEGER NOT NULL, + source TEXT NOT NULL, + partial BOOLEAN NOT NULL DEFAULT FALSE, + created_at TIMESTAMPTZ NOT NULL DEFAULT now(), + last_hit_at TIMESTAMPTZ NOT NULL DEFAULT now(), + hit_count INTEGER NOT NULL DEFAULT 0, + expires_at TIMESTAMPTZ NOT NULL +); + +-- payload arrives already gzipped; EXTERNAL stops TOAST attempting pglz on top. +ALTER TABLE query_results ALTER COLUMN payload SET STORAGE EXTERNAL; + +CREATE INDEX IF NOT EXISTS query_results_expires_at_idx ON query_results (expires_at); + +ALTER TABLE published_workflows ADD COLUMN IF NOT EXISTS result_key TEXT; diff --git a/src/App.css b/src/App.css index 30bf85b..87d1768 100644 --- a/src/App.css +++ b/src/App.css @@ -74,6 +74,19 @@ gap: var(--space-md); } +.header-link { + display: flex; + align-items: center; + gap: var(--space-xs); + font-size: var(--text-base); + color: var(--color-gray-600); + text-decoration: none; +} + +.header-link:hover { + color: var(--color-primary-600); +} + /* Question Bar */ .question-bar { display: flex; @@ -164,12 +177,12 @@ .question-bar-name-input:focus { outline: none; border-color: var(--color-primary-600); - box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15); + box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.2); } .question-bar-rename-error { font-size: var(--text-xs); - color: var(--color-red-700, #b91c1c); + color: var(--color-red-700); } .question-bar-row { @@ -432,9 +445,9 @@ margin-top: 0.4rem; padding: 0.4rem 0.6rem; border-radius: var(--radius-sm); - background: #fff7ed; - border: 1px solid #fed7aa; - color: #9a3412; + background: var(--color-yellow-50); + border: 1px solid var(--color-yellow-400); + color: var(--color-yellow-800); font-size: var(--text-sm); line-height: 1.35; } @@ -585,6 +598,9 @@ align-items: center; flex-shrink: 0; width: 24px; + /* ponytail: matches .timeline-content top padding + half a text line, so the dot + sits on the first line of text instead of the top of the box */ + padding-top: 0.5rem; } .timeline-dot { @@ -630,16 +646,15 @@ } .timeline-content { - padding-bottom: var(--space-md); flex: 1; min-width: 0; + padding: var(--space-xs) var(--space-sm); + margin-bottom: var(--space-sm); } .timeline-content--running { background: var(--color-primary-50); border-radius: var(--radius-sm); - padding: var(--space-xs) var(--space-sm); - margin: -2px 0 var(--space-md); } .timeline-desc { @@ -940,7 +955,7 @@ .hs-select-all { position: sticky; top: 0; - background: var(--color-gray-50, #f9fafb); + background: var(--color-gray-50); border-bottom: 1px solid var(--color-gray-200); font-weight: 500; z-index: 1; @@ -1207,11 +1222,85 @@ padding: var(--space-3xl) var(--space-2xl); } -.dashboard-welcome { - font-size: var(--text-2xl); - font-weight: var(--font-light); - color: var(--color-gray-700); +.dashboard-hero { + background: linear-gradient( + 135deg, + var(--color-indigo-600), + var(--color-primary-700) + ); + color: #fff; + border-radius: var(--radius-lg); + padding: var(--space-2xl); margin: 0 0 var(--space-2xl); + position: relative; +} + +.dashboard-hero-close { + position: absolute; + top: var(--space-lg); + right: var(--space-lg); + display: flex; + padding: var(--space-xs); + background: none; + border: none; + border-radius: var(--radius-sm); + color: #fff; + opacity: 0.7; + cursor: pointer; +} + +.dashboard-hero-close:hover { + opacity: 1; + background: rgba(255, 255, 255, 0.18); +} + +.dashboard-hero-eyebrow { + margin: 0 0 var(--space-sm); + font-size: var(--text-sm); + font-weight: var(--font-semibold); + letter-spacing: 0.12em; + opacity: 0.8; +} + +.dashboard-hero h2 { + margin: 0 0 var(--space-md); + font-size: var(--text-2xl); + font-weight: var(--font-semibold); +} + +.dashboard-hero-body { + margin: 0; + font-size: var(--text-base); + line-height: 1.55; + /* ponytail: no measure cap, the band is only ~2 lines of copy. Put a + max-width back if the text ever grows past three lines. */ + opacity: 0.9; + padding-right: var(--space-2xl); +} + +.dashboard-hero-actions { + display: flex; + align-items: center; + gap: var(--space-lg); + margin-top: var(--space-xl); +} + +.dashboard-hero-cta { + background: #fff; + color: var(--color-gray-900); + border: none; + border-radius: var(--radius-md); + padding: var(--space-sm) 1.25rem; + font-size: var(--text-base); + font-weight: var(--font-semibold); + cursor: pointer; +} + +.dashboard-hero-link { + color: #fff; + font-size: var(--text-base); + text-decoration: underline; + cursor: pointer; } .dashboard-section { @@ -1313,6 +1402,29 @@ box-shadow: var(--shadow-card-hover); } +/* Only the prebuilt cards carry a thumbnail. The community cards share + .query-card and stack their children, so the row layout lives here. */ +.query-card-with-thumb { + display: flex; + align-items: flex-start; + gap: var(--space-lg); +} + +.query-card-body { + flex: 1; + min-width: 0; +} + +.query-card-thumb { + flex-shrink: 0; + width: 132px; + height: 90px; + object-fit: cover; + border-radius: var(--radius-md); + border: 1px solid var(--color-gray-200); + background: var(--color-gray-100); +} + .query-card-title { margin: 0 0 0.35rem; font-size: var(--text-lg); @@ -1392,7 +1504,7 @@ justify-content: center; width: 34px; height: 34px; - color: #333; + color: var(--color-gray-700); cursor: pointer; } @@ -1402,11 +1514,11 @@ gap: 2px; padding: 8px 12px 8px 8px; min-width: 170px; - border-top: 1px solid #ddd; + border-top: 1px solid var(--color-gray-300); } .custom-layer-panel:hover .custom-layer-panel__toggle { - border-bottom: 1px solid #ddd; + border-bottom: 1px solid var(--color-gray-300); } .custom-layer-panel:hover .custom-layer-panel__body { @@ -1424,7 +1536,7 @@ } .custom-layer-panel__row:hover { - background: #f5f5f5; + background: var(--color-gray-100); } .custom-layer-panel__row input[type='checkbox'] { @@ -1432,7 +1544,7 @@ width: 14px; height: 14px; cursor: pointer; - accent-color: var(--color-primary, #4f46e5); + accent-color: var(--color-primary); } .custom-layer-panel__swatch { @@ -1443,7 +1555,7 @@ } .custom-layer-panel__label { - color: #333; + color: var(--color-gray-700); user-select: none; } @@ -1463,18 +1575,18 @@ justify-content: center; width: 34px; height: 34px; - color: #333; + color: var(--color-gray-700); cursor: pointer; } .basemap-selector__body { display: none; padding: 10px; - border-top: 1px solid #ddd; + border-top: 1px solid var(--color-gray-300); } .basemap-selector:hover .basemap-selector__toggle { - border-bottom: 1px solid #ddd; + border-bottom: 1px solid var(--color-gray-300); } .basemap-selector:hover .basemap-selector__body { @@ -1502,11 +1614,11 @@ } .basemap-selector__tile:hover { - background: #f5f5f5; + background: var(--color-gray-100); } .basemap-selector__tile.is-active { - border-color: var(--color-primary, #4f46e5); + border-color: var(--color-primary); } .basemap-selector__thumb { @@ -1519,7 +1631,7 @@ .basemap-selector__label { font-size: 11px; - color: #333; + color: var(--color-gray-700); user-select: none; max-width: 64px; text-align: center; @@ -1668,7 +1780,7 @@ padding: 0.3rem 0.85rem; border-radius: 999px; border: 1px solid var(--color-gray-200); - background: var(--color-gray-50, #f9fafb); + background: var(--color-gray-50); font-size: var(--text-sm); color: var(--color-gray-700); cursor: pointer; @@ -1812,9 +1924,9 @@ .measure-control__toggle--active, .measure-control__toggle--active:hover { - background: var(--color-primary-600, #4f46e5); + background: var(--color-primary-600); color: white; - border-color: var(--color-primary-600, #4f46e5); + border-color: var(--color-primary-600); } .measure-control__readout { @@ -1984,11 +2096,11 @@ } .saved-row-menu-item-danger { - color: #b42318; + color: var(--color-red-700); } .saved-row-menu-item-danger:hover { - background: #fef3f2; + background: var(--color-red-100); } /* Save modal */ @@ -2017,7 +2129,7 @@ .save-modal-input:focus { outline: none; border-color: var(--color-primary-200); - box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); + box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.2); } .save-modal-hint { @@ -2045,8 +2157,8 @@ width: 56px; height: 56px; border-radius: 50%; - background: rgba(139, 92, 246, 0.12); - color: var(--color-primary-600, #7c3aed); + background: rgba(var(--color-primary-rgb), 0.12); + color: var(--color-primary-600); display: flex; align-items: center; justify-content: center; @@ -2096,8 +2208,8 @@ .publish-field-input:focus { outline: none; - border-color: var(--color-primary-300, #a78bfa); - box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); + border-color: var(--color-primary-300); + box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.2); } .publish-field-hint { @@ -2132,8 +2244,8 @@ } .tag-input:focus-within { - border-color: var(--color-primary-300, #a78bfa); - box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15); + border-color: var(--color-primary-300); + box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.2); } .tag-chip { @@ -2141,7 +2253,7 @@ align-items: center; gap: 4px; padding: 2px 8px; - background: var(--color-gray-100, #f3f4f6); + background: var(--color-gray-100); border-radius: 999px; font-size: var(--text-sm); color: var(--color-gray-800); @@ -2189,7 +2301,7 @@ height: 64px; border-radius: 50%; background: rgba(34, 197, 94, 0.15); - color: #16a34a; + color: var(--color-green-700); display: flex; align-items: center; justify-content: center; @@ -2238,7 +2350,7 @@ align-items: center; gap: var(--space-md); padding: var(--space-sm) var(--space-lg); - background: var(--color-gray-50, #f9fafb); + background: var(--color-gray-50); border-bottom: 1px solid var(--color-gray-200); } @@ -2305,7 +2417,7 @@ width: 90%; max-width: 420px; padding: var(--space-xl); - background: linear-gradient(180deg, #d9ccff, #efeaff); + background: linear-gradient(180deg, var(--color-primary-200), var(--color-primary-100)); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); text-align: center; @@ -2315,7 +2427,7 @@ margin: 0 0 var(--space-lg); font-size: var(--text-2xl, 1.5rem); font-weight: var(--font-semibold); - color: var(--color-gray-900, #111); + color: var(--color-gray-900); } .how-it-works-tracks { @@ -2374,3 +2486,73 @@ border: none; border-radius: var(--radius-sm); } + +/* Partial results: some slices of a split query failed, the rest succeeded. */ +.partial-results-notice { + position: absolute; + top: 0.75rem; + left: 50%; + transform: translateX(-50%); + z-index: 900; + display: flex; + align-items: flex-start; + gap: 0.75rem; + max-width: 560px; + padding: 0.625rem 0.875rem; + background: var(--color-yellow-50); + border: 1px solid var(--color-yellow-400); + border-radius: var(--radius-md); + box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08); + font-size: var(--text-sm); + line-height: 1.45; + color: var(--color-gray-800); +} + +.partial-results-notice button { + flex-shrink: 0; + background: none; + border: none; + cursor: pointer; + font-size: 1.1rem; + line-height: 1; + color: var(--color-gray-600); +} + +/* Popup footer while a sample point's measurements are loading. */ +.popup-detail-status { + margin-top: 0.5rem; + font-size: var(--text-xs, 0.75rem); + color: var(--color-gray-600); + font-style: italic; +} + +/* Saved (cached) results — never let a stored answer look like a fresh one. */ +.cached-result-notice { + position: absolute; + top: 0.75rem; + left: 50%; + transform: translateX(-50%); + z-index: 900; + display: flex; + align-items: center; + gap: 0.75rem; + padding: 0.5rem 0.875rem; + background: white; + border: 1px solid var(--color-primary-200); + border-radius: var(--radius-md); + box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08); + font-size: var(--text-sm); + color: var(--color-gray-700); +} + +.cached-result-notice button { + flex-shrink: 0; + padding: 0.25rem 0.625rem; + background: var(--color-primary-50); + border: 1px solid var(--color-primary-200); + border-radius: var(--radius-sm, 4px); + color: var(--color-primary-700); + font-size: var(--text-xs, 0.75rem); + font-weight: 600; + cursor: pointer; +} diff --git a/src/api/resultCacheClient.ts b/src/api/resultCacheClient.ts new file mode 100644 index 0000000..1802dc4 --- /dev/null +++ b/src/api/resultCacheClient.ts @@ -0,0 +1,78 @@ +import type { PipelineSuccess } from '../engine/executor'; +import { cacheKey } from '../engine/cacheKey'; +import { fromWire, isWireResult, toWire, type WireResult } from '../engine/wire'; +import type { AnalysisQuestion } from '../types/query'; + +function getApiBase(): string { + const base = import.meta.env.VITE_API_BASE_URL; + if (!base) throw new Error('VITE_API_BASE_URL is not set. Add it to .env.local (see .env.example).'); + return base.replace(/\/$/, ''); +} + +export interface CachedResult { + result: PipelineSuccess; + computedAt: string | null; + partial: boolean; +} + +// `?cache=off` forces a live run — for debugging, and for anyone who needs to +// be certain they are looking at fresh data. +export function cacheDisabled(): boolean { + if (typeof window === 'undefined') return false; + return new URLSearchParams(window.location.search).get('cache') === 'off'; +} + +async function readCache(url: string): Promise { + const res = await fetch(url); + if (!res.ok) return null; // 404 is the normal miss; anything else is also just a miss + const body: unknown = await res.json(); + if (!isWireResult(body)) return null; + return { + result: fromWire(body), + computedAt: res.headers.get('X-Result-Computed-At') ?? body.computedAt ?? null, + partial: res.headers.get('X-Result-Partial') === '1', + }; +} + +// A cache miss must never break a run — any failure here falls through to +// executing the pipeline locally, exactly as before this cache existed. +export async function fetchCachedResult(question: AnalysisQuestion): Promise { + if (cacheDisabled()) return null; + try { + return await readCache(`${getApiBase()}/api/results/${await cacheKey(question)}`); + } catch { + return null; + } +} + +export async function fetchPublishedResult(publishId: string): Promise { + if (cacheDisabled()) return null; + try { + return await readCache(`${getApiBase()}/api/publish/${publishId}/result`); + } catch { + return null; + } +} + +// Called after a successful publish with the result the publisher already has. +// Never throws: caching is a bonus, and a publish that succeeded must not look +// like a failure because the upload of a 7MB payload did not. +export async function savePublishedResult( + publishId: string, + editToken: string, + result: PipelineSuccess, +): Promise { + try { + const wire: WireResult = toWire(result); + const res = await fetch(`${getApiBase()}/api/publish/${publishId}/result`, { + method: 'PUT', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ editToken, result: wire }), + }); + if (!res.ok) console.warn(`Could not cache published result (${res.status})`); + return res.ok; + } catch (err) { + console.warn('Could not cache published result', err); + return false; + } +} diff --git a/src/components/Dashboard/Dashboard.tsx b/src/components/Dashboard/Dashboard.tsx index 8ddd854..d320761 100644 --- a/src/components/Dashboard/Dashboard.tsx +++ b/src/components/Dashboard/Dashboard.tsx @@ -24,6 +24,7 @@ import { toSavedQueryParam } from '../../types/savedQuestion'; export function Dashboard() { const navigate = useNavigate(); const [searchOpen, setSearchOpen] = useState(false); + const [heroDismissed, setHeroDismissed] = useState(false); const [searchFilter, setSearchFilter] = useState('all'); const isTourOpen = useQueryStore((s) => s.isTourOpen); const openTour = useQueryStore((s) => s.openTour); @@ -62,7 +63,52 @@ export function Dashboard() { return (
-

Welcome to Sawgraph!

+ {!heroDismissed && ( +
+ +

SAWGraph Explorer

+

Explore PFAS contamination without writing a line of SPARQL

+

+ Explorer is an easy to use interface for researchers to explore + the SAWGraph knowledge graph without writing SPARQL. Pick an + entity, a relationship, and an anchor, say samples downstream of a + paper mill, and Explorer runs the queries and maps the answer. +

+ +
+ )}
@@ -145,7 +191,7 @@ export function Dashboard() {
Loading…
) : communityTop.length === 0 ? (
- No community analyses yet — publish one to see it here. + No community analyses yet. Publish one to see it here.
) : (
@@ -193,7 +239,9 @@ export function Dashboard() { } else { // Map/edit tours live on the editor route; hand off via the store. setPendingTour(id); - navigate(id === 'edit' ? '/q/new' : `/q/${PREBUILT_QUERIES[0].id}`); + navigate( + id === 'edit' ? '/q/new' : `/q/${PREBUILT_QUERIES[0].id}`, + ); } }} /> diff --git a/src/components/Dashboard/PrebuiltQueryCard.tsx b/src/components/Dashboard/PrebuiltQueryCard.tsx index 92e74a9..8c01734 100644 --- a/src/components/Dashboard/PrebuiltQueryCard.tsx +++ b/src/components/Dashboard/PrebuiltQueryCard.tsx @@ -1,6 +1,7 @@ import { useState } from 'react'; import type { PrebuiltQuery } from '../../constants/prebuiltQueries'; import { getTagColor } from '../../utils/tagColor'; +import { questionThumbnailUrl } from '../../constants/regionBounds'; interface PrebuiltQueryCardProps { query: PrebuiltQuery; @@ -16,36 +17,52 @@ export function PrebuiltQueryCard({ query, onClick }: PrebuiltQueryCardProps) { const hiddenCount = query.tags.length - MAX_VISIBLE_TAGS; return ( -
-

{query.title}

- - - - {expanded &&

{query.description}

} - -
- Tags - {visibleTags.map((tag) => ( - - {tag} - - ))} - {hiddenCount > 0 && ( - +{hiddenCount} - )} +
+
+

{query.title}

+ + + + {expanded &&

{query.description}

} + +
+ Tags + {visibleTags.map((tag) => ( + + {tag} + + ))} + {hiddenCount > 0 && ( + +{hiddenCount} + )} +
+ + { + // No generated thumbnail yet: show the plain basemap for the region + // rather than a broken image. + const img = e.currentTarget; + const fallback = questionThumbnailUrl(query.question); + if (img.src !== fallback) img.src = fallback; + }} + />
); } diff --git a/src/components/DesignSystem/DesignSystem.css b/src/components/DesignSystem/DesignSystem.css index fbb8785..7c959c4 100644 --- a/src/components/DesignSystem/DesignSystem.css +++ b/src/components/DesignSystem/DesignSystem.css @@ -406,7 +406,7 @@ } .ds-contrast-row--fail { - background: #fff5f5; + background: var(--color-red-100); } .ds-contrast-row--fail td:last-child { diff --git a/src/components/DesignSystem/DesignSystem.tsx b/src/components/DesignSystem/DesignSystem.tsx index 033d711..48f1a42 100644 --- a/src/components/DesignSystem/DesignSystem.tsx +++ b/src/components/DesignSystem/DesignSystem.tsx @@ -23,21 +23,24 @@ const COLOR_PALETTES = [ ], }, { - name: 'Primary (Blue)', + name: 'Primary (Blue), the only accent ramp', tokens: [ + { variable: '--color-primary-50', hex: '#f5fbff' }, { variable: '--color-primary-100', hex: '#ebf8ff' }, { variable: '--color-primary-200', hex: '#bee3f8' }, + { variable: '--color-primary-300', hex: '#90cdf4' }, + { variable: '--color-primary-400', hex: '#63b3ed' }, { variable: '--color-primary-600', hex: '#3182ce' }, { variable: '--color-primary-700', hex: '#2b6cb0' }, ], }, { - name: 'Indigo (Accent)', + name: 'Indigo (aliases of Primary, kept for old call sites)', tokens: [ - { variable: '--color-indigo-100', hex: '#ebf4ff' }, - { variable: '--color-indigo-300', hex: '#a3bffa' }, - { variable: '--color-indigo-600', hex: '#5a67d8' }, - { variable: '--color-indigo-700', hex: '#4c51bf' }, + { variable: '--color-indigo-100', hex: '#ebf8ff' }, + { variable: '--color-indigo-300', hex: '#90cdf4' }, + { variable: '--color-indigo-600', hex: '#3182ce' }, + { variable: '--color-indigo-700', hex: '#2b6cb0' }, ], }, { @@ -60,6 +63,7 @@ const COLOR_PALETTES = [ { name: 'Yellow (Warning)', tokens: [ + { variable: '--color-yellow-50', hex: '#fffbeb' }, { variable: '--color-yellow-100', hex: '#fefcbf' }, { variable: '--color-yellow-400', hex: '#ecc94b' }, { variable: '--color-yellow-800', hex: '#744210' }, diff --git a/src/components/Layout/AnalysisQuestionBar.tsx b/src/components/Layout/AnalysisQuestionBar.tsx index fdadc2a..7f9b7ca 100644 --- a/src/components/Layout/AnalysisQuestionBar.tsx +++ b/src/components/Layout/AnalysisQuestionBar.tsx @@ -20,6 +20,7 @@ import { } from '../../types/savedQuestion'; import { deepEqual } from '../../utils/clone'; import { publishEditTokens } from '../../storage/publishEditTokens'; +import { savePublishedResult } from '../../api/resultCacheClient'; const PUBLISHED_ID_PREFIX = 'published:'; @@ -365,6 +366,15 @@ export function AnalysisQuestionBar() { }); markBaseline(); setPublishedUrl(result.url); + + // Hand over the result this browser already computed, so visitors + // to the share link get it instantly instead of re-running the + // pipeline themselves. Deliberately not awaited and never throws: + // the publish has already succeeded. + const computed = useQueryStore.getState().pipelineResult; + if (computed?.status === 'success') { + void savePublishedResult(result.id, result.editToken, computed); + } } catch (err) { setPublishError( err instanceof Error ? err.message : 'Failed to publish.', diff --git a/src/components/Layout/Header.tsx b/src/components/Layout/Header.tsx index a9d00b8..250952e 100644 --- a/src/components/Layout/Header.tsx +++ b/src/components/Layout/Header.tsx @@ -14,6 +14,18 @@ export function Header() {
+ + About the SAWGraph project + + {isEditor && (