5.2.21. xgt.Edge¶
- class xgt.Edge(mapping=None, *, container_map=None, validation_id=0)¶
Represents an edge from an edge frame providing access to the properties and the frame the edge belongs to.
The user shouldn’t manually construct these. They will be constructed by calls to get_data().
The class is implemented as a dictionary with the following keys:
‘id’: Row ID
‘metadata’: dict containing frame metadata:
‘name’: Edge frame name
‘schema’: Frame schema
‘source_name’: Source vertex frame name
‘target_name’: Target vertex frame name
‘source_key’: Source vertex key column name
‘target_key’: Target vertex key column name
‘properties’: dict mapping property names to values
See
TableRowfor the identity and round-trip semantics shared by all element classes.Experimental: The API of this class may change in future releases.
Attributes
The element's
elementId()string,"{rowid}:{commit_id}"-- a stable, round-trippable reference to this element.The frame the element belongs to.
The position of the element's row in its frame.
A dictionary of the properties of the element.
- property element_id: str¶
The element’s
elementId()string,"{rowid}:{commit_id}"– a stable, round-trippable reference to this element. Pass it back into a query withWHERE elementId(v) = $idvalto select this element in O(1), or compare two elements’element_idvalues to check identity and version.The token is opaque: treat it as a parseable string, not a durable key. A delete anywhere in the element’s frame invalidates it (see the server
elementId()documentation).Added in version 2.7.0.
Notes
The commit portion is the source frame’s delete id as captured when the result was written, so for an element a query returned this equals the server’s
elementId(v)for the same element, whichever query returned it. A row id inserted directly into a ROWID column carries a conservative upper-bound id instead when the insert never read the frame it references; that can differ numerically from a same-elementelementId(v)but validates the same way, rejecting on the first delete in the source frame, so the reference still round-trips.
- property frame: TableFrame | VertexFrame | EdgeFrame¶
The frame the element belongs to.
- property position: int¶
The position of the element’s row in its frame.
- property properties: dict[str, Any]¶
A dictionary of the properties of the element. The keys are the property names.