GFQL Schema#

Experimental public declarative graph schema model for GFQL validation.

The import path is public, but this schema surface is still experimental while inference, coercion, remote transport, and planner use are developed.

class graphistry.schema.EdgeTopology(relationship_type, source_labels, destination_labels)#

Bases: object

Experimental source/destination-label contract for a relationship type.

Parameters:
  • relationship_type (str)

  • source_labels (FrozenSet[str])

  • destination_labels (FrozenSet[str])

as_metadata()#
Return type:

Dict[str, object]

destination_labels: FrozenSet[str]#
relationship_type: str#
source_labels: FrozenSet[str]#
class graphistry.schema.EdgeType(name, source, destination, properties=None)#

Bases: object

Experimental declarative edge contract with topology constraints.

Parameters:
  • name (str)

  • source (FrozenSet[str])

  • destination (FrozenSet[str])

  • properties (Mapping[str, NodeRef | EdgeRef | ScalarType | PathType | ListType])

property columns: FrozenSet[str]#

Columns admitted for this edge type, including relationship label.

destination: FrozenSet[str]#
name: str#
properties: Mapping[str, NodeRef | EdgeRef | ScalarType | PathType | ListType]#
source: FrozenSet[str]#
to_arrow(*, include_type_label=True, coercion='widen')#

Export this edge contract as a pyarrow.Schema.

Parameters:
  • include_type_label (bool)

  • coercion (Literal['strict', 'widen'])

Return type:

Any

to_row_schema(*, include_type_label=True)#

Export this edge contract as GFQL’s Arrow-bridge row schema.

Parameters:

include_type_label (bool)

Return type:

RowSchema

property topology: EdgeTopology#
class graphistry.schema.GraphSchema(node_types=(), edge_types=(), *, strict=True, node_id_column=None, edge_source_column=None, edge_destination_column=None)#

Bases: object

Experimental public graph schema contract for GFQL validation.

Parameters:
  • node_types (Tuple[NodeType, ...])

  • edge_types (Tuple[EdgeType, ...])

  • strict (bool)

  • node_id_column (str | None)

  • edge_source_column (str | None)

  • edge_destination_column (str | None)

property edge_columns: FrozenSet[str]#
property edge_columns_by_type: Dict[str, Tuple[str, ...]]#
edge_destination_column: str | None = None#
edge_source_column: str | None = None#
edge_types: Tuple[EdgeType, ...]#
property node_columns: FrozenSet[str]#
property node_columns_by_label: Dict[str, Tuple[str, ...]]#
node_id_column: str | None = None#
node_types: Tuple[NodeType, ...]#
strict: bool = True#
to_catalog(*, node_id_column=None, edge_source_column=None, edge_destination_column=None, strict=None)#

Adapt this public schema into the internal GFQL schema catalog.

Parameters:
  • node_id_column (str | None)

  • edge_source_column (str | None)

  • edge_destination_column (str | None)

  • strict (bool | None)

Return type:

GraphSchemaCatalog

class graphistry.schema.NodeType(name, properties=None, labels=None)#

Bases: object

Experimental declarative node contract for GFQL schema validation.

name is the stable user-facing type name. labels defaults to (name,) and maps to GFQL’s existing label__<Label> convention.

Parameters:
  • name (str)

  • properties (Mapping[str, NodeRef | EdgeRef | ScalarType | PathType | ListType])

  • labels (FrozenSet[str])

property columns: FrozenSet[str]#

Columns admitted for this node type, including label columns.

labels: FrozenSet[str]#
name: str#
properties: Mapping[str, NodeRef | EdgeRef | ScalarType | PathType | ListType]#
to_arrow(*, include_labels=True, coercion='widen')#

Export this node contract as a pyarrow.Schema.

Parameters:
  • include_labels (bool)

  • coercion (Literal['strict', 'widen'])

Return type:

Any

to_row_schema(*, include_labels=True)#

Export this node contract as GFQL’s Arrow-bridge row schema.

Parameters:

include_labels (bool)

Return type:

RowSchema