# -*- coding: utf-8 -*-
# @Time : 2023/8/4 16:19
# @Author : Ultipa
# @Email : [email protected]
# @File : Edge.py
from typing import Dict
from ultipa.structs.BaseModel import BaseModel
[docs]
class Edge(BaseModel):
'''
Data class for edge.
'''
_index = None
def __init__(self, values: Dict, from_id: str = None, from_uuid: int = None, to_id: str = None, to_uuid: int = None,
schema: str = None,
uuid: int = None, **kwargs):
if schema is None:
if kwargs.get("schema_name") is not None:
self.schema = kwargs.get("schema_name")
else:
self.schema = None
else:
self.schema = schema
self.from_id = from_id
self.from_uuid = from_uuid
self.to_id = to_id
self.to_uuid = to_uuid
self.values = values
self.uuid = uuid
[docs]
def getUUID(self):
return self.uuid
[docs]
def getFrom(self):
return self.from_id
[docs]
def getTo(self):
return self.to_id
[docs]
def getFromUUID(self):
return self.from_uuid
[docs]
def getToUUID(self):
return self.to_uuid
[docs]
def getValues(self):
return self.values
[docs]
def getSchema(self):
return self.schema
[docs]
def get(self, propertyName: str):
return self.values.get(propertyName)
[docs]
def set(self, propertyName: str, value):
self.values.update({propertyName: value})
def _getIndex(self):
return self._index