# zgis/semantique architecture

> Architecture diagram of the GitHub repository zgis/semantique, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zgis/semantique
- Repository: https://github.com/zgis/semantique

## Overview

semantique is a Python framework for querying Earth-observation data cubes through semantic concepts. Users express queries as recipes using ontology-backed mappings and spatial/temporal extents; a processor evaluates them against a cube and returns array results. The graph also preserves the package’s documented interactive Blockly visualization capability. Source excerpts establish key processor-to-cube and extent-parsing actions; where only the source index indicates a relationship, the edge is dashed rather than asserted as a verified call.

Main entry points: [`semantique/processor/core.py`](https://github.com/zgis/semantique/blob/main/semantique/processor/core.py) (Recipe processor), [`semantique/recipe.py`](https://github.com/zgis/semantique/blob/main/semantique/recipe.py) (Recipe), [`semantique/processor/arrays.py`](https://github.com/zgis/semantique/blob/main/semantique/processor/arrays.py) (Array operations), [`semantique/blocks.py`](https://github.com/zgis/semantique/blob/main/semantique/blocks.py) (Query blocks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_query["Query modeling"]
  node_blocks["Query blocks<br/>[blocks.py]"]
  node_recipe["Recipe<br/>[recipe.py]"]
  node_mapping["Ontology mapping<br/>[mapping.py]"]
end

subgraph group_execution["Query execution"]
  node_processor["Recipe processor<br/>[core.py]"]
end

subgraph group_data["Cube and extent"]
  node_extent["Query extent<br/>[extent.py]"]
  node_cube["Data cube adapters<br/>[datacube.py]"]
end

subgraph group_support["Array and visualization"]
  node_arrays["Array operations<br/>[arrays.py]"]
  node_operators["Operators<br/>[operators.py]"]
  node_reducers["Reducers<br/>[reducers.py]"]
  node_values["Value types<br/>[values.py]"]
  node_utils["Array utilities<br/>[utils.py]"]
  node_dimensions["Dimensions<br/>[dimensions.py]"]
  node_components["Dimension components<br/>[components.py]"]
  node_exceptions["Query errors<br/>[exceptions.py]"]
  node_visualise["Model visualizer<br/>[visualise.py]"]
  node_convert["Blockly converter<br/>[convert.py]"]
end

node_user(("Query author"))

node_user -->|"expresses query"| node_blocks
node_blocks -.->|"builds recipe"| node_recipe
node_recipe -.->|"runs recipe"| node_processor
node_processor -->|"retrieves layers"| node_cube
node_processor -->|"parses extent"| node_utils
node_mapping -.->|"supplies mapping"| node_processor
node_processor -.->|"evaluates arrays"| node_arrays
node_arrays -.->|"uses operators"| node_operators
node_arrays -.->|"uses reducers"| node_reducers
node_recipe -.->|"visualizes model"| node_visualise
node_visualise -->|"converts model"| node_convert
node_utils -->|"labels coordinates"| node_components
node_components -->|"uses dimension names"| node_dimensions

click node_blocks "https://github.com/zgis/semantique/blob/main/semantique/blocks.py"
click node_recipe "https://github.com/zgis/semantique/blob/main/semantique/recipe.py"
click node_mapping "https://github.com/zgis/semantique/blob/main/semantique/mapping.py"
click node_extent "https://github.com/zgis/semantique/blob/main/semantique/extent.py"
click node_cube "https://github.com/zgis/semantique/blob/main/semantique/datacube.py"
click node_processor "https://github.com/zgis/semantique/blob/main/semantique/processor/core.py"
click node_arrays "https://github.com/zgis/semantique/blob/main/semantique/processor/arrays.py"
click node_operators "https://github.com/zgis/semantique/blob/main/semantique/processor/operators.py"
click node_reducers "https://github.com/zgis/semantique/blob/main/semantique/processor/reducers.py"
click node_values "https://github.com/zgis/semantique/blob/main/semantique/processor/values.py"
click node_utils "https://github.com/zgis/semantique/blob/main/semantique/processor/utils.py"
click node_dimensions "https://github.com/zgis/semantique/blob/main/semantique/dimensions.py"
click node_components "https://github.com/zgis/semantique/blob/main/semantique/components.py"
click node_exceptions "https://github.com/zgis/semantique/blob/main/semantique/exceptions.py"
click node_visualise "https://github.com/zgis/semantique/blob/main/semantique/visualiser/visualise.py"
click node_convert "https://github.com/zgis/semantique/blob/main/semantique/visualiser/convert.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_blocks,node_recipe,node_mapping toneBlue
class node_processor toneAmber
class node_extent,node_cube toneMint
class node_arrays,node_operators,node_reducers,node_values,node_utils,node_dimensions,node_components,node_exceptions,node_visualise,node_convert toneRose
class node_user toneIndigo
```

## Components

### Query modeling

- [Query blocks](https://github.com/zgis/semantique/blob/main/semantique/blocks.py): `semantique/blocks.py`
- [Recipe](https://github.com/zgis/semantique/blob/main/semantique/recipe.py): `semantique/recipe.py`
- [Ontology mapping](https://github.com/zgis/semantique/blob/main/semantique/mapping.py): `semantique/mapping.py`

### Query execution

- [Recipe processor](https://github.com/zgis/semantique/blob/main/semantique/processor/core.py): `semantique/processor/core.py`

### Cube and extent

- [Query extent](https://github.com/zgis/semantique/blob/main/semantique/extent.py): `semantique/extent.py`
- [Data cube adapters](https://github.com/zgis/semantique/blob/main/semantique/datacube.py): `semantique/datacube.py`

### Array and visualization

- [Array operations](https://github.com/zgis/semantique/blob/main/semantique/processor/arrays.py): `semantique/processor/arrays.py`
- [Operators](https://github.com/zgis/semantique/blob/main/semantique/processor/operators.py): `semantique/processor/operators.py`
- [Reducers](https://github.com/zgis/semantique/blob/main/semantique/processor/reducers.py): `semantique/processor/reducers.py`
- [Value types](https://github.com/zgis/semantique/blob/main/semantique/processor/values.py): `semantique/processor/values.py`
- [Array utilities](https://github.com/zgis/semantique/blob/main/semantique/processor/utils.py): `semantique/processor/utils.py`
- [Dimensions](https://github.com/zgis/semantique/blob/main/semantique/dimensions.py): `semantique/dimensions.py`
- [Dimension components](https://github.com/zgis/semantique/blob/main/semantique/components.py): `semantique/components.py`
- [Query errors](https://github.com/zgis/semantique/blob/main/semantique/exceptions.py): `semantique/exceptions.py`
- [Model visualizer](https://github.com/zgis/semantique/blob/main/semantique/visualiser/visualise.py): `semantique/visualiser/visualise.py`
- [Blockly converter](https://github.com/zgis/semantique/blob/main/semantique/visualiser/convert.py): `semantique/visualiser/convert.py`

### Other components

- **Query author**

## Connections

- Query author → Query blocks: expresses query (evidence: `README.md`)
- Query blocks → Recipe: builds recipe
- Recipe → Recipe processor: runs recipe (evidence: `semantique/recipe.py`)
- Recipe processor → Data cube adapters: retrieves layers (evidence: `semantique/processor/core.py`)
- Recipe processor → Array utilities: parses extent (evidence: `semantique/processor/core.py`)
- Ontology mapping → Recipe processor: supplies mapping (evidence: `semantique/mapping.py`)
- Recipe processor → Array operations: evaluates arrays (evidence: `semantique/processor/core.py`)
- Array operations → Operators: uses operators (evidence: `semantique/processor/arrays.py`)
- Array operations → Reducers: uses reducers (evidence: `semantique/processor/arrays.py`)
- Recipe → Model visualizer: visualizes model (evidence: `semantique/recipe.py`)
- Model visualizer → Blockly converter: converts model (evidence: `semantique/visualiser/visualise.py`)
- Array utilities → Dimension components: labels coordinates (evidence: `semantique/processor/utils.py`)
- Dimension components → Dimensions: uses dimension names (evidence: `semantique/components.py`)
