diff --git a/settings.gradle b/settings.gradle index 621647862..e2de8b7ea 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,4 +13,3 @@ include 'vitrivr-engine-module-pgvector' include 'vitrivr-engine-module-features' include 'vitrivr-engine-module-m3d' include 'vitrivr-engine-module-fes' -include 'vitrivr-engine-module-statistics' diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/config/pipeline/execution/RetrievalPipeline.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/config/pipeline/execution/RetrievalPipeline.kt index 4ec039c6c..d6e58f635 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/config/pipeline/execution/RetrievalPipeline.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/config/pipeline/execution/RetrievalPipeline.kt @@ -6,8 +6,6 @@ import org.vitrivr.engine.core.operators.Operator /** * A pipeline for retrieval. It wraps a (query) [Operator] that returns [Retrieved] objects. * - * TODO: Builder for this must be implemented. - * * @author Ralph Gasser * @version 1.0.0 */ diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/context/Context.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/context/Context.kt index ad03b9a25..75927fb0b 100755 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/context/Context.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/context/Context.kt @@ -2,7 +2,6 @@ package org.vitrivr.engine.core.context import io.javalin.openapi.OpenApiIgnore import kotlinx.serialization.Serializable -import kotlinx.serialization.Transient import org.vitrivr.engine.core.model.metamodel.Schema /** @@ -11,7 +10,7 @@ import org.vitrivr.engine.core.model.metamodel.Schema * This is applicable for index and query phases. */ @Serializable -sealed class Context() { +sealed class Context { /** * Configuration per named operator. */ diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/BlackholeConnection.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/BlackholeConnection.kt new file mode 100755 index 000000000..19c22969a --- /dev/null +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/BlackholeConnection.kt @@ -0,0 +1,68 @@ +package org.vitrivr.engine.core.database.blackhole + +import io.github.oshai.kotlinlogging.KLogger +import io.github.oshai.kotlinlogging.KotlinLogging.logger +import io.github.oshai.kotlinlogging.Marker +import org.vitrivr.engine.core.database.AbstractConnection +import org.vitrivr.engine.core.database.ConnectionProvider +import org.vitrivr.engine.core.database.blackhole.descriptors.BlackholeDescriptorInitializer +import org.vitrivr.engine.core.database.blackhole.descriptors.BlackholeDescriptorReader +import org.vitrivr.engine.core.database.blackhole.descriptors.BlackholeDescriptorWriter +import org.vitrivr.engine.core.database.blackhole.retrievable.BlackholeRetrievableInitializer +import org.vitrivr.engine.core.database.blackhole.retrievable.BlackholeRetrievableReader +import org.vitrivr.engine.core.database.blackhole.retrievable.BlackholeRetrievableWriter +import org.vitrivr.engine.core.database.descriptor.DescriptorReader +import org.vitrivr.engine.core.database.retrievable.RetrievableInitializer +import org.vitrivr.engine.core.database.retrievable.RetrievableReader +import org.vitrivr.engine.core.database.retrievable.RetrievableWriter +import org.vitrivr.engine.core.model.descriptor.Descriptor +import org.vitrivr.engine.core.model.metamodel.Schema + + +/** Defines [KLogger] of the class. */ +internal val LOGGER: KLogger = logger {} + +/** + * An [AbstractConnection] that swallows all data and does not store anything. However, it can be used to log operations. + * + * @author Ralph Gasser + * @version 1.0.0 + */ +class BlackholeConnection(schemaName: String, provider: ConnectionProvider, private val log: Boolean = false) : AbstractConnection(schemaName, provider) { + + + + init { + LOGGER.warn { "You are using the blackhole connection with schema $schemaName. No data will be stored!" } + } + + /** [Marker] used for logging. */ + private val marker: Marker = object : Marker { + override fun getName(): String = this@BlackholeConnection.description() + } + + override fun initialize() = this.logIf("Initializing schema '$schemaName'.") + override fun truncate() = this.logIf("Truncating schema '$schemaName'.") + override fun withTransaction(action: (Unit) -> T): T { + LOGGER.warn { "Transactions are not supported by blackhole connection. Ignoring transaction." } + return action(Unit) + } + + override fun getRetrievableInitializer(): RetrievableInitializer = BlackholeRetrievableInitializer(this) + override fun getRetrievableWriter(): RetrievableWriter = BlackholeRetrievableWriter(this) + override fun getRetrievableReader(): RetrievableReader = BlackholeRetrievableReader(this) + override fun > getDescriptorInitializer(field: Schema.Field<*, D>) = BlackholeDescriptorInitializer(this, field) + override fun > getDescriptorWriter(field: Schema.Field<*, D>) = BlackholeDescriptorWriter(this, field) + override fun > getDescriptorReader(field: Schema.Field<*, D>): DescriptorReader = BlackholeDescriptorReader(this, field) + override fun description(): String = "'$schemaName'@blackhole" + override fun close() = this.logIf("Closing connection to blackhole database.") + + /** + * Conditionally logs a message if logging is enabled. + * + * @param message The message to log. + */ + internal fun logIf(message: String) { + if (this.log) LOGGER.info(throwable = null, marker = this.marker) { message } + } +} diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/BlackholeConnectionProvider.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/BlackholeConnectionProvider.kt new file mode 100755 index 000000000..f6837bfa1 --- /dev/null +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/BlackholeConnectionProvider.kt @@ -0,0 +1,21 @@ +package org.vitrivr.engine.core.database.blackhole + +import org.vitrivr.engine.core.database.ConnectionProvider +import org.vitrivr.engine.core.database.blackhole.descriptors.BlackholeDescriptionProvider +import org.vitrivr.engine.core.database.descriptor.DescriptorProvider +import org.vitrivr.engine.core.model.descriptor.Descriptor +import kotlin.reflect.KClass + +/** + * A [ConnectionProvider] for the [BlackholeConnection]. + * + * @author Ralph Gasser + * @version 1.0.0 + */ +class BlackholeConnectionProvider : ConnectionProvider { + override val databaseName: String = "blackhole" + override val version: String = "1.0.0" + override fun openConnection(schemaName: String, parameters: Map) = BlackholeConnection(schemaName, this, parameters["log"]?.toBoolean() == true) + override fun > register(descriptorClass: KClass, provider: DescriptorProvider<*>) { /* No op. */ } + override fun > obtain(descriptorClass: KClass) = BlackholeDescriptionProvider() +} diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/descriptors/BlackholeDescriptionProvider.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/descriptors/BlackholeDescriptionProvider.kt new file mode 100644 index 000000000..98f072e57 --- /dev/null +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/descriptors/BlackholeDescriptionProvider.kt @@ -0,0 +1,21 @@ +package org.vitrivr.engine.core.database.blackhole.descriptors + +import org.vitrivr.engine.core.database.Connection +import org.vitrivr.engine.core.database.blackhole.BlackholeConnection +import org.vitrivr.engine.core.database.descriptor.DescriptorProvider +import org.vitrivr.engine.core.database.descriptor.DescriptorReader +import org.vitrivr.engine.core.database.descriptor.DescriptorWriter +import org.vitrivr.engine.core.model.descriptor.Descriptor +import org.vitrivr.engine.core.model.metamodel.Schema + +/** + * A [DescriptorProvider] for the [BlackholeConnection]. + * + * @author Ralph Gasser + * @version 1.0.0 + */ +class BlackholeDescriptionProvider>: DescriptorProvider { + override fun newInitializer(connection: Connection, field: Schema.Field<*, T>)= BlackholeDescriptorInitializer(connection as BlackholeConnection, field) + override fun newReader(connection: Connection, field: Schema.Field<*, T>): DescriptorReader = BlackholeDescriptorReader(connection as BlackholeConnection, field) + override fun newWriter(connection: Connection, field: Schema.Field<*, T>): DescriptorWriter = BlackholeDescriptorWriter(connection as BlackholeConnection, field) +} \ No newline at end of file diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/descriptors/BlackholeDescriptorInitializer.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/descriptors/BlackholeDescriptorInitializer.kt new file mode 100644 index 000000000..b8b1a973e --- /dev/null +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/descriptors/BlackholeDescriptorInitializer.kt @@ -0,0 +1,19 @@ +package org.vitrivr.engine.core.database.blackhole.descriptors + +import org.vitrivr.engine.core.database.blackhole.BlackholeConnection +import org.vitrivr.engine.core.database.descriptor.DescriptorInitializer +import org.vitrivr.engine.core.model.descriptor.Descriptor +import org.vitrivr.engine.core.model.metamodel.Schema + +/** + * A [DescriptorInitializer] for the [BlackholeConnection]. + * + * @author Ralph Gasser + * @version 1.0.0 + */ +class BlackholeDescriptorInitializer>(private val connection: BlackholeConnection, override val field: Schema.Field<*, T>): DescriptorInitializer { + override fun initialize() = this.connection.logIf("Initializing descriptor entity '${this.field.fieldName}'.") + override fun deinitialize() = this.connection.logIf("De-initializing descriptor entity '${this.field.fieldName}'.") + override fun isInitialized(): Boolean = false + override fun truncate() = this.connection.logIf("Truncating descriptor entity '${this.field.fieldName}'.") +} \ No newline at end of file diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/descriptors/BlackholeDescriptorReader.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/descriptors/BlackholeDescriptorReader.kt new file mode 100644 index 000000000..707cd70a1 --- /dev/null +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/descriptors/BlackholeDescriptorReader.kt @@ -0,0 +1,28 @@ +package org.vitrivr.engine.core.database.blackhole.descriptors + +import org.vitrivr.engine.core.database.blackhole.BlackholeConnection +import org.vitrivr.engine.core.database.descriptor.DescriptorReader +import org.vitrivr.engine.core.model.descriptor.Descriptor +import org.vitrivr.engine.core.model.descriptor.DescriptorId +import org.vitrivr.engine.core.model.metamodel.Schema +import org.vitrivr.engine.core.model.query.Query +import org.vitrivr.engine.core.model.retrievable.RetrievableId +import org.vitrivr.engine.core.model.retrievable.Retrieved + +/** + * A [DescriptorReader] for the [BlackholeConnection]. + * + * @author Ralph Gasser + * @version 1.0.0 + */ +class BlackholeDescriptorReader>(override val connection: BlackholeConnection, override val field: Schema.Field<*, T>) : DescriptorReader { + override fun exists(descriptorId: DescriptorId): Boolean = false + override fun get(descriptorId: DescriptorId): T? = null + override fun getAll(descriptorIds: Iterable) = emptySequence() + override fun getAll() = emptySequence() + override fun getForRetrievable(retrievableId: RetrievableId) = emptySequence() + override fun getAllForRetrievable(retrievableIds: Iterable) = emptySequence() + override fun query(query: Query) = emptySequence() + override fun queryAndJoin(query: Query) = emptySequence() + override fun count() = 0L +} \ No newline at end of file diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/descriptors/BlackholeDescriptorWriter.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/descriptors/BlackholeDescriptorWriter.kt new file mode 100644 index 000000000..f1414f9d3 --- /dev/null +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/descriptors/BlackholeDescriptorWriter.kt @@ -0,0 +1,39 @@ +package org.vitrivr.engine.core.database.blackhole.descriptors + +import org.vitrivr.engine.core.database.blackhole.BlackholeConnection +import org.vitrivr.engine.core.database.descriptor.DescriptorWriter +import org.vitrivr.engine.core.model.descriptor.Descriptor +import org.vitrivr.engine.core.model.metamodel.Schema + +/** + * A [DescriptorWriter] for the [BlackholeConnection]. + * + * @author Ralph Gasser + * @version 1.0.0 + */ +class BlackholeDescriptorWriter>(override val connection: BlackholeConnection, override val field: Schema.Field<*, T>): DescriptorWriter { + override fun add(item: T): Boolean { + this.connection.logIf("Adding descriptor '${item.id}' to entity '${this.field.fieldName}'.") + return false + } + + override fun addAll(items: Iterable): Boolean { + items.forEach { item -> this.connection.logIf("Adding descriptor '${item.id}' to entity '${this.field.fieldName}'.") } + return false + } + + override fun update(item: T): Boolean { + this.connection.logIf("Updating descriptor '${item.id}' in entity '${this.field.fieldName}'.") + return false + } + + override fun delete(item: T): Boolean { + this.connection.logIf("Deleting descriptor '${item.id}' in entity '${this.field.fieldName}'.") + return false + } + + override fun deleteAll(items: Iterable): Boolean { + items.forEach { item -> this.connection.logIf("Deleting descriptor '${item.id}' from entity '${this.field.fieldName}'.") } + return false + } +} \ No newline at end of file diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/BlackholeRetrievableInitializer.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/BlackholeRetrievableInitializer.kt new file mode 100644 index 000000000..cbc2b06c7 --- /dev/null +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/BlackholeRetrievableInitializer.kt @@ -0,0 +1,17 @@ +package org.vitrivr.engine.core.database.blackhole.retrievable + +import org.vitrivr.engine.core.database.blackhole.BlackholeConnection +import org.vitrivr.engine.core.database.retrievable.RetrievableInitializer + +/** + * A [RetrievableInitializer] for the [BlackholeConnection]. + * + * @author Ralph Gasser + * @version 1.0.0 + */ +class BlackholeRetrievableInitializer(private val connection: BlackholeConnection): RetrievableInitializer { + override fun initialize() = this.connection.logIf("Initializing entities 'retrievable' and 'relationship'.") + override fun deinitialize() = this.connection.logIf("De-initializing entities 'retrievable' and 'relationship'.") + override fun isInitialized(): Boolean = false + override fun truncate() = this.connection.logIf("Truncating entities 'retrievable' and 'relationship'.") +} \ No newline at end of file diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/BlackholeRetrievableReader.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/BlackholeRetrievableReader.kt new file mode 100644 index 000000000..d4e287078 --- /dev/null +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/BlackholeRetrievableReader.kt @@ -0,0 +1,22 @@ +package org.vitrivr.engine.core.database.blackhole.retrievable + +import org.vitrivr.engine.core.database.blackhole.BlackholeConnection +import org.vitrivr.engine.core.database.retrievable.RetrievableReader +import org.vitrivr.engine.core.model.retrievable.Retrievable +import org.vitrivr.engine.core.model.retrievable.RetrievableId + + +/** + * A [RetrievableReader] for the [BlackholeConnection]. + * + * @author Ralph Gasser + * @version 1.0.0 + */ +class BlackholeRetrievableReader(override val connection: BlackholeConnection) : RetrievableReader { + override fun get(id: RetrievableId): Retrievable? = null + override fun exists(id: RetrievableId): Boolean = false + override fun getAll(ids: Iterable) = emptySequence() + override fun getAll() = emptySequence() + override fun getConnections(subjectIds: Collection, predicates: Collection, objectIds: Collection) = emptySequence>() + override fun count(): Long = 0L +} \ No newline at end of file diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/BlackholeRetrievableWriter.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/BlackholeRetrievableWriter.kt new file mode 100644 index 000000000..26888832f --- /dev/null +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/BlackholeRetrievableWriter.kt @@ -0,0 +1,60 @@ +package org.vitrivr.engine.core.database.blackhole.retrievable + +import org.vitrivr.engine.core.database.blackhole.BlackholeConnection +import org.vitrivr.engine.core.database.retrievable.RetrievableWriter +import org.vitrivr.engine.core.model.relationship.Relationship +import org.vitrivr.engine.core.model.retrievable.Retrievable + + +/** + * A [RetrievableWriter] for the [BlackholeConnection]. + * + * @author Ralph Gasser + * @version 1.0.0 + */ +class BlackholeRetrievableWriter(override val connection: BlackholeConnection): RetrievableWriter { + override fun connect(relationship: Relationship): Boolean { + this.connection.logIf("Adding relationship ${relationship.subjectId} >[${relationship.predicate}] ${relationship.objectId}.") + return false + } + + override fun connectAll(relationships: Iterable): Boolean { + relationships.forEach { relationship -> this.connection.logIf("Adding relationship ${relationship.subjectId} >[${relationship.predicate}] ${relationship.objectId}.")} + return false + } + + override fun disconnect(relationship: Relationship): Boolean { + this.connection.logIf("Removing relationship ${relationship.subjectId} >[${relationship.predicate}] ${relationship.objectId}.") + return false + } + + override fun disconnectAll(relationships: Iterable): Boolean { + relationships.forEach { relationship -> this.connection.logIf("Removing relationship ${relationship.subjectId} >[${relationship.predicate}] ${relationship.objectId}.")} + return false + } + + override fun add(item: Retrievable): Boolean { + this.connection.logIf("Adding retrievable '${item.id}' to entity 'retrievable'.") + return false + } + + override fun addAll(items: Iterable): Boolean { + items.forEach { item -> this.connection.logIf("Adding retrievable '${item.id}' to entity 'retrievable'.") } + return false + } + + override fun update(item: Retrievable): Boolean { + this.connection.logIf("Updating retrievable '${item.id}' in entity 'retrievable'.") + return false + } + + override fun delete(item: Retrievable): Boolean { + this.connection.logIf("Deleting retrievable '${item.id}' from entity 'retrievable'.") + return false + } + + override fun deleteAll(items: Iterable): Boolean { + items.forEach { item -> this.connection.logIf("Deleting retrievable '${item.id}' from entity 'retrievable'.") } + return false + } +} \ No newline at end of file diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/features/metadata/source/video/VideoSourceMetadataExtractor.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/features/metadata/source/video/VideoSourceMetadataExtractor.kt index 9c6e4ad45..d8acad29e 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/features/metadata/source/video/VideoSourceMetadataExtractor.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/features/metadata/source/video/VideoSourceMetadataExtractor.kt @@ -49,6 +49,7 @@ class VideoSourceMetadataExtractor(input: Operator, analyser: Video mapOf( "width" to Value.Int(source.width() ?: 0), "height" to Value.Int(source.height() ?: 0), + "duration" to Value.Long(source.duration() ?: 0L), "fps" to Value.Double(source.fps() ?: 0.0), "channels" to Value.Int(source.channels() ?: 0), "sampleRate" to Value.Int(source.sampleRate() ?: 0), diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/features/migration/MediaDimensions.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/features/migration/MediaDimensions.kt deleted file mode 100644 index 2cbc46ea3..000000000 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/features/migration/MediaDimensions.kt +++ /dev/null @@ -1,34 +0,0 @@ -package org.vitrivr.engine.core.features.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.struct.metadata.MediaDimensionsDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever - -class MediaDimensions : Analyser, MediaDimensionsDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = MediaDimensionsDescriptor::class - override fun prototype(field: Schema.Field<*,*>) = MediaDimensionsDescriptor.PROTOTYPE - override fun newRetrieverForContent(field: Schema.Field, MediaDimensionsDescriptor>, content: Collection>, context: QueryContext): Retriever, MediaDimensionsDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, MediaDimensionsDescriptor>, query: Query, context: QueryContext): Retriever, MediaDimensionsDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, MediaDimensionsDescriptor>, input: Operator, context: IndexContext): Extractor, MediaDimensionsDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, MediaDimensionsDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/features/migration/VideoDuration.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/features/migration/VideoDuration.kt deleted file mode 100644 index c389b9a4f..000000000 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/features/migration/VideoDuration.kt +++ /dev/null @@ -1,34 +0,0 @@ -package org.vitrivr.engine.core.features.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.scalar.FloatDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class VideoDuration : Analyser, FloatDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatDescriptor(UUID.randomUUID(), UUID.randomUUID(), value = Value.Float(.0f)) - override fun newRetrieverForContent(field: Schema.Field, FloatDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatDescriptor> { - TODO("Not yet implemented") - } - override fun newRetrieverForQuery(field: Schema.Field, FloatDescriptor>, query: Query, context: QueryContext): Retriever, FloatDescriptor> { - TODO("Not yet implemented") - } - override fun newExtractor(field: Schema.Field, FloatDescriptor>, input: Operator, context: IndexContext): Extractor, FloatDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/features/migration/VideoFPS.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/features/migration/VideoFPS.kt deleted file mode 100644 index 012c8b4ab..000000000 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/features/migration/VideoFPS.kt +++ /dev/null @@ -1,36 +0,0 @@ -package org.vitrivr.engine.core.features.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.scalar.FloatDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class VideoFPS : Analyser, FloatDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatDescriptor(UUID.randomUUID(), UUID.randomUUID(), value = Value.Float(.0f)) - override fun newRetrieverForQuery(field: Schema.Field, FloatDescriptor>, query: Query, context: QueryContext): Retriever, FloatDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForContent(field: Schema.Field, FloatDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatDescriptor>, input: Operator, context: IndexContext): Extractor, FloatDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/element/Model3DContent.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/element/Model3DContent.kt index b4082087d..d83ea36cb 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/element/Model3DContent.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/element/Model3DContent.kt @@ -2,7 +2,6 @@ package org.vitrivr.engine.core.model.content.element import org.vitrivr.engine.core.model.content.ContentType import org.vitrivr.engine.core.model.mesh.Model3D -import java.awt.image.BufferedImage /** * A 3D [ContentElement]. diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/factory/CachedContentFactory.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/factory/CachedContentFactory.kt index 3dac1e44e..13fc7aff0 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/factory/CachedContentFactory.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/factory/CachedContentFactory.kt @@ -8,6 +8,7 @@ import org.vitrivr.engine.core.model.content.impl.cache.CachedAudioContent import org.vitrivr.engine.core.model.content.impl.cache.CachedContent import org.vitrivr.engine.core.model.content.impl.cache.CachedImageContent import org.vitrivr.engine.core.model.content.impl.cache.CachedTextContent +import org.vitrivr.engine.core.model.content.impl.memory.InMemoryMeshContent import org.vitrivr.engine.core.model.mesh.Model3D import org.vitrivr.engine.core.model.metamodel.Schema import java.awt.image.BufferedImage @@ -119,7 +120,9 @@ class CachedContentFactory : ContentFactoriesFactory { override fun newMeshContent(model3D: Model3D): Model3DContent { check(!this.closed) { "CachedContentFactory has been closed." } - TODO() + val content = InMemoryMeshContent(model3D) /* TODO: Caching. */ + logger.warn { "Caching of MeshContent is not yet implemented. Using in-memory content instead." } + return content } @@ -142,7 +145,6 @@ class CachedContentFactory : ContentFactoriesFactory { } } - /** * Closes this [CachedContentFactory] and purges all remaining items. A closed [CachedContentFactory] cannot be used anymore. */ diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/factory/InMemoryContentFactory.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/factory/InMemoryContentFactory.kt index 6af446eea..a3e5a8327 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/factory/InMemoryContentFactory.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/content/factory/InMemoryContentFactory.kt @@ -1,7 +1,9 @@ package org.vitrivr.engine.core.model.content.factory import org.vitrivr.engine.core.context.Context -import org.vitrivr.engine.core.model.content.element.* +import org.vitrivr.engine.core.model.content.element.ContentElement +import org.vitrivr.engine.core.model.content.element.Model3DContent +import org.vitrivr.engine.core.model.content.element.TextContent import org.vitrivr.engine.core.model.content.impl.memory.InMemoryAudioContent import org.vitrivr.engine.core.model.content.impl.memory.InMemoryImageContent import org.vitrivr.engine.core.model.content.impl.memory.InMemoryMeshContent @@ -15,21 +17,14 @@ import java.nio.ShortBuffer * A [ContentFactory] that keeps [ContentElement]s in memory. * * @author Ralph Gasser - * @version 1.0.0 + * @version 1.0.1 */ class InMemoryContentFactory : ContentFactoriesFactory { - override fun newContentFactory(schema: Schema, context: Context): ContentFactory = Instance() - private class Instance() : ContentFactory { - - override fun newImageContent(bufferedImage: BufferedImage): ImageContent = InMemoryImageContent(bufferedImage) - - override fun newAudioContent(channels: Short, samplingRate: Int, audio: ShortBuffer): AudioContent = - InMemoryAudioContent(channels, samplingRate, audio) - + override fun newImageContent(bufferedImage: BufferedImage) = InMemoryImageContent(bufferedImage) + override fun newAudioContent(channels: Short, sampleRate: Int, audio: ShortBuffer) = InMemoryAudioContent(channels, sampleRate, audio) override fun newTextContent(text: String): TextContent = InMemoryTextContent(text) - override fun newMeshContent(model3D: Model3D): Model3DContent = InMemoryMeshContent(model3D) } } diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/descriptor/struct/metadata/source/VideoSourceMetadataDescriptor.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/descriptor/struct/metadata/source/VideoSourceMetadataDescriptor.kt index 10ae28da7..820f19b5b 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/descriptor/struct/metadata/source/VideoSourceMetadataDescriptor.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/descriptor/struct/metadata/source/VideoSourceMetadataDescriptor.kt @@ -29,6 +29,9 @@ class VideoSourceMetadataDescriptor( /** The width of the video source in pixels. */ val height: Value.Int by this.values + /** The duration of the video source in pixels. */ + val duration: Value.Double by this.values + /** The number of visual frames per seconds. */ val fps: Value.Double by this.values @@ -46,6 +49,7 @@ class VideoSourceMetadataDescriptor( private val SCHEMA = listOf( Attribute("width", Type.Int), Attribute("height", Type.Int), + Attribute("duration", Type.Long), Attribute("fps", Type.Double), Attribute("channels", Type.Int), Attribute("sampleRate", Type.Int), @@ -59,6 +63,7 @@ class VideoSourceMetadataDescriptor( mapOf( "width" to Value.Int(0), "height" to Value.Int(0), + "duration" to Value.Long(0L), "fps" to Value.Double(0.0), "channels" to Value.Int(0), "sampleRate" to Value.Int(0), diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/descriptor/tensor/TensorDescriptor.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/descriptor/tensor/TensorDescriptor.kt deleted file mode 100644 index 683c04fad..000000000 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/descriptor/tensor/TensorDescriptor.kt +++ /dev/null @@ -1,13 +0,0 @@ -package org.vitrivr.engine.core.model.descriptor.tensor - -import org.vitrivr.engine.core.model.descriptor.Descriptor - -/** - * TODO - * - * @author Ralph Gasser - * @version 1.0.0 - */ -interface TensorDescriptor> : Descriptor { - -} \ No newline at end of file diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/mesh/Mesh.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/mesh/Mesh.kt index dedb2f2b5..a937639be 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/mesh/Mesh.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/mesh/Mesh.kt @@ -2,6 +2,7 @@ package org.vitrivr.engine.core.model.mesh import org.joml.Vector3f import org.joml.Vector3i +import org.vitrivr.engine.core.model.mesh.Mesh.Face import kotlin.math.sign import kotlin.math.sqrt diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/mesh/MinimalBoundingBox.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/mesh/MinimalBoundingBox.kt index 6a31a60f7..903be0a18 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/mesh/MinimalBoundingBox.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/mesh/MinimalBoundingBox.kt @@ -63,7 +63,6 @@ open class MinimalBoundingBox { * * @param positions List of vertices. */ - @Suppress("unused") constructor(positions: List) { update(positions) } diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/serializer/UUIDSerializer.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/serializer/UUIDSerializer.kt index 8cffbf8cd..cac372a2d 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/serializer/UUIDSerializer.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/model/serializer/UUIDSerializer.kt @@ -5,7 +5,7 @@ import kotlinx.serialization.descriptors.PrimitiveKind import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder -import java.util.UUID +import java.util.* object UUIDSerializer: KSerializer { override val descriptor = PrimitiveSerialDescriptor("UUID", PrimitiveKind.STRING) diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/source/Metadata.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/source/Metadata.kt index 87d41146f..91d34278e 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/source/Metadata.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/source/Metadata.kt @@ -9,6 +9,7 @@ package org.vitrivr.engine.core.source object Metadata { const val METADATA_KEY_IMAGE_WIDTH = "image.width" const val METADATA_KEY_IMAGE_HEIGHT = "image.height" + const val METADATA_KEY_AV_DURATION = "av.duration" const val METADATA_KEY_VIDEO_FPS = "video.fps" const val METADATA_KEY_AUDIO_CHANNELS = "audio.channels" const val METADATA_KEY_AUDIO_SAMPLERATE = "audio.samplerate" diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/source/Source.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/source/Source.kt index 59918e4c7..8d0c488b2 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/source/Source.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/source/Source.kt @@ -52,6 +52,14 @@ interface Source { */ fun height(): Int? = this.metadata[Metadata.METADATA_KEY_IMAGE_HEIGHT] as? Int + /** + * Duration of the [Source] in milliseconds (if applicable and available). + * + * Only applicable for [MediaType.VIDEO] and [MediaType.AUDIO]. + * @return [Long] + */ + fun duration(): Long? = this.metadata[Metadata.METADATA_KEY_AV_DURATION] as? Long + /** * Frames per second (FPS) of the [Source] in pixels (if applicable and available). * diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/source/file/MimeType.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/source/file/MimeType.kt index 5f435018d..5669a31bc 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/source/file/MimeType.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/source/file/MimeType.kt @@ -3,7 +3,6 @@ package org.vitrivr.engine.core.source.file import org.vitrivr.engine.core.source.MediaType import java.io.File import java.nio.file.Path -import kotlin.enums.EnumEntries /** * A range of known [MimeType]s used for internal conversion. diff --git a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/util/math/ScoringFunctions.kt b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/util/math/ScoringFunctions.kt index 463b2ea0a..faf5a316e 100644 --- a/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/util/math/ScoringFunctions.kt +++ b/vitrivr-engine-core/src/main/kotlin/org/vitrivr/engine/core/util/math/ScoringFunctions.kt @@ -3,7 +3,6 @@ package org.vitrivr.engine.core.util.math import org.vitrivr.engine.core.model.retrievable.Retrieved import org.vitrivr.engine.core.model.retrievable.attributes.DistanceAttribute import org.vitrivr.engine.core.model.retrievable.attributes.ScoreAttribute -import kotlin.math.sqrt /** * A collection of [ScoringFunctions] that can be used to score [Retrieved] object that come with a [DistanceAttribute]. diff --git a/vitrivr-engine-core/src/main/resources/META-INF/services/org.vitrivr.engine.core.database.ConnectionProvider b/vitrivr-engine-core/src/main/resources/META-INF/services/org.vitrivr.engine.core.database.ConnectionProvider new file mode 100644 index 000000000..78e279142 --- /dev/null +++ b/vitrivr-engine-core/src/main/resources/META-INF/services/org.vitrivr.engine.core.database.ConnectionProvider @@ -0,0 +1 @@ +org.vitrivr.engine.core.database.blackhole.BlackholeConnectionProvider \ No newline at end of file diff --git a/vitrivr-engine-core/src/main/resources/META-INF/services/org.vitrivr.engine.core.model.metamodel.Analyser b/vitrivr-engine-core/src/main/resources/META-INF/services/org.vitrivr.engine.core.model.metamodel.Analyser index 736805a45..f3d140936 100644 --- a/vitrivr-engine-core/src/main/resources/META-INF/services/org.vitrivr.engine.core.model.metamodel.Analyser +++ b/vitrivr-engine-core/src/main/resources/META-INF/services/org.vitrivr.engine.core.model.metamodel.Analyser @@ -2,7 +2,4 @@ org.vitrivr.engine.core.features.averagecolor.AverageColor org.vitrivr.engine.core.features.metadata.source.file.FileSourceMetadata org.vitrivr.engine.core.features.metadata.source.exif.ExifMetadata org.vitrivr.engine.core.features.metadata.source.video.VideoSourceMetadata -org.vitrivr.engine.core.features.metadata.temporal.TemporalMetadata -org.vitrivr.engine.core.features.migration.MediaDimensions -org.vitrivr.engine.core.features.migration.VideoFPS -org.vitrivr.engine.core.features.migration.VideoDuration \ No newline at end of file +org.vitrivr.engine.core.features.metadata.temporal.TemporalMetadata \ No newline at end of file diff --git a/vitrivr-engine-core/src/test/kotlin/org/vitrivr/engine/core/config/ingest/IngestionPipelineBuilderTest.kt b/vitrivr-engine-core/src/test/kotlin/org/vitrivr/engine/core/config/ingest/IngestionPipelineBuilderTest.kt index 926a30dbf..c0eac6510 100755 --- a/vitrivr-engine-core/src/test/kotlin/org/vitrivr/engine/core/config/ingest/IngestionPipelineBuilderTest.kt +++ b/vitrivr-engine-core/src/test/kotlin/org/vitrivr/engine/core/config/ingest/IngestionPipelineBuilderTest.kt @@ -6,7 +6,8 @@ import org.junit.jupiter.api.fail import org.vitrivr.engine.core.config.ingest.operation.OperationConfig import org.vitrivr.engine.core.config.ingest.operator.OperatorConfig import org.vitrivr.engine.core.context.IngestionContextConfig -import org.vitrivr.engine.core.database.MockConnection +import org.vitrivr.engine.core.database.blackhole.BlackholeConnection +import org.vitrivr.engine.core.database.blackhole.BlackholeConnectionProvider import org.vitrivr.engine.core.model.metamodel.Schema import org.vitrivr.engine.core.resolver.impl.DiskResolver @@ -45,7 +46,8 @@ class IngestionPipelineBuilderTest { output = listOf("file") ) - val mockSchema = Schema("test-schema", MockConnection("test-schema")) + val provider = BlackholeConnectionProvider() + val mockSchema = Schema("test-schema", BlackholeConnection("test-schema", provider, true)) mockSchema.addResolver("disk", DiskResolver().newResolver(mockSchema, mapOf("location" to "./thumbnails/testing"))) config.context.schema = mockSchema val testSubject = IngestionPipelineBuilder(config) diff --git a/vitrivr-engine-core/src/test/kotlin/org/vitrivr/engine/core/database/MockConnection.kt b/vitrivr-engine-core/src/test/kotlin/org/vitrivr/engine/core/database/MockConnection.kt deleted file mode 100755 index 5d5a02479..000000000 --- a/vitrivr-engine-core/src/test/kotlin/org/vitrivr/engine/core/database/MockConnection.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.vitrivr.engine.core.database - -import org.vitrivr.engine.core.database.descriptor.DescriptorInitializer -import org.vitrivr.engine.core.database.descriptor.DescriptorReader -import org.vitrivr.engine.core.database.descriptor.DescriptorWriter -import org.vitrivr.engine.core.database.retrievable.RetrievableInitializer -import org.vitrivr.engine.core.database.retrievable.RetrievableReader -import org.vitrivr.engine.core.database.retrievable.RetrievableWriter -import org.vitrivr.engine.core.model.descriptor.Descriptor -import org.vitrivr.engine.core.model.metamodel.Schema - -class MockConnection(schemaName: String, provider: ConnectionProvider = MockConnectionProvider(schemaName)) : AbstractConnection(schemaName, provider) { - override val provider: ConnectionProvider - get() = TODO("Not yet implemented") - - - override val schemaName: String - get() = TODO("Not yet implemented") - - override fun initialize() { - TODO("Not yet implemented") - } - - override fun truncate() { - TODO("Not yet implemented") - } - - override fun withTransaction(action: (Unit) -> T): T { - TODO("Not yet implemented") - } - - override fun getRetrievableInitializer(): RetrievableInitializer { - TODO("Not yet implemented") - } - - override fun getRetrievableWriter(): RetrievableWriter { - TODO("Not yet implemented") - } - - override fun getRetrievableReader(): RetrievableReader { - TODO("Not yet implemented") - } - - override fun > getDescriptorInitializer(field: Schema.Field<*, D>): DescriptorInitializer { - TODO("Not yet implemented") - } - - override fun > getDescriptorWriter(field: Schema.Field<*, D>): DescriptorWriter { - TODO("Not yet implemented") - } - - override fun > getDescriptorReader(field: Schema.Field<*, D>): DescriptorReader { - TODO("Not yet implemented") - } - - override fun description(): String { - TODO("Not yet implemented") - } - - override fun close() { - TODO("Not yet implemented") - } -} diff --git a/vitrivr-engine-core/src/test/kotlin/org/vitrivr/engine/core/database/MockConnectionProvider.kt b/vitrivr-engine-core/src/test/kotlin/org/vitrivr/engine/core/database/MockConnectionProvider.kt deleted file mode 100755 index 7528fc381..000000000 --- a/vitrivr-engine-core/src/test/kotlin/org/vitrivr/engine/core/database/MockConnectionProvider.kt +++ /dev/null @@ -1,22 +0,0 @@ -package org.vitrivr.engine.core.database - -import org.vitrivr.engine.core.database.descriptor.DescriptorProvider -import org.vitrivr.engine.core.model.descriptor.Descriptor -import kotlin.reflect.KClass - -class MockConnectionProvider(override val databaseName: String, override val version: String = "TEST-1") : ConnectionProvider { - override fun openConnection(schemaName: String, parameters: Map): Connection { - TODO("Not yet implemented") - } - - override fun > register( - descriptorClass: KClass, - provider: DescriptorProvider<*> - ) { - TODO("Not yet implemented") - } - - override fun > obtain(descriptorClass: KClass): DescriptorProvider? { - TODO("Not yet implemented") - } -} diff --git a/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/descriptor/DescriptorInitializerTest.kt b/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/descriptor/DescriptorInitializerTest.kt new file mode 100644 index 000000000..f3a7e165f --- /dev/null +++ b/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/descriptor/DescriptorInitializerTest.kt @@ -0,0 +1,8 @@ +package org.vitrivr.engine.core.database.blackhole.descriptor + +import org.junit.jupiter.api.Disabled +import org.vitrivr.engine.core.database.descriptor.AbstractDescriptorInitializerTest + + +@Disabled("Blackhole database connect tests are skipped.") +class DescriptorInitializerTest : AbstractDescriptorInitializerTest("no-schema.json") \ No newline at end of file diff --git a/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/descriptor/struct/FileMetadataDescriptorReaderTest.kt b/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/descriptor/struct/FileMetadataDescriptorReaderTest.kt new file mode 100644 index 000000000..8751affb6 --- /dev/null +++ b/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/descriptor/struct/FileMetadataDescriptorReaderTest.kt @@ -0,0 +1,7 @@ +package org.vitrivr.engine.core.database.blackhole.descriptor.struct + +import org.junit.jupiter.api.Disabled +import org.vitrivr.engine.core.database.descriptor.struct.AbstractFileMetadataDescriptorReaderTest + +@Disabled("Blackhole database connect tests are skipped.") +class FileMetadataDescriptorReaderTest : AbstractFileMetadataDescriptorReaderTest("no-schema.json") \ No newline at end of file diff --git a/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/descriptor/vector/FloatVectorDescriptorReaderTest.kt b/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/descriptor/vector/FloatVectorDescriptorReaderTest.kt new file mode 100644 index 000000000..85dc3afbe --- /dev/null +++ b/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/descriptor/vector/FloatVectorDescriptorReaderTest.kt @@ -0,0 +1,7 @@ +package org.vitrivr.engine.core.database.blackhole.descriptor.vector + +import org.junit.jupiter.api.Disabled +import org.vitrivr.engine.core.database.descriptor.vector.AbstractFloatVectorDescriptorReaderTest + +@Disabled("Blackhole database connect tests are skipped.") +class FloatVectorDescriptorReaderTest : AbstractFloatVectorDescriptorReaderTest("no-schema.json") \ No newline at end of file diff --git a/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/RetrievableInitializerTest.kt b/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/RetrievableInitializerTest.kt new file mode 100644 index 000000000..5440ea8a6 --- /dev/null +++ b/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/RetrievableInitializerTest.kt @@ -0,0 +1,8 @@ +package org.vitrivr.engine.core.database.blackhole.retrievable + +import org.junit.jupiter.api.Disabled +import org.vitrivr.engine.core.database.retrievable.AbstractRetrievableWriterTest + + +@Disabled("Blackhole database connect tests are skipped.") +class RetrievableInitializerTest : AbstractRetrievableWriterTest("no-schema.json") \ No newline at end of file diff --git a/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/RetrievableWriterTest.kt b/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/RetrievableWriterTest.kt new file mode 100644 index 000000000..a0fff4a1f --- /dev/null +++ b/vitrivr-engine-core/src/testFixtures/kotlin/org/vitrivr/engine/core/database/blackhole/retrievable/RetrievableWriterTest.kt @@ -0,0 +1,8 @@ +package org.vitrivr.engine.core.database.blackhole.retrievable + +import org.junit.jupiter.api.Disabled +import org.vitrivr.engine.core.database.retrievable.AbstractRetrievableWriterTest + + +@Disabled("Blackhole database connect tests are skipped.") +class RetrievableWriterTest : AbstractRetrievableWriterTest("no-schema.json") \ No newline at end of file diff --git a/vitrivr-engine-index/src/main/kotlin/org/vitrivr/engine/index/decode/VideoDecoder.kt b/vitrivr-engine-index/src/main/kotlin/org/vitrivr/engine/index/decode/VideoDecoder.kt index 57da3b800..2d49f8769 100644 --- a/vitrivr-engine-index/src/main/kotlin/org/vitrivr/engine/index/decode/VideoDecoder.kt +++ b/vitrivr-engine-index/src/main/kotlin/org/vitrivr/engine/index/decode/VideoDecoder.kt @@ -121,6 +121,7 @@ class VideoDecoder : DecoderFactory { /* Extract and enrich source metadata. */ source.metadata[Metadata.METADATA_KEY_VIDEO_FPS] = grabber.videoFrameRate + source.metadata[Metadata.METADATA_KEY_AV_DURATION] = TimeUnit.MICROSECONDS.toMillis(grabber.lengthInTime) source.metadata[Metadata.METADATA_KEY_IMAGE_WIDTH] = grabber.imageWidth source.metadata[Metadata.METADATA_KEY_IMAGE_HEIGHT] = grabber.imageHeight source.metadata[Metadata.METADATA_KEY_AUDIO_CHANNELS] = grabber.audioChannels diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/StringConnection.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/StringConnection.kt deleted file mode 100644 index 816f80df1..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/StringConnection.kt +++ /dev/null @@ -1,44 +0,0 @@ -package org.vitrivr.engine.module.features.database.string - -import io.github.oshai.kotlinlogging.KLogger -import io.github.oshai.kotlinlogging.KotlinLogging.logger -import org.vitrivr.engine.core.database.AbstractConnection -import org.vitrivr.engine.core.database.retrievable.NoRetrievableInitializer -import org.vitrivr.engine.core.database.retrievable.RetrievableInitializer -import org.vitrivr.engine.core.database.retrievable.RetrievableReader -import org.vitrivr.engine.core.database.retrievable.RetrievableWriter -import org.vitrivr.engine.core.model.Persistable -import org.vitrivr.engine.module.features.database.string.writer.StringRetrievableWriter - - - -/** Defines [KLogger] of the class. */ -internal val LOGGER: KLogger = logger("org.vitrivr.engine.module.database.string.StringConnection") - -class StringConnection(override val provider: StringConnectionProvider, schemaName: String, internal val stringify: (Persistable) -> String) : AbstractConnection(schemaName, provider) { - /** - * [StringConnection] does not support transactions. - */ - override fun withTransaction(action: (Unit) -> T): T { - LOGGER.warn { "Transactions are not supported by the StringConnection." } - return action.invoke(Unit) - } - - override fun getRetrievableInitializer(): RetrievableInitializer = NoRetrievableInitializer() - - override fun getRetrievableWriter(): RetrievableWriter = StringRetrievableWriter(this, provider.targetStream, stringify) - - override fun getRetrievableReader(): RetrievableReader { - TODO("Not yet implemented") - } - - /** - * - */ - override fun description(): String = "" - - override fun close() { - this.provider.targetStream.flush() - this.provider.targetStream.close() - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/StringConnectionProvider.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/StringConnectionProvider.kt deleted file mode 100644 index ca6c8fedc..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/StringConnectionProvider.kt +++ /dev/null @@ -1,36 +0,0 @@ -package org.vitrivr.engine.module.features.database.string - -import org.vitrivr.engine.core.database.ConnectionProvider -import org.vitrivr.engine.core.database.descriptor.DescriptorProvider -import org.vitrivr.engine.core.model.Persistable -import org.vitrivr.engine.core.model.descriptor.Descriptor -import org.vitrivr.engine.core.model.descriptor.scalar.StringDescriptor -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import java.io.OutputStream -import kotlin.reflect.KClass - -class StringConnectionProvider(internal val targetStream: OutputStream = System.out, val stringify: (Persistable) -> String = { persistable -> persistable.toString() }) : ConnectionProvider { - - override val databaseName = "String" - override val version = "1.0" - - private val registered = HashMap>, DescriptorProvider<*>>() - - init { - /* Register all providers known to this CottontailConnection. */ - this.register(FloatVectorDescriptor::class, StringWriterProvider()) - this.register(StringDescriptor::class, StringWriterProvider()) - - } - - override fun openConnection(schemaName: String, parameters: Map): StringConnection = StringConnection(this, schemaName, stringify) - - @Suppress("UNCHECKED_CAST") - override fun > register(descriptorClass: KClass, provider: DescriptorProvider<*>) { - require(!this.registered.containsKey(descriptorClass as KClass>)) { "Descriptor of class $descriptorClass cannot be registered twice." } - this.registered[descriptorClass] = provider - } - - @Suppress("UNCHECKED_CAST") - override fun > obtain(descriptorClass: KClass): DescriptorProvider? = this.registered[descriptorClass as KClass>] as DescriptorProvider? -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/StringWriterProvider.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/StringWriterProvider.kt deleted file mode 100644 index 08d1851ae..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/StringWriterProvider.kt +++ /dev/null @@ -1,22 +0,0 @@ -package org.vitrivr.engine.module.features.database.string - -import org.vitrivr.engine.core.database.Connection -import org.vitrivr.engine.core.database.descriptor.DescriptorProvider -import org.vitrivr.engine.core.database.descriptor.DescriptorReader -import org.vitrivr.engine.core.database.descriptor.DescriptorWriter -import org.vitrivr.engine.core.database.descriptor.NoDescriptorInitializer -import org.vitrivr.engine.core.model.descriptor.Descriptor -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.module.features.database.string.writer.StringDescriptorWriter - -class StringWriterProvider> : DescriptorProvider { - - override fun newInitializer(connection: Connection, field: Schema.Field<*,D>): NoDescriptorInitializer = NoDescriptorInitializer(field) - - override fun newReader(connection: Connection, field: Schema.Field<*,D>): DescriptorReader { - throw UnsupportedOperationException("StringWriter is append only") - } - - override fun newWriter(connection: Connection, field: Schema.Field<*,D>): DescriptorWriter = StringDescriptorWriter(connection as StringConnection, field) - -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/writer/StringDescriptorWriter.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/writer/StringDescriptorWriter.kt deleted file mode 100644 index 3c7effff7..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/writer/StringDescriptorWriter.kt +++ /dev/null @@ -1,8 +0,0 @@ -package org.vitrivr.engine.module.features.database.string.writer - -import org.vitrivr.engine.core.database.descriptor.DescriptorWriter -import org.vitrivr.engine.core.model.descriptor.Descriptor -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.module.features.database.string.StringConnection - -class StringDescriptorWriter>(connection: StringConnection, override val field: Schema.Field<*, D>) : DescriptorWriter, StringWriter(connection, connection.provider.targetStream, connection.stringify) \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/writer/StringRetrievableWriter.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/writer/StringRetrievableWriter.kt deleted file mode 100644 index 4dbed8d2b..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/writer/StringRetrievableWriter.kt +++ /dev/null @@ -1,26 +0,0 @@ -package org.vitrivr.engine.module.features.database.string.writer - -import org.vitrivr.engine.core.database.retrievable.RetrievableWriter -import org.vitrivr.engine.core.model.Persistable -import org.vitrivr.engine.core.model.relationship.Relationship -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.module.features.database.string.StringConnection -import java.io.OutputStream - -class StringRetrievableWriter(connection: StringConnection, outputStream: OutputStream, stringify: (Persistable) -> String) : StringWriter(connection, outputStream, stringify), RetrievableWriter { - override fun connect(relationship: Relationship): Boolean { - TODO("Not yet implemented") - } - - override fun connectAll(relationships: Iterable): Boolean { - TODO("Not yet implemented") - } - - override fun disconnect(relationship: Relationship): Boolean { - TODO("Not yet implemented") - } - - override fun disconnectAll(relationships: Iterable): Boolean { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/writer/StringWriter.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/writer/StringWriter.kt deleted file mode 100644 index 3dea5891c..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/database/string/writer/StringWriter.kt +++ /dev/null @@ -1,49 +0,0 @@ -package org.vitrivr.engine.module.features.database.string.writer - -import org.vitrivr.engine.core.database.Writer -import org.vitrivr.engine.core.model.Persistable -import org.vitrivr.engine.module.features.database.string.StringConnection -import java.io.IOException -import java.io.OutputStream -import java.io.PrintWriter - -open class StringWriter(override val connection: StringConnection, outputStream: OutputStream, private val stringify: (Persistable) -> String) : Writer { - - private val writer = PrintWriter(outputStream) - - private fun write(item: T) { - writer.println(stringify(item)) - } - - override fun add(item: T): Boolean { - return try { - write(item) - writer.flush() - true - } catch (e: IOException) { - false - } - } - - override fun addAll(items: Iterable): Boolean { - return try { - items.forEach { write(it) } - writer.flush() - true - } catch (e: IOException) { - false - } - } - - override fun update(item: T): Boolean { - throw UnsupportedOperationException("StringWriter is append only") - } - - override fun delete(item: T): Boolean { - throw UnsupportedOperationException("StringWriter is append only") - } - - override fun deleteAll(items: Iterable): Boolean { - throw UnsupportedOperationException("StringWriter is append only") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/averagecolorraster/AverageColorRaster.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/averagecolorraster/AverageColorRaster.kt deleted file mode 100644 index e20dc1798..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/averagecolorraster/AverageColorRaster.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.averagecolorraster - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class AverageColorRaster: Analyser, RasterDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = RasterDescriptor::class - override fun prototype(field: Schema.Field<*, *>): RasterDescriptor = - RasterDescriptor(id = UUID.randomUUID(), retrievableId = UUID.randomUUID(), mapOf("hist" to Value.FloatVector(FloatArray(15)), "raster" to Value.FloatVector(FloatArray(64)))) - - override fun newRetrieverForContent(field: Schema.Field, RasterDescriptor>, content: Collection>, context: QueryContext): Retriever, RasterDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, RasterDescriptor>, query: Query, context: QueryContext): Retriever, RasterDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, RasterDescriptor>, input: Operator, context: IndexContext): Extractor, RasterDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, RasterDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/averagecolorraster/RasterDescriptor.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/averagecolorraster/RasterDescriptor.kt deleted file mode 100644 index 4d3e1e2f8..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/averagecolorraster/RasterDescriptor.kt +++ /dev/null @@ -1,47 +0,0 @@ -package org.vitrivr.engine.module.features.feature.averagecolorraster - -import org.vitrivr.engine.core.model.descriptor.Attribute -import org.vitrivr.engine.core.model.descriptor.AttributeName -import org.vitrivr.engine.core.model.descriptor.DescriptorId -import org.vitrivr.engine.core.model.descriptor.struct.StructDescriptor -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.retrievable.RetrievableId -import org.vitrivr.engine.core.model.types.Type -import org.vitrivr.engine.core.model.types.Value - -/** - * A struct vector descriptor that stores the average color and raster of an image. - * - * @author Ralph Gasser - * @version 1.0.0 - */ -class RasterDescriptor( - override var id: DescriptorId, - override var retrievableId: RetrievableId?, - values: Map?>, - override val field: Schema.Field<*, RasterDescriptor>? = null -) : StructDescriptor(id, retrievableId, LAYOUT, values, field) { - - companion object { - private val LAYOUT = listOf( - Attribute("hist", Type.FloatVector(15)), - Attribute("raster", Type.FloatVector(4)) - ) - } - - /** The histogram vector. */ - val hist: Value.FloatVector by this.values - - /** The raster vector. */ - val raster: Value.FloatVector by this.values - - /** - * Returns a copy of this [RasterDescriptor] with new [RetrievableId] and/or [DescriptorId] - * - * @param id [DescriptorId] of the new [RasterDescriptor]. - * @param retrievableId [RetrievableId] of the new [RasterDescriptor]. - * @param field [Schema.Field] the new [RasterDescriptor] belongs to. - * @return Copy of this [RasterDescriptor]. - */ - override fun copy(id: DescriptorId, retrievableId: RetrievableId?, field: Schema.Field<*, RasterDescriptor>?) = RasterDescriptor(id, retrievableId, this.values, field) -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/external/ErrorStatus.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/external/ErrorStatus.kt deleted file mode 100644 index 226adb116..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/external/ErrorStatus.kt +++ /dev/null @@ -1,11 +0,0 @@ -package org.vitrivr.engine.module.features.feature.external - -import kotlinx.serialization.Serializable - -/** - * An [ErrorStatus] as returned by the Feature Extraction Server - * - * @author Rahel Arnold - */ -@Serializable -data class ErrorStatus(val code: Int, val description: String) \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/external/common/ExternalWithFloatVectorDescriptorAnalyser.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/external/common/ExternalWithFloatVectorDescriptorAnalyser.kt deleted file mode 100644 index 787eb7240..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/external/common/ExternalWithFloatVectorDescriptorAnalyser.kt +++ /dev/null @@ -1,114 +0,0 @@ -package org.vitrivr.engine.module.features.feature.external.common - -import io.github.oshai.kotlinlogging.KLogger -import io.github.oshai.kotlinlogging.KotlinLogging -import kotlinx.serialization.builtins.ListSerializer -import kotlinx.serialization.builtins.serializer -import kotlinx.serialization.json.Json -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.content.element.ImageContent -import org.vitrivr.engine.core.model.content.element.TextContent -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.module.features.feature.external.ExternalAnalyser -import java.io.* -import java.net.HttpURLConnection -import java.net.URI -import java.net.URLEncoder -import java.nio.charset.StandardCharsets -import java.util.* - -/** - * Abstract base class for external analyzers that generate [FloatVectorDescriptor] from [ContentElement]. - * - * @param C Type parameter for the [ContentElement] being analyzed. - * - * @author Rahel Arnold - * @version 1.0.0 - */ -abstract class ExternalWithFloatVectorDescriptorAnalyser> : ExternalAnalyser() { - - private val logger: KLogger = KotlinLogging.logger {} - - /** - * Executes an API request to the given [url] with the specified [requestBody] and returns the response as a list of floats. - * - * @param url The URL for the API request. - * @param requestBody The body of the API request. - * @return A list of floats representing the API response. - */ - private fun executeApiRequest(content: ContentElement<*>, url: String): List { - - val base64 = when (content) { - is TextContent -> Base64.getEncoder().encodeToString(content.content.toByteArray(StandardCharsets.UTF_8)) - is ImageContent -> content.toDataUrl() - else -> throw IllegalArgumentException("Unsupported content type") - } - - val requestBody = URLEncoder.encode("data:text/plain;charset=utf-8,$base64", StandardCharsets.UTF_8.toString()) - - // Create an HttpURLConnection - val connection = URI(url).toURL().openConnection() as HttpURLConnection - - try { - // Set up the connection for a POST request - connection.requestMethod = "POST" - connection.doOutput = true - connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded") - - logger.debug { "Initialised external API request" } - - // Write the request body to the output stream - val outputStream: OutputStream = connection.outputStream - val writer = BufferedWriter(OutputStreamWriter(outputStream)) - writer.write("data=$requestBody") - writer.flush() - writer.close() - outputStream.close() - - logger.debug { "Wrote request: $requestBody" } - - // Get the response code (optional, but useful for error handling) - val responseCode = connection.responseCode - - logger.debug{"Received response code: $responseCode"} - - // Read the response as a JSON string - val responseJson = if (responseCode == HttpURLConnection.HTTP_OK) { - val inputStream = BufferedReader(InputStreamReader(connection.inputStream)) - val response = inputStream.readLine() - inputStream.close() - logger.trace { "Received $response" } - response - } else { - logger.warn { "Non OK response" } - null - } - - - // Parse the JSON string to List using Gson - return if (responseJson != null) { - try { - Json.decodeFromString(ListSerializer(Float.serializer()), responseJson).map { Value.Float(it) } - } catch (e: Exception) { - e.printStackTrace() - logger.catching(e) - logger.warn { "Exception during json decode. Sending empty list" } - emptyList() - } - } else { - logger.warn { "No response. Sending empty list" } - emptyList() - } - - } catch (e: Exception) { - e.printStackTrace() - logger.catching(e) - logger.error { "An error occurred during external API call, $e" } - } finally { - connection.disconnect() - logger.trace { "Disconnected" } - } - return emptyList() - } -} diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AudioTranscription.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AudioTranscription.kt deleted file mode 100644 index ac4ed61da..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AudioTranscription.kt +++ /dev/null @@ -1,35 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.scalar.StringDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class AudioTranscription : Analyser, StringDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = StringDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = StringDescriptor(id = UUID.randomUUID(), retrievableId = UUID.randomUUID(), value = Value.String("")) - - override fun newRetrieverForContent(field: Schema.Field, StringDescriptor>, content: Collection>, context: QueryContext): Retriever, StringDescriptor> { - TODO("Not yet implemented") - } - override fun newRetrieverForQuery(field: Schema.Field, StringDescriptor>, query: Query, context: QueryContext): Retriever, StringDescriptor> { - TODO("Not yet implemented") - } - override fun newExtractor(field: Schema.Field, StringDescriptor>, input: Operator, context: IndexContext): Extractor, StringDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, StringDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AverageColorGrid8.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AverageColorGrid8.kt deleted file mode 100644 index d83590ec8..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AverageColorGrid8.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class AverageColorGrid8 : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(192)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AverageColorGrid8Reduced15.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AverageColorGrid8Reduced15.kt deleted file mode 100644 index f0779e2e4..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AverageColorGrid8Reduced15.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class AverageColorGrid8Reduced15 : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(192)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AverageFuzzyHist.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AverageFuzzyHist.kt deleted file mode 100644 index 765f50fa7..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AverageFuzzyHist.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class AverageFuzzyHist : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(15)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AverageFuzzyHistNormalized.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AverageFuzzyHistNormalized.kt deleted file mode 100644 index e2ee9aec8..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/AverageFuzzyHistNormalized.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class AverageFuzzyHistNormalized : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(15)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/CLD.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/CLD.kt deleted file mode 100644 index caf1090f5..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/CLD.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class CLD : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(12)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/CLDReduced15.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/CLDReduced15.kt deleted file mode 100644 index e28484d9e..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/CLDReduced15.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class CLDReduced15 : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(12)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/ConceptMasksADE20k.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/ConceptMasksADE20k.kt deleted file mode 100644 index d8ea266fe..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/ConceptMasksADE20k.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class ConceptMasksADE20k : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(2048)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/DominantColor.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/DominantColor.kt deleted file mode 100644 index 3815b753b..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/DominantColor.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.scalar.StringDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class DominantColor : Analyser, StringDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = StringDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = StringDescriptor(id = UUID.randomUUID(), retrievableId = UUID.randomUUID(), value = Value.String("")) - - override fun newRetrieverForContent(field: Schema.Field, StringDescriptor>, content: Collection>, context: QueryContext): Retriever, StringDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, StringDescriptor>, query: Query, context: QueryContext): Retriever, StringDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, StringDescriptor>, input: Operator, context: IndexContext): Extractor, StringDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, StringDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/DominantEdgeGrid.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/DominantEdgeGrid.kt deleted file mode 100644 index 89c050aad..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/DominantEdgeGrid.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class DominantEdgeGrid : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(64)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/DominantEdgeGrid16.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/DominantEdgeGrid16.kt deleted file mode 100644 index f6cd65a95..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/DominantEdgeGrid16.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class DominantEdgeGrid16 : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(256)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/DominantEdgeGrid8.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/DominantEdgeGrid8.kt deleted file mode 100644 index 6c50f83dc..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/DominantEdgeGrid8.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class DominantEdgeGrid8 : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(64)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/EHD.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/EHD.kt deleted file mode 100644 index 6e2ebad55..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/EHD.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class EHD : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(80)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/EdgeARP88.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/EdgeARP88.kt deleted file mode 100644 index 342328fb5..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/EdgeARP88.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class EdgeARP88 : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(64)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/EdgeGrid16.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/EdgeGrid16.kt deleted file mode 100644 index 8158b51fa..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/EdgeGrid16.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class EdgeGrid16 : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(256)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/HOGMF25k512.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/HOGMF25k512.kt deleted file mode 100644 index f20686f74..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/HOGMF25k512.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class HOGMF25k512 : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(512)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/HueHistogram.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/HueHistogram.kt deleted file mode 100644 index 2cf63783f..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/HueHistogram.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class HueHistogram : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(16)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/InceptionResNetV2.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/InceptionResNetV2.kt deleted file mode 100644 index 866516d3c..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/InceptionResNetV2.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class InceptionResNetV2 : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(1536)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/MedianColor.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/MedianColor.kt deleted file mode 100644 index 19ed1bf9d..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/MedianColor.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class MedianColor : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(3)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/MedianFuzzyHist.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/MedianFuzzyHist.kt deleted file mode 100644 index 6486f1a74..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/MedianFuzzyHist.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class MedianFuzzyHist : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(15)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/OpenCLIP.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/OpenCLIP.kt deleted file mode 100644 index 5edb01240..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/OpenCLIP.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class OpenCLIP : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(512)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/ProvidedOCR.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/ProvidedOCR.kt deleted file mode 100644 index 382724fd9..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/ProvidedOCR.kt +++ /dev/null @@ -1,36 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.scalar.StringDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class ProvidedOCR : Analyser, StringDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = StringDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = StringDescriptor(id = UUID.randomUUID(), retrievableId = UUID.randomUUID(), value = Value.String("")) - override fun newRetrieverForContent(field: Schema.Field, StringDescriptor>, content: Collection>, context: QueryContext): Retriever, StringDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, StringDescriptor>, query: Query, context: QueryContext): Retriever, StringDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, StringDescriptor>, input: Operator, context: IndexContext): Extractor, StringDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, StringDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/SURFMF25K512.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/SURFMF25K512.kt deleted file mode 100644 index b1367835a..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/SURFMF25K512.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class SURFMF25K512 : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(512)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/VisualTextCoEmbedding.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/VisualTextCoEmbedding.kt deleted file mode 100644 index eeced2b9f..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/VisualTextCoEmbedding.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class VisualTextCoEmbedding : Analyser, FloatVectorDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = FloatVectorDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), Value.FloatVector(256)) - - override fun newRetrieverForContent(field: Schema.Field, FloatVectorDescriptor>, content: Collection>, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, FloatVectorDescriptor>, query: Query, context: QueryContext): Retriever, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, FloatVectorDescriptor>, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, FloatVectorDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/WhisperASR.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/WhisperASR.kt deleted file mode 100644 index 638bb9a7d..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/migration/WhisperASR.kt +++ /dev/null @@ -1,36 +0,0 @@ -package org.vitrivr.engine.module.features.feature.migration - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.descriptor.scalar.StringDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import java.util.* - -class WhisperASR : Analyser, StringDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = StringDescriptor::class - override fun prototype(field: Schema.Field<*, *>) = StringDescriptor(id = UUID.randomUUID(), retrievableId = UUID.randomUUID(), value = Value.String("")) - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, StringDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForContent(field: Schema.Field, StringDescriptor>, content: Collection>, context: QueryContext): Retriever, StringDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, StringDescriptor>, query: Query, context: QueryContext): Retriever, StringDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, StringDescriptor>, input: Operator, context: IndexContext): Extractor, StringDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/skeleton/SkeletonDescriptor.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/skeleton/SkeletonDescriptor.kt deleted file mode 100644 index 7ee275eb6..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/skeleton/SkeletonDescriptor.kt +++ /dev/null @@ -1,51 +0,0 @@ -package org.vitrivr.engine.module.features.feature.skeleton - -import org.vitrivr.engine.core.model.descriptor.Attribute -import org.vitrivr.engine.core.model.descriptor.AttributeName -import org.vitrivr.engine.core.model.descriptor.DescriptorId -import org.vitrivr.engine.core.model.descriptor.struct.StructDescriptor -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.retrievable.RetrievableId -import org.vitrivr.engine.core.model.types.Type -import org.vitrivr.engine.core.model.types.Value - -/** - * A descriptor used to store a skeleton pose. - * - * @author Ralph Gasser - * @version 1.0.0 - */ -class SkeletonDescriptor( - override var id: DescriptorId, - override var retrievableId: RetrievableId?, - values: Map?>, - override val field: Schema.Field<*, SkeletonDescriptor>? = null -) : StructDescriptor(id, retrievableId, LAYOUT, values, field) { - - companion object { - private val LAYOUT = listOf( - Attribute("person", Type.Int), - Attribute("skeleton", Type.FloatVector(12)), - Attribute("weights", Type.FloatVector(12)) - ) - } - - /** The person index. */ - val person: Value.Int by this.values - - /** The vector describing the skeleton. */ - val skeleton: List by this.values - - /** The vector describing the skeleto weights. */ - val weights: List by this.values - - /** - * Returns a copy of this [SkeletonDescriptor] with new [RetrievableId] and/or [DescriptorId] - * - * @param id [DescriptorId] of the new [SkeletonDescriptor]. - * @param retrievableId [RetrievableId] of the new [SkeletonDescriptor]. - * @param field [Schema.Field] the new [SkeletonDescriptor] belongs to. - * @return Copy of this [SkeletonDescriptor]. - */ - override fun copy(id: DescriptorId, retrievableId: RetrievableId?, field: Schema.Field<*, SkeletonDescriptor>?) = SkeletonDescriptor(id, retrievableId, this.values, field) -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/skeleton/SkeletonPose.kt b/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/skeleton/SkeletonPose.kt deleted file mode 100644 index 9d696cf35..000000000 --- a/vitrivr-engine-module-features/src/main/kotlin/org/vitrivr/engine/module/features/feature/skeleton/SkeletonPose.kt +++ /dev/null @@ -1,49 +0,0 @@ -package org.vitrivr.engine.module.features.feature.skeleton - -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.content.element.ContentElement -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever - -/** - * A descriptor used to store a skeleton pose. - * - * @author Ralph Gasser - * @version 1.0.0 - */ -class SkeletonPose : Analyser, SkeletonDescriptor> { - override val contentClasses = setOf(ContentElement::class) - override val descriptorClass = SkeletonDescriptor::class - override fun prototype(field: Schema.Field<*, *>): SkeletonDescriptor = SkeletonDescriptor( - id = java.util.UUID.randomUUID(), - retrievableId = java.util.UUID.randomUUID(), - mapOf( - "person" to Value.Int(0), - "skeleton" to Value.FloatVector(FloatArray(12)), - "weights" to Value.FloatVector(FloatArray(12)) - ) - ) - - override fun newRetrieverForContent(field: Schema.Field, SkeletonDescriptor>, content: Collection>, context: QueryContext): Retriever, SkeletonDescriptor> { - TODO("Not yet implemented") - } - - override fun newRetrieverForQuery(field: Schema.Field, SkeletonDescriptor>, query: Query, context: QueryContext): Retriever, SkeletonDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(field: Schema.Field, SkeletonDescriptor>, input: Operator, context: IndexContext): Extractor, SkeletonDescriptor> { - TODO("Not yet implemented") - } - - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor, SkeletonDescriptor> { - TODO("Not yet implemented") - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/resources/META-INF/services/org.vitrivr.engine.core.database.ConnectionProvider b/vitrivr-engine-module-features/src/main/resources/META-INF/services/org.vitrivr.engine.core.database.ConnectionProvider deleted file mode 100644 index fef2bf145..000000000 --- a/vitrivr-engine-module-features/src/main/resources/META-INF/services/org.vitrivr.engine.core.database.ConnectionProvider +++ /dev/null @@ -1 +0,0 @@ -org.vitrivr.engine.module.features.database.string.StringConnectionProvider \ No newline at end of file diff --git a/vitrivr-engine-module-features/src/main/resources/META-INF/services/org.vitrivr.engine.core.model.metamodel.Analyser b/vitrivr-engine-module-features/src/main/resources/META-INF/services/org.vitrivr.engine.core.model.metamodel.Analyser index a8c5e73b6..d4ef3f422 100644 --- a/vitrivr-engine-module-features/src/main/resources/META-INF/services/org.vitrivr.engine.core.model.metamodel.Analyser +++ b/vitrivr-engine-module-features/src/main/resources/META-INF/services/org.vitrivr.engine.core.model.metamodel.Analyser @@ -1,29 +1,2 @@ org.vitrivr.engine.module.features.feature.external.implementations.dino.DINO org.vitrivr.engine.module.features.feature.external.implementations.clip.CLIP -org.vitrivr.engine.module.features.feature.migration.WhisperASR -org.vitrivr.engine.module.features.feature.migration.ProvidedOCR -org.vitrivr.engine.module.features.feature.migration.AudioTranscription -org.vitrivr.engine.module.features.feature.skeleton.SkeletonPose -org.vitrivr.engine.module.features.feature.migration.MedianColor -org.vitrivr.engine.module.features.feature.migration.CLD -org.vitrivr.engine.module.features.feature.migration.CLDReduced15 -org.vitrivr.engine.module.features.feature.migration.AverageFuzzyHistNormalized -org.vitrivr.engine.module.features.feature.migration.AverageFuzzyHist -org.vitrivr.engine.module.features.feature.migration.MedianFuzzyHist -org.vitrivr.engine.module.features.feature.migration.HueHistogram -org.vitrivr.engine.module.features.feature.migration.DominantEdgeGrid -org.vitrivr.engine.module.features.feature.migration.EHD -org.vitrivr.engine.module.features.feature.migration.AverageColorGrid8 -org.vitrivr.engine.module.features.feature.migration.AverageColorGrid8Reduced15 -org.vitrivr.engine.module.features.feature.migration.EdgeGrid16 -org.vitrivr.engine.module.features.feature.migration.DominantEdgeGrid16 -org.vitrivr.engine.module.features.feature.migration.VisualTextCoEmbedding -org.vitrivr.engine.module.features.feature.migration.OpenCLIP -org.vitrivr.engine.module.features.feature.migration.HOGMF25k512 -org.vitrivr.engine.module.features.feature.migration.SURFMF25K512 -org.vitrivr.engine.module.features.feature.migration.InceptionResNetV2 -org.vitrivr.engine.module.features.feature.migration.ConceptMasksADE20k -org.vitrivr.engine.module.features.feature.averagecolorraster.AverageColorRaster -org.vitrivr.engine.module.features.feature.migration.EdgeARP88 -org.vitrivr.engine.module.features.feature.migration.DominantColor -org.vitrivr.engine.module.features.feature.migration.DominantEdgeGrid8 \ No newline at end of file diff --git a/vitrivr-engine-module-m3d/src/test/kotlin/org/vitrivr/engine/model3d/ModelHandlerTest.kt b/vitrivr-engine-module-m3d/src/test/kotlin/org/vitrivr/engine/model3d/ModelHandlerTest.kt index 49af98429..e26e984c5 100644 --- a/vitrivr-engine-module-m3d/src/test/kotlin/org/vitrivr/engine/model3d/ModelHandlerTest.kt +++ b/vitrivr-engine-module-m3d/src/test/kotlin/org/vitrivr/engine/model3d/ModelHandlerTest.kt @@ -1,6 +1,5 @@ package org.vitrivr.engine.model3d -import org.joml.Vector3f import org.junit.jupiter.api.Assertions import org.junit.jupiter.api.Test import java.nio.file.Files @@ -26,6 +25,5 @@ class ModelHandlerTest { val mesh = model.getMaterials().first().meshes.first() Assertions.assertEquals(4968, mesh.numberOfFaces) Assertions.assertEquals(2503, mesh.numberOfVertices) - //TODO: Maybe more tests? } } \ No newline at end of file diff --git a/vitrivr-engine-module-pgvector/src/main/kotlin/org/vitrivr/engine/database/pgvector/PgVectorConnection.kt b/vitrivr-engine-module-pgvector/src/main/kotlin/org/vitrivr/engine/database/pgvector/PgVectorConnection.kt index 1b256dc45..7a95c318e 100644 --- a/vitrivr-engine-module-pgvector/src/main/kotlin/org/vitrivr/engine/database/pgvector/PgVectorConnection.kt +++ b/vitrivr-engine-module-pgvector/src/main/kotlin/org/vitrivr/engine/database/pgvector/PgVectorConnection.kt @@ -17,7 +17,7 @@ import java.sql.SQLException internal val LOGGER: KLogger = logger("org.vitrivr.engine.database.pgvector.PgVectorConnection") /** - * A [AbstractConnection] to connect to a PostgreSQL instance with the pgVector extension. + * An [AbstractConnection] to connect to a PostgreSQL instance with the pgVector extension. * * @author Ralph Gasser * @version 1.0.0 diff --git a/vitrivr-engine-module-pgvector/src/main/kotlin/org/vitrivr/engine/database/pgvector/retrievable/RetrievableReader.kt b/vitrivr-engine-module-pgvector/src/main/kotlin/org/vitrivr/engine/database/pgvector/retrievable/RetrievableReader.kt index 758cf378e..030a4d99a 100644 --- a/vitrivr-engine-module-pgvector/src/main/kotlin/org/vitrivr/engine/database/pgvector/retrievable/RetrievableReader.kt +++ b/vitrivr-engine-module-pgvector/src/main/kotlin/org/vitrivr/engine/database/pgvector/retrievable/RetrievableReader.kt @@ -5,13 +5,14 @@ import org.vitrivr.engine.core.model.retrievable.Retrievable import org.vitrivr.engine.core.model.retrievable.RetrievableId import org.vitrivr.engine.core.model.retrievable.Retrieved import org.vitrivr.engine.database.pgvector.* +import java.sql.SQLException import java.util.* /** * A [RetrievableReader] implementation for PostgreSQL with pgVector. * * @author Ralph Gasser - * @version 1.0.0 + * @version 1.0.1 */ class RetrievableReader(override val connection: PgVectorConnection): RetrievableReader { /** @@ -97,12 +98,53 @@ class RetrievableReader(override val connection: PgVectorConnection): Retrievabl } } - override fun getConnections( - subjectIds: Collection, - predicates: Collection, - objectIds: Collection - ): Sequence> { - TODO("Not yet implemented") + /** + * Returns all relationships thar are stored by the database and that match the given query. + * + * @return A [Sequence] of all [Retrievable]s in the database. + */ + override fun getConnections(subjectIds: Collection, predicates: Collection, objectIds: Collection): Sequence> { + val query = StringBuilder("SELECT * FROM \"$RELATIONSHIP_ENTITY_NAME\" WHERE ") + if (subjectIds.isNotEmpty()) { + query.append("$SUBJECT_ID_COLUMN_NAME = ANY (?)") + } + if (predicates.isNotEmpty()) { + if (subjectIds.isNotEmpty()) { + query.append(" AND ") + } + query.append("$PREDICATE_COLUMN_NAME = ANY (?)") + } + if (objectIds.isNotEmpty()) { + if (subjectIds.isNotEmpty() || predicates.isNotEmpty()) { + query.append(" AND ") + } + query.append("$OBJECT_ID_COLUMN_NAME = ANY (?)") + } + + return sequence { + try { + this@RetrievableReader.connection.jdbc.prepareStatement(query.toString()).use { stmt -> + var index = 1 + if (subjectIds.isNotEmpty()) { + stmt.setArray(index++, this@RetrievableReader.connection.jdbc.createArrayOf("uuid", subjectIds.toTypedArray())) + } + if (predicates.isNotEmpty()) { + stmt.setArray(index++, this@RetrievableReader.connection.jdbc.createArrayOf("varchar", predicates.toTypedArray())) + } + if (objectIds.isNotEmpty()) { + stmt.setArray(index, this@RetrievableReader.connection.jdbc.createArrayOf("uuid", objectIds.toTypedArray())) + } + stmt.executeQuery().use { result -> + while (result.next()) { + yield(Triple(result.getObject(OBJECT_ID_COLUMN_NAME, UUID::class.java), result.getString(PREDICATE_COLUMN_NAME), result.getObject(SUBJECT_ID_COLUMN_NAME, UUID::class.java))) + } + } + } + } catch (e: SQLException) { + LOGGER.error(e) { "Failed to fetch relationships due to SQL error." } + } + } + } /** @@ -118,7 +160,7 @@ class RetrievableReader(override val connection: PgVectorConnection): Retrievabl return result.getLong(1) } } - } catch (e: Exception) { + } catch (e: SQLException) { LOGGER.error(e) { "Failed to count retrievable due to SQL error." } return 0L } diff --git a/vitrivr-engine-module-pgvector/src/test/kotlin/org/vitrivr/engine/database/pgvector/retrievable/RetrievableWriterTest.kt b/vitrivr-engine-module-pgvector/src/test/kotlin/org/vitrivr/engine/database/pgvector/retrievable/RetrievableWriterTest.kt index c6326f32a..7572f718a 100644 --- a/vitrivr-engine-module-pgvector/src/test/kotlin/org/vitrivr/engine/database/pgvector/retrievable/RetrievableWriterTest.kt +++ b/vitrivr-engine-module-pgvector/src/test/kotlin/org/vitrivr/engine/database/pgvector/retrievable/RetrievableWriterTest.kt @@ -1,6 +1,7 @@ package org.vitrivr.engine.database.pgvector.retrievable import org.vitrivr.engine.core.database.retrievable.AbstractRetrievableWriterTest +import org.vitrivr.engine.database.pgvector.PgVectorConnection /** * An [AbstractRetrievableWriterTest] for the [PgVectorConnection]. @@ -8,6 +9,4 @@ import org.vitrivr.engine.core.database.retrievable.AbstractRetrievableWriterTes * @author Ralph Gasser * @version 1.0.0 */ -class RetrievableWriterTest : AbstractRetrievableWriterTest("test-schema-postgres.json") { - -} \ No newline at end of file +class RetrievableWriterTest : AbstractRetrievableWriterTest("test-schema-postgres.json") \ No newline at end of file diff --git a/vitrivr-engine-module-statistics/averagecolor/AverageColor.kt b/vitrivr-engine-module-statistics/averagecolor/AverageColor.kt deleted file mode 100644 index 4e8dfa8ae..000000000 --- a/vitrivr-engine-module-statistics/averagecolor/AverageColor.kt +++ /dev/null @@ -1,135 +0,0 @@ -package org.vitrivr.engine.base.features.averagecolor - -import io.github.oshai.kotlinlogging.KLogger -import io.github.oshai.kotlinlogging.KotlinLogging -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.context.QueryContext -import org.vitrivr.engine.core.model.color.MutableRGBFloatColorContainer -import org.vitrivr.engine.core.model.color.RGBByteColorContainer -import org.vitrivr.engine.core.model.color.RGBFloatColorContainer -import org.vitrivr.engine.core.model.content.Content -import org.vitrivr.engine.core.model.content.element.ImageContent -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Analyser -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.Query -import org.vitrivr.engine.core.model.query.proximity.ProximityQuery -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.operators.retrieve.Retriever -import org.vitrivr.engine.core.util.extension.getRGBArray -import java.util.* - -/** - * Implementation of the [AverageColor] [Analyser], which derives the average color from an [ImageContent] as [FloatVectorDescriptor]. - * - * @author Ralph Gasser - * @version 1.0.0 - */ -class AverageColor : Analyser { - - private val logger: KLogger = KotlinLogging.logger {} - - override val contentClasses = setOf(ImageContent::class) - override val descriptorClass = FloatVectorDescriptor::class - - /** - * Generates a prototypical [FloatVectorDescriptor] for this [AverageColor]. - * - * @param field [Schema.Field] to create the prototype for. - * @return [FloatVectorDescriptor] - */ - override fun prototype(field: Schema.Field<*, *>) = FloatVectorDescriptor(UUID.randomUUID(), UUID.randomUUID(), listOf(Value.Float(0.0f), Value.Float(0.0f), Value.Float(0.0f))) - - /** - * Generates and returns a new [AverageColorExtractor] instance for this [AverageColor]. - * - * @param field The [Schema.Field] to create an [Extractor] for. - * @param input The [Operator] that acts as input to the new [Extractor]. - * @param context The [IndexContext] to use with the [Extractor]. - * - * @return A new [Extractor] instance for this [Analyser] - * @throws [UnsupportedOperationException], if this [Analyser] does not support the creation of an [Extractor] instance. - */ - override fun newExtractor(field: Schema.Field, input: Operator, context: IndexContext) = AverageColorExtractor(input, field) - - /** - * Generates and returns a new [AverageColorExtractor] instance for this [AverageColor]. - * - * @param name The name of the [AverageColorExtractor]. - * @param input The [Operator] that acts as input to the new [Extractor]. - * @param context The [IndexContext] to use with the [Extractor]. - * - * @return A new [Extractor] instance for this [Analyser] - * @throws [UnsupportedOperationException], if this [Analyser] does not support the creation of an [Extractor] instance. - */ - override fun newExtractor(name: String, input: Operator, context: IndexContext): Extractor = AverageColorExtractor(input, null) - - /** - * Generates and returns a new [AverageColorRetriever] instance for this [AverageColor]. - * - * @param field The [Schema.Field] to create an [Retriever] for. - * @param query The [Query] to use with the [Retriever]. - * @param context The [QueryContext] to use with the [Retriever]. - * - * @return A new [Retriever] instance for this [Analyser] - */ - override fun newRetrieverForQuery(field: Schema.Field, query: Query, context: QueryContext): AverageColorRetriever { - require(field.analyser == this) { "The field '${field.fieldName}' analyser does not correspond with this analyser. This is a programmer's error!" } - require(query is ProximityQuery<*> && query.value.first() is Value.Float) { "The query is not a ProximityQuery." } - @Suppress("UNCHECKED_CAST") - return AverageColorRetriever(field, query as ProximityQuery) - } - - /** - * Generates and returns a new [AverageColorRetriever] instance for this [AverageColor]. - * - * Invoking this method involves converting the provided [FloatVectorDescriptor] into a [ProximityQuery] that can be used to retrieve similar [ImageContent] elements. - * - * @param field The [Schema.Field] to create an [Retriever] for. - * @param descriptors An array of [FloatVectorDescriptor] elements to use with the [Retriever] - * @param context The [QueryContext] to use with the [Retriever] - */ - override fun newRetrieverForDescriptors(field: Schema.Field, descriptors: Collection, context: QueryContext): AverageColorRetriever { - require(field.analyser == this) { "The field '${field.fieldName}' analyser does not correspond with this analyser. This is a programmer's error!" } - - /* Prepare query parameters. */ - val k = context.getProperty(field.fieldName, "limit")?.toLongOrNull() ?: 1000L - val fetchVector = context.getProperty(field.fieldName, "returnDescriptor")?.toBooleanStrictOrNull() ?: false - - /* Return retriever. */ - return this.newRetrieverForQuery(field, ProximityQuery(value = descriptors.first().vector, k = k, fetchVector = fetchVector), context) - } - - /** - * Generates and returns a new [AverageColorRetriever] instance for this [AverageColor]. - * - * Invoking this method involves converting the provided [ImageContent] and the [QueryContext] into a [FloatVectorDescriptor] - * that can be used to retrieve similar [ImageContent] elements. - * - * @param field The [Schema.Field] to create an [Retriever] for. - * @param content An array of [Content] elements to use with the [Retriever] - * @param context The [QueryContext] to use with the [Retriever] - */ - override fun newRetrieverForContent(field: Schema.Field, content: Collection, context: QueryContext): AverageColorRetriever = - this.newRetrieverForDescriptors(field, this.analyse(content), context) - - /** - * Performs the [AverageColor] analysis on the provided [List] of [ImageContent] elements. - * - * @param content The [List] of [ImageContent] elements. - * @return [List] of [FloatVectorDescriptor]s. - */ - fun analyse(content: Collection): List = content.map { - logger.trace{"Analysing"} - val color = MutableRGBFloatColorContainer() - val rgb = it.content.getRGBArray() - rgb.forEach { c -> color += RGBByteColorContainer.fromRGB(c) } - - /* Generate descriptor. */ - val averageColor = RGBFloatColorContainer(color.red / rgb.size, color.green / rgb.size, color.blue / rgb.size) - FloatVectorDescriptor(UUID.randomUUID(), null, averageColor.toValueList()) - } -} diff --git a/vitrivr-engine-module-statistics/averagecolor/AverageColorExtractor.kt b/vitrivr-engine-module-statistics/averagecolor/AverageColorExtractor.kt deleted file mode 100644 index fa0b07316..000000000 --- a/vitrivr-engine-module-statistics/averagecolor/AverageColorExtractor.kt +++ /dev/null @@ -1,44 +0,0 @@ -package org.vitrivr.engine.base.features.averagecolor - -import org.vitrivr.engine.core.features.AbstractExtractor -import org.vitrivr.engine.core.features.metadata.source.file.FileSourceMetadataExtractor -import org.vitrivr.engine.core.model.content.ContentType -import org.vitrivr.engine.core.model.content.element.ImageContent -import org.vitrivr.engine.core.model.descriptor.Descriptor -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.ingest.Extractor -import org.vitrivr.engine.core.source.file.FileSource - -/** - * [Extractor] implementation for the [AverageColor] analyser. - * - * @see [AverageColor] - * - * @author Luca Rossetto - * @version 1.1.0 - */ -class AverageColorExtractor(input: Operator, field: Schema.Field?) : AbstractExtractor(input, field) { - /** - * Internal method to check, if [Retrievable] matches this [Extractor] and should thus be processed. - * - * [FileSourceMetadataExtractor] implementation only works with [Retrievable] that contain a [FileSource]. - * - * @param retrievable The [Retrievable] to check. - * @return True on match, false otherwise, - */ - override fun matches(retrievable: Retrievable): Boolean = retrievable.content.any { it.type == ContentType.BITMAP_IMAGE } - - /** - * Internal method to perform extraction on [Retrievable]. - ** - * @param retrievable The [Retrievable] to process. - * @return List of resulting [Descriptor]s. - */ - override fun extract(retrievable: Retrievable): List { - val content = retrievable.content.filterIsInstance() - return AverageColor().analyse(content).map { it.copy(retrievableId = retrievable.id, field = this@AverageColorExtractor.field) } - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-statistics/averagecolor/AverageColorRetriever.kt b/vitrivr-engine-module-statistics/averagecolor/AverageColorRetriever.kt deleted file mode 100644 index 6e32d8f39..000000000 --- a/vitrivr-engine-module-statistics/averagecolor/AverageColorRetriever.kt +++ /dev/null @@ -1,48 +0,0 @@ -package org.vitrivr.engine.base.features.averagecolor - -import io.github.oshai.kotlinlogging.KLogger -import io.github.oshai.kotlinlogging.KotlinLogging -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.flow.flow -import org.vitrivr.engine.core.model.content.element.ImageContent -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.query.proximity.ProximityQuery -import org.vitrivr.engine.core.model.retrievable.Retrieved -import org.vitrivr.engine.core.model.retrievable.attributes.DistanceAttribute -import org.vitrivr.engine.core.model.retrievable.attributes.ScoreAttribute -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.core.operators.retrieve.Retriever - -/** - * [Retriever] implementation for the [AverageColor] analyser. - * - * @see [AverageColor] - * - * @author Luca Rossetto - * @version 1.0.0 - */ -class AverageColorRetriever( - override val field: Schema.Field, - private val query: ProximityQuery -) : Retriever { - - private val logger: KLogger = KotlinLogging.logger {} - - companion object { - private const val MAXIMUM_DISTANCE = 3f - fun scoringFunction(retrieved: Retrieved): Float { - val distance = retrieved.filteredAttribute()?.distance ?: return 0f - return 1f - (distance / MAXIMUM_DISTANCE) - } - } - - override fun toFlow(scope: CoroutineScope) = flow { - val reader = this@AverageColorRetriever.field.getReader() - logger.debug { "Flow init with query $query" } - reader.getAll(this@AverageColorRetriever.query).forEach { - it.addAttribute(ScoreAttribute.Similarity(scoringFunction(it))) - emit(it) - } - } -} diff --git a/vitrivr-engine-module-statistics/build.gradle b/vitrivr-engine-module-statistics/build.gradle deleted file mode 100644 index 8f65ebe63..000000000 --- a/vitrivr-engine-module-statistics/build.gradle +++ /dev/null @@ -1,75 +0,0 @@ -plugins { - id 'maven-publish' - id 'signing' -} - -dependencies { - api project(':vitrivr-engine-core') -} - -/* Publication of vitrivr engine query to Maven Central. */ -publishing { - publications { - mavenJava(MavenPublication) { - groupId = 'org.vitrivr' - artifactId = 'vitrivr-engine-plugin-statistics' - version = System.getenv().getOrDefault("MAVEN_PUBLICATION_VERSION", version.toString()) - from components.java - pom { - name = 'vitrivr Engine Statistics' - description = 'Shared based components of the vitrivr multimedia retrieval engine (e.g., database connection, features).' - url = 'https://github.com/vitrivr/vitrivr-engine/' - licenses { - license { - name = 'MIT License' - } - } - developers { - developer { - id = 'ppanopticon' - name = 'Ralph Gasser' - email = 'ralph.gasser@unibas.ch' - } - developer { - id = 'lucaro' - name = 'Luca Rossetto' - email = 'rossetto@ifi.uzh.ch' - } - developer { - id = 'net-cscience-raphael' - name = 'Raphael Waltensül' - email = 'raphael.waltenspuel@unibas.ch' - } - developer { - id = 'rahelarnold98' - name = 'Rahel Arnold' - email = 'rahel.arnold@unibas.ch' - } - developer { - id = 'rahelarnold98' - name = 'faberf' - email = 'fynnfirouz.faber@unibas.ch' - } - } - scm { - connection = 'scm:git:https://github.com/vitrivr/vitrivr-engine.git' - url = 'https://github.com/vitrivr/vitrivr-engine/' - } - } - } - } - repositories { - repositories { - maven { - def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' - def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' - name = "OSSRH" - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl - credentials { - username = System.getenv("MAVEN_USERNAME") - password = System.getenv("MAVEN_PASSWORD") - } - } - } - } -} \ No newline at end of file diff --git a/vitrivr-engine-module-statistics/src/main/kotlin/StatisticsConsumer.kt b/vitrivr-engine-module-statistics/src/main/kotlin/StatisticsConsumer.kt deleted file mode 100644 index 42d2129e6..000000000 --- a/vitrivr-engine-module-statistics/src/main/kotlin/StatisticsConsumer.kt +++ /dev/null @@ -1,52 +0,0 @@ -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.channels.Channel -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch -import kotlinx.coroutines.runBlocking -import java.util.concurrent.ExecutorService -import java.util.concurrent.Executors - - -class StatisticsConsumer { - /** The [ExecutorService] used to execution [] */ - private val executor: ExecutorService = Executors.newCachedThreadPool() - - - @OptIn(ExperimentalCoroutinesApi::class) - suspend fun produceNumbers(channel: Channel) { - while (!channel.isClosedForSend) { - (500..2000).random().let { - println("Sending $it") - channel.send(it) - suspend { delay(it.toLong()) } - } - - } - channel.close() - } - - @OptIn(ExperimentalCoroutinesApi::class) - suspend fun consumeNumbers(channel: Channel) { - var millis = System.currentTimeMillis() - while (!channel.isClosedForReceive) { - - channel.receive().let { num -> - System.currentTimeMillis().let { - println("Received $num current time: ${it - millis}") - millis = it - } - - } - } - } - - fun main() = runBlocking { - val channel = Channel() - launch { produceNumbers(channel) } - consumeNumbers(channel) - } - - - - -} \ No newline at end of file diff --git a/vitrivr-engine-module-statistics/src/main/kotlin/StatisticsExporter.kt b/vitrivr-engine-module-statistics/src/main/kotlin/StatisticsExporter.kt deleted file mode 100644 index 49f132717..000000000 --- a/vitrivr-engine-module-statistics/src/main/kotlin/StatisticsExporter.kt +++ /dev/null @@ -1,27 +0,0 @@ -import io.github.oshai.kotlinlogging.KLogger -import io.github.oshai.kotlinlogging.KotlinLogging -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.flow.Flow -import org.vitrivr.engine.core.context.IndexContext -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.operators.Operator -import org.vitrivr.engine.core.operators.general.Exporter -import org.vitrivr.engine.core.operators.general.ExporterFactory -import org.vitrivr.engine.core.source.file.MimeType - - -private val logger: KLogger = KotlinLogging.logger {} - -class StatisticsExporter : ExporterFactory { - - - override fun newExporter(name: String, input: Operator, context: IndexContext): Exporter { - logger.debug { "Creating new StatisticsExporter." } - return Instance(input, context) - } - private class Instance(override val input: Operator, private val context: IndexContext) : Exporter { - override fun toFlow(scope: CoroutineScope): Flow { - return this.input.toFlow(scope) - } - } -} \ No newline at end of file diff --git a/vitrivr-engine-server/build.gradle b/vitrivr-engine-server/build.gradle index f11d772e8..007186c30 100644 --- a/vitrivr-engine-server/build.gradle +++ b/vitrivr-engine-server/build.gradle @@ -8,10 +8,10 @@ dependencies { /** vitrivr engine dependencies. */ api project(':vitrivr-engine-index') api project(':vitrivr-engine-query') - api project(':vitrivr-engine-module-features') /* TODO: This dependency is not necessary and only here to facilitate easy testing. */ - api project(':vitrivr-engine-module-cottontaildb') /* TODO: This dependency is not necessary and only here to facilitate easy testing. */ - api project(':vitrivr-engine-module-pgvector') /* TODO: This dependency is not necessary and only here to facilitate easy testing. */ - api project(':vitrivr-engine-module-fes') /* TODO: This dependency is not necessary and only here to facilitate easy testing. */ + api project(':vitrivr-engine-module-features') /* TODO: This dependency is not necessary and only here to facilitate easy testing. */ + api project(':vitrivr-engine-module-cottontaildb') /* TODO: This dependency is not necessary and only here to facilitate easy testing. */ + api project(':vitrivr-engine-module-pgvector') /* TODO: This dependency is not necessary and only here to facilitate easy testing. */ + api project(':vitrivr-engine-module-fes') /* TODO: This dependency is not necessary and only here to facilitate easy testing. */ /** Clikt & JLine */ implementation group: 'com.github.ajalt.clikt', name: 'clikt', version: version_clikt diff --git a/vitrivr-engine-server/src/main/kotlin/org/vitrivr/engine/tools/CineastMigrationTool.kt b/vitrivr-engine-server/src/main/kotlin/org/vitrivr/engine/tools/CineastMigrationTool.kt deleted file mode 100644 index ff5f90364..000000000 --- a/vitrivr-engine-server/src/main/kotlin/org/vitrivr/engine/tools/CineastMigrationTool.kt +++ /dev/null @@ -1,540 +0,0 @@ -package org.vitrivr.engine.tools - -import kotlinx.coroutines.* -import kotlinx.serialization.* -import kotlinx.serialization.builtins.ListSerializer -import kotlinx.serialization.json.Json -import kotlinx.serialization.json.JsonArray -import kotlinx.serialization.json.JsonElement -import kotlinx.serialization.json.decodeFromStream -import kotlinx.serialization.modules.SerializersModule -import org.vitrivr.engine.core.config.schema.SchemaConfig -import org.vitrivr.engine.core.database.Initializer -import org.vitrivr.engine.core.model.descriptor.Descriptor -import org.vitrivr.engine.core.model.descriptor.DescriptorId -import org.vitrivr.engine.core.model.descriptor.scalar.FloatDescriptor -import org.vitrivr.engine.core.model.descriptor.scalar.StringDescriptor -import org.vitrivr.engine.core.model.descriptor.struct.metadata.MediaDimensionsDescriptor -import org.vitrivr.engine.core.model.descriptor.struct.metadata.TemporalMetadataDescriptor -import org.vitrivr.engine.core.model.descriptor.struct.metadata.source.FileSourceMetadataDescriptor -import org.vitrivr.engine.core.model.descriptor.vector.FloatVectorDescriptor -import org.vitrivr.engine.core.model.metamodel.Schema -import org.vitrivr.engine.core.model.metamodel.SchemaManager -import org.vitrivr.engine.core.model.relationship.Relationship -import org.vitrivr.engine.core.model.retrievable.Ingested -import org.vitrivr.engine.core.model.retrievable.Retrievable -import org.vitrivr.engine.core.model.retrievable.RetrievableId -import org.vitrivr.engine.core.model.types.Value -import org.vitrivr.engine.module.features.feature.averagecolorraster.RasterDescriptor -import org.vitrivr.engine.module.features.feature.skeleton.SkeletonDescriptor -import java.io.File -import java.nio.file.Files -import java.nio.file.Paths -import kotlin.reflect.KClass - -@Serializable -data class CineastMultimediaObject( - val objectid: String, - val mediatype: Int, - val name: String, - val path: String -) - -@Serializable -data class CineastSegment( - val segmentid: String, - val objectid: String, - val segmentnumber: Int, - val segmentstart: Int, - val segmentend: Int, - val segmentstartabs: Float, - val segmentendabs: Float -) - -@Serializable -data class CineastObjectMetadata( - val objectid: String, - val domain: String, - val key: String, - val value: String -) - -@Serializable -data class CineastSegmentMetadata( - val segmentid: String, - val domain: String, - val key: String, - val value: String -) - -interface CineastFeature { - val id: String - fun toDescriptor(idmap: Map): Descriptor<*>? -} - -@Serializable -data class CineastVectorFeature(override val id: String, val feature: List) : CineastFeature { - override fun toDescriptor(idmap: Map): FloatVectorDescriptor? { - val id = this.id - if (idmap[id] == null) { - return null - } - return FloatVectorDescriptor( - id = DescriptorId.randomUUID(), - retrievableId = RetrievableId.fromString(idmap[id]), - vector = Value.FloatVector(feature.toFloatArray()) - ) - } -} - -@Serializable -data class CineastStringFeature(override val id: String, val feature: String) : CineastFeature { - override fun toDescriptor(idmap: Map): StringDescriptor? { - val id = this.id - if (idmap[id] == null) { - return null - } - return StringDescriptor( - id = DescriptorId.randomUUID(), - retrievableId = RetrievableId.fromString(idmap[id]), - value = Value.String(feature) - ) - } -} - -@Serializable -data class CineastSkeletonPoseFeature( - override val id: String, - val person: Int, - val skeleton: List, - val weights: List -) : CineastFeature { - override fun toDescriptor(idmap: Map): SkeletonDescriptor? { - val id = this.id - if (idmap[id] == null) { - return null - } - return SkeletonDescriptor( - id = DescriptorId.randomUUID(), - retrievableId = RetrievableId.fromString(idmap[id]), - mapOf( - "person" to Value.Int(person), - "skeleton" to Value.FloatVector(skeleton.toFloatArray()), - "weights" to Value.FloatVector(weights.toFloatArray()) - ) - ) - } -} - -@Serializable -data class CineastRasterFeature(override val id: String, val hist: List, val raster: List) : - CineastFeature { - override fun toDescriptor(idmap: Map): RasterDescriptor? { - val id = this.id - if (idmap[id] == null) { - return null - } - return RasterDescriptor( - id = DescriptorId.randomUUID(), - retrievableId = RetrievableId.fromString(idmap[id]), - mapOf( - "hist" to Value.FloatVector(hist.toFloatArray()), - "raster" to Value.FloatVector(raster.toFloatArray()) - ) - ) - } -} - -@Serializable -data class MigrationConfig( - val segmentspath: String, - val objectspath: String, - val segmentmetadatapath: String, - val objectmetadatapath: String, - val features: List -) - -@Serializable -data class FeatureConfig(val path: String, val fieldname: String) - -@OptIn(InternalSerializationApi::class) -fun parseJsonList(filePath: String, clazz: KClass): List { - val json = Json { ignoreUnknownKeys = true } - return Files.newInputStream(Paths.get(filePath)).use { inputStream -> - json.decodeFromStream(ListSerializer(clazz.serializer()), inputStream) - } -} - -@OptIn(InternalSerializationApi::class) -fun streamJsonItems(filePath: String, clazz: KClass): Sequence = sequence { - val json = Json { ignoreUnknownKeys = true } - Files.newInputStream(Paths.get(filePath)).use { inputStream -> - val element = json.decodeFromStream(inputStream) - if (element is JsonArray) { - element.forEach { jsonElement -> - val item = Json.decodeFromJsonElement(clazz.serializer(), jsonElement) - yield(item) - } - } else { - throw IllegalArgumentException("Expected a JSON array at the root") - } - } -} - -// Function to obtain a serializer for a given KClass instance at runtime. -@OptIn(InternalSerializationApi::class) -fun serializerForType(type: KClass): KSerializer { - return type.serializer() -} - -// Function to deserialize a JSON string into a list of objects of a dynamic type. -fun decodeJsonListFromString(jsonString: String, type: KClass): List { - val json = Json { serializersModule = SerializersModule { contextual(type, serializerForType(type)) } } - val listSerializer = ListSerializer(serializerForType(type)) - return json.decodeFromString(listSerializer, jsonString) -} - -class CineastMigrationTool(val migrationconfigpath: String, val schemaconfigpath: String) { - - private val migrationConfig: MigrationConfig - private val schemaConfig: SchemaConfig - private val schemaManager: SchemaManager - val schema: Schema - val descriptorToFeatureMap: Map, KClass> = mapOf( - FloatVectorDescriptor::class to CineastVectorFeature::class, - StringDescriptor::class to CineastStringFeature::class, - SkeletonDescriptor::class to CineastSkeletonPoseFeature::class, - RasterDescriptor::class to CineastRasterFeature::class, - ) - - private var idmap: MutableMap = mutableMapOf() - - init { - // Read the configuration strings - val configstring = Files.readString(Paths.get(migrationconfigpath)) - val schemaconfigstring = Files.readString(Paths.get(schemaconfigpath)) - - // Decode the configuration strings into objects - migrationConfig = Json.decodeFromString(configstring) - schemaConfig = Json.decodeFromString(schemaconfigstring) - - // Initialize the SchemaManager and load the schema - schemaManager = SchemaManager() - schemaManager.load(schemaConfig) - schema = schemaManager.getSchema(schemaConfig.name) - ?: throw IllegalArgumentException("Schema ${schemaConfig.name} not found") - } - - fun getFeatureClassFromDescriptor(descriptorClass: KClass<*>): KClass? { - return descriptorToFeatureMap[descriptorClass] - } - - fun initialize() { - var initialized = 0 - var initializer: Initializer<*> = schema.connection.getRetrievableInitializer() - if (!initializer.isInitialized()) { - initializer.initialize() - initialized += 1 - } - for (field in schema.fields()) { - initializer = field.getInitializer() - if (!initializer.isInitialized()) { - initializer.initialize() - initialized += 1 - } - } - println("Successfully initialized schema '${schema.name}'; created $initialized entities.") - - } - - fun migrate_objects() { - - val objects: List = - parseJsonList(migrationConfig.objectspath, CineastMultimediaObject::class) - val retrievableWriter = schema.connection.getRetrievableWriter() - val filemetadatawriter = schema.get("file")?.getWriter() - ?: throw IllegalArgumentException("Could not find file metadata writer in schema ${schema.name}") - - //val retr_list = mutableListOf() - //val desc_list = mutableListOf() - - //var i = 0 - for (mobject in objects) { - val uuid = RetrievableId.randomUUID() - idmap[mobject.objectid] = uuid.toString() - val objectRetrievable = Ingested( - uuid, - "source", - false - ) - val size = 0L - try { - val size = Files.size(Paths.get(mobject.path)) - } catch (e: Exception) { - println("Could not find file ${mobject.path}, setting size to 0") - } - val fileMetadataDescriptor = FileSourceMetadataDescriptor( - id = DescriptorId.randomUUID(), - retrievableId = objectRetrievable.id, - mapOf( - "path" to Value.String(mobject.path), - "size" to Value.Long(size), - ) - ) - filemetadatawriter.add(fileMetadataDescriptor) - retrievableWriter.add(objectRetrievable) - } - - } - - fun save_idmap() { - val idmapjson = Json.encodeToString(idmap as Map) - Files.writeString(Paths.get("idmap.json"), idmapjson) - } - - fun load_idmap() { - val idmapjson = Files.readString(Paths.get("idmap.json")) - idmap = Json.decodeFromString(idmapjson) - } - - fun migrate_objectmetadata() { - val widths = mutableMapOf() - val heights = mutableMapOf() - - val objectmetadata: List = - parseJsonList(migrationConfig.objectmetadatapath, CineastObjectMetadata::class) - val mediadimensionswriter = schema.get("dimensions")?.getWriter() - ?: throw IllegalArgumentException("Could not find media dimensions writer in schema ${schema.name}") - val videofpswriter = schema.get("fps")?.getWriter() - ?: throw IllegalArgumentException("Could not find video fps writer in schema ${schema.name}") - val videodurationwriter = schema.get("duration")?.getWriter() - ?: throw IllegalArgumentException("Could not find video duration writer in schema ${schema.name}") - - for (mobjectmetadata in objectmetadata) { - val retrievableId = idmap[mobjectmetadata.objectid] - ?: throw IllegalArgumentException("Could not find retrievable id for object ${mobjectmetadata.objectid}") - - if (mobjectmetadata.domain == "technical" && mobjectmetadata.key == "width") { - widths[retrievableId] = mobjectmetadata.value.toInt() - } - if (mobjectmetadata.domain == "technical" && mobjectmetadata.key == "height") { - val height = mobjectmetadata.value.toInt() - heights[retrievableId] = height - - if (widths.containsKey(retrievableId)) { - val width = widths[retrievableId] - ?: throw IllegalArgumentException("Could not find width for object ${mobjectmetadata.objectid}") - val dimensionsDescriptor = MediaDimensionsDescriptor( - id = DescriptorId.randomUUID(), - retrievableId = RetrievableId.fromString(retrievableId), - mapOf( - "width" to Value.Int(width), - "height" to Value.Int(height) - ) - ) - mediadimensionswriter.add(dimensionsDescriptor) - } - } - if (mobjectmetadata.domain == "technical" && mobjectmetadata.key == "fps") { - val fps = mobjectmetadata.value.toFloat() - val retrievableId = idmap[mobjectmetadata.objectid] - ?: throw IllegalArgumentException("Could not find retrievable id for object ${mobjectmetadata.objectid}") - val fpsDescriptor = FloatDescriptor( - id = DescriptorId.randomUUID(), - retrievableId = RetrievableId.fromString(retrievableId), - value = Value.Float(fps) - ) - videofpswriter.add(fpsDescriptor) - } - - if (mobjectmetadata.domain == "technical" && mobjectmetadata.key == "duration") { - val retrievableId = idmap[mobjectmetadata.objectid] - ?: throw IllegalArgumentException("Could not find retrievable id for object ${mobjectmetadata.objectid}") - val duration = mobjectmetadata.value.toFloat() - val durationDescriptor = FloatDescriptor( - id = DescriptorId.randomUUID(), - retrievableId = RetrievableId.fromString(retrievableId), - value = Value.Float(duration) - ) - videodurationwriter.add(durationDescriptor) - } - } - } - - fun migrate_segments() { - val segments: List = parseJsonList(migrationConfig.segmentspath, CineastSegment::class) - val temporalmetadatawriter = schema.get("time")?.getWriter() - ?: throw IllegalArgumentException("Could not find temporal metadata writer in schema ${schema.name}") - val retrievableWriter = schema.connection.getRetrievableWriter() - - val batchSize = 5000 - val ingestedList = mutableListOf() - val temporalMetadataList = mutableListOf() - val parentIdList = mutableListOf() - - for ((index, segment) in segments.withIndex()) { - val uuid = RetrievableId.randomUUID() - idmap[segment.segmentid] = uuid.toString() - - val ingested = Ingested( - uuid, - "segment", - false - ) - - val temporalMetadataDescriptor = TemporalMetadataDescriptor( - id = DescriptorId.randomUUID(), - retrievableId = ingested.id, - mapOf( - "start" to Value.Long(segment.segmentstartabs.toLong() * 1000 * 1000 * 1000), - "end" to Value.Long(segment.segmentendabs.toLong() * 1000 * 1000 * 1000), - ) - - ) - - ingestedList.add(ingested) - temporalMetadataList.add(temporalMetadataDescriptor) - parentIdList.add( - idmap[segment.objectid] - ?: throw IllegalArgumentException("Could not find retrievable id for segment ${segment.objectid}") - ) - - // Check if the batch size is reached - if ((index + 1) % batchSize == 0 || index == segments.size - 1) { - retrievableWriter.addAll(ingestedList) - retrievableWriter.connectAll( - ingestedList.zip(parentIdList).map { - Relationship.ById( - it.first.id, - "isPartOf", - RetrievableId.fromString(it.second) - ?: throw IllegalArgumentException("Could not find retrievable id for segment $it"), - false - ) - } - ) - temporalmetadatawriter.addAll(temporalMetadataList) - - // Clear the lists for the next batch - ingestedList.clear() - temporalMetadataList.clear() - parentIdList.clear() - } - } - } - - fun migrate_segmentmetadata() { - val segmentmetadata: List = - parseJsonList(migrationConfig.segmentmetadatapath, CineastSegmentMetadata::class) - val dominantcolorwriter = schema.get("dominantcolor")?.getWriter() - ?: throw IllegalArgumentException("Could not find dominant color writer in schema ${schema.name}") - - val dominantcolordescriptors = mutableListOf() - for (msegmentmetadata in segmentmetadata) { - if (msegmentmetadata.domain == "dominantcolor" && msegmentmetadata.key == "color") { - val color = msegmentmetadata.value - try { - val retrievableId = RetrievableId.fromString(idmap[msegmentmetadata.segmentid]) - ?: throw IllegalArgumentException("Could not find retrievable id for segment ${msegmentmetadata.segmentid}") - val dominantColorDescriptor = StringDescriptor( - id = DescriptorId.randomUUID(), - retrievableId = retrievableId, - value = Value.String(color) - ) - dominantcolordescriptors.add(dominantColorDescriptor) - } catch (e: Exception) { - println("Could not find retrievable id for segment ${msegmentmetadata.segmentid}") - } - } - } - dominantcolorwriter.addAll(dominantcolordescriptors) - } - - fun migrateAllFeatures() = runBlocking { - migrationConfig.features.map { featureConfig -> - launch(Dispatchers.Default) { // Use the appropriate dispatcher - migrateFeature(featureConfig.fieldname) - } - }.joinAll() // Wait for all tasks to complete - } - - suspend fun migrateFeature(fieldName: String) = withContext(Dispatchers.Default) { - - println("Migrating feature $fieldName") - val featureConfig = migrationConfig.features.find { it.fieldname == fieldName } - ?: throw IllegalArgumentException("Feature config for field $fieldName not found.") - val path = featureConfig.path - - val field = schema.get(name = fieldName) - ?: throw IllegalArgumentException("Field $fieldName does not exist in schema ${schema.name}.") - - val descriptorClass = field.analyser.descriptorClass - - val featureClass = getFeatureClassFromDescriptor(descriptorClass) - ?: throw IllegalArgumentException("Feature class not found for descriptor class $descriptorClass") - - val featureStream = streamJsonItems(path, featureClass) - - val fieldwriter = field.getWriter() - - val fieldreader = field.getReader() - - if (fieldreader.count() > 0) { - println("Field $fieldName already contains ${fieldreader.count()} entries, skipping migration.") - return@withContext - } - - File("$fieldName-skipped_ids.json").bufferedWriter().use { writer -> - writer.write("[") // Start of JSON array - var firstEntry = true - - featureStream.chunked(1000).forEach { batch -> - val descriptors: Iterable> = batch.mapNotNull { feature -> - if (!featureClass.isInstance(feature)) { - throw IllegalArgumentException("Feature is not an instance of expected feature class $featureClass") - } - val descriptor = feature.toDescriptor(idmap) - if (descriptor == null) { - if (firstEntry) { - firstEntry = false - } else { - writer.write(",") // Add comma before next entry, except for the first - } - writer.write(Json.encodeToString(feature.id)) - } - descriptor - } - fieldwriter.addAll(descriptors) - } - - writer.write("]") // End of JSON array - } - - println("Finished migrating feature $fieldName") - } -} - -fun main(args: Array) { - // Check for the required arguments - if (args.size < 2) { - println("Usage: ") - return - } - - // Obtain the paths from the command-line arguments - val migrationConfigPath = args[0] - val schemaConfigPath = args[1] - - // Create an instance of the migration tool with the paths - val migrationTool = CineastMigrationTool(migrationConfigPath, schemaConfigPath) - - // Perform the migration - migrationTool.initialize() - migrationTool.load_idmap() - - runBlocking { - migrationTool.migrateFeature("skeletonpose") - } - - println("Migration completed successfully.") -}