```sparql
FILTER (isREF (?chebi_compound ))
```
is added to a generated query that is send to a remote SPARQL endpoint when using virtuoso v7.2.8 that has a nested SERVICE clause.

`isREF` is not SPARQL and should not be generated by the SERVICE rewriting.

This can be triggerd by a query like.
```sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX up: <http://purl.uniprot.org/core/>
PREFIX sachem: <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#>
PREFIX rh: <http://rdf.rhea-db.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?score ?chebi_compound ?name ?rhea_reaction ?uniprot_enzyme
WHERE {
 
  SERVICE <https://sparql.rhea-db.org/sparql> {
    ?chebi_compound up:name ?name .
    ?rhea_reaction rh:side/rh:contains/rh:compound/rh:chebi ?chebi_compound .
    SERVICE <https://idsm.elixir-czech.cz/sparql/endpoint/chebi> {
 		_:b0  sachem:compound       ?chebi_compound ;
                    sachem:score          ?score ;
                    sachem:similaritySearch  _:b1 .
              _:b1  sachem:query          "OC1OCC=C2OC(=O)C=C12" ;
                    sachem:cutoff         "8e-1"^^xsd:double ;
                    sachem:aromaticityMode  sachem:aromaticityDetect ;
                    sachem:similarityRadius  1 ;
                    sachem:tautomerMode   sachem:ignoreTautomers .
	}
  }

  ?uniprot_enzyme up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea_reaction .
}
ORDER BY DESC(?score)
```

Virtuoso generates the following query 

```sparql
SELECT  ?score ?rhea_reaction ?name ?chebi_compound
WHERE
  { ?chebi_compound
              <http://purl.uniprot.org/core/name>  ?name .
    ?rhea_reaction ((<http://rdf.rhea-db.org/side>/<http://rdf.rhea-db.org/contains>)/<http://rdf.rhea-db.org/compound>)/<http://rdf.rhea-db.org/chebi> ?chebi_compound
    SERVICE <https://idsm.elixir-czech.cz/sparql/endpoint/chebi> ( IN ?chebi_compound)   # <-- this is also not SPARQL
      { ?OrgnBNb0  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#compound>  ?chebi_compound ;
                  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#score>  ?score ;
                  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#similaritySearch>  ?OrgnBNb1 .
        ?OrgnBNb1  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#query>  "OC1OCC=C2OC(=O)C=C12" ;
                  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#cutoff>  8e-1 ;
                  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#aromaticityMode>  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#aromaticityDetect> ;
                  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#similarityRadius>  1 ;
                  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#tautomerMode>  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#ignoreTautomers>
                 FILTER (isREF (?chebi_compound )) # <-- I think it should be isIRI ? 
      }
  }
```


isREF, which is not SPARQL in generated query when doing SERVICE with SERVICE clause
This is a GitHub Issue
repo:virtuoso-opensource
owner:openlink
Title : isREF, which is not SPARQL in generated query when doing SERVICE with SERVICE clause
Issue date:

--- start body ---
```sparql
FILTER (isREF (?chebi_compound ))
```
is added to a generated query that is send to a remote SPARQL endpoint when using virtuoso v7.2.8 that has a nested SERVICE clause.

`isREF` is not SPARQL and should not be generated by the SERVICE rewriting.

This can be triggerd by a query like.
```sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX up: <http://purl.uniprot.org/core/>
PREFIX sachem: <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#>
PREFIX rh: <http://rdf.rhea-db.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

SELECT ?score ?chebi_compound ?name ?rhea_reaction ?uniprot_enzyme
WHERE {
 
  SERVICE <https://sparql.rhea-db.org/sparql> {
    ?chebi_compound up:name ?name .
    ?rhea_reaction rh:side/rh:contains/rh:compound/rh:chebi ?chebi_compound .
    SERVICE <https://idsm.elixir-czech.cz/sparql/endpoint/chebi> {
 		_:b0  sachem:compound       ?chebi_compound ;
                    sachem:score          ?score ;
                    sachem:similaritySearch  _:b1 .
              _:b1  sachem:query          "OC1OCC=C2OC(=O)C=C12" ;
                    sachem:cutoff         "8e-1"^^xsd:double ;
                    sachem:aromaticityMode  sachem:aromaticityDetect ;
                    sachem:similarityRadius  1 ;
                    sachem:tautomerMode   sachem:ignoreTautomers .
	}
  }

  ?uniprot_enzyme up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea_reaction .
}
ORDER BY DESC(?score)
```

Virtuoso generates the following query 

```sparql
SELECT  ?score ?rhea_reaction ?name ?chebi_compound
WHERE
  { ?chebi_compound
              <http://purl.uniprot.org/core/name>  ?name .
    ?rhea_reaction ((<http://rdf.rhea-db.org/side>/<http://rdf.rhea-db.org/contains>)/<http://rdf.rhea-db.org/compound>)/<http://rdf.rhea-db.org/chebi> ?chebi_compound
    SERVICE <https://idsm.elixir-czech.cz/sparql/endpoint/chebi> ( IN ?chebi_compound)   # <-- this is also not SPARQL
      { ?OrgnBNb0  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#compound>  ?chebi_compound ;
                  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#score>  ?score ;
                  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#similaritySearch>  ?OrgnBNb1 .
        ?OrgnBNb1  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#query>  "OC1OCC=C2OC(=O)C=C12" ;
                  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#cutoff>  8e-1 ;
                  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#aromaticityMode>  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#aromaticityDetect> ;
                  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#similarityRadius>  1 ;
                  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#tautomerMode>  <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#ignoreTautomers>
                 FILTER (isREF (?chebi_compound )) # <-- I think it should be isIRI ? 
      }
  }
```


--- end body ---
