AST Objects#
ASTSerializable#
- class graphistry.compute.ASTSerializable.ASTSerializable#
Bases:
ABCInternal, not intended for use outside of this module. Class name becomes o[‘type’], and all non reserved_fields become JSON-typed key
- classmethod from_json(d, validate=True)#
Given c.to_json(), hydrate back c
- Args:
d: Dictionary from to_json() validate: If True (default), validate after parsing
- Returns:
Hydrated AST object
- Raises:
GFQLValidationError: If validate=True and validation fails
- Parameters:
d (Dict[str, None | bool | str | float | int | List[Any] | Dict[str, Any]])
validate (bool)
- Return type:
- reserved_fields = ['type']#
- to_json(validate=True)#
Returns JSON-compatible dictionry {“type”: “ClassName”, “arg1”: val1, …} Emits all non-reserved instance fields
- Return type:
Dict[str, None | bool | str | float | int | List[Any] | Dict[str, Any]]
- validate(collect_all=False)#
Validate this AST node.
- Args:
- collect_all: If True, collect all errors instead of raising on first.
If False (default), raise on first error.
- Returns:
If collect_all=True: List of validation errors (empty if valid) If collect_all=False: None if valid
- Raises:
GFQLValidationError: If collect_all=False and validation fails
- Parameters:
collect_all (bool)
- Return type:
List[GFQLValidationError] | None
ASTObject#
- class graphistry.compute.ast.ASTObject(name=None)#
Bases:
ASTSerializableInternal, not intended for use outside of this module. These are operator-level expressions used as g.chain(List<ASTObject>)
- Parameters:
name (str | None)
- classmethod from_json(d, validate=True)#
Given c.to_json(), hydrate back c
- Args:
d: Dictionary from to_json() validate: If True (default), validate after parsing
- Returns:
Hydrated AST object
- Raises:
GFQLValidationError: If validate=True and validation fails
- Parameters:
d (Dict[str, None | bool | str | float | int | List[Any] | Dict[str, Any]])
validate (bool)
- Return type:
- reserved_fields = ['type']#
- to_json(validate=True)#
Returns JSON-compatible dictionry {“type”: “ClassName”, “arg1”: val1, …} Emits all non-reserved instance fields
- Return type:
Dict[str, None | bool | str | float | int | List[Any] | Dict[str, Any]]
- validate(collect_all=False)#
Validate this AST node.
- Args:
- collect_all: If True, collect all errors instead of raising on first.
If False (default), raise on first error.
- Returns:
If collect_all=True: List of validation errors (empty if valid) If collect_all=False: None if valid
- Raises:
GFQLValidationError: If collect_all=False and validation fails
- Parameters:
collect_all (bool)
- Return type:
List[GFQLValidationError] | None
ASTEdge#
- class graphistry.compute.ast.ASTEdge(direction='forward', edge_match=None, hops=1, min_hops=None, max_hops=None, output_min_hops=None, output_max_hops=None, label_node_hops=None, label_edge_hops=None, label_seeds=False, to_fixed_point=False, source_node_match=None, destination_node_match=None, source_node_query=None, destination_node_query=None, edge_query=None, name=None)#
Bases:
ASTObjectInternal, not intended for use outside of this module.
- Parameters:
direction (Literal['forward', 'reverse', 'undirected'] | None)
edge_match (dict | None)
hops (int | None)
min_hops (int | None)
max_hops (int | None)
output_min_hops (int | None)
output_max_hops (int | None)
label_node_hops (str | None)
label_edge_hops (str | None)
label_seeds (bool)
to_fixed_point (bool)
source_node_match (dict | None)
destination_node_match (dict | None)
source_node_query (str | None)
destination_node_query (str | None)
edge_query (str | None)
name (str | None)
- classmethod from_json(d, validate=True)#
Given c.to_json(), hydrate back c
- Args:
d: Dictionary from to_json() validate: If True (default), validate after parsing
- Returns:
Hydrated AST object
- Raises:
GFQLValidationError: If validate=True and validation fails
- Parameters:
d (dict)
validate (bool)
- Return type:
- reserved_fields = ['type']#
- to_json(validate=True)#
Returns JSON-compatible dictionry {“type”: “ClassName”, “arg1”: val1, …} Emits all non-reserved instance fields
- Return type:
dict
- validate(collect_all=False)#
Validate this AST node.
- Args:
- collect_all: If True, collect all errors instead of raising on first.
If False (default), raise on first error.
- Returns:
If collect_all=True: List of validation errors (empty if valid) If collect_all=False: None if valid
- Raises:
GFQLValidationError: If collect_all=False and validation fails
- Parameters:
collect_all (bool)
- Return type:
List[GFQLValidationError] | None
ASTPredicate#
- class graphistry.compute.predicates.ASTPredicate.ASTPredicate#
Bases:
ASTSerializableInternal, not intended for use outside of this module. These are fancy columnar predicates used in {k: v, …} node/edge df matching when going beyond primitive equality
- classmethod from_json(d, validate=True)#
Given c.to_json(), hydrate back c
- Args:
d: Dictionary from to_json() validate: If True (default), validate after parsing
- Returns:
Hydrated AST object
- Raises:
GFQLValidationError: If validate=True and validation fails
- Parameters:
d (Dict[str, None | bool | str | float | int | List[Any] | Dict[str, Any]])
validate (bool)
- Return type:
- reserved_fields = ['type']#
- to_json(validate=True)#
Returns JSON-compatible dictionry {“type”: “ClassName”, “arg1”: val1, …} Emits all non-reserved instance fields
- Return type:
Dict[str, None | bool | str | float | int | List[Any] | Dict[str, Any]]
- validate(collect_all=False)#
Validate this AST node.
- Args:
- collect_all: If True, collect all errors instead of raising on first.
If False (default), raise on first error.
- Returns:
If collect_all=True: List of validation errors (empty if valid) If collect_all=False: None if valid
- Raises:
GFQLValidationError: If collect_all=False and validation fails
- Parameters:
collect_all (bool)
- Return type:
List[GFQLValidationError] | None