The original query: {{{ SELECT ?it1 ?st1 ?p01 ?x01 ?p02 ?x02 ?p03 WHERE {?it1 ?st1 . ?it1 ?p01 ?x01 . ?x01 ?p02 ?x02 . ?p03 ?x02 . FILTER (isIRI(?it1) && isIRI(?x01) && isIRI(?x02)) FILTER (?it1 != ?x01) FILTER (?it1 != ?x02) FILTER (?x01 != ?x02) FILTER (str(?p01) NOT IN ("http://rdfs.org/ns/void#inDataset", "http://bio2rdf.org/omim_vocabulary:refers-to", "http://bio2rdf.org/omim_vocabulary:article", "http://bio2rdf.org/omim_vocabulary:mapping-method", "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://www.w3.org/2000/01/rdf-schema#subClassOf", "http://bioportal.bioontology.org/ontologies/umls/hasSTY")) FILTER (str(?p02) NOT IN ("http://rdfs.org/ns/void#inDataset", "http://bio2rdf.org/omim_vocabulary:refers-to", "http://bio2rdf.org/omim_vocabulary:article", "http://bio2rdf.org/omim_vocabulary:mapping-method", "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://www.w3.org/2000/01/rdf-schema#subClassOf", "http://bioportal.bioontology.org/ontologies/umls/hasSTY")) FILTER (str(?p03) NOT IN ("http://rdfs.org/ns/void#inDataset", "http://bio2rdf.org/omim_vocabulary:refers-to", "http://bio2rdf.org/omim_vocabulary:article", "http://bio2rdf.org/omim_vocabulary:mapping-method", "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://www.w3.org/2000/01/rdf-schema#subClassOf", "http://bioportal.bioontology.org/ontologies/umls/hasSTY")) FILTER (str(?st1) IN ("http://www.w3.org/1999/02/22-rdf-syntax-ns#type", "http://www.w3.org/2000/01/rdf-schema#subClassOf", "http://bioportal.bioontology.org/ontologies/umls/hasSTY"))} LIMIT 10 }}} ==Test 1 == '''FedX:''' Rewriting the query by filling the predicate parts: {{{ select ?s1 ?o1 ?o2 where{ ?s1 . ?s1 ?o1. ?o1 ?o2. ?o2. } }}} {{{ select ?s1 ?o1 ?o2  where{ ?s1 ?p1 . ?s1    ?o1. ?o1   ?o2. ?o2. } }}} {{{ select ?s1 ?o1 ?o2  where{ ?s1 ?P1 . ?s1   ?P2 ?o1. ?o1   ?o2. ?o2. } }}} ALl of these three queries can be finished within 5 seconds. {{{ select ?s ?p1 ?o1 ?o2 where{ ?s . ?s ?p2 ?o1. ?o1 ?p3 ?o2. ?o2.} }}} Error while using the FedX CLI. System will exit. Details: -1 As for the original query,the following error occurs: Exception in thread "pool-31-thread-2" Exception in thread "Union Scheduler_12" java.lang.OutOfMemoryError: Java heap space ==Test 2 == ''' Virtuoso:''' {{{ select ?s1 ?o1 ?o2 where{ service { ?o2.} service { ?s1 . ?s1 ?o1. ?o1 ?o2.} } }}} OK! {{{ select ?s1 ?o1 ?o2 where{ service { ?s1 . ?s1 ?o1. ?o1 ?o2.} service { ?o2.} } }}} wrong! {{{ Virtuoso RDFZZ Error DB.DBA.SPARQL_REXEC('http://pharmgkb.bio2rdf.org/sparql', ...) has received result with unexpected variable name 'stubvar11' }}} '''Conclusion''' 1. Virtuoso requires explicitly specified Service keyword, namely SPARQL endpoints; 2. Even with the explicitly specified SPARQL endpoints, queries may not get