The argument variable should be named something like names but nids:
|
@router.post( |
|
"/{kg_name}/subgraph/query_by_node_name", |
|
summary="summary", |
|
description="Get the subgraph of a given List of node-names and the number of hops", |
|
responses={ |
|
200: { |
|
#"model": DatastoreStats, |
|
"description": "The subgraph as a set of nodes and edges", |
|
}, |
|
404: {"description": "The subgraph could not be retrieved"}, |
|
}, |
|
#response_model=DatastoreStats, |
|
) |
|
async def subgraph_by_names( |
|
kg_name: str = Path(..., description="The knowledge graph name"), |
|
nids: set = Body(..., description="List of node names."), |
|
hops: int = Body(2, description="Number of hops to retrieve."), |
|
conn=Depends(get_kg_storage_connector), |
|
): |
|
# Need to handle if wrong kg_name was gave as an input |
|
subgraph = await conn.extract_subgraph_by_names(kg_name, nodes=nids, hops=hops) |
|
if subgraph is not None: |
|
return subgraph |
|
else: |
|
raise HTTPException(status_code=404) |
The argument variable should be named something like
namesbutnids:square-core/datastore-api/app/routers/kgs.py
Lines 331 to 355 in 41e9c58