Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions query_service/core/routers/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@ async def get_named_graphs():
}
return response_graph

@router.get("query/xref-to-bkbit")
async def get_bkbit_id(xref):
query_bkbit_id = f"""
PREFIX biolink: <https://w3id.org/biolink/vocab/>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@puja since we are using the named graphs, please update the query to include the named graphs. I would suggest to include the named graph as one of the input that you can request from the user.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@puja-trivedi could you also address this issue?

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?bkbit_id
WHERE {{
?bkbit_id biolink:xref "{xref}"^^xsd:anyURI .
}}
"""

response = fetch_data_gdb(query_bkbit_id)
return {
"xref": xref,
"matched_ids": [
binding["bkbit_id"]["value"]
for binding in response["message"]["results"]["bindings"]
]
}


@router.get("/query/sparql/", include_in_schema=False)
async def sparql_query(
Expand Down