SkillAgentSearch skills...

OntoRaster

Novel knowledge graph (KG) framework to query multidimensional raster data integrated with relational geometrical data powered by LLMs

Install / Use

/learn @aghoshpro/OntoRaster

README

<picture> <source media="(prefers-color-scheme: dark)" srcset="diagrams/OntoRaster-Dark.png"> <source media="(prefers-color-scheme: light)" srcset="diagrams/OntoRaster-Light.png"> <img alt=OntoRaster Logo" src="diagrams/OntoRaster-Light.png" style="width:auto;"> </picture> <!-- Raster extension of VKG system Ontop to query over **multidimensional raster** data combined with **relational data**. Current version of OntoRaster supports regular gridded 3-D **raster** data and geometrical **vector data** in geospatial domain. We are constantly improving the extension with new features which will enable the end user to query over raster data and vector data of any domain under the VKG paradigm in future. -->

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

  1. Motivation
  2. Framework
  3. Demo
  4. Queries
  5. Ontology (O)
  1. Heterogenous Data Sources (D)
  1. Mappings (M)
  2. More details

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

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 terminal or cmd and navigate to the OntoRaster repository

  • 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-compose file uses the mapping vkg/OntoRaster.obda and ontology vkg/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,

<img src="diagrams/Success1.PNG"/>

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+C to 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 residentials and respective sub-districts in Munich, where the average terrain elevation is above 520 meters

    <img align="right" width="300" height="355" src="diagrams/Q1result.png">
    SELECT ?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 rasters within respective sub-districts in Munich based on the similar conditions of above query [**WORK IN PROGRESS]

    <!-- <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">
    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

View on GitHub
GitHub Stars5
CategoryData
Updated5d ago
Forks0

Languages

Jupyter Notebook

Security Score

90/100

Audited on Apr 3, 2026

No findings