Discussion Forum

Query from BioGrakn Text Mining Use Case not termining

I’m still trying to reproduce the BioGrakn Text Mining Use Case from the White Paper “Text Mined Knowledge Graphs” with the aim of building a text mined knowledge graph out of my (non-biomedical) document collection later on, using Client Java. Now I’m trying to reproduce the queries from the White Paper. The first one aks what knowledge is extracted from a specific PubMed article:
match $p isa pubmed-article, has pmid "27246822"; $r ($p, $k) isa knowledge-extraction; get ;
This works fine in the Grakn Workbase and displays all extracted knowledge, but the same query for Client Java does not termine and does not return the entities and relations I’m interested in.

    GraqlGet knowledgeFromPubMedArticleQuery = Graql.match(
    		var("p").isa("pubmed-article").has("pmid", "27246822"),
    		var("r").isa("knowledge-extraction").rel("p").rel("k")
    		).get();
    
    List<ConceptMap> answers = transaction.execute(knowledgeFromPubMedArticleQuery);
    
    for (ConceptMap answer : answers) {
        System.out.println(answer.get("p").asEntity());
        System.out.println(answer.get("r").asRelation());
    }

Am I getting something wrong here? Do you have any ideas on what could be the problem here? Any help is highly appreciated.

Hi - what happens if you run the match...get query in grakn console as opposed to workbase and client-java?

It just won’t termine as well…

How long are you waiting? I’ve spun a BioGrakn instance on google cloud and it appears to terminate in about 10 seconds.

You could also try a small variation of the query by leaving out the type of pubmed-article and see if it helps: match $p has pmid "27246822"; $r ($p, $k) isa knowledge-extraction; get ;

Great, now it terminates instantly and returns some results - concerning those I have another follow-up question :wink: Thanks for the effort!

Out of curiosity, did leaving out the type of $p speed up the query? This is a fault in the query planner that we are actively working on.
Glad it worked!

Yes - it did speed up the query, that’s what I intended :slight_smile: It’s great you’re working on this!