|
@@ -149,7 +149,7 @@ class ModelverseState(object):
|
|
|
""" % node)
|
|
|
if len(result) == 0:
|
|
|
return (None, status.FAIL_RV_NO_VALUE)
|
|
|
- return (result[0], status.SUCCESS)
|
|
|
+ return (list(result)[0][0], status.SUCCESS)
|
|
|
|
|
|
def read_outgoing(self, elem):
|
|
|
if not isinstance(elem, rdflib.BNode):
|
|
@@ -161,7 +161,7 @@ class ModelverseState(object):
|
|
|
_:%s MV:hasTarget ?link .
|
|
|
}
|
|
|
""" % elem)
|
|
|
- return (list(result), status.SUCCESS)
|
|
|
+ return ([i[0] for i in result], status.SUCCESS)
|
|
|
|
|
|
def read_incoming(self, elem):
|
|
|
if not isinstance(elem, rdflib.BNode):
|
|
@@ -173,7 +173,7 @@ class ModelverseState(object):
|
|
|
_:%s MV:hasSource ?link .
|
|
|
}
|
|
|
""" % elem)
|
|
|
- return (list(result), status.SUCCESS)
|
|
|
+ return ([i[0] for i in result], status.SUCCESS)
|
|
|
|
|
|
def read_edge(self, edge):
|
|
|
result = self.graph.query(
|
|
@@ -187,7 +187,7 @@ class ModelverseState(object):
|
|
|
if len(result) == 0:
|
|
|
return ([None, None], status.FAIL_RE_UNKNOWN)
|
|
|
else:
|
|
|
- return (list(result), status.SUCCESS)
|
|
|
+ return ([list(result)[0][0], list(result)[0][1]], status.SUCCESS)
|
|
|
|
|
|
def read_dict(self, node, value):
|
|
|
if not isinstance(node, rdflib.BNode):
|
|
@@ -205,7 +205,6 @@ class ModelverseState(object):
|
|
|
?attr_node MV:hasValue '%s' .
|
|
|
}
|
|
|
""" % (node, json.dumps(value))
|
|
|
- print(q)
|
|
|
result = self.graph.query(q)
|
|
|
if len(result) == 0:
|
|
|
return (None, status.FAIL_RDICT_NOT_FOUND)
|
|
@@ -224,7 +223,7 @@ class ModelverseState(object):
|
|
|
MV:hasTarget ?key .
|
|
|
}
|
|
|
""")
|
|
|
- return (list(result), status.SUCCESS)
|
|
|
+ return ([i[0] for i in result], status.SUCCESS)
|
|
|
|
|
|
def read_dict_edge(self, node, value):
|
|
|
if not isinstance(node, rdflib.BNode):
|
|
@@ -244,7 +243,7 @@ class ModelverseState(object):
|
|
|
""" % (node, value))
|
|
|
if len(result) == 0:
|
|
|
return (None, status.FAIL_RDICTE_NOT_FOUND)
|
|
|
- return (result[0], status.SUCCESS)
|
|
|
+ return (list(result)[0][0], status.SUCCESS)
|
|
|
|
|
|
def read_dict_node(self, node, value_node):
|
|
|
if not isinstance(node, rdflib.BNode):
|
|
@@ -262,7 +261,7 @@ class ModelverseState(object):
|
|
|
""" % (node, value))
|
|
|
if len(result) == 0:
|
|
|
return (None, status.FAIL_RDICTN_NOT_FOUND)
|
|
|
- return (result[0], status.SUCCESS)
|
|
|
+ return (list(result)[0][0], status.SUCCESS)
|
|
|
|
|
|
def read_dict_node_edge(self, node, value_node):
|
|
|
if not isinstance(node, rdflib.BNode):
|
|
@@ -278,7 +277,7 @@ class ModelverseState(object):
|
|
|
""" % (node, value))
|
|
|
if len(result) == 0:
|
|
|
return (None, status.FAIL_RDICTNE_NOT_FOUND)
|
|
|
- return (result[0], status.SUCCESS)
|
|
|
+ return (list(result)[0][0], status.SUCCESS)
|
|
|
|
|
|
def read_reverse_dict(self, node, value):
|
|
|
if not isinstance(node, rdflib.BNode):
|
|
@@ -296,7 +295,7 @@ class ModelverseState(object):
|
|
|
}
|
|
|
""" % (node, value))
|
|
|
|
|
|
- return (list(result), status.SUCCESS)
|
|
|
+ return ([i[0] for i in result], status.SUCCESS)
|
|
|
|
|
|
def delete_node(self, node):
|
|
|
if node == self.root:
|
|
@@ -318,7 +317,7 @@ class ModelverseState(object):
|
|
|
""")
|
|
|
# ... and remove them
|
|
|
for e in result:
|
|
|
- self.delete_edge(e)
|
|
|
+ self.delete_edge(e[0])
|
|
|
|
|
|
return (None, status.SUCCESS)
|
|
|
|
|
@@ -340,7 +339,7 @@ class ModelverseState(object):
|
|
|
""")
|
|
|
# ... and remove them
|
|
|
for e in result:
|
|
|
- self.delete_edge(e)
|
|
|
+ self.delete_edge(e[0])
|
|
|
|
|
|
return (None, status.SUCCESS)
|
|
|
|