Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unclear method name extract_nodes #390

Open
kwang2049 opened this issue Jan 13, 2023 · 1 comment
Open

Unclear method name extract_nodes #390

kwang2049 opened this issue Jan 13, 2023 · 1 comment

Comments

@kwang2049
Copy link
Collaborator

kwang2049 commented Jan 13, 2023

The method name cannot reflect its function clearly:

async def extract_nodes(self,kg_name, nids):
"""Returns all nodes which go in or out a given node.
Args:
kg_name (str): Name of the knowledge graph.
nids (List[str]]): List of nodes for which the in- and out-nodes should be retrieved.
"""
edges = await self.edges_in_out_msearch(kg_name, nids)
results_nids = [{} for _ in nids]
for i,nid in enumerate(nids):
extra_nodes =[]
for edge in edges[nid].values():
if edge["in_id"] == nid:
extra_node = edge["out_id"]
else:
extra_node = edge["in_id"]
extra_nodes.append(extra_node)
results_nids[i] = {nid:set(extra_nodes)}
return results_nids

And why do we need this?

@kwang2049
Copy link
Collaborator Author

@SevenDaysDA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant