Browse Source

Fixed some bugs with RDF

Yentl Van Tendeloo 8 years ago
parent
commit
8734584f74

+ 5 - 0
hybrid_server/classes/mvkcontroller.xml

@@ -62,6 +62,8 @@
                 if commands is None:
                     break
                 reply = [self.mvs_operations[command[0]](*(command[1]))[0] for command in commands]
+                for c, r in zip(commands, reply):
+                    print("%s --> %s" % (c, r))
             ]]>
         </body>
     </method>
@@ -126,10 +128,12 @@
                         <script>
                             self.timeout = False
                             self.destination = None
+                            print("Execute")
                             if self.users:
                                 user = self.users.pop()
 
                                 # Check if there are values to input
+                                print("Execute")
                                 if self.input_queue[user]:
                                     source, args = self.input_queue[user].pop(0)
                                     for args_entry in args:
@@ -140,6 +144,7 @@
                                     self.all_failed = False
 
                                 # Now process for some steps, or until we are again blocked for input
+                                print("Rule")
                                 for x in xrange(200):
                                     self.execute_modelverse(user, "execute_rule", [])
 

+ 1 - 2
kernel/modelverse_kernel/main.py

@@ -66,7 +66,7 @@ class ModelverseKernel(object):
             elif inst_v is None:
                 raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
             else:
-                #print("%-30s(%s) -- %s" % (inst_v["value"], phase_v, username))
+                print("%-30s(%s) -- %s" % (inst_v["value"], phase_v, username))
                 gen = getattr(self, "%s_%s" % (inst_v["value"], phase_v))(user_root)
         elif inst_v is None:
             raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info, inst_v, phase_v))
@@ -421,7 +421,6 @@ class ModelverseKernel(object):
                                    ("CNV", ["finish"]),
                                   ]
             if variable is None:
-                print("READ " + str(var))
                 raise Exception("%s: not found as global: %s" % (self.debug_info, var_name))
 
             # Resolved a global, so this is a string

+ 6 - 4
state/modelverse_state/rdf.py

@@ -151,8 +151,6 @@ class ModelverseState(object):
                 ?link MV:hasSource <%s> .
             }
             """ % elem)
-        print(elem)
-        print("Result: " + str(len(result)))
         return ([i[0] for i in result], status.SUCCESS)
 
     def read_incoming(self, elem):
@@ -200,6 +198,9 @@ class ModelverseState(object):
         result = self.graph.query(q)
         if len(result) == 0:
             return (None, status.FAIL_RDICT_NOT_FOUND)
+        if len(result) != 1:
+            print(value)
+            raise Exception("Error!")
         return (list(result)[0][0], status.SUCCESS)
 
     def read_dict_keys(self, node):
@@ -305,8 +306,9 @@ class ModelverseState(object):
                 UNION
                 { ?edge MV:hasSource <%s> . }
             }
-            """)
+            """ % (node, node))
         # ... and remove them
+        print("Got related nodes: " + str(len(result)))
         for e in result:
             self.delete_edge(e[0])
 
@@ -327,7 +329,7 @@ class ModelverseState(object):
                 UNION
                 { ?edge MV:hasSource <%s> . }
             }
-            """)
+            """ % (edge, edge))
         # ... and remove them
         for e in result:
             self.delete_edge(e[0])