Skip to content

Commit

Permalink
Fixed some serialization issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaro committed Jul 30, 2024
1 parent 0d0998a commit de1e4f8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import java.util.*
* @author Loris Sauter
* @version 2.0.0
*/
@Serializable
sealed interface Type {

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package org.vitrivr.engine.database.jsonl
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import org.vitrivr.engine.core.database.descriptor.DescriptorWriter
import org.vitrivr.engine.core.model.descriptor.Attribute
import org.vitrivr.engine.core.model.descriptor.AttributeName
import org.vitrivr.engine.core.model.descriptor.Descriptor
import org.vitrivr.engine.core.model.metamodel.Schema
import org.vitrivr.engine.core.model.types.Type
import org.vitrivr.engine.core.model.types.Value
import org.vitrivr.engine.database.jsonl.JsonlConnection.Companion.DESCRIPTOR_ID_COLUMN_NAME
import org.vitrivr.engine.database.jsonl.JsonlConnection.Companion.RETRIEVABLE_ID_COLUMN_NAME
Expand All @@ -31,9 +33,14 @@ class JsonlWriter<D : Descriptor>(override val field: Schema.Field<*, D>, overri
)

valueMap.putAll(item.values())
val attributes = mutableListOf(
Attribute(DESCRIPTOR_ID_COLUMN_NAME, Type.UUID, false),
Attribute(RETRIEVABLE_ID_COLUMN_NAME, Type.UUID, false)
)
attributes.addAll(item.layout())

val list = AttributeContainerList(
item.layout().map { attribute ->
attributes.map { attribute ->
AttributeContainer(
attribute,
valueMap[attribute.name]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.vitrivr.engine.core.model.types.Value
import java.util.*

@Serializable
sealed class ValueContainer(val type: Type) {
sealed class ValueContainer(val innerType: Type) { //TODO explicitly use innerType for serialization

companion object {
fun fromValue(value: Value<*>): ValueContainer = when (value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class StructJsonlReader(
val parameters: MutableList<Any?> = mutableListOf(
descriptorId,
retrievableId,
prototype.layout(),
valueMap
)

Expand Down

0 comments on commit de1e4f8

Please sign in to comment.