noctis.data_architecture.graph_schema.GraphSchema

pydantic model noctis.data_architecture.graph_schema.GraphSchema[source]

Base model representing the schema of a NOCtis graph

Show JSON schema
{
   "title": "GraphSchema",
   "description": "Base model representing the schema of a NOCtis graph",
   "type": "object",
   "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"
      }
   },
   "additionalProperties": false
}

Config:
  • extra: str = forbid

Fields:
Validators:
field base_nodes: dict[str, str] = {'chemical_equation': 'ChemicalEquation', 'molecule': 'Molecule'}
Constraints:
  • min_length = 2

Validated by:
field base_relationships: dict[str, dict[str, str]] = {'product': {'end_node': 'molecule', 'start_node': 'chemical_equation', 'type': 'PRODUCT'}, 'reactant': {'end_node': 'chemical_equation', 'start_node': 'molecule', 'type': 'REACTANT'}}
Constraints:
  • min_length = 2

Validated by:
field extra_nodes: dict[str, str] [Optional]
field extra_relationships: dict[str, dict[str, str]] [Optional]
Validated by:
classmethod build_from_dict(data: dict) GraphSchema[source]

To build a GraphSchema object from a dictionary

classmethod build_from_file(file_path: str, file_format: Literal['json', 'yaml'] = 'json')[source]

To build a GraphSchema object from a file

get_node_label_by_tag(node_tag: str) str[source]

To get the label of a node type

get_nodes_labels() list[str][source]
get_relationship_type_by_tag(relationship_tag: str) str[source]

To get the type of a relationship

get_relationships_types() list[str][source]
save_to_file(file_path: str, file_format: Literal['json', 'yaml'] = 'json') None[source]

To save the schema to a file

validator validate_base_nodes  »  base_nodes[source]

To validate the base nodes

validator validate_base_relationships  »  base_relationships[source]

To validate the base relationships

validator validate_extra_relationships  »  extra_relationships[source]

To validate the extra relationships