exist-sparql icon indicating copy to clipboard operation
exist-sparql copied to clipboard

query returns empty result

Open duncdrum opened this issue 7 years ago • 5 comments

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

duncdrum avatar Feb 20 '18 22:02 duncdrum

@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.

ljo avatar Feb 21 '18 08:02 ljo

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 [email protected] 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:

<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?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ljo/exist-sparql/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfAbHOmgBJHi-o-DvBI77eTBNEoqDgSks5tW04wgaJpZM4SMzwX.

PietroLiuzzo avatar Feb 22 '18 08:02 PietroLiuzzo

@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?

wsalesky avatar Feb 23 '18 15:02 wsalesky

@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?

duncdrum avatar Feb 23 '18 18:02 duncdrum

@duncdrum does it work with my updates?

adamretter avatar Jun 24 '20 22:06 adamretter