noctis.data_architecture.datamodel.GraphRecord

pydantic model noctis.data_architecture.datamodel.GraphRecord[source]

Represents a record of nodes and relationships forming a graph.

Show JSON schema
{
   "title": "GraphRecord",
   "description": "Represents a record of nodes and relationships forming a graph.",
   "type": "object",
   "properties": {
      "nodes": {
         "default": [],
         "items": {
            "$ref": "#/$defs/Node"
         },
         "title": "Nodes",
         "type": "array"
      },
      "relationships": {
         "default": [],
         "items": {
            "$ref": "#/$defs/Relationship"
         },
         "title": "Relationships",
         "type": "array"
      }
   },
   "$defs": {
      "Node": {
         "description": "Represents a node in a graph with a unique identifier and optional properties.",
         "properties": {
            "node_label": {
               "pattern": "^[A-Z][\\w\\-]*$",
               "title": "Node Label",
               "type": "string"
            },
            "uid": {
               "pattern": "^[A-Z]{0,3}{1,2}\\d+$",
               "title": "Uid",
               "type": "string"
            },
            "properties": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Properties"
            }
         },
         "required": [
            "node_label",
            "uid"
         ],
         "title": "Node",
         "type": "object"
      },
      "Relationship": {
         "description": "Represents a relationship between two nodes in a graph.",
         "properties": {
            "relationship_type": {
               "pattern": "^[A-Z\\d_-]+$",
               "title": "Relationship Type",
               "type": "string"
            },
            "start_node": {
               "$ref": "#/$defs/Node"
            },
            "end_node": {
               "$ref": "#/$defs/Node"
            },
            "properties": {
               "anyOf": [
                  {
                     "additionalProperties": true,
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": {},
               "title": "Properties"
            }
         },
         "required": [
            "relationship_type",
            "start_node",
            "end_node"
         ],
         "title": "Relationship",
         "type": "object"
      }
   }
}

Fields:
Validators:
field nodes: list[Node] = []
Validated by:
field relationships: list[Relationship] = []
Validated by:
validator ensure_relationship_nodes_present  »  all fields[source]
validator ensure_unique_nodes  »  nodes[source]
validator ensure_unique_relationships  »  relationships[source]
get_all_relationships_start_end_uids() list[tuple[str, str]][source]
get_nodes_with_label(input_label: str) list[Node][source]
property nodes_uids: set[str]
property relationships_nodes_uids: set[str]