ranking-agent / strider

A TRAPI-compliant component of ARAGORN that queries distributed KPs and assembles answers to user questions.
MIT License
3 stars 0 forks source link

Subclass handling difficulties #391

Closed cbizon closed 2 months ago

cbizon commented 1 year ago

When a KP has information about a subclass, it returns it. Currently, dev strider is doing some odd things:

Test query:

{
    "message": {
        "query_graph": {
            "edges": {
                "e00": {
                    "subject": "chemical",
                    "object": "enrich_nodes",
                    "predicates": [
                        "biolink:has_adverse_event"
                    ]
                }
            },
            "nodes": {
                "chemical": {
                    "categories": [
                        "biolink:ChemicalEntity"
                    ]
                },
                "enrich_nodes": {
                    "ids": [
                        "HP:0001649"
                    ],
                    "categories": [
                        "biolink:NamedThing"
                    ]
                }
            }
        }
    },
    "workflow": [
        {
            "id": "lookup"
        }
    ]
}

Example result:

{
    "node_bindings": {
        "enrich_nodes": [
            {
                "id": "HP:0004755",
                "query_id": null,
                "attributes": null
            },
            {
                "id": "HP:0001649",
                "query_id": null,
                "attributes": null
            },
            {
                "id": "MONDO:0005477",
                "query_id": null,
                "attributes": null
            },
            {
                "id": "HP:0006688",
                "query_id": null,
                "attributes": null
            }
        ],
        "chemical": [
            {
                "id": "PUBCHEM.COMPOUND:1983",
                "query_id": null,
                "attributes": null
            }
        ]
    },
    "edge_bindings": {
        "e00": [
            {
                "id": "eaf304228027",
                "attributes": null
            },
            {
                "id": "74963d4d8451",
                "attributes": null
            },
            {
                "id": "bb883ccb0ef9",
                "attributes": null
            },
            {
                "id": "d72ec6cdce28",
                "attributes": null
            }
        ]
    },
    "score": null
}
  1. All the subclasses are merged into a single result when they hit the same chemicals. I think that this is incorrect; universal binding should dictate that these are all individual answers.
  2. in the cases where the subclass is bound to the qnode, the query_id should be "enrich_nodes" not null
maximusunc commented 2 months ago

We've updated the handling of subclasses a few times since this. Currently, we make any subclasses into aux graphs, and merging has also been updated in reasoner_pydantic. So I think we handle subclasses correctly now, but please reopen or create a new issue if you see other issues with subclasses.