noctis.repository.neo4j.neo4j_queries.AddNodesAndRelationships

pydantic model noctis.repository.neo4j.neo4j_queries.AddNodesAndRelationships[source]

Query to add nodes and relationships from a python object. Suitable for small to medium size uploads

Show JSON schema
{
   "title": "AddNodesAndRelationships",
   "description": "Query to add nodes and relationships from a python object. Suitable for small to medium size uploads",
   "type": "object",
   "properties": {
      "query": {
         "default": null,
         "items": {
            "type": "string"
         },
         "title": "Query",
         "type": "array"
      },
      "graph_schema": {
         "anyOf": [
            {
               "$ref": "#/$defs/GraphSchema"
            },
            {
               "type": "null"
            }
         ],
         "default": {
            "base_nodes": {
               "chemical_equation": "ChemicalEquation",
               "molecule": "Molecule"
            },
            "base_relationships": {
               "product": {
                  "end_node": "molecule",
                  "start_node": "chemical_equation",
                  "type": "PRODUCT"
               },
               "reactant": {
                  "end_node": "chemical_equation",
                  "start_node": "molecule",
                  "type": "REACTANT"
               }
            },
            "extra_nodes": {},
            "extra_relationships": {}
         }
      },
      "data": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "$ref": "#/$defs/DataContainer"
            }
         ],
         "default": null,
         "title": "Data"
      },
      "data_type": {
         "default": null,
         "title": "Data Type",
         "type": "string"
      },
      "input_chem_format": {
         "default": null,
         "title": "Input Chem Format",
         "type": "string"
      },
      "output_chem_format": {
         "default": null,
         "title": "Output Chem Format",
         "type": "string"
      },
      "validation": {
         "default": null,
         "title": "Validation",
         "type": "boolean"
      }
   },
   "$defs": {
      "DataContainer": {
         "description": "A container for managing and transforming chemical equation data.\n\nDataContainer is a collection of GraphRecord objects with methods for\nmanaging records and transforming data into various formats.\n\nAttributes:\n    records (list[GraphRecord]): List of GraphRecord objects.\n    ce_label (str): Label for chemical equations (default: settings.nodes.node_chemequation).\n\nMethods:\n    add_record(record): Add a GraphRecord to the container.\n    get_record(record_key): Retrieve a specific GraphRecord.\n    get_records(record_keys): Retrieve multiple GraphRecords.\n    get_subcontainer_with_records(record_keys): Create a new DataContainer with specified records.\n    transform_to(format_type, with_record_id, ce_label): Transform data to specified format.\n\nNote:\n    DataContainer objects can be compared for equality using the == operator.",
         "properties": {
            "records": {
               "items": {
                  "$ref": "#/$defs/GraphRecord"
               },
               "title": "Records",
               "type": "array"
            },
            "ce_label": {
               "default": "ChemicalEquation",
               "title": "Ce Label",
               "type": "string"
            }
         },
         "title": "DataContainer",
         "type": "object"
      },
      "GraphRecord": {
         "description": "Represents a record of nodes and relationships forming a graph.",
         "properties": {
            "nodes": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/Node"
               },
               "title": "Nodes",
               "type": "array"
            },
            "relationships": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/Relationship"
               },
               "title": "Relationships",
               "type": "array"
            }
         },
         "title": "GraphRecord",
         "type": "object"
      },
      "GraphSchema": {
         "additionalProperties": false,
         "description": "Base model representing the schema of a NOCtis graph",
         "properties": {
            "base_nodes": {
               "additionalProperties": {
                  "type": "string"
               },
               "default": {
                  "chemical_equation": "ChemicalEquation",
                  "molecule": "Molecule"
               },
               "minProperties": 2,
               "title": "Base Nodes",
               "type": "object"
            },
            "base_relationships": {
               "additionalProperties": {
                  "additionalProperties": {
                     "type": "string"
                  },
                  "type": "object"
               },
               "default": {
                  "product": {
                     "end_node": "molecule",
                     "start_node": "chemical_equation",
                     "type": "PRODUCT"
                  },
                  "reactant": {
                     "end_node": "chemical_equation",
                     "start_node": "molecule",
                     "type": "REACTANT"
                  }
               },
               "minProperties": 2,
               "title": "Base Relationships",
               "type": "object"
            },
            "extra_nodes": {
               "additionalProperties": {
                  "type": "string"
               },
               "title": "Extra Nodes",
               "type": "object"
            },
            "extra_relationships": {
               "additionalProperties": {
                  "additionalProperties": {
                     "type": "string"
                  },
                  "type": "object"
               },
               "title": "Extra Relationships",
               "type": "object"
            }
         },
         "title": "GraphSchema",
         "type": "object"
      },
      "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"
      }
   }
}

Config:
  • arbitrary_types_allowed: bool = True

Fields:
Validators:

field data: list[str] | list[SynGraph] | DataContainer | DataFrame = None
Validated by:
field data_type: str = None
Validated by:
field input_chem_format: str = None
Validated by:
field output_chem_format: str = None
Validated by:
field query: list[str] = None
Validated by:
field validation: bool = None
Validated by:
get_query() list[str][source]
parameters_embedded: ClassVar[bool] = True
query_args_optional: ClassVar[list[str]] = ['input_chem_format', 'output_chem_format', 'validation', 'graph_schema']
query_args_required: ClassVar[list[str]] = ['data', 'data_type']
query_name: ClassVar[str] = 'load_nodes_and_relationships'
query_type: ClassVar[str] = 'modify_graph'