ExposuresProvider/cam-kp-api

Timeout on Blazegraph on testRelatedToQuery

gaurav opened this issue · 0 comments

The following query (see also on Yasgui) is generated from testRelatedToQuery in PR #499 results in a TimeoutException on Blazegraph. May be related to #517.

PREFIX hint: <http://www.bigdata.com/queryHints#>

          SELECT DISTINCT  ?e0  ?n0_type  ?n1_type 
               (GROUP_CONCAT(DISTINCT ?g; SEPARATOR='|') AS ?graphs)
               (GROUP_CONCAT(DISTINCT ?d; SEPARATOR='|') AS ?derivedFrom)
          WHERE {
             ?n0 <http://www.openrdf.org/schema/sesame#directType> ?n0_type .
                  ?n0_type <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?n0_class .
               ?n1 <http://www.openrdf.org/schema/sesame#directType> ?n1_type .
                  ?n1_type <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?n1_class .
              
            OPTIONAL { ?g <http://www.w3.org/ns/prov#wasDerivedFrom> ?d }
            {
              SELECT  ?e0  ?n0  ?n1  ?g
              WHERE {
                
               VALUES ?n0_class {  <https://w3id.org/biolink/vocab/GeneOrGeneProduct>  }
                      ?n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?n0_class .
                       VALUES ?n1_class {  <https://w3id.org/biolink/vocab/BiologicalProcess>  }
                      ?n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?n1_class .
                      
              GRAPH ?g {
                 FILTER( ?e0 IN ( <http://purl.obolibrary.org/obo/RO_0002565>, <http://purl.obolibrary.org/obo/RO_0000057>, <http://purl.obolibrary.org/obo/RO_0002087>, <http://purl.obolibrary.org/obo/RO_0002500>, <http://www.w3.org/2004/02/skos/core#narrowMatch>, <http://purl.obolibrary.org/obo/RO_0004007>, <http://purl.obolibrary.org/obo/RO_0002131>, <http://purl.obolibrary.org/obo/RO_0002206>, <http://purl.obolibrary.org/obo/RO_0002436>, <http://purl.obolibrary.org/obo/RO_0002160>, <http://purl.obolibrary.org/obo/RO_0001025>, <http://purl.obolibrary.org/obo/RO_0002093>, <http://purl.obolibrary.org/obo/RO_0002356>, <http://www.w3.org/2004/02/skos/core#relatedMatch>, <http://purl.obolibrary.org/obo/RO_0002216>, <http://purl.obolibrary.org/obo/BFO_0000063>, <http://purl.obolibrary.org/obo/RO_0002432>, <http://purl.obolibrary.org/obo/BFO_0000051>, <http://purl.obolibrary.org/obo/RO_0002349>, <http://purl.obolibrary.org/obo/RO_0002204>, <http://purl.obolibrary.org/obo/RO_0002488>, <http://purl.obolibrary.org/obo/RO_0004034>, <http://purl.obolibrary.org/obo/RO_0002497>, <http://purl.obolibrary.org/obo/RO_0002292>, <http://purl.obolibrary.org/obo/RO_0004033>, <http://purl.obolibrary.org/obo/RO_0001015>, <http://purl.obolibrary.org/obo/RO_0002434>, <http://purl.obolibrary.org/obo/RO_0002263>, <http://purl.obolibrary.org/obo/RO_0002212>, <http://purl.obolibrary.org/obo/RO_0002496>, <http://purl.obolibrary.org/obo/RO_0002331>, <http://purl.obolibrary.org/obo/RO_0002608>, <http://purl.obolibrary.org/obo/RO_0002314>, <http://purl.obolibrary.org/obo/RO_0002449>, <http://purl.obolibrary.org/obo/RO_0002333>, <http://purl.obolibrary.org/obo/RO_0002298>, <http://purl.obolibrary.org/obo/RO_0000056>, <http://purl.obolibrary.org/obo/RO_0002229>, <http://purl.obolibrary.org/obo/RO_0004032>, <http://translator.renci.org/ubergraph-axioms.ofn#acts_upstream_of_o_enabled_by>, <http://purl.obolibrary.org/obo/RO_0000052>, <http://purl.obolibrary.org/obo/BFO_0000066>, <http://www.w3.org/2004/02/skos/core#exactMatch>, <http://www.w3.org/2000/01/rdf-schema#subClassOf>, <http://purl.obolibrary.org/obo/RO_0002588>, <http://www.w3.org/2000/01/rdf-schema#subPropertyOf>, <http://purl.obolibrary.org/obo/RO_0002348>, <http://purl.obolibrary.org/obo/BFO_0000062>, <http://purl.obolibrary.org/obo/RO_0002211>, <http://www.w3.org/2004/02/skos/core#closeMatch>, <http://purl.obolibrary.org/obo/RO_0002224>, <http://purl.obolibrary.org/obo/RO_0002450>, <http://purl.obolibrary.org/obo/RO_0002205>, <http://purl.obolibrary.org/obo/RO_0002604>, <http://purl.obolibrary.org/obo/RO_0002448>, <http://purl.obolibrary.org/obo/RO_0002344>, <http://purl.obolibrary.org/obo/RO_0002232>, <http://purl.obolibrary.org/obo/RO_0002338>, <http://purl.obolibrary.org/obo/RO_0002592>, <http://purl.obolibrary.org/obo/RO_0002315>, <http://purl.obolibrary.org/obo/RO_0002234>, <http://purl.obolibrary.org/obo/RO_0002327>, <http://purl.obolibrary.org/obo/RO_0002492>, <http://purl.obolibrary.org/obo/RO_0002090>, <http://purl.obolibrary.org/obo/RO_0002412>, <http://purl.obolibrary.org/obo/RO_0002296>, <http://purl.obolibrary.org/obo/GOREL_0001006>, <http://purl.obolibrary.org/obo/RO_0002230>, <http://purl.obolibrary.org/obo/RO_0002299>, <http://purl.obolibrary.org/obo/RO_0002264>, <http://purl.obolibrary.org/obo/RO_0002092>, <http://purl.obolibrary.org/obo/RO_0002084>, <http://purl.obolibrary.org/obo/RO_0002297>, <http://purl.obolibrary.org/obo/RO_0004009>, <http://purl.obolibrary.org/obo/RO_0002223>, <http://purl.obolibrary.org/obo/RO_0002339>, <http://www.w3.org/2004/02/skos/core#broadMatch>, <http://purl.obolibrary.org/obo/UPHENO_0000001>, <http://purl.obolibrary.org/obo/RO_0002313>, <http://purl.obolibrary.org/obo/RO_0004008>, <http://purl.obolibrary.org/obo/RO_0002326>, <http://purl.obolibrary.org/obo/BFO_0000050>, <http://purl.obolibrary.org/obo/RO_0002220>, <http://purl.obolibrary.org/obo/RO_0001019>, <http://purl.obolibrary.org/obo/RO_0002215>, <http://purl.obolibrary.org/obo/RO_0002231>, <http://purl.obolibrary.org/obo/RO_0000053>, <http://purl.obolibrary.org/obo/RO_0002411>, <http://purl.obolibrary.org/obo/RO_0004035>, <http://purl.obolibrary.org/obo/RO_0002213>, <http://purl.obolibrary.org/obo/RO_0002590>, <http://purl.obolibrary.org/obo/RO_0002328>, <http://purl.obolibrary.org/obo/RO_0002233> ) )
                ?n0 ?e0 ?n1 .
              }
            
              }
            }
            hint:Prior hint:runFirst true .
          }
          GROUP BY  ?e0  ?n0_type  ?n1_type 
           LIMIT 10

Here is the code that executes these tests:

val testRelatedToQuery = suite("testRelatedToQuery")(
testM("test related_to query") {
val n0Node = TRAPIQueryNode(None, Some(List(BiolinkClass("GeneOrGeneProduct"))), None)
val n1Node = TRAPIQueryNode(None, Some(List(BiolinkClass("BiologicalProcess"))), None)
val e0Edge = TRAPIQueryEdge(Some(List(BiolinkPredicate("related_to"))), "n0", "n1", None)
val queryGraph = TRAPIQueryGraph(Map("n0" -> n0Node, "n1" -> n1Node), Map("e0" -> e0Edge))
val message = TRAPIMessage(Some(queryGraph), None, None)
val requestBody = TRAPIQuery(message, None)
for {
response <- runTest(requestBody, 10)
_ = Files.writeString(Paths.get("src/it/resources/test-related-to-query.json"), response)
} yield assert(response)(isNonEmptyString)
}
)