fluxion.jsongraph.objects.edge module
- class fluxion.jsongraph.objects.edge.Edge(source, target, relation=None, directed=None, metadata=None)
Bases:
objectEdge class representing a edge in the JSON Graph Format.
- DIRECTED = 'directed'
- METADATA = 'metadata'
- RELATION = 'relation'
- SOURCE = 'source'
- TARGET = 'target'
- get_metadata()
Get the metadata of the edge.
- Returns:
dictionary the metadata of the edge if set, else None
- get_relation()
Get relationname of the edge.
- Returns:
string the name of the relationship if set, else None
- get_source()
Get source of the edge.
- Returns:
string the id of the source-node set
- get_target()
Get target of the edge.
- Returns:
string the id of the target-node set
- is_directed()
Get boolean indicating whether edge is directed.
- Returns:
bool True if edge is directed, if nothing set None
- set_directed(directed)
Method to set the edge directed or not.
- Parameters:
not (directed -- bool boolean indicating whether the edge is directed or)
- set_metadata(metadata)
Method to set the metadata of the edge.
- Parameters:
edge (metadata -- dictionary the metadata to set on the)
- set_relation(relation)
Method to set the name of the relationship of the edge.
- Parameters:
relationship (relation -- string the name of the)
- set_source(source)
Method to the set source of the edge.
- Parameters:
set (source -- string the id of the source-node to)
- set_target(target)
Method to set the target of the edge.
- Parameters:
set (target -- string the id of the target-node to)
- to_JSON()
Convert the edge to JSON.
Creates a dictionary object of the edge conforming to the JSON Graph Format.
- Returns:
dictionary the edge as dictionary ready to serialize