ljo / exist-sparql

Integrates SPARQL and RDF indexing through the Jena TDB libraries into eXist-db.
GNU General Public License v3.0
18 stars 3 forks source link

query returns empty result #6

Open duncdrum opened 6 years ago

duncdrum commented 6 years ago

the following sparql returns the expected 230 result on wikidata query service (see link). However, when started from inside exist

xquery version "3.1";
import module namespace sparql = "http://exist-db.org/xquery/sparql" at java:org.exist.xquery.modules.rdf.SparqlModule";

declare namespace sr = "http://www.w3.org/2005/sparql-results#";

let $query := ("PREFIX wikibase: <http://wikiba.se/ontology#>
                PREFIX wdt: <http://www.wikidata.org/prop/direct/>
                PREFIX wd: <http://www.wikidata.org/entity/>
                PREFIX bd: <http://www.bigdata.com/rdf#>

                SELECT ?item ?itemLabel 
                WHERE { ?item wdt:P31 wd:Q836688.
                SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE],zh'. }
}")

return
    sparql:query($query)

I get:

<sr:sparql xmlns:sr="http://www.w3.org/2005/sparql-results#">
    <sr:head>
        <sr:variable name="item"/>
        <sr:variable name="itemLabel"/>
    </sr:head>
    <sr:results/>
</sr:sparql

Am I doing something wrong, or is there a bug?

eXist 4.0.0 exist-sparql 0.1-snapshot (build from source) java 1.8.0_162 macOS 10.13.3

ljo commented 6 years ago

@duncdrum I will look into it. We unfortunately have a two day consortium meeting just starting so I am not sure it will happen before the weekend.

PietroLiuzzo commented 6 years ago

Wow, I thought the sparql module could only query the data indexed inside exist (which is already a great feature), can it be used to query also wikidata directly? Pietro Maria Liuzzo cel (DE): +49 (0) 176 61 000 606 Skype: pietro.liuzzo (Quingentole) https://uk.linkedin.com/in/pietroliuzzo

Il giorno 20 feb 2018, alle ore 23:58, Duncan Paterson notifications@github.com ha scritto:

the following sparql http://tinyurl.com/y7rlfb8u returns the expected result on wikidata query service. However, when started from inside exist

xquery version "3.1"; import module namespace sparql = "http://exist-db.org/xquery/sparql" at java:org.exist.xquery.modules.rdf.SparqlModule";

declare namespace sr = "http://www.w3.org/2005/sparql-results#";

let $query := ("PREFIX wikibase: http://wikiba.se/ontology# PREFIX wdt: http://www.wikidata.org/prop/direct/ PREFIX wd: http://www.wikidata.org/entity/ PREFIX bd: http://www.bigdata.com/rdf#

            SELECT ?item ?itemLabel 
            WHERE { ?item wdt:P31 wd:Q836688.
            SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE],zh'. }

}")

return sparql:query($query) I get:

, or mute the thread .
wsalesky commented 6 years ago

@duncdrum This happens to me when I forget to add the <module id="rdf-index" class="org.exist.indexing.rdf.TDBRDFIndex"/> to conf.xml. Which happens more often then I would like to admit. Are you sure your RDF is being indexed?

duncdrum commented 6 years ago

@wsalesky and @PietroLiuzzo thanks for chiming in and helping out. I m certain that the rdf-indexmodule is active in conf.xml and the updated readme demo runs fine.

I am, however, addressing the wikidata sparql endpoint directly, instead of running a query over locally stored rdfs. Maybe that was too optimistic, @ljo?

adamretter commented 4 years ago

@duncdrum does it work with my updates?