Module sktmls.graphs

Sub-modules

sktmls.graphs.graph

Classes

class EdgeClient (env: MLSENV = None, runtime_env:  = None, username: str = None, password: str = None)

MLS Edge 스키마 관련 기능들을 제공하는 클라이언트입니다.

Args

Returns

EdgeClient

Example

edge_client = EdgeClient(env=MLSENV.STG, runtime_env=MLSRuntimeENV.YE, username="mls_account", password="mls_password")

Ancestors

Methods

def create_edge(self, label: str, frm: str, to: str, properties: Dict[str, str] = {}) ‑> EdgeSchema

Edge 스키마를 생성합니다.

Args

  • label: (str) Edge 스키마 라벨
  • frm: (str) Edge 시작 Vertex 라벨
  • to: (str) Edge 종료 Vertex 라벨
  • properties: (optional) (dict) Vertex 스키마의 데이터 속성 (Float(single)|Float(set)|String(single)|String(set))
    • Float, String: 데이터 타입
    • single: 단일 property 값을 계속 업데이트
    • set: property값을 여러 개 계속 누적해 저장

Returns

EdgeSchema

Example

edge = edge_client.create_edge(
    label="SampleEdge",
    frm="startVertex",
    to="endVertex",
    properties={
        "name":"String(single)",
        "lat":"Float(single)",
        "long": "Float(single)"
    }
)
def delete_edge(self, edge: EdgeSchema) ‑> MLSResponse

단일 Edge 스키마를 삭제합니다.

Args

  • edge: (EdgeSchema) Edge 스키마 객체

Returns

MLSResponse

Example

edge_client.delete_edge(edge)
def get_edge(self, id: int = None, label: str = None) ‑> EdgeSchema

단일 Edge 스키마 정보를 가져옵니다.

Args: id 또는 label 중 한 개 이상의 값이 반드시 전달되어야 합니다.

  • id: (int) Edge 스키마 id
  • label: (str) Edge 스키마 라벨

Returns

EdgeSchema

Example

edge = edge_client.get_edge(id=1)
edge = edge_client.get_edge(label="SampleEdge")
def list_edges(self, **kwargs) ‑> List[EdgeSchema]

Edge 스키마 리스트를 가져옵니다.

Args

  • kwargs: (optional) (dict) 쿼리 조건
    • id: (int) Edge 스키마 id
    • label: (str) Edge 스키마 라벨
    • query: (str) 검색 문자
    • page: (int) 페이지 번호

Returns

list(EdgeSchema)

Example

edges = edge_client.list_edges()
def update_edge(self, edge: EdgeSchema, label: str, frm: str, to: str, properties: Dict[str, Any] = {}) ‑> EdgeSchema

단일 Edge 스키마를 수정합니다.

Args

  • edge: (EdgeSchema) Edge 스키마 객체
  • label: (str) Edge 스키마 라벨
  • frm: (str) Edge 시작 Vertex 라벨
  • to: (str) Edge 종료 Vertex 라벨
  • properties: (optional) (dict) Vertex 스키마의 데이터 속성 (Float(single)|Float(set)|String(single)|String(set))
    • Float, String: 데이터 타입
    • single: 단일 property 값을 계속 업데이트
    • set: property값을 여러 개 계속 누적해 저장

Returns

EdgeSchema

Example

edge_client.update_edge(
    edge,
    label="SampleEdge2",
    frm="startVertex",
    to="endVertex",
    properties={
        "name":"String(single)"
    }
)
class EdgeSchema (**kwargs)

MLS Edge 스키마 클래스입니다.

Args

  • kwargs
    • id: (str) Edge 스키마 ID
    • label: (str) Edge 스키마 라벨
    • frm: (str) 출발 Vertex 라벨
    • to: (str) 도착 Vertex 라벨
    • properties: (dict) Edge property 데이터 타입 정의

Returns

EdgeSchema

Methods

def get(self)
class VertexClient (env: MLSENV = None, runtime_env: MLSRuntimeENV = None, username: str = None, password: str = None)

MLS Vertex 스키마 관련 기능들을 제공하는 클라이언트입니다.

Args

Returns

VertexClient

Example

vertex_client = VertexClient(env=MLSENV.STG, runtime_env=MLSRuntimeENV.YE, username="mls_account", password="mls_password")

Ancestors

Methods

def create_vertex(self, label: str, properties: Dict[str, str] = {}) ‑> VertexSchema

Vertex 스키마를 생성합니다.

Args

  • label: (str) Vertex 스키마 라벨
  • properties: (optional) (dict) Vertex 스키마의 데이터 속성 (Float(single)|Float(set)|String(single)|String(set))
    • Float, String: 데이터 타입
    • single: 단일 property 값을 계속 업데이트
    • set: property값을 여러 개 계속 누적해 저장

Returns

VertexSchema

Example

vertex = vertex_client.create_vertex(
    label="SampleVertex",
    properties={
        "name":"String(single)",
        "lat":"Float(single)",
        "long": "Float(single)"
    }
)
def delete_vertex(self, vertex: VertexSchema) ‑> MLSResponse

단일 Vertex 스키마를 삭제합니다. 연결된 Edge 스키마도 함께 삭제됩니다.

Args

  • vertex: (VertexSchema) Vertex 스키마 객체

Returns

MLSResponse

Example

vertex_client.delete_vertex(vertex)
def get_vertex(self, id: int = None, label: str = None) ‑> VertexSchema

단일 Vertex 스키마 정보를 가져옵니다.

Args: id 또는 label 중 한 개 이상의 값이 반드시 전달되어야 합니다.

  • id: (int) vertex 스키마 id
  • label: (str) vertex 스키마 라벨

Returns

VertexSchema

Example

vertex = vertex_client.get_vertex(id=1)
vertex = vertex_client.get_vertex(label="SampleVertex")
def list_vertices(self, **kwargs) ‑> List[VertexSchema]

vertex 스키마 리스트를 가져옵니다.

Args

  • kwargs: (optional) (dict) 쿼리 조건
    • id: (int) vertex 스키마 id
    • label: (str) vertex 스키마 라벨
    • query: (str) 검색 문자
    • page: (int) 페이지 번호

Returns

list(VertexSchema)

Example

vertices = vertex_client.list_vertices()
def update_vertex(self, vertex: VertexSchema, label: str, properties: Dict[str, Any] = {}) ‑> VertexSchema

단일 Vertex 스키마를 수정합니다.

Args

  • vertex: (VertexSchema) Vertex 스키마 객체
  • label: (str) Vertex 스키마 라벨
  • properties: (optional) (dict) Vertex 스키마의 데이터 속성 (Float(single)|Float(set)|String(single)|String(set))
    • Float, String: 데이터 타입
    • single: 단일 property 값을 계속 업데이트
    • set: property값을 여러 개 계속 누적해 저장

Returns

VertexSchema

Example

new_vertex = vertex_client.update_vertex(
    vertex,
    label="SampleVertex2",
    properties={
        "name":"String(single)"
    }
)
class VertexSchema (**kwargs)

MLS Vertex 스키마 클래스입니다.

Args

  • kwargs
    • id: (str) Vertex 스키마 ID
    • label: (str) Vertex 스키마 라벨
    • properties: (dict) Vertex property 데이터 타입 정의

Returns

VertexSchema

Methods

def get(self)