0

Is it possible to get the WHERE Clause from a Query org.apache.jena.query.Query ? Haven't found no info enywhere, no documentation anywhere.

Imagine I create a query from a String

String queryString = "    
SELECT ?name ?mbox
    WHERE
      { ?x foaf:name ?name .
        ?x foaf:mbox ?mbox }";

Query query = QueryFactory.create() ;

For example, I can get the variables that the query will request using the query.getResultVars()), but I cannot get any manner to get the WHERE clause/expression or however you wanna call. Just interested in getting this part:

  { ?x foaf:name ?name .
    ?x foaf:mbox ?mbox }

Here's Query API: https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/query/Query.html

f_puras
  • 2,521
  • 4
  • 33
  • 38
tremendows
  • 4,262
  • 3
  • 34
  • 51
  • 1
    `Query::getQueryPattern()` returns an object of type `Element`, which is basically the part of the WHERE clause. – UninformedUser Apr 26 '16 at 21:52
  • Thanks a lot @AKSW . Why have not written as an answer? I'll accept and can be useful for other people in the future, right? – tremendows Apr 27 '16 at 08:24

1 Answers1

1

Query::getQueryPattern() returns an object of type Element, which is basically the part of the WHERE clause.

UninformedUser
  • 8,397
  • 1
  • 14
  • 23