AST Objects#

ASTSerializable#

class graphistry.compute.ASTSerializable.ASTSerializable#

Bases: ABC

Internal, 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)#

Given c.to_json(), hydrate back c

Corresponding c.__class__.__init__ must accept all non-reserved instance fields

Parameters:

d (Dict[str, None | bool | str | float | int | List[None | bool | str | float | int | List[JSONVal] | Dict[str, JSONVal]] | Dict[str, None | bool | str | float | int | List[JSONVal] | Dict[str, JSONVal]]])

Return type:

ASTSerializable

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[None | bool | str | float | int | List[JSONVal] | Dict[str, JSONVal]] | Dict[str, None | bool | str | float | int | List[JSONVal] | Dict[str, JSONVal]]]

validate()#
Return type:

None

ASTObject#

class graphistry.compute.ast.ASTObject(name=None)#

Bases: ASTSerializable

Internal, 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)#

Given c.to_json(), hydrate back c

Corresponding c.__class__.__init__ must accept all non-reserved instance fields

Parameters:

d (Dict[str, None | bool | str | float | int | List[None | bool | str | float | int | List[JSONVal] | Dict[str, JSONVal]] | Dict[str, None | bool | str | float | int | List[JSONVal] | Dict[str, JSONVal]]])

Return type:

ASTSerializable

reserved_fields = ['type']#
abstract reverse()#
Return type:

ASTObject

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[None | bool | str | float | int | List[JSONVal] | Dict[str, JSONVal]] | Dict[str, None | bool | str | float | int | List[JSONVal] | Dict[str, JSONVal]]]

validate()#
Return type:

None

ASTEdge#

class graphistry.compute.ast.ASTEdge(direction='forward', edge_match=None, hops=1, 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: ASTObject

Internal, not intended for use outside of this module.

Parameters:
  • direction (Literal['forward', 'reverse', 'undirected'] | None)

  • edge_match (dict | None)

  • hops (int | None)

  • 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)#

Given c.to_json(), hydrate back c

Corresponding c.__class__.__init__ must accept all non-reserved instance fields

Parameters:

d (dict)

Return type:

ASTEdge

reserved_fields = ['type']#
reverse()#
Return type:

ASTEdge

to_json(validate=True)#

Returns JSON-compatible dictionry {“type”: “ClassName”, “arg1”: val1, …} Emits all non-reserved instance fields

Return type:

dict

validate()#
Return type:

None

ASTPredicate#

class graphistry.compute.predicates.ASTPredicate.ASTPredicate#

Bases: ASTSerializable

Internal, 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)#

Given c.to_json(), hydrate back c

Corresponding c.__class__.__init__ must accept all non-reserved instance fields

Parameters:

d (Dict[str, None | bool | str | float | int | List[None | bool | str | float | int | List[JSONVal] | Dict[str, JSONVal]] | Dict[str, None | bool | str | float | int | List[JSONVal] | Dict[str, JSONVal]]])

Return type:

ASTSerializable

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[None | bool | str | float | int | List[JSONVal] | Dict[str, JSONVal]] | Dict[str, None | bool | str | float | int | List[JSONVal] | Dict[str, JSONVal]]]

validate()#
Return type:

None