|
@@ -191,25 +191,31 @@ Void function model_delete_element(model : Element, name : String):
|
|
|
return
|
|
|
|
|
|
Element function read_attribute(model : Element, element : String, attribute : String):
|
|
|
- // Read out the value of an attribute
|
|
|
- Element attr_type
|
|
|
- Element attr_links
|
|
|
- Element attr_link
|
|
|
+ Integer i
|
|
|
+ Integer count
|
|
|
+ Element edge
|
|
|
+ Element edge_type
|
|
|
+ Element elem
|
|
|
|
|
|
- attr_type = find_attribute_type(model, element, attribute)
|
|
|
- attr_links = allOutgoingAssociationInstances(model, element, attr_type)
|
|
|
+ elem = model["model"][element]
|
|
|
+ count = read_nr_out(elem)
|
|
|
|
|
|
- while (list_len(attr_links) > 0):
|
|
|
- attr_link = set_pop(attr_links)
|
|
|
- return read_edge_dst(model["model"][attr_link])
|
|
|
+ i = 0
|
|
|
+ while (i < count):
|
|
|
+ edge = read_out(elem, i)
|
|
|
+ if (dict_in_node(model["type_mapping"], edge)):
|
|
|
+ edge_type = dict_read_node(model["type_mapping"], edge)
|
|
|
+ if (element_eq(edge_type, dict_read_edge(read_edge_src(edge_type), attribute))):
|
|
|
+ return read_edge_dst(edge)
|
|
|
+ i = i + 1
|
|
|
|
|
|
return read_root()
|
|
|
|
|
|
Void function unset_attribute(model : Element, element : String, attribute : String):
|
|
|
// Removes an attribute if it exists
|
|
|
- Element attr_type
|
|
|
+ String attr_type
|
|
|
Element attr_links
|
|
|
- Element attr_link
|
|
|
+ String attr_link
|
|
|
|
|
|
attr_type = find_attribute_type(model, element, attribute)
|
|
|
attr_links = allOutgoingAssociationInstances(model, element, attr_type)
|