Skip to content

This PR should be reviewed before merging. Spatio temporal features for vitrivr-engine and Type System changes.#141

Open
henrikluemkemann wants to merge 19 commits into
vitrivr:mainfrom
henrikluemkemann:SpatioTemporalFeatures
Open

This PR should be reviewed before merging. Spatio temporal features for vitrivr-engine and Type System changes.#141
henrikluemkemann wants to merge 19 commits into
vitrivr:mainfrom
henrikluemkemann:SpatioTemporalFeatures

Conversation

@henrikluemkemann

Copy link
Copy Markdown

This PR contains commits that introduce:

  • New Extractors and Analysers for:
  1. Timestamps in JPEG Comment field of LSC images.
  2. Coordinates either found in EXIF-Metadata or parsed from the JPEG Comment field of LSC images. The Coordinates can be stored in a strict as lat and Lon values or in a PostGIS GEOGRAPHY type as a Point(Lon Lat) on a WGS84 coordinate grid.
  • Rewriting of the DateTime Type across the project
  1. The DateTime Value now exclusively uses java.time.LocalDateTime instead of java.util.date because it matches PostgreSQL column types more closely and avoids the need for casting in a lot of cases.

Introduced `CaptureTime` and `Coordinates` modules to analyze image metadata and extract capture timestamp and GPS coordinates from EXIF metadata, respectively. These implementations include necessary extractors, analysers and utilities.
…s specifically for geography queries, since > and < dont really have ignificant meaning. there is a fallback implementation for these operators, but its not really thought to be used.

Further embed new geography type in vitrivr-engines persistance model as well as create a new Extractor and Analyzer for PostGISCoordinates.

Also adds default values for normal coordinates (lat = 0, lon = 0) and for timestamps (1 jan 1970) because there were errors when trying to write empty descriptors to db
…es, and data across modules.

Major changes include:
- Deletion of `LocalDateTimeSerializer` and `DateTimeInputData`.
- Removal of `LocalDateTimeValue` usage in core and plugins.
- Addition of LSCTimestamp module targeting LSC dataset timestamp extraction.
- CaptureTimeExtractor.kt now just handles the happy case where we have a timestamp directly in the EXIF metadata.
- Adaptation of Documentation around the project
- Some rewriting of code in the Extractor and Analyser classes after comments from Ralph
- Adds TODOS which are not yet handled regarding code review feedback
…ime instead of java.util.date with the Value.DateTime and Type.DateTime instances.

Also adjusts the Timestamp extractors to use LocalDateTime now.

This should overall be the better choice compared to java.util.date, since when working with PostgreSQL and PGvector this matches the expected column types more closely.
…deletes work in progress changes for code review. No Unit Test as of now.
@ppanopticon ppanopticon self-requested a review June 7, 2025 08:01
… spatial query support with geography type integration, and add Boolean AND API."
@henrikluemkemann henrikluemkemann marked this pull request as ready for review June 11, 2025 23:01
@henrikluemkemann henrikluemkemann marked this pull request as draft June 11, 2025 23:07
Fix IntersectionAggregator.kt to properly log crucial info during runtime and fix its functionality to correctly detect an intersection.
…nates, LSCTimestamp, and CaptureTime

- Added `IntersectionAggregatorTest` to verify intersection functionality.
- Implemented integration-style tests for `Coordinates`, `PostGISCoordinates`, `LSCTimestamp`, and `CaptureTime` to validate metadata extraction.
- Updated build.gradle to include `vitrivr-engine-module-features` dependency.
- Included sample resources for testing EXIF metadata, GPS coordinates, and timestamp extraction.
@henrikluemkemann henrikluemkemann changed the title [DRAFT DO NOT MERGE] This PR is for review purposes only for now. Spatio temporal features for vitrivr-engine. This PR should be reviewed before merging. Spatio temporal features for vitrivr-engine and Type System changes. Jun 15, 2025
@henrikluemkemann

Copy link
Copy Markdown
Author

This PR now also contains unit tests for the added features.
Further, it contains a new BooleanQuery Type, the 'CompoundBooleanQuery', which can logically link statements in the WHERE clause for the same attribute.
Also adds the IntersectionAggregator with a matching unit test to logically link Query Results from different attributes.

Changes regarding the Geography type are not final but changes will follow over the course of my Bachelor Project.

…ography type is compared with primitive operators.

Removes some TODOS.
- Made `latAttribute` and `lonAttribute` optional in SpatialBooleanQuery.
- This allows better flexibility when using operators like `DWITHIN` that don't require explicit column names.
- Added `kotlin-test` dependency for improved testing support.
- Refactored QueryParser to simplify spatial operator evaluation.
- StructDescriptor:
  • Adjusted representation of spatial fields for better alignment with flexible query models.
  • Ensures correct type declarations and compatibility with retrievers.

  - Changed the Analysers for all coordinate related features to perform a proximity query instead of an exact coordinate match. This makes more sense for most use cases.
@henrikluemkemann henrikluemkemann marked this pull request as ready for review June 16, 2025 23:17
@ppanopticon ppanopticon requested a review from lucaro July 7, 2025 08:10

@ppanopticon ppanopticon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally the PR looks fine. I have left some minor comments. The greatest issue I currently see is placement of things:

  • Tests should be in the same module like the classes being tested.
  • I would not put too much into the vitrivr-engine-core module. For example, the Extractors and Retrievers belong to the vitrivr-engine-module-features or a dedicated module (e.g., for LSC-only features).

Comment thread vitrivr-engine-core/build.gradle Outdated
/* Test Fixtures. */
testFixturesImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: version_junit
testFixturesImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: version_junit
testImplementation "org.jetbrains.kotlin:kotlin-test:2.1.10"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could reference version_kotlin variable here instead writing-out the version.

private val layout = listOf(Attribute("timestamp", Type.Datetime))

// we need file access (and ContentType.BITMAP_IMAGE)
override fun matches(r: Retrievable): Boolean = r.content.any { it.type == ContentType.BITMAP_IMAGE } && r.filteredAttribute(SourceAttribute::class.java)?.source is FileSource

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a FileSource? Couldn't we use an arbitrary InputStream to extract metadata from.

* @author henrikluemkemann
* @version 1.0.0
*/
data class CompoundBooleanQuery(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you call the 'OR' version of this query (since they are both compound)?

* This type is intended to represent PostGIS `geography(POINT,4326)` types.
*/
@Serializable
data object Geography : Type {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again a naming issue: Since 'Geography' is effectively a point, wouldn't it make sense to call it that? In my understanding (and maybe I'm wrong) a geography could also be a rectangle, for example.

/* vitrivr core dependency. */
api project(':vitrivr-engine-core')
api project(':vitrivr-engine-module-m3d')
api project(':vitrivr-engine-module-features')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this dependency needed?

…LSC dataset instead of just thumbnails.

- Added `logger` to `StructDescriptorTable` and handled multi-parameter constructors dynamically because it had many issues with the new endpoint.

- Implemented metadata API endpoint for LSC content, including handling of WKT/WKB coordinate parsing.

- Updated `build.gradle` to dynamically use Kotlin version for test dependencies.

- Added `metadata` configuration in `ApiConfig` and integrated metadata route in `Routes`.
…tioTemporalFeatures

# Conflicts:
#	vitrivr-engine-core/build.gradle
…` to avoid PostgreSQL parameter limits.

- Introduced `MultiFieldLookup` transformer and its factory for efficient retrieval and lookup of multiple fields (I didn't get FieldLookup query syntax to work)
- Registered `MultiFieldLookupFactory` in transformer services.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants