@@ -168,7 +168,6 @@ def transform_result(cypher_record,
168168 # Each path is an array of nodes and edges like [n1, n2, n3, e1, e2, e3],
169169 # where nodes are node_ids from the graph and edges are element_ids of relationships from the graph.
170170 for path in paths :
171- print (path )
172171 # Map results/paths to their corresponding qnodes and qedges
173172 qnode_id_to_results = {qnode_id : (qnode , result_node_id ) for (qnode_id , qnode ), result_node_id in
174173 zip (qgraph_nodes .items (), path [:len (qgraph_nodes )])}
@@ -217,35 +216,25 @@ def transform_result(cypher_record,
217216 # Create TRAPI edge bindings
218217 for qedge_id , (qedge , path_edge ) in qedge_id_to_results .items ():
219218
220- print (" " ,qedge_id , qedge , path_edge )
221-
222219 # skip empty results
223- if not path_edge :
224- print ('bb1' )
220+ if ((not path_edge ) and (not path_edge == 0 )):
225221 continue
226222 # don't return subclass qedges in the edge bindings
227223 if qedge .get ("_subclass" , False ):
228- print ('bb2' )
229224 continue
230225
231226 # find the knowledge graph edge id for the element id from the path edge
232227 edge_element_id = path_edge
233228 graph_edge_id = element_id_to_edge_id [edge_element_id ]
234229
235- print (" edge_element_id:" , edge_element_id , " graph_edge_id:" , graph_edge_id )
236- print (" qewatt:" ,qedges_with_attached_subclass_edges .get (qedge_id , []))
237-
238230 # Check to see if the edge has subclass edges that are connected to it
239231 subclass_edge_ids = []
240232 superclass_node_ids = {}
241233 for (subclass_subject_or_object , subclass_qedge_id , superclass_qnode_id ) in \
242234 qedges_with_attached_subclass_edges .get (qedge_id , []):
243235 # If so, check to see if there are results for it
244- print ("-" ,subclass_qedge_id )
245236 qedge , subclass_edge_element_ids = qedge_id_to_results [subclass_qedge_id ]
246- print ("--" ,qedge ,subclass_edge_element_ids )
247237 qedge , subclass_edge_element_ids = qedge_id_to_results [subclass_qedge_id ]
248- print ("-?-" ,qedge ,subclass_edge_element_ids )
249238 if subclass_edge_element_ids :
250239 # If path_edge is Truthy, it means the subclass was used in the result.
251240 # For subclass edges, path result is a list of element ids, due to being a variable length edge.
@@ -254,14 +243,12 @@ def transform_result(cypher_record,
254243
255244 qnode , superclass_result_node_id = qnode_id_to_results [superclass_qnode_id ]
256245 superclass_node_ids [subclass_subject_or_object ] = superclass_result_node_id
257- print ("-=-" ,subclass_edge_ids )
258246
259247 if subclass_edge_ids :
260248 # make a composite id with all of their kg edge ids
261249 composite_edge_ids = [graph_edge_id ] + subclass_edge_ids
262250 composite_edge_id = "_" .join (composite_edge_ids )
263251 aux_graph_id = f"aux_{ composite_edge_id } "
264- print (" " ,aux_graph_id )
265252 if aux_graph_id not in aux_graphs :
266253 aux_graphs [aux_graph_id ] = {
267254 "edges" : composite_edge_ids ,
0 commit comments