hydra.pg.mapping module

A model for property graph mapping specifications. See https://github.com/CategoricalData/hydra/wiki/Property-graphs.

class hydra.pg.mapping.AnnotationSchema(vertex_label: str, edge_label: str, vertex_id: str, edge_id: str, property_key: str, property_value: str, out_vertex: str, out_vertex_label: str, in_vertex: str, in_vertex_label: str, out_edge: str, out_edge_label: str, in_edge: str, in_edge_label: str, ignore: str)

Bases: object

Configurable annotation keys for property graph mapping specifications.

class Builder(_vertex_label: 'str' = None, _edge_label: 'str' = None, _vertex_id: 'str' = None, _edge_id: 'str' = None, _property_key: 'str' = None, _property_value: 'str' = None, _out_vertex: 'str' = None, _out_vertex_label: 'str' = None, _in_vertex: 'str' = None, _in_vertex_label: 'str' = None, _out_edge: 'str' = None, _out_edge_label: 'str' = None, _in_edge: 'str' = None, _in_edge_label: 'str' = None, _ignore: 'str' = None)

Bases: object

build()
edge_id(edge_id)
edge_label(edge_label)
ignore(ignore)
in_edge(in_edge)
in_edge_label(in_edge_label)
in_vertex(in_vertex)
in_vertex_label(in_vertex_label)
out_edge(out_edge)
out_edge_label(out_edge_label)
out_vertex(out_vertex)
out_vertex_label(out_vertex_label)
property_key(property_key)
property_value(property_value)
vertex_id(vertex_id)
vertex_label(vertex_label)
EDGE_ID = Name(value='edgeId')
EDGE_LABEL = Name(value='edgeLabel')
IGNORE = Name(value='ignore')
IN_EDGE = Name(value='inEdge')
IN_EDGE_LABEL = Name(value='inEdgeLabel')
IN_VERTEX = Name(value='inVertex')
IN_VERTEX_LABEL = Name(value='inVertexLabel')
OUT_EDGE = Name(value='outEdge')
OUT_EDGE_LABEL = Name(value='outEdgeLabel')
OUT_VERTEX = Name(value='outVertex')
OUT_VERTEX_LABEL = Name(value='outVertexLabel')
PROPERTY_KEY = Name(value='propertyKey')
PROPERTY_VALUE = Name(value='propertyValue')
TYPE_ = Name(value='hydra.pg.mapping.AnnotationSchema')
VERTEX_ID = Name(value='vertexId')
VERTEX_LABEL = Name(value='vertexLabel')
static builder()
edge_id: str
edge_label: str
ignore: str
in_edge: str
in_edge_label: str
in_vertex: str
in_vertex_label: str
out_edge: str
out_edge_label: str
out_vertex: str
out_vertex_label: str
property_key: str
property_value: str
vertex_id: str
vertex_label: str
with_edge_id(edge_id)
with_edge_label(edge_label)
with_ignore(ignore)
with_in_edge(in_edge)
with_in_edge_label(in_edge_label)
with_in_vertex(in_vertex)
with_in_vertex_label(in_vertex_label)
with_out_edge(out_edge)
with_out_edge_label(out_edge_label)
with_out_vertex(out_vertex)
with_out_vertex_label(out_vertex_label)
with_property_key(property_key)
with_property_value(property_value)
with_vertex_id(vertex_id)
with_vertex_label(vertex_label)
class hydra.pg.mapping.EdgeSpec(label: Annotated[EdgeLabel, 'The label of the target edges, which must conform to the edge type associated with that label.'], id: Annotated[ValueSpec, 'A specification of the id of each target edge'], out: Annotated[ValueSpec, 'A specification of the out-vertex reference of each target edge'], in_: Annotated[ValueSpec, 'A specification of the in-vertex reference of each target edge'], properties: Annotated[Sequence[PropertySpec], 'Zero or more property specifications for each target edge'])

Bases: object

A mapping specification producing edges of a specified label.

class Builder(_label: 'hydra.pg.model.EdgeLabel' = None, _id: 'ValueSpec' = None, _out: 'ValueSpec' = None, _in_: 'ValueSpec' = None, _properties: 'Sequence[PropertySpec]' = None)

Bases: object

build()
id(id)
in_(in_)
label(label)
out(out)
properties(properties)
ID = Name(value='id')
IN = Name(value='in')
LABEL = Name(value='label')
OUT = Name(value='out')
PROPERTIES = Name(value='properties')
TYPE_ = Name(value='hydra.pg.mapping.EdgeSpec')
static builder()
id: Annotated[ValueSpec, 'A specification of the id of each target edge']
in_: Annotated[ValueSpec, 'A specification of the in-vertex reference of each target edge']
label: Annotated[EdgeLabel, 'The label of the target edges, which must conform to the edge type associated with that label.']
out: Annotated[ValueSpec, 'A specification of the out-vertex reference of each target edge']
properties: Annotated[Sequence[PropertySpec], 'Zero or more property specifications for each target edge']
with_id(id)
with_in_(in_)
with_label(label)
with_out(out)
with_properties(properties)
class hydra.pg.mapping.ElementSpec

Bases: object

ElementSpecVertex | ElementSpecEdge

EDGE = Name(value='edge')
TYPE_ = Name(value='hydra.pg.mapping.ElementSpec')
VERTEX = Name(value='vertex')
class hydra.pg.mapping.ElementSpecEdge(value: T)

Bases: Node[EdgeSpec]

class hydra.pg.mapping.ElementSpecVertex(value: T)

Bases: Node[VertexSpec]

class hydra.pg.mapping.PropertySpec(key: Annotated[PropertyKey, 'The key of the target properties'], value: Annotated[ValueSpec, 'A specification of the value of each target property, which must conform to the type associated with the property key'])

Bases: object

A mapping specification producing properties of a specified key, and values of the appropriate type.

class Builder(_key: 'hydra.pg.model.PropertyKey' = None, _value: 'ValueSpec' = None)

Bases: object

build()
key(key)
value(value)
KEY = Name(value='key')
TYPE_ = Name(value='hydra.pg.mapping.PropertySpec')
VALUE = Name(value='value')
static builder()
key: Annotated[PropertyKey, 'The key of the target properties']
value: Annotated[ValueSpec, 'A specification of the value of each target property, which must conform to the type associated with the property key']
with_key(key)
with_value(value)
class hydra.pg.mapping.Schema(vertex_id_types: Coder[Type, T, E], vertex_ids: Coder[Term, V, E], edge_id_types: Coder[Type, T, E], edge_ids: Coder[Term, V, E], property_types: Coder[Type, T, E], property_values: Coder[Term, V, E], annotations: AnnotationSchema, default_vertex_id: V, default_edge_id: V)

Bases: Generic[S, T, V, E]

A set of mappings which translates between Hydra terms and annotations, and application-specific property graph types.

ANNOTATIONS = Name(value='annotations')
class Builder(_vertex_id_types: 'hydra.coders.Coder[hydra.core.Type, T, E]' = None, _vertex_ids: 'hydra.coders.Coder[hydra.core.Term, V, E]' = None, _edge_id_types: 'hydra.coders.Coder[hydra.core.Type, T, E]' = None, _edge_ids: 'hydra.coders.Coder[hydra.core.Term, V, E]' = None, _property_types: 'hydra.coders.Coder[hydra.core.Type, T, E]' = None, _property_values: 'hydra.coders.Coder[hydra.core.Term, V, E]' = None, _annotations: 'AnnotationSchema' = None, _default_vertex_id: 'V' = None, _default_edge_id: 'V' = None)

Bases: Generic[S, T, V, E]

annotations(annotations)
build()
default_edge_id(default_edge_id)
default_vertex_id(default_vertex_id)
edge_id_types(edge_id_types)
edge_ids(edge_ids)
property_types(property_types)
property_values(property_values)
vertex_id_types(vertex_id_types)
vertex_ids(vertex_ids)
DEFAULT_EDGE_ID = Name(value='defaultEdgeId')
DEFAULT_VERTEX_ID = Name(value='defaultVertexId')
EDGE_IDS = Name(value='edgeIds')
EDGE_ID_TYPES = Name(value='edgeIdTypes')
PROPERTY_TYPES = Name(value='propertyTypes')
PROPERTY_VALUES = Name(value='propertyValues')
TYPE_ = Name(value='hydra.pg.mapping.Schema')
VERTEX_IDS = Name(value='vertexIds')
VERTEX_ID_TYPES = Name(value='vertexIdTypes')
annotations: AnnotationSchema
static builder()
default_edge_id: V
default_vertex_id: V
edge_id_types: Coder[Type, T, E]
edge_ids: Coder[Term, V, E]
property_types: Coder[Type, T, E]
property_values: Coder[Term, V, E]
vertex_id_types: Coder[Type, T, E]
vertex_ids: Coder[Term, V, E]
with_annotations(annotations)
with_default_edge_id(default_edge_id)
with_default_vertex_id(default_vertex_id)
with_edge_id_types(edge_id_types)
with_edge_ids(edge_ids)
with_property_types(property_types)
with_property_values(property_values)
with_vertex_id_types(vertex_id_types)
with_vertex_ids(vertex_ids)
class hydra.pg.mapping.ValueSpec

Bases: object

ValueSpecValue | ValueSpecPattern

PATTERN = Name(value='pattern')
TYPE_ = Name(value='hydra.pg.mapping.ValueSpec')
VALUE = Name(value='value')
class hydra.pg.mapping.ValueSpecPattern(value: T)

Bases: Node[str]

A compact path representing the function, e.g. engine-${engineInfo/model/name}

class hydra.pg.mapping.ValueSpecValue

Bases: object

A trivial no-op specification which passes the entire value

class hydra.pg.mapping.VertexSpec(label: Annotated[VertexLabel, 'The label of the target vertices, which must conform to the vertex type associated with that label.'], id: Annotated[ValueSpec, 'A specification of the id of each target vertex'], properties: Annotated[Sequence[PropertySpec], 'Zero or more property specifications for each target vertex'])

Bases: object

A mapping specification producing vertices of a specified label.

class Builder(_label: 'hydra.pg.model.VertexLabel' = None, _id: 'ValueSpec' = None, _properties: 'Sequence[PropertySpec]' = None)

Bases: object

build()
id(id)
label(label)
properties(properties)
ID = Name(value='id')
LABEL = Name(value='label')
PROPERTIES = Name(value='properties')
TYPE_ = Name(value='hydra.pg.mapping.VertexSpec')
static builder()
id: Annotated[ValueSpec, 'A specification of the id of each target vertex']
label: Annotated[VertexLabel, 'The label of the target vertices, which must conform to the vertex type associated with that label.']
properties: Annotated[Sequence[PropertySpec], 'Zero or more property specifications for each target vertex']
with_id(id)
with_label(label)
with_properties(properties)