MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / add_data

Method add_data

easygraph/readwrite/graphml.py:560–572  ·  view source on GitHub ↗

Make a data element for an edge or a node. Keep a log of the type in the keys table.

(self, name, element_type, value, scope="all", default=None)

Source from the content-addressed store, hash-verified

558 return new_id
559
560 def add_data(self, name, element_type, value, scope="all", default=None):
561 """
562 Make a data element for an edge or a node. Keep a log of the
563 type in the keys table.
564 """
565 if element_type not in self.xml_type:
566 raise eg.EasyGraphError(
567 f"GraphML writer does not support {element_type} as data values."
568 )
569 keyid = self.get_key(name, self.get_xml_type(element_type), scope, default)
570 data_element = self.myElement("data", key=keyid)
571 data_element.text = str(value)
572 return data_element
573
574 def add_attributes(self, scope, xml_obj, data, default):
575 """Appends attribute data to edges or nodes, and stores type information

Callers 2

add_graph_elementMethod · 0.95
add_attributesMethod · 0.80

Calls 2

get_keyMethod · 0.95
get_xml_typeMethod · 0.80

Tested by

no test coverage detected