Skip to content

Commit

Permalink
Add /predicates endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickkwang committed Mar 26, 2021
1 parent 3132350 commit 99f7823
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ def wrapper(*args, request=None, **kwargs):
for route in ROUTER.routes:
APP.add_api_route(
route.path,
prepare_output(route.endpoint),
(
prepare_output(route.endpoint)
if route.path != "/predicates" else
route.endpoint
),
responses={
200: {
"content": {"text/tabular": {}},
Expand Down
24 changes: 24 additions & 0 deletions handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,30 @@ def knowledge_graph_schema(
return {"return value": return_value}


@ROUTER.get(
"/predicates",
tags=["reasoner"],
)
def predicates():
"""Get meta-knowledge graph."""
categories = [
"biolink:ActivityAndBehavior",
"biolink:ChemicalSubstance",
"biolink:Disease",
"biolink:Drug",
"biolink:Environment",
"biolink:NamedThing",
"biolink:PhenotypicFeature",
]
return {
sub: {
obj: ["biolink:correlated_with"]
for obj in categories
}
for sub in categories
}


with open("examples/knowledge_graph_overlay.json") as stream:
kg_overlay_example = json.load(stream)

Expand Down

0 comments on commit 99f7823

Please sign in to comment.