|
@@ -59,7 +59,7 @@ class Verifier(object):
|
|
|
if node_typ not in self._available_types:
|
|
|
return {"OK": False, "error": "Type {} from instance model not in example models".format(node_typ)}
|
|
|
|
|
|
- return {"OK":True, "error":None}
|
|
|
+ return {"OK":True, "error":None, "affected":[]}
|
|
|
|
|
|
def verify_node_multiplicity(self):
|
|
|
"""
|
|
@@ -78,7 +78,7 @@ class Verifier(object):
|
|
|
if not commons.count_occurences(el, self._instance_model) >= min_occ:
|
|
|
return {"OK": False, "error": "Node with type {} needs to occur at least {} times".format(el, min_occ)}
|
|
|
|
|
|
- return {"OK": True, "error": None}
|
|
|
+ return {"OK": True, "error": None, "affected":[]}
|
|
|
|
|
|
def _get_attributes_of_all_types(self):
|
|
|
"""
|
|
@@ -140,7 +140,8 @@ class Verifier(object):
|
|
|
break
|
|
|
else:
|
|
|
# loop completed without break, so we did not find any key in example models
|
|
|
- return {"OK": False, "error": "No key {} for type {} in example models".format(attr.key, node_typ)}
|
|
|
+ return {"OK": False, "error": "No key {} for type {} in example models".format(attr.key, node_typ),
|
|
|
+ "affected":[node]}
|
|
|
|
|
|
# Check if mandatory attributes are present in instance model
|
|
|
attr_mandatory = {node_type:{} for node_type in self._available_types}
|
|
@@ -165,9 +166,10 @@ class Verifier(object):
|
|
|
for attr, mand in attr_mand.iteritems():
|
|
|
if mand:
|
|
|
if not attr in [x.key for x in node_attrs]:
|
|
|
- return {"OK": False, "error":"Attribute {} for type {} mandatory".format(attr, node_type)}
|
|
|
+ return {"OK": False, "error":"Attribute {} for type {} mandatory".format(attr, node_type),
|
|
|
+ "affected":[node]}
|
|
|
|
|
|
- return {"OK": True, "error": None}
|
|
|
+ return {"OK": True, "error": None, "affected":[]}
|
|
|
|
|
|
def verify_associations(self):
|
|
|
"""
|
|
@@ -200,7 +202,8 @@ class Verifier(object):
|
|
|
# instance model contains both types
|
|
|
for node in commons.all_nodes_with_type(self._instance_model, edge.n1):
|
|
|
if not commons.has_edge_to_type(self._instance_model, node, edge.n2):
|
|
|
- return {"OK":False, "error": "Edge between {} and {} mandatory".format(edge.n1, edge.n2)}
|
|
|
+ return {"OK":False, "error": "Edge between {} and {} mandatory".format(edge.n1, edge.n2),
|
|
|
+ "affected":[]}
|
|
|
|
|
|
# lastly, check if all edges in the instance model are actually supported
|
|
|
all_edges = mv.all_instances(self._instance_model, "Edge")
|
|
@@ -210,6 +213,7 @@ class Verifier(object):
|
|
|
src_type = commons.get_node_type(self._instance_model, src_id)
|
|
|
dest_type = commons.get_node_type(self._instance_model, dest_id)
|
|
|
if not commons.is_edge_supported(src_type, dest_type):
|
|
|
- return {"OK":False, "error": "Edge between {} and {} not supported".format(edge.n1, edge.n2)}
|
|
|
+ return {"OK":False, "error": "Edge between {} and {} not supported".format(edge.n1, edge.n2),
|
|
|
+ "affected":[src_id, dest_id]}
|
|
|
|
|
|
- return {"OK": True, "error": None}
|
|
|
+ return {"OK": True, "error": None, "affected":[]}
|