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

fix: warn+terminate if edge drops all results #87

Merged
merged 1 commit into from
Feb 2, 2022
Merged

fix: warn+terminate if edge drops all results #87

merged 1 commit into from
Feb 2, 2022

Conversation

tokebe
Copy link
Member

@tokebe tokebe commented Jan 27, 2022

Addresses cases where sub-queries return results, but those results aren't kept because they don't match the opposing qNode ID(s).

After updating edge results, check if the edge still has any results and terminate the query if it doesn't, with a warning to the user via TRAPI logs.

@colleenXu
Copy link
Contributor

colleenXu commented Jan 28, 2022

Example queries that would get a 500 error with the current code, and are now correctly handled by this PR:

the tyrosine-phenylalanine query from the linked issue

POST to http://localhost:3000/v1/smartapi/1d288b3a3caf75d541ffaae3aab386c8/query (semmeddb thru BTE specifically)

{
  "message": {
    "query_graph": {
      "edges": {
        "e00": {
          "subject": "n00",
          "object": "n01",
          "predicates": [
            "biolink:derives_from"
          ]
        }
      },
      "nodes": {
        "n00": {
          "categories": [
            "biolink:Polypeptide"
          ],
          "ids": [
            "UMLS:C0041485"
          ]
        },
        "n01": {
          "categories": [
            "biolink:ChemicalEntity"
          ],
          "ids": [
            "UMLS:C0031453"
          ]
        }
      }
    }
  }
}
one-hop Explain related to demo query D3
{
  "message": {
    "query_graph": {
      "edges": {
        "e00": {
          "subject": "n00",
          "object": "n01"
        }
      },
      "nodes": {
        "n00": {
          "ids": ["DRUGBANK:DB00715"],
          "categories": ["biolink:SmallMolecule"]
        },
        "n01": {
          "ids": ["DOID:1936"],
          "categories": ["biolink:Disease"]
        }
      }
    }
  }
}
two-hop Explain related to demo query A2a
{
    "message": {
        "query_graph": {
            "edges": {
                "e01": {
                    "object": "n0",
                    "subject": "n1",
                    "predicates": [
                        "biolink:entity_negatively_regulates_entity"
                    ]
                },
                "e02": {
                    "object": "n1",
                    "subject": "n2",
                    "predicates":  [
                        "biolink:increases_abundance_of", 
                        "biolink:increases_expression_of", 
                        "biolink:increases_stability_of", 
                        "biolink:increases_uptake_of", 
                        "biolink:decreases_degradation_of", 
                        "biolink:increases_secretion_of", 
                        "biolink:increases_metabolic_processing_of", 
                        "biolink:increases_folding_of", 
                        "biolink:increases_localization_of", 
                        "biolink:increases_synthesis_of", 
                        "biolink:increases_response_to", 
                        "biolink:increases_splicing_of", 
                        "biolink:increases_mutation_rate_of", 
                        "biolink:increases_transport_of", 
                        "biolink:increases_activity_of", 
                        "biolink:increases_molecular_modification_of", 
                        "biolink:increases_molecular_interaction"
                    ]
                }
            },
            "nodes": {
                "n0": {
                    "ids": ["NCBIGene:23221"],
                    "categories": ["biolink:Gene"]
                },
                "n1": {
                    "categories": ["biolink:Gene"]
                },
                "n2": {
                    "ids": ["PUBCHEM.COMPOUND:15627"],
                    "categories": ["biolink:SmallMolecule"]
                }
            }
        }
    }
}

@colleenXu
Copy link
Contributor

This looks to address the issue!

However, I'd want to test to see if there's any inadvertent changes to other queries (that are successful / have results).

@ariutta ariutta mentioned this pull request Jan 29, 2022
7 tasks
@colleenXu
Copy link
Contributor

I think of this issue as addressing the situation where two QNodes with IDs are connected to each other in the QGraph (like an Explain-style, but it can be more complex), but BTE doesn't actually find a connection between the two QNodes after all the sub-query execution and edge-management (intersecting records from different QEdges).

@colleenXu
Copy link
Contributor

@tokebe do we need a test for this behavior?

@tokebe
Copy link
Member Author

tokebe commented May 11, 2022

Yes, we could stand to test for this behavior.

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

Successfully merging this pull request may close these issues.

2 participants