Skip to content
Snippets Groups Projects
Commit 2f1c679f authored by Joana Plewnia's avatar Joana Plewnia
Browse files

added toAron and toJSON methods for metadata

this now allows to save metadata into a json file using python
parent f4fd4b5b
No related branches found
No related tags found
1 merge request!79adding aron and armem functionalities from research repo
Pipeline #22249 passed
from dataclasses import dataclass
from ...variant import AronDict
from armarx_memory.aron.data.variant import AronDict, AronDouble, AronLong
from armarx_memory.aron.data.dto.aron_dto import AronDTOBase
......@@ -37,4 +38,16 @@ class Metadata(AronDTOBase):
return cls(timeArrived=arrived.value, timeSent=sent.value, timeReferenced=referenced.value, timeStored=stored.value)
def toAron(self) -> AronDict:
elements = {
"__ENTITY_METADATA__CONFIDENCE" : AronDouble(1.0, "__ENTITY_METADATA__CONFIDENCE"),
"__ENTITY_METADATA__TIME_ARRIVED": AronLong(self.timeArrived, "__ENTITY_METADATA__TIME_ARRIVED"),
"__ENTITY_METADATA__TIME_REFERENCED": AronLong(self.timeReferenced, "__ENTITY_METADATA__TIME_REFERENCED"),
"__ENTITY_METADATA__TIME_SENT": AronLong(self.timeSent, "__ENTITY_METADATA__TIME_SENT"),
"__WRITER_METADATA__TIME_STORED": AronLong(self.timeStored, "__WRITER_METADATA__TIME_STORED")
}
aron_dict = AronDict(elements=elements, path=[])
return aron_dict
def toJSON(self):
return self.toAron().toJSON()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment