Q: Query evaluation took too long I am using GraphDB Free 7.1 and I have created a repository with the default settings. I have uploaded a ttl file with 2.7 million triplets. I am trying to issue a query (not very complex, but quite complex) that should return 200k answers and the Workbench displays just 1k answers and the GraphDB log displays an exception 
10:52:19.580 [repositories/PaaSport] INFO  c.o.f.sesame.RepositoryController - POST query -1325396809
10:52:29.594 [repositories/PaaSport] ERROR o.o.h.s.r.TupleQueryResultView - Query interrupted
org.openrdf.query.QueryInterruptedException: Query evaluation took too long
...
10:52:29.594 [repositories/PaaSport] INFO  o.o.h.s.r.TupleQueryResultView - Request for query -1325396809 is finished

The query I'm using is:

SELECT DISTINCT ?offering ?Value 
WHERE {
    ?offering           a                          paasport:Offering ; 
                        DUL:satisfies              ?groundDescription . 
    ?groundDescription  paasport:offers            ?characteristic . 
    ?characteristic     a                          paasport:Storage ; 
                        DUL:hasParameter           ?par . 
    ?par                a                          paasport:StorageCapacity ; 
                        DUL:hasParameterDataValue  ?Value ; 
                        DUL:parametrizes           ?qualityValue . 
    ?qualityValue       uomvocab:measuredIn        ?Units .
    ?Units              a                          ?AppParMeasureUnitType . 
    ucum:GB             a                          ?AppParMeasureUnitType . 
    ?Units              a                          uomvocab:SimpleDerivedUnit . 
    ucum:GB             a                          uomvocab:SimpleDerivedUnit . 
    ucum:GB             uomvocab:derivesFrom       ?BasicUnit . 
    ?Units              uomvocab:derivesFrom       ?BasicUnit . 
    ucum:GB             uomvocab:modifierPrefix    ?prefix1 . 
    ?Units              uomvocab:modifierPrefix    ?prefix2 . 
    ?prefix1            uomvocab:factor            ?Factor1 . 
    ?prefix2            uomvocab:factor            ?Factor2 . 
       FILTER( xsd:double(?Factor2)*?Value = xsd:double(?Factor1)*4) 
  }

Since the query timeout is set to 0, I am not sure what causes the query interruption exception; most probably memory problems?
Very simple queries (e.g. return all instances of a certain class) work OK.
Are there any hints? Any help would be appreciated.
I can provide more details if needed.
Best,
Nick

A: Actually I have managed to cut down the query to the minimum, in order to be answered. The problem was mainly due to the following triple patterns:
ucum:GB  rdf:type              ?AppParMeasureUnitType .
ucum:GB  rdf:type              uomvocab:SimpleDerivedUnit .
ucum:GB  uomvocab:derivesFrom  ?BasicUnit .

If these are omitted and the corresponding variables in the original query are replaced by constant resources, then the query is answered.
Here is the resulting query:
SELECT DISTINCT ?offering ?Value 
WHERE {
    ?offering           rdf:type                   paasport:Offering .
    ?offering           DUL:satisfies              ?groundDescription .
    ?groundDescription  paasport:offers            ?characteristic .
    ?characteristic     rdf:type                   paasport:Storage  .
    ?characteristic     DUL:hasParameter           ?par .
    ?par                rdf:type                   paasport:StorageCapacity .
    ?par                DUL:hasParameterDataValue  ?Value .
    ?par                DUL:parametrizes           ?qualityValue .
    ?qualityValue       uomvocab:measuredIn        ?Units .
    ?Units              rdf:type                   ucum:UnitOf-infotech .
    ?Units              rdf:type                   uomvocab:SimpleDerivedUnit .
    ?Units              uomvocab:derivesFrom       <http://purl.oclc.org/NET/muo/ucum/unit/amount-of-information/byte> .
    ucum:GB             uomvocab:modifierPrefix    ?prefix1 .
    ?Units              uomvocab:modifierPrefix    ?prefix2 .
    ?prefix1            uomvocab:factor            ?Factor1 .
    ?prefix2            uomvocab:factor            ?Factor2 .
        FILTER( xsd:double(?Factor2)*?Value >= xsd:double(?Factor1)*2)
}


A: *

*Do you really need DISTINCT? That always slows down things, since it has to fetch all results in memory, sort them and uniq them before starting to serve.

*Do you need = or >= in the FILTER? If = then replace the filter with a BIND(...as ?Factor2), and put these things before searching for ?prefix2

*Have you profiled the query? http://graphdb.ontotext.com/documentation/standard/explain-plan.html
