Federated query gives: "Usupported combination of subqueries and service invocations"
1
1
Entering edit mode
5.8 years ago
cleb ▴ 70

I try to perform the following query on uniprot:

PREFIX rh:<http://rdf.rhea-db.org/>
PREFIX up:<http://purl.uniprot.org/core/>
PREFIX taxon:<http://purl.uniprot.org/taxonomy/>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT
       ?protein
       ?ecNumber
       ?reaction
       ?equation

WHERE {

    ?protein a up:Protein .
    ?protein up:reviewed true .
    ?taxon a up:Taxon .
    ?taxon up:scientificName ?name .
    VALUES ?taxonlist { taxon:83333 }
    {
        ?taxon rdfs:subClassOf ?taxonlist .
        ?protein up:organism ?taxon . 
    } UNION {
        ?protein up:organism ?taxonlist . 
    }

    ?protein up:enzyme|((up:component|up:domain)/up:enzyme) ?ecNumber .

  SERVICE <http://rdf.rhea-db.org/> {

    ?reaction rdfs:subClassOf rh:Reaction .
    ?reaction rh:status rh:Approved .
    ?reaction rh:equation ?equation .
    ?reaction rh:ec ?ecNumber .
  } 
}

which always results in the error:

VirtuosoException: SQ074: Line 36: SP031:
SPARQL compiler: Internal error: Usupported combination of subqueries and service invocations

When I remove the entire SERVICE part, it seems to work fine. Is there a way to perform a federated query from uniprot and if so, how?

uniprot linked-data sparql • 1.4k views
ADD COMMENT
1
Entering edit mode
2.4 years ago
De ▴ 10

Hi Cleb,

I just ran into the same issue, and with help of a colleague, we fixed the issue. Documentation link. We have implemented this approach in a different query, see example below.

I needed to add a SELECT within the SELECT clause, so the service query is executed after the initial request. Furthermore, adding double curly brackets after the first WHERE. Note that I executed this query in a Virtuoso powered SPARQL endpoint , and there is a difference for Blazegraph powered ones (see Wikidata example).

    SELECT DISTINCT ?pathwayRes (str(?wpid) as ?pathway) (str(?title) as ?pathwayTitle) ((substr(str(?COMPOUND),46)) as ?PubChem) 
WHERE{ 
  {
  SELECT ?pathwayRes (str(?wpid) as ?pathway) (str(?title) as ?pathwayTitle) ((substr(str(?COMPOUND),46)) as ?PubChem) 
    WHERE{
  VALUES ?wpid {"WP4224"^^xsd:string "WP4225"^^xsd:string "WP4571"^^xsd:string}

  ?gene a wp:Metabolite ;
    dcterms:identifier ?id ;
    dcterms:isPartOf ?pathwayRes ;
    wp:bdbPubChem ?COMPOUND .

  ?pathwayRes a wp:Pathway ;
    wp:organismName "Homo sapiens"^^xsd:string ;
    dcterms:identifier ?wpid ;
    dc:title ?title .
     }
  }
  SERVICE <https://idsm.elixir-czech.cz/sparql/endpoint/molmedb> {
   <http://identifiers.org/molmedb/MM00431> skos:exactMatch ?COMPOUND.
  filter (strstarts(str(?COMPOUND), 'http://rdf.ncbi.nlm.nih.gov/pubchem/compound/CID'))

  } 
}
ADD COMMENT

Login before adding your answer.

Traffic: 2426 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6