|
@@ -196,7 +196,8 @@ class ModelverseState(object):
|
|
return (None, {status.FAIL_RDICTE_UNKNOWN: status.FAIL_RDICT_UNKNOWN,
|
|
return (None, {status.FAIL_RDICTE_UNKNOWN: status.FAIL_RDICT_UNKNOWN,
|
|
status.FAIL_RDICTE_UNCERTAIN: status.FAIL_RDICT_UNCERTAIN,
|
|
status.FAIL_RDICTE_UNCERTAIN: status.FAIL_RDICT_UNCERTAIN,
|
|
status.FAIL_RDICTE_OOB: status.FAIL_RDICT_OOB,
|
|
status.FAIL_RDICTE_OOB: status.FAIL_RDICT_OOB,
|
|
- status.FAIL_RDICTE_NOT_FOUND: status.FAIL_RDICT_NOT_FOUND}[s])
|
|
|
|
|
|
+ status.FAIL_RDICTE_NOT_FOUND: status.FAIL_RDICT_NOT_FOUND,
|
|
|
|
+ status.FAIL_RDICTE_AMBIGUOUS: status.FAIL_RDICT_AMBIGUOUS}[s])
|
|
return (self.edges[e][1], status.SUCCESS)
|
|
return (self.edges[e][1], status.SUCCESS)
|
|
|
|
|
|
def read_dict_keys(self, node):
|
|
def read_dict_keys(self, node):
|
|
@@ -216,6 +217,7 @@ class ModelverseState(object):
|
|
return (None, status.FAIL_RDICTE_OOB)
|
|
return (None, status.FAIL_RDICTE_OOB)
|
|
|
|
|
|
# Get all outgoing links
|
|
# Get all outgoing links
|
|
|
|
+ found = None
|
|
for e1 in self.outgoing.get(node, set()):
|
|
for e1 in self.outgoing.get(node, set()):
|
|
data_links = self.outgoing.get(e1, set())
|
|
data_links = self.outgoing.get(e1, set())
|
|
# For each link, we read the links that might link to a data value
|
|
# For each link, we read the links that might link to a data value
|
|
@@ -230,14 +232,21 @@ class ModelverseState(object):
|
|
if len(data_links) > 1:
|
|
if len(data_links) > 1:
|
|
return (None, status.FAIL_RDICTE_UNCERTAIN)
|
|
return (None, status.FAIL_RDICTE_UNCERTAIN)
|
|
else:
|
|
else:
|
|
- return (e1, status.SUCCESS)
|
|
|
|
- return (None, status.FAIL_RDICTE_NOT_FOUND)
|
|
|
|
|
|
+ if found is not None:
|
|
|
|
+ #raise Exception("Duplicate key: %s (%s <-> %s)!" % (v, found, e1))
|
|
|
|
+ return (None, status.FAIL_RDICTE_AMBIGUOUS)
|
|
|
|
+ found = e1
|
|
|
|
+ if found is not None:
|
|
|
|
+ return (found, status.SUCCESS)
|
|
|
|
+ else:
|
|
|
|
+ return (None, status.FAIL_RDICTE_NOT_FOUND)
|
|
|
|
|
|
def read_dict_node(self, node, value_node):
|
|
def read_dict_node(self, node, value_node):
|
|
e, s = self.read_dict_node_edge(node, value_node)
|
|
e, s = self.read_dict_node_edge(node, value_node)
|
|
if s != status.SUCCESS:
|
|
if s != status.SUCCESS:
|
|
return (None, {status.FAIL_RDICTNE_UNKNOWN: status.FAIL_RDICTN_UNKNOWN,
|
|
return (None, {status.FAIL_RDICTNE_UNKNOWN: status.FAIL_RDICTN_UNKNOWN,
|
|
status.FAIL_RDICTNE_UNCERTAIN: status.FAIL_RDICTN_UNCERTAIN,
|
|
status.FAIL_RDICTNE_UNCERTAIN: status.FAIL_RDICTN_UNCERTAIN,
|
|
|
|
+ status.FAIL_RDICTNE_AMBIGUOUS: status.FAIL_RDICTN_AMBIGUOUS,
|
|
status.FAIL_RDICTNE_OOB: status.FAIL_RDICTN_OOB,
|
|
status.FAIL_RDICTNE_OOB: status.FAIL_RDICTN_OOB,
|
|
status.FAIL_RDICTNE_NOT_FOUND: status.FAIL_RDICTN_NOT_FOUND}[s])
|
|
status.FAIL_RDICTNE_NOT_FOUND: status.FAIL_RDICTN_NOT_FOUND}[s])
|
|
return (self.edges[e][1], status.SUCCESS)
|
|
return (self.edges[e][1], status.SUCCESS)
|
|
@@ -245,7 +254,9 @@ class ModelverseState(object):
|
|
def read_dict_node_edge(self, node, value_node):
|
|
def read_dict_node_edge(self, node, value_node):
|
|
if node not in self.nodes and node not in self.edges:
|
|
if node not in self.nodes and node not in self.edges:
|
|
return (None, status.FAIL_RDICTNE_UNKNOWN)
|
|
return (None, status.FAIL_RDICTNE_UNKNOWN)
|
|
|
|
+
|
|
# Get all outgoing links
|
|
# Get all outgoing links
|
|
|
|
+ found = None
|
|
for e1 in self.outgoing.get(node, set()):
|
|
for e1 in self.outgoing.get(node, set()):
|
|
data_links = self.outgoing.get(e1, set())
|
|
data_links = self.outgoing.get(e1, set())
|
|
# For each link, we read the links that might link to a data value
|
|
# For each link, we read the links that might link to a data value
|
|
@@ -259,8 +270,14 @@ class ModelverseState(object):
|
|
if len(data_links) > 1:
|
|
if len(data_links) > 1:
|
|
return (None, status.FAIL_RDICTNE_UNCERTAIN)
|
|
return (None, status.FAIL_RDICTNE_UNCERTAIN)
|
|
else:
|
|
else:
|
|
- return (e1, status.SUCCESS)
|
|
|
|
- return (None, status.FAIL_RDICTNE_NOT_FOUND)
|
|
|
|
|
|
+ if found is not None:
|
|
|
|
+ #raise Exception("Duplicate key: %s (%s <-> %s)!" % (value_node, found, e1))
|
|
|
|
+ return (None, status.FAIL_RDICTNE_AMBIGUOUS)
|
|
|
|
+ found = e1
|
|
|
|
+ if found is not None:
|
|
|
|
+ return (found, status.SUCCESS)
|
|
|
|
+ else:
|
|
|
|
+ return (None, status.FAIL_RDICTNE_NOT_FOUND)
|
|
|
|
|
|
def read_reverse_dict(self, node, value):
|
|
def read_reverse_dict(self, node, value):
|
|
if node not in self.nodes and node not in self.edges:
|
|
if node not in self.nodes and node not in self.edges:
|