Error in SPARQL Query

2019-09-06 15:10发布

问题:

I'm getting an error with my SPARQL query but can't find it out:

Query

PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> 
PREFIX : <http://dbpedia.org/resource/> 
PREFIX dbpedia2: <http://dbpedia.org/property/> 
PREFIX dbpedia: <http://dbpedia.org/> 
SELECT DISTINCT ?lat, ?long { 
:Taj_Mahal dbpedia2:latitude ?lat . 
:Taj_Mahal dbpedia2:longitude ?long }

Error

Encountered " "," ", "" at line 9, column 21.
Was expecting one of:
     ...
     ...
    "from" ...
    "where" ...
    "(" ...
    "{" ...

Any suggestion??

回答1:

you should not put a comma between ?lat and ?long

SELECT DISTINCT ?lat ?long { 
    :Taj_Mahal dbpedia2:latitude ?lat . 
    :Taj_Mahal dbpedia2:longitude ?long 
}

run query