2023-12-11 23:13:19 +08:00
|
|
|
from knext import rest
|
2023-12-08 11:25:26 +08:00
|
|
|
from knext.component.builder.base import SinkWriter
|
2023-12-11 23:13:19 +08:00
|
|
|
from knext.operator.spg_record import SPGRecord
|
2023-12-06 17:26:39 +08:00
|
|
|
|
|
|
|
|
2023-12-08 11:25:26 +08:00
|
|
|
class KGSinkWriter(SinkWriter):
|
2023-12-06 17:26:39 +08:00
|
|
|
"""The Sink Component that writing data to KG storage.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
None
|
|
|
|
Examples:
|
|
|
|
sink = KGSinkWriter()
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
@property
|
2023-12-08 11:25:26 +08:00
|
|
|
def input_types(self):
|
2023-12-11 23:13:19 +08:00
|
|
|
return SPGRecord
|
2023-12-06 17:26:39 +08:00
|
|
|
|
|
|
|
@property
|
2023-12-08 11:25:26 +08:00
|
|
|
def output_types(self):
|
2023-12-06 17:26:39 +08:00
|
|
|
return None
|
|
|
|
|
|
|
|
def to_rest(self):
|
2023-12-18 14:30:59 +08:00
|
|
|
"""Transforms `KGSinkWriter` to REST model `GraphStoreSinkNodeConfig`."""
|
2023-12-11 23:13:19 +08:00
|
|
|
config = rest.GraphStoreSinkNodeConfig()
|
|
|
|
return rest.Node(**super().to_dict(), node_config=config)
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def from_rest(cls, node: rest.Node):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def invoke(self, input):
|
|
|
|
pass
|
2023-12-08 11:25:26 +08:00
|
|
|
|
|
|
|
def submit(self):
|
2023-12-11 10:44:37 +08:00
|
|
|
pass
|