OntoRaster
Novel knowledge graph (KG) framework to query multidimensional raster data integrated with relational geometrical data powered by LLMs
Install / Use
/learn @aghoshpro/OntoRasterREADME
Demonstrating raster extension of Virtual Knowledge Graph (VKG) system Ontop to query over multidimensional raster data integrated with relational data in arbitrary domains. At present, it integrates and queries regular gridded (geo) spatial-temporal raster data together with relational data including vector geometrical data on the fly. We're constantly enhancing the extension with new robust features to enable end users to semantically query raster data of arbitrary domain under the VKG paradigm.
Features
- 🧠 On-the-fly integration of heterogenous tabular data, 2D & 3D geometrical data and $n-dimensional$ data in geospatial (or any arbitrary domain) with automatic meta data handling during query time.
- 🎯 Supports RasSPARQL, an extended SPARQL with GeoSPARQL and novel raster functions.
- 🧮 Incremental addition of new OWL ontologies, geo databases with respective mappings.
- 🗜️ Supported Data Formats :
.txt,.shp,.geojson,.geotiff,.netcdf,.gml,json. - 🤖 Query Answers are explainable by LLMs i.e., Ollama, ChatGPT, Claude etc.
- 🖥️ Clean Web UI and SPARQL YASGUI for usage demonstration.
Table of Contents
- 4.1. Raster Ontology
- 4.2. GeoSPARQL v1.1
- 4.3. GeoNames v3.3
- 4.4. LinkedGeoData
- 4.5. CityGML v2.0
- 4.6. Quantities, Units, Dimensions and Types (QUDT) Ontology
-
5.1. Relational Data
- 5.1.1. GeoNames Data
- 5.1.2. Vector Data (D<sup>Vector</sup>)
- 5.1.3. 3DCityGML Data (D<sup>City3D</sup>)
- 5.1.4. OSM Data (D<sup>OSM</sup>)
0. Motivation
-
Query - List all the 30 meters tall residentials in Munich where average terrain elevation less than 550 meters and average land surface temperature is over 300K, given the following heterogenous data.
<img src="diagrams/AOIMunich04.PNG">How can someone find an answer to this question if they don't have the required domain knowledge or expertise regarding to handle these many types of spatial data and their respective metadata.
😃 You need OntoRaster to solve this. 😃
1. Framework
<img src="diagrams/OntoRaster_Framework.png"/> <!-- ### 1.1. For more check out the publication > **Ghosh, A**., Pano, A., Xiao, G., Calvanese, D. [**OntoRaster: Extending VKGs with Raster Data**](https://doi.org/10.1007/978-3-031-72407-7_9). _International Joint Conference on Rules and Reasoning. RuleML+RR 2024. Lecture Notes in Computer Science (LNCS), vol 15183. Springer_, **2024**. -->2. Demo
2.1 Clone this repository
-
git clone https://github.com/aghoshpro/OntoRaster.git
2.2 Setup Docker
- Go to https://docs.docker.com/desktop/ and install docker on your favourite OS.
2.3 Run The Demo
-
For this demo, we assume that the ports
7777,7001-7010(used for the RDBMS),8080(for Array DBMS),8082(used by Ontop),6060(prompt success msg and endpoint) are free. If you need to use different ports, please edit the file.env. -
Open
terminalorcmdand navigate to theOntoRasterrepository -
Run the following:
docker-compose -f docker-compose.ontoraster.yml up -
This command starts and initializes the relational database PostgreSQL with the spatial extension PostGIS. Once the relational database is ready, the array database Rasdaman initiates and imports the raster data.
-
NOTE:When running Rasdaman in a Docker container, it's important to ensure that your system has sufficient resources (CPU, memory, and disk space) to handle large raster file imports. If you encounter issues, such as failed imports, it may be due to insufficient available memory or other resource constraints. If this issue occurs try closing unnecessary applications or increase docker resource limits. -
docker-composefile uses the mappingvkg/OntoRaster.obdaand ontologyvkg/OntoRaster.owl.
2.4 Ontop SPARQL Endpoint
It becomes available at http://localhost:8082/ under success in docker desktop (ETC 5 min). Click the link and try out the RasSPARQL queries as shown below,
2.4.1 RasSPARQL Query Yasgui Editor
<!-- <img src="diagrams/Ontop-Endpoint.gif"/> --> <img src="diagrams/Munich02.gif"/>2.5 Stop Demo (optional)
-
Press
Ctrl+Cto stop and then run the following,docker-compose -f docker-compose.ontoraster.yml down --volumes --rmi all
3. Queries (Q)
All RasSPARQL queries are mentioned at vkg/OntoRaster.toml.
| Q<sub>i</sub> | Functional Description | | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | | Q1 | What is the dimension of the input raster dataset? | | Q2 | Perform element-wise operation over cells of an array of an input raster dataset at a particular timestamp with the user-specific operator and operator. | | Q3 | Find spatial average value from the raster dataset over a user-specific vector region at a specific timestamp | | Q4 | Find spatial maximum value from the raster dataset over a user-specific vector region at a specific timestamp | | Q5 | Find spatial minimum value from the raster dataset over a user-specific vector region at a specific timestamp | | Q6 | Find the temporal average value from a user-specific raster dataset over a user-specific vector region between start time and end time. | | Q7 | Find the temporal maximum value from a user-specific raster dataset over a user-specific vector region between start time and end time. | | Q8 | Find the temporal minimum value from a user-specific raster dataset over a user-specific vector region between start time and end time. | | Q9 | Clip a portion of user-specific raster data using the geometry of a user-specific vector region at a particular time and return the clipped array | | Q10 | Clip a portion of user-specific raster data based on the shape of custom vector region at a particular time and return filtered arrays |
3.1 Query Result
-
Find all the
<img align="right" width="300" height="355" src="diagrams/Q1result.png">residentialsand respectivesub-districtsin Munich, where the average terrainelevationis above 520 metersSELECT ?distName ?elevation ?distWkt ?distWktColor ?bldgWkt ?bldgWktColor { ?region a :SubDistrict . ?region rdfs:label ?distName . ?region geo:asWKT ?distWkt . BIND('#008AFF5C' AS ?distWktColor) ?building a lgdo:Residential . ?building geo:asWKT ?bldgWkt . BIND('red' AS ?bldgWktColor) FILTER (geof:sfWithin(?bldgWkt, ?distWkt)) ?gridCoverage a :Raster . ?gridCoverage rasdb:rasterName ?rasterName . FILTER (CONTAINS(?rasterName, 'Elevation')) BIND ('2000-02-11T00:00:00+00:00'^^xsd:dateTime AS ?timeStamp) BIND (rasdb:rasSpatialAverage(?timeStamp, ?distWkt, ?rasterName) AS ?elevation) FILTER(?elevation > 520) } -
Find all the
<!-- <img align="left" width="300 " height="380" src="diagrams/Screenshot from 2025-02-19 01-23-55.png"> --> <img align="right" width="300 " height="315" src="diagrams/Screenshot from 2025-02-19 01-27-57.png">rasterswithin respectivesub-districtsin Munich based on the similar conditions of above query [**WORK IN PROGRESS]SELECT ?distName ?elevation ?distWkt ?distWktColor ?bldgWkt ?bldgWktColor { ?region a :SubDistrict . ?region rdfs:label ?distName . ?region geo:asWKT ?distWkt . ?building a lgdo:Residential . ?building geo:asWKT ?bldgWkt . FILTER (geof:sfWithin(?bldgWkt, ?distWkt)) ?gridCoverage a :Raster . ?gridCoverage rasdb:rasterName ?rasterName . FILTER (CONTAINS(?rasterName, 'Elevation')) BIND ('2000-02-11T00:00:00+00:00'^^xsd:dateTime AS ?timeStamp) BIND (rasdb:rasGeoTIFF(?timeStamp, ?distWkt, ?rasterName) AS ?elevation) FILTER(?elevation > 520) }
4. Ontology (O)
4.1. Raster On
Related Skills
feishu-drive
352.9k|
things-mac
352.9kManage Things 3 via the `things` CLI on macOS (add/update projects+todos via URL scheme; read/search/list from the local Things database)
clawhub
352.9kUse the ClawHub CLI to search, install, update, and publish agent skills from clawhub.com
postkit
PostgreSQL-native identity, configuration, metering, and job queues. SQL functions that work with any language or driver
