hydra.pg.model module
A typed property graph data model. Property graphs are parameterized a type for property and id values, while property graph schemas are parameterized by a type for property and id types.
- class hydra.pg.model.AdjacentEdge(label: Annotated[EdgeLabel, 'The label of the edge'], id: Annotated[V, 'The unique identifier of the edge'], vertex: Annotated[V, 'The id of the other vertex adjacent to the edge'], properties: Annotated[Mapping[PropertyKey, V], 'A key/value map of edge properties'])
Bases:
Generic[V]An edge which is adjacent to a given vertex. Only the other endpoint of the edge is provided.
- class Builder(_label: 'EdgeLabel' = None, _id: 'V' = None, _vertex: 'V' = None, _properties: 'Mapping[PropertyKey, V]' = None)
Bases:
Generic[V]- build()
- id(id)
- label(label)
- properties(properties)
- vertex(vertex)
- ID = Name(value='id')
- LABEL = Name(value='label')
- PROPERTIES = Name(value='properties')
- TYPE_ = Name(value='hydra.pg.model.AdjacentEdge')
- VERTEX = Name(value='vertex')
- static builder()
- id: Annotated[V, 'The unique identifier of the edge']
- properties: Annotated[Mapping[PropertyKey, V], 'A key/value map of edge properties']
- vertex: Annotated[V, 'The id of the other vertex adjacent to the edge']
- with_id(id)
- with_label(label)
- with_properties(properties)
- with_vertex(vertex)
- class hydra.pg.model.Direction(*values)
Bases:
EnumThe direction of an edge or edge pattern.
- BOTH = Name(value='both')
- IN = Name(value='in')
- OUT = Name(value='out')
- TYPE_ = Name(value='hydra.pg.model.Direction')
- UNDIRECTED = Name(value='undirected')
- class hydra.pg.model.Edge(label: Annotated[EdgeLabel, 'The label of the edge'], id: Annotated[V, 'The unique identifier of the edge'], out: Annotated[V, 'The id of the out-vertex (tail) of the edge'], in_: Annotated[V, 'The id of the in-vertex (head) of the edge'], properties: Annotated[Mapping[PropertyKey, V], 'A key/value map of edge properties'])
Bases:
Generic[V]An edge.
- class Builder(_label: 'EdgeLabel' = None, _id: 'V' = None, _out: 'V' = None, _in_: 'V' = None, _properties: 'Mapping[PropertyKey, V]' = None)
Bases:
Generic[V]- 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.model.Edge')
- static builder()
- id: Annotated[V, 'The unique identifier of the edge']
- in_: Annotated[V, 'The id of the in-vertex (head) of the edge']
- out: Annotated[V, 'The id of the out-vertex (tail) of the edge']
- properties: Annotated[Mapping[PropertyKey, V], 'A key/value map of edge properties']
- with_id(id)
- with_in_(in_)
- with_label(label)
- with_out(out)
- with_properties(properties)
- class hydra.pg.model.EdgeLabel(value: T)
Bases:
Node[str]The label of an edge.
- TYPE_ = Name(value='hydra.pg.model.EdgeLabel')
- class hydra.pg.model.EdgeType(label: Annotated[EdgeLabel, 'The label of any edge of this edge type'], id: Annotated[T, 'The type of the id of any edge of this edge type'], out: Annotated[VertexLabel, 'The label of the out-vertex (tail) of any edge of this edge type'], in_: Annotated[VertexLabel, 'The label of the in-vertex (head) of any edge of this edge type'], properties: Annotated[Sequence[PropertyType[T]], 'A list of property types. The types are ordered for the sake of applications in which property order is significant.'])
Bases:
Generic[T]The type of an edge.
- class Builder(_label: 'EdgeLabel' = None, _id: 'T' = None, _out: 'VertexLabel' = None, _in_: 'VertexLabel' = None, _properties: 'Sequence[PropertyType[T]]' = None)
Bases:
Generic[T]- 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.model.EdgeType')
- static builder()
- id: Annotated[T, 'The type of the id of any edge of this edge type']
- in_: Annotated[VertexLabel, 'The label of the in-vertex (head) of any edge of this edge type']
- out: Annotated[VertexLabel, 'The label of the out-vertex (tail) of any edge of this edge type']
- properties: Annotated[Sequence[PropertyType[T]], 'A list of property types. The types are ordered for the sake of applications in which property order is significant.']
- with_id(id)
- with_in_(in_)
- with_label(label)
- with_out(out)
- with_properties(properties)
- class hydra.pg.model.Element
Bases:
objectElementVertex[V] | ElementEdge[V]
- EDGE = Name(value='edge')
- TYPE_ = Name(value='hydra.pg.model.Element')
- VERTEX = Name(value='vertex')
- class hydra.pg.model.ElementKind(*values)
Bases:
EnumThe kind of an element: vertex or edge.
- EDGE = Name(value='edge')
- TYPE_ = Name(value='hydra.pg.model.ElementKind')
- VERTEX = Name(value='vertex')
- class hydra.pg.model.ElementTree(self: object, dependencies: Sequence[ElementTree[V]])
Bases:
Generic[V]An element together with its dependencies in some context.
- class Builder(_self: 'Element[V]' = None, _dependencies: 'Sequence[ElementTree[V]]' = None)
Bases:
Generic[V]- build()
- dependencies(dependencies)
- self_(self_)
- DEPENDENCIES = Name(value='dependencies')
- SELF = Name(value='self')
- TYPE_ = Name(value='hydra.pg.model.ElementTree')
- static builder()
- dependencies: Sequence[ElementTree[V]]
- with_dependencies(dependencies)
- with_self(_self)
- class hydra.pg.model.ElementType
Bases:
objectElementTypeVertex[T] | ElementTypeEdge[T]
- EDGE = Name(value='edge')
- TYPE_ = Name(value='hydra.pg.model.ElementType')
- VERTEX = Name(value='vertex')
- class hydra.pg.model.ElementTypeTree(self: object, dependencies: Sequence[ElementTypeTree[T]])
Bases:
Generic[T]An element type together with its dependencies in some context.
- class Builder(_self: 'ElementType[T]' = None, _dependencies: 'Sequence[ElementTypeTree[T]]' = None)
Bases:
Generic[T]- build()
- dependencies(dependencies)
- self_(self_)
- DEPENDENCIES = Name(value='dependencies')
- SELF = Name(value='self')
- TYPE_ = Name(value='hydra.pg.model.ElementTypeTree')
- static builder()
- dependencies: Sequence[ElementTypeTree[T]]
- with_dependencies(dependencies)
- with_self(_self)
- class hydra.pg.model.Graph(vertices: Mapping[V, Vertex[V]], edges: Mapping[V, Edge[V]])
Bases:
Generic[V]A graph; a self-contained collection of vertices and edges.
- class Builder(_vertices: 'Mapping[V, Vertex[V]]' = None, _edges: 'Mapping[V, Edge[V]]' = None)
Bases:
Generic[V]- build()
- edges(edges)
- vertices(vertices)
- EDGES = Name(value='edges')
- TYPE_ = Name(value='hydra.pg.model.Graph')
- VERTICES = Name(value='vertices')
- static builder()
- with_edges(edges)
- with_vertices(vertices)
- class hydra.pg.model.GraphSchema(vertices: Annotated[Mapping[VertexLabel, VertexType[T]], 'A unique vertex type for each vertex label which may occur in a graph'], edges: Annotated[Mapping[EdgeLabel, EdgeType[T]], 'A unique edge type for each edge label which may occur in a graph'])
Bases:
Generic[T]A graph schema; a vertex and edge types for the vertices and edges of a graph conforming to the schema.
- class Builder(_vertices: 'Mapping[VertexLabel, VertexType[T]]' = None, _edges: 'Mapping[EdgeLabel, EdgeType[T]]' = None)
Bases:
Generic[T]- build()
- edges(edges)
- vertices(vertices)
- EDGES = Name(value='edges')
- TYPE_ = Name(value='hydra.pg.model.GraphSchema')
- VERTICES = Name(value='vertices')
- static builder()
- edges: Annotated[Mapping[EdgeLabel, EdgeType[T]], 'A unique edge type for each edge label which may occur in a graph']
- vertices: Annotated[Mapping[VertexLabel, VertexType[T]], 'A unique vertex type for each vertex label which may occur in a graph']
- with_edges(edges)
- with_vertices(vertices)
- class hydra.pg.model.Label
Bases:
objectLabelVertex | LabelEdge
- EDGE = Name(value='edge')
- TYPE_ = Name(value='hydra.pg.model.Label')
- VERTEX = Name(value='vertex')
- class hydra.pg.model.LabelVertex(value: T)
Bases:
Node[VertexLabel]
- class hydra.pg.model.LazyGraph(vertices: Sequence[Vertex[V]], edges: Sequence[Edge[V]])
Bases:
Generic[V]A graph which does not assume that vertex or edge ids are unique. This is useful in mappings because the id specifications for vertices and/or edges may be non-unique.
- class Builder(_vertices: 'Sequence[Vertex[V]]' = None, _edges: 'Sequence[Edge[V]]' = None)
Bases:
Generic[V]- build()
- edges(edges)
- vertices(vertices)
- EDGES = Name(value='edges')
- TYPE_ = Name(value='hydra.pg.model.LazyGraph')
- VERTICES = Name(value='vertices')
- static builder()
- with_edges(edges)
- with_vertices(vertices)
- class hydra.pg.model.Property(key: Annotated[PropertyKey, 'They key of the property'], value: Annotated[V, 'The value of the property'])
Bases:
Generic[V]A key/value property.
- class Builder(_key: 'PropertyKey' = None, _value: 'V' = None)
Bases:
Generic[V]- build()
- key(key)
- value(value)
- KEY = Name(value='key')
- TYPE_ = Name(value='hydra.pg.model.Property')
- VALUE = Name(value='value')
- static builder()
- key: Annotated[PropertyKey, 'They key of the property']
- value: Annotated[V, 'The value of the property']
- with_key(key)
- with_value(value)
- class hydra.pg.model.PropertyKey(value: T)
Bases:
Node[str]A property key.
- TYPE_ = Name(value='hydra.pg.model.PropertyKey')
- class hydra.pg.model.PropertyType(key: Annotated[PropertyKey, "A property's key"], value: Annotated[T, "The type of a property's value"], required: Annotated[bool, 'Whether the property is required; values may be omitted from a property map otherwise'])
Bases:
Generic[T]The type of a property.
- class Builder(_key: 'PropertyKey' = None, _value: 'T' = None, _required: 'bool' = None)
Bases:
Generic[T]- build()
- key(key)
- required(required)
- value(value)
- KEY = Name(value='key')
- REQUIRED = Name(value='required')
- TYPE_ = Name(value='hydra.pg.model.PropertyType')
- VALUE = Name(value='value')
- static builder()
- key: Annotated[PropertyKey, "A property's key"]
- required: Annotated[bool, 'Whether the property is required; values may be omitted from a property map otherwise']
- value: Annotated[T, "The type of a property's value"]
- with_key(key)
- with_required(required)
- with_value(value)
- class hydra.pg.model.Vertex(label: Annotated[VertexLabel, 'The label of the vertex'], id: Annotated[V, 'The unique identifier of the vertex'], properties: Annotated[Mapping[PropertyKey, V], 'A key/value map of vertex properties'])
Bases:
Generic[V]A vertex.
- class Builder(_label: 'VertexLabel' = None, _id: 'V' = None, _properties: 'Mapping[PropertyKey, V]' = None)
Bases:
Generic[V]- build()
- id(id)
- label(label)
- properties(properties)
- ID = Name(value='id')
- LABEL = Name(value='label')
- PROPERTIES = Name(value='properties')
- TYPE_ = Name(value='hydra.pg.model.Vertex')
- static builder()
- id: Annotated[V, 'The unique identifier of the vertex']
- label: Annotated[VertexLabel, 'The label of the vertex']
- properties: Annotated[Mapping[PropertyKey, V], 'A key/value map of vertex properties']
- with_id(id)
- with_label(label)
- with_properties(properties)
- class hydra.pg.model.VertexLabel(value: T)
Bases:
Node[str]The label of a vertex. The default (null) vertex is represented by the empty string.
- TYPE_ = Name(value='hydra.pg.model.VertexLabel')
- class hydra.pg.model.VertexType(label: Annotated[VertexLabel, 'The label of any vertex of this vertex type'], id: Annotated[T, 'The type of the id of any vertex of this vertex type'], properties: Annotated[Sequence[PropertyType[T]], 'A list of property types. The types are ordered for the sake of applications in which property order is significant.'])
Bases:
Generic[T]The type of a vertex.
- class Builder(_label: 'VertexLabel' = None, _id: 'T' = None, _properties: 'Sequence[PropertyType[T]]' = None)
Bases:
Generic[T]- build()
- id(id)
- label(label)
- properties(properties)
- ID = Name(value='id')
- LABEL = Name(value='label')
- PROPERTIES = Name(value='properties')
- TYPE_ = Name(value='hydra.pg.model.VertexType')
- static builder()
- id: Annotated[T, 'The type of the id of any vertex of this vertex type']
- label: Annotated[VertexLabel, 'The label of any vertex of this vertex type']
- properties: Annotated[Sequence[PropertyType[T]], 'A list of property types. The types are ordered for the sake of applications in which property order is significant.']
- with_id(id)
- with_label(label)
- with_properties(properties)
- class hydra.pg.model.VertexWithAdjacentEdges(vertex: Annotated[Vertex[V], 'The focus vertex'], ins: Annotated[Sequence[AdjacentEdge[V]], 'An adjacency list of edges in which the focus vertex is the head (in-vertex) of the edge'], outs: Annotated[Sequence[AdjacentEdge[V]], 'An adjacency list of edges in which the focus vertex is the tail (out-vertex) of the edge'])
Bases:
Generic[V]A vertex together with any outgoing and/or incoming edges; a vertex object.
- class Builder(_vertex: 'Vertex[V]' = None, _ins: 'Sequence[AdjacentEdge[V]]' = None, _outs: 'Sequence[AdjacentEdge[V]]' = None)
Bases:
Generic[V]- build()
- ins(ins)
- outs(outs)
- vertex(vertex)
- INS = Name(value='ins')
- OUTS = Name(value='outs')
- TYPE_ = Name(value='hydra.pg.model.VertexWithAdjacentEdges')
- VERTEX = Name(value='vertex')
- static builder()
- ins: Annotated[Sequence[AdjacentEdge[V]], 'An adjacency list of edges in which the focus vertex is the head (in-vertex) of the edge']
- outs: Annotated[Sequence[AdjacentEdge[V]], 'An adjacency list of edges in which the focus vertex is the tail (out-vertex) of the edge']
- with_ins(ins)
- with_outs(outs)
- with_vertex(vertex)