简体   繁体   中英

SPARQL Query returns empty result set

I am querying marine data via SPARQL. I developed a SPARQL console with CodeMirror, RDFLib and SPARQLWrapper in order to display a number of predefined queries and results in my website. In the console, the query:

prefix geo: <https://www.w3.org/2003/01/geo/wgs84_pos#> 
prefix owl: <http://www.w3.org/2002/07/owl#> 
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
prefix ssn: <http://www.w3.org/ns/ssn/> 
prefix xml: <http://www.w3.org/XML/1998/namespace> 
prefix xsd: <http://www.w3.org/2001/XMLSchema#> 
prefix argo: <http://www.argodatamgt.org/argo-ontology#> 
prefix foaf: <http://xmlns.com/foaf/0.1/> 
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
prefix sosa: <http://www.w3.org/ns/sosa/>
prefix nerc: <http://vocab.nerc.ac.uk/collection/>
prefix dct: <http://purl.org/dc/terms/>
prefix prov: <https://www.w3.org/TR/prov-o/>

# stations/date of each cycle
SELECT distinct ?wmo ?lat ?lon ?date where{
 ?float argo:cycle ?cycle;
        argo:wmoCode ?wmo.
 ?cycle geo:latitude ?lat;
        geo:longitude ?lon;
        argo:startDate ?date.
}

returns nothing. I cross-checked it by using https://www.orpha.net/sparql , a query editor, and the result was the same - empty result set. However, when I try the exact same query in the research infrastructure's SPARQL Endpoint https://www.ifremer.fr/co/argo-linked-data/html/Argo-HTML-SPARQL/ , it works flawlessly.

I have tried very generic queries like:

SELECT DISTINCT * WHERE {
  ?s ?p ?o
}
LIMIT 10

or

select distinct ?p ?label 
where { 
    ?s ?p ?o . 
    OPTIONAL { ?p rdfs:label ?label } 
}

and they return non-empty results both in my console and in the generic SPARQL editor I mentioned before.

Performing a CURL request, modifying the template query by the first mentioned "stations/date of each cycle" one I am able to get the data:

curl -X POST "https://sparql.ifremer.fr/argo/query" --data-urlencode "query=select ?s ?o ?p where{?s ?o ?p.} limit 10" 

This makes me think that an outdated Virtuoso server on their side might be the culprit, however, I am very new in SPARQL and Semantics to tell and I would appreciate any clue.

As OP said in comment --

I found the culprit and it was an error from my side. I am using SPARQLWrapper and somewhere in my code I had a fixed SPARQL endpoint from another research infrastructure, I totally missed that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM