ThomasFrancart
ThomasFrancart

Reputation: 510

SERVICE against Virtuoso DBPedia Gives "Virtuoso S0022 Error SQ200 : No Column"

I run a SPARQL query in a local GraphDB triplestore that contains a SERVICE clause that goes to DBPedia Virtuoso. The query basically fetches labels of some DBPedia URIs directly from DBPedia (note the subquery executed first to fetch local results, before passing in these results to the SERVICE clause) :

SELECT DISTINCT ?uri (STR(?theLabel) AS ?label)
WHERE {
 {
  SELECT DISTINCT ?uri 
  WHERE {
    ?domain a <http://xmlns.com/foaf/0.1/Person> .
    ?domain <http://virtual-assembly.org/pair#hasKeyword> ?uri .
  }
  }

  SERVICE <http://dbpedia.org/sparql> {
    ?uri <http://www.w3.org/2000/01/rdf-schema#label> ?theLabel .
    FILTER(lang(?theLabel) = 'fr')
  }

}
ORDER BY ?label

I get the following error from Virtuoso while evaluating the service clause Virtuoso S0022 Error SQ200 :

Query evaluation error: org.eclipse.rdf4j.query.QueryEvaluationException: Virtuoso S0022 Error SQ200: No column uri.

SPARQL query:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sesame: <http://www.openrdf.org/schema/sesame#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX fn: <http://www.w3.org/2005/xpath-functions#> 

SELECT  ?theLabel ?__rowIdx WHERE {
 ?uri <http://www.w3.org/2000/01/rdf-schema#label> ?theLabel .
 FILTER(lang(?theLabel) = 'fr')
} 
VALUES (?__rowIdx ?uri) {  ("0" <http://dbpedia.org/resource/Semantic_Web> ) ("1" <http://dbpedia.org/resource/Peer-to-peer> ) ("2" <http://dbpedia.org/resource/Collaboration> ) ("3" <http://dbpedia.org/resource/Free_software> ) ("4" <http://dbpedia.org/resource/Social_transformation> ) ("5" <http://dbpedia.org/resource/Social_network> ) ("6" <http://dbpedia.org/resource/Ecology> ) ("7" <http://dbpedia.org/resource/Activism> ) ("8" <http://dbpedia.org/resource/Supernatural> ) ("9" <http://dbpedia.org/resource/Sociology> ) ("10" <http://dbpedia.org/resource/Natural_science> ) ("11" <http://dbpedia.org/resource/Popular_science> ) ("12" <http://dbpedia.org/resource/Cooperation> ) ("13" <http://dbpedia.org/resource/Wikimedia_Commons> ) ("14" <http://dbpedia.org/resource/Musician> ) } 

(HTTP status 500)

The SPARQL query sent to Virtuoso is valid to my eyes.

Of course I don't have my hand on how GraphDB generates the query, but is there any way I can rewrite the original query to work around this ?

Thanks

Upvotes: 0

Views: 203

Answers (2)

Kingsley Uyi Idehen
Kingsley Uyi Idehen

Reputation: 925

Okay, I stand corrected here, as a VALUES CLAUSE following a WHERE CLAUSE is indeed valid SPARQL. For example:

PREFIX dc:   <http://purl.org/dc/elements/1.1/> 
PREFIX :     <http://example.org/book/> 
PREFIX ns:   <http://example.org/ns#> 

SELECT ?book ?title ?price
{
   ?book dc:title ?title ;
         ns:price ?price .
}
VALUES (?book ?title)
{ (UNDEF "SPARQL Tutorial")
  (:book2 UNDEF)
}

Live Query Results Example.

The following returns an empty resultset indicating an incorrect solution i.e., a bug:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sesame: <http://www.openrdf.org/schema/sesame#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX fn: <http://www.w3.org/2005/xpath-functions#> 

SELECT  ?theLabel ?rowIdx 
WHERE {
        ?uri <http://www.w3.org/2000/01/rdf-schema#label> ?theLabel .
        FILTER (?uri = <http://dbpedia.org/resource/Semantic_Web>) 
        FILTER (lang(?theLabel) = "en")
      }
VALUES (?rowIdx ?uri) 
      {  ("0" <http://dbpedia.org/resource/Semantic_Web> ) 
         ("1" <http://dbpedia.org/resource/Peer-to-peer> ) 
         ("2" <http://dbpedia.org/resource/Collaboration> ) 
         ("3" <http://dbpedia.org/resource/Free_software> ) 
         ("4" <http://dbpedia.org/resource/Social_transformation> ) 
         ("5" <http://dbpedia.org/resource/Social_network> ) 
         ("6" <http://dbpedia.org/resource/Ecology> ) 
         ("7" <http://dbpedia.org/resource/Activism> ) 
         ("8" <http://dbpedia.org/resource/Supernatural> ) 
         ("9" <http://dbpedia.org/resource/Sociology> ) 
         ("10" <http://dbpedia.org/resource/Natural_science> ) 
         ("11" <http://dbpedia.org/resource/Popular_science> ) 
         ("12" <http://dbpedia.org/resource/Cooperation> ) 
         ("13" <http://dbpedia.org/resource/Wikimedia_Commons> ) 
         ("14" <http://dbpedia.org/resource/Musician> ) 
      } 

Live Query Results Link.

Upvotes: 1

Kingsley Uyi Idehen
Kingsley Uyi Idehen

Reputation: 925

The following works, which reveals a structural issue with the initial example.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sesame: <http://www.openrdf.org/schema/sesame#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX fn: <http://www.w3.org/2005/xpath-functions#> 

SELECT  ?theLabel ?__rowIdx
WHERE {
       ?uri <http://www.w3.org/2000/01/rdf-schema#label> ?theLabel .
       FILTER(lang(?theLabel) = 'fr')

       VALUES (?__rowIdx ?uri) {  ("0" <http://dbpedia.org/resource/Semantic_Web> ) ("1" <http://dbpedia.org/resource/Peer-to-peer> ) ("2" <http://dbpedia.org/resource/Collaboration> ) ("3" <http://dbpedia.org/resource/Free_software> ) ("4" <http://dbpedia.org/resource/Social_transformation> ) ("5" <http://dbpedia.org/resource/Social_network> ) ("6" <http://dbpedia.org/resource/Ecology> ) ("7" <http://dbpedia.org/resource/Activism> ) ("8" <http://dbpedia.org/resource/Supernatural> ) ("9" <http://dbpedia.org/resource/Sociology> ) ("10" <http://dbpedia.org/resource/Natural_science> ) ("11" <http://dbpedia.org/resource/Popular_science> ) ("12" <http://dbpedia.org/resource/Cooperation> ) ("13" <http://dbpedia.org/resource/Wikimedia_Commons> ) ("14" <http://dbpedia.org/resource/Musician> ) } 

}

Live Query Results page from DBpedia.

Upvotes: -1

Related Questions