You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Jean-Claude Moissinac <je...@telecom-paristech.fr> on 2019/12/19 15:48:38 UTC

using wdqs as a service in a sparql query

Hello

In an instance of Fuseki, I'm trying the following query

PREFIX wdt: <http://www.wikidata.org/prop/direct/>

prefix wikibase: <http://wikiba.se/ontology#>

PREFIX bd: <http://www.bigdata.com/rdf#>

SELECT * where

{

bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)

service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {

select ?p ?propLabel ?o ?oLabel where {

?wikidata ?p ?o . ?prop wikibase:directClaim ?p . SERVICE wikibase:label {
bd:serviceParam wikibase:language "en,fr" .

} } } }


which fails with an error 500 (Error 500: HTTP 500 error making the query:
Internal Server Error)

While the following one gives results:

PREFIX wdt: <http://www.wikidata.org/prop/direct/>

prefix wikibase: <http://wikiba.se/ontology#>

PREFIX bd: <http://www.bigdata.com/rdf#>

SELECT * where {

bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)

service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {

select ?p ?propLabel ?o ?oLabel where {

<http://www.wikidata.org/entity/Q640447> ?p ?o .

?prop wikibase:directClaim ?p . SERVICE wikibase:label { bd:serviceParam
wikibase:language "en,fr" .

} } } }


In my real query, in place of the bind, I have some code which selects some
wikidata entities. The goal is to get a wikidata description of these
entities

Have you some ideas?


--
Jean-Claude Moissinac

Re: using wdqs as a service in a sparql query

Posted by Jean-Claude Moissinac <je...@telecom-paristech.fr>.
My example is about wikidata. But, the goal is just about SPARQL and
federated queries. And Jena  seems to have a good support for fedarated
queries.

--
Jean-Claude Moissinac



Le ven. 20 déc. 2019 à 12:38, Marco Neumann <ma...@gmail.com> a
écrit :

> you are welcome Jean-Claude, BTW wikidata SPARQL query questions can be
> best discussed over at the wikidata mailing lists / sites
>
> On Fri, Dec 20, 2019 at 11:30 AM Jean-Claude Moissinac <
> jean-claude.moissinac@telecom-paristech.fr> wrote:
>
> > So, the shared variable ?wikidata must be in the inner select to be seen
> by
> > both triple store.
> > Many thank's
> > --
> > Jean-Claude Moissinac
> >
> >
> >
> > Le ven. 20 déc. 2019 à 11:57, Marco Neumann <ma...@gmail.com> a
> > écrit :
> >
> > > PREFIX wdt: <http://www.wikidata.org/prop/direct/>
> > > PREFIX wikibase: <http://wikiba.se/ontology#>
> > > PREFIX bd: <http://www.bigdata.com/rdf#>
> > > SELECT * where{
> > > bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata).
> > > SERVICE <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
> > > select ?wikidata ?p ?propLabel ?o ?oLabel where {
> > > ?wikidata ?p ?o . ?prop wikibase:directClaim ?p .
> > > SERVICE wikibase:label {bd:serviceParam wikibase:language "en,fr" .}
> > > } } }
> > >
> > > On Fri, Dec 20, 2019 at 10:56 AM Marco Neumann <
> marco.neumann@gmail.com>
> > > wrote:
> > >
> > > > ok I see, how about the following
> > > >
> > > >
> > > > On Fri, Dec 20, 2019 at 9:34 AM Jean-Claude Moissinac <
> > > > jean-claude.moissinac@telecom-paristech.fr> wrote:
> > > >
> > > >> In the second code, the bind must be inside the service <...> {...}
> > > >> --
> > > >> Jean-Claude Moissinac
> > > >>
> > > >>
> > > >>
> > > >> Le jeu. 19 déc. 2019 à 16:48, Jean-Claude Moissinac <
> > > >> jean-claude.moissinac@telecom-paristech.fr> a écrit :
> > > >>
> > > >> > Hello
> > > >> >
> > > >> > In an instance of Fuseki, I'm trying the following query
> > > >> >
> > > >> > PREFIX wdt: <http://www.wikidata.org/prop/direct/>
> > > >> >
> > > >> > prefix wikibase: <http://wikiba.se/ontology#>
> > > >> >
> > > >> > PREFIX bd: <http://www.bigdata.com/rdf#>
> > > >> >
> > > >> > SELECT * where
> > > >> >
> > > >> > {
> > > >> >
> > > >> > bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
> > > >> >
> > > >> > service <https://query.wikidata.org/bigdata/namespace/wdq/sparql>
> {
> > > >> >
> > > >> > select ?p ?propLabel ?o ?oLabel where {
> > > >> >
> > > >> > ?wikidata ?p ?o . ?prop wikibase:directClaim ?p . SERVICE
> > > >> wikibase:label {
> > > >> > bd:serviceParam wikibase:language "en,fr" .
> > > >> >
> > > >> > } } } }
> > > >> >
> > > >> >
> > > >> > which fails with an error 500 (Error 500: HTTP 500 error making
> the
> > > >> query:
> > > >> > Internal Server Error)
> > > >> >
> > > >> > While the following one gives results:
> > > >> >
> > > >> > PREFIX wdt: <http://www.wikidata.org/prop/direct/>
> > > >> >
> > > >> > prefix wikibase: <http://wikiba.se/ontology#>
> > > >> >
> > > >> > PREFIX bd: <http://www.bigdata.com/rdf#>
> > > >> >
> > > >> > SELECT * where {
> > > >> >
> > > >> > bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
> > > >> >
> > > >> > service <https://query.wikidata.org/bigdata/namespace/wdq/sparql>
> {
> > > >> >
> > > >> > select ?p ?propLabel ?o ?oLabel where {
> > > >> >
> > > >> > <http://www.wikidata.org/entity/Q640447> ?p ?o .
> > > >> >
> > > >> > ?prop wikibase:directClaim ?p . SERVICE wikibase:label {
> > > bd:serviceParam
> > > >> > wikibase:language "en,fr" .
> > > >> >
> > > >> > } } } }
> > > >> >
> > > >> >
> > > >> > In my real query, in place of the bind, I have some code which
> > selects
> > > >> > some wikidata entities. The goal is to get a wikidata description
> of
> > > >> these
> > > >> > entities
> > > >> >
> > > >> > Have you some ideas?
> > > >> >
> > > >> >
> > > >> > --
> > > >> > Jean-Claude Moissinac
> > > >> >
> > > >> >
> > > >>
> > > >
> > > >
> > > > --
> > > >
> > > >
> > > > ---
> > > > Marco Neumann
> > > > KONA
> > > >
> > > >
> > >
> > > --
> > >
> > >
> > > ---
> > > Marco Neumann
> > > KONA
> > >
> >
>
>
> --
>
>
> ---
> Marco Neumann
> KONA
>

Re: using wdqs as a service in a sparql query

Posted by Marco Neumann <ma...@gmail.com>.
you are welcome Jean-Claude, BTW wikidata SPARQL query questions can be
best discussed over at the wikidata mailing lists / sites

On Fri, Dec 20, 2019 at 11:30 AM Jean-Claude Moissinac <
jean-claude.moissinac@telecom-paristech.fr> wrote:

> So, the shared variable ?wikidata must be in the inner select to be seen by
> both triple store.
> Many thank's
> --
> Jean-Claude Moissinac
>
>
>
> Le ven. 20 déc. 2019 à 11:57, Marco Neumann <ma...@gmail.com> a
> écrit :
>
> > PREFIX wdt: <http://www.wikidata.org/prop/direct/>
> > PREFIX wikibase: <http://wikiba.se/ontology#>
> > PREFIX bd: <http://www.bigdata.com/rdf#>
> > SELECT * where{
> > bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata).
> > SERVICE <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
> > select ?wikidata ?p ?propLabel ?o ?oLabel where {
> > ?wikidata ?p ?o . ?prop wikibase:directClaim ?p .
> > SERVICE wikibase:label {bd:serviceParam wikibase:language "en,fr" .}
> > } } }
> >
> > On Fri, Dec 20, 2019 at 10:56 AM Marco Neumann <ma...@gmail.com>
> > wrote:
> >
> > > ok I see, how about the following
> > >
> > >
> > > On Fri, Dec 20, 2019 at 9:34 AM Jean-Claude Moissinac <
> > > jean-claude.moissinac@telecom-paristech.fr> wrote:
> > >
> > >> In the second code, the bind must be inside the service <...> {...}
> > >> --
> > >> Jean-Claude Moissinac
> > >>
> > >>
> > >>
> > >> Le jeu. 19 déc. 2019 à 16:48, Jean-Claude Moissinac <
> > >> jean-claude.moissinac@telecom-paristech.fr> a écrit :
> > >>
> > >> > Hello
> > >> >
> > >> > In an instance of Fuseki, I'm trying the following query
> > >> >
> > >> > PREFIX wdt: <http://www.wikidata.org/prop/direct/>
> > >> >
> > >> > prefix wikibase: <http://wikiba.se/ontology#>
> > >> >
> > >> > PREFIX bd: <http://www.bigdata.com/rdf#>
> > >> >
> > >> > SELECT * where
> > >> >
> > >> > {
> > >> >
> > >> > bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
> > >> >
> > >> > service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
> > >> >
> > >> > select ?p ?propLabel ?o ?oLabel where {
> > >> >
> > >> > ?wikidata ?p ?o . ?prop wikibase:directClaim ?p . SERVICE
> > >> wikibase:label {
> > >> > bd:serviceParam wikibase:language "en,fr" .
> > >> >
> > >> > } } } }
> > >> >
> > >> >
> > >> > which fails with an error 500 (Error 500: HTTP 500 error making the
> > >> query:
> > >> > Internal Server Error)
> > >> >
> > >> > While the following one gives results:
> > >> >
> > >> > PREFIX wdt: <http://www.wikidata.org/prop/direct/>
> > >> >
> > >> > prefix wikibase: <http://wikiba.se/ontology#>
> > >> >
> > >> > PREFIX bd: <http://www.bigdata.com/rdf#>
> > >> >
> > >> > SELECT * where {
> > >> >
> > >> > bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
> > >> >
> > >> > service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
> > >> >
> > >> > select ?p ?propLabel ?o ?oLabel where {
> > >> >
> > >> > <http://www.wikidata.org/entity/Q640447> ?p ?o .
> > >> >
> > >> > ?prop wikibase:directClaim ?p . SERVICE wikibase:label {
> > bd:serviceParam
> > >> > wikibase:language "en,fr" .
> > >> >
> > >> > } } } }
> > >> >
> > >> >
> > >> > In my real query, in place of the bind, I have some code which
> selects
> > >> > some wikidata entities. The goal is to get a wikidata description of
> > >> these
> > >> > entities
> > >> >
> > >> > Have you some ideas?
> > >> >
> > >> >
> > >> > --
> > >> > Jean-Claude Moissinac
> > >> >
> > >> >
> > >>
> > >
> > >
> > > --
> > >
> > >
> > > ---
> > > Marco Neumann
> > > KONA
> > >
> > >
> >
> > --
> >
> >
> > ---
> > Marco Neumann
> > KONA
> >
>


-- 


---
Marco Neumann
KONA

Re: using wdqs as a service in a sparql query

Posted by Jean-Claude Moissinac <je...@telecom-paristech.fr>.
So, the shared variable ?wikidata must be in the inner select to be seen by
both triple store.
Many thank's
--
Jean-Claude Moissinac



Le ven. 20 déc. 2019 à 11:57, Marco Neumann <ma...@gmail.com> a
écrit :

> PREFIX wdt: <http://www.wikidata.org/prop/direct/>
> PREFIX wikibase: <http://wikiba.se/ontology#>
> PREFIX bd: <http://www.bigdata.com/rdf#>
> SELECT * where{
> bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata).
> SERVICE <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
> select ?wikidata ?p ?propLabel ?o ?oLabel where {
> ?wikidata ?p ?o . ?prop wikibase:directClaim ?p .
> SERVICE wikibase:label {bd:serviceParam wikibase:language "en,fr" .}
> } } }
>
> On Fri, Dec 20, 2019 at 10:56 AM Marco Neumann <ma...@gmail.com>
> wrote:
>
> > ok I see, how about the following
> >
> >
> > On Fri, Dec 20, 2019 at 9:34 AM Jean-Claude Moissinac <
> > jean-claude.moissinac@telecom-paristech.fr> wrote:
> >
> >> In the second code, the bind must be inside the service <...> {...}
> >> --
> >> Jean-Claude Moissinac
> >>
> >>
> >>
> >> Le jeu. 19 déc. 2019 à 16:48, Jean-Claude Moissinac <
> >> jean-claude.moissinac@telecom-paristech.fr> a écrit :
> >>
> >> > Hello
> >> >
> >> > In an instance of Fuseki, I'm trying the following query
> >> >
> >> > PREFIX wdt: <http://www.wikidata.org/prop/direct/>
> >> >
> >> > prefix wikibase: <http://wikiba.se/ontology#>
> >> >
> >> > PREFIX bd: <http://www.bigdata.com/rdf#>
> >> >
> >> > SELECT * where
> >> >
> >> > {
> >> >
> >> > bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
> >> >
> >> > service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
> >> >
> >> > select ?p ?propLabel ?o ?oLabel where {
> >> >
> >> > ?wikidata ?p ?o . ?prop wikibase:directClaim ?p . SERVICE
> >> wikibase:label {
> >> > bd:serviceParam wikibase:language "en,fr" .
> >> >
> >> > } } } }
> >> >
> >> >
> >> > which fails with an error 500 (Error 500: HTTP 500 error making the
> >> query:
> >> > Internal Server Error)
> >> >
> >> > While the following one gives results:
> >> >
> >> > PREFIX wdt: <http://www.wikidata.org/prop/direct/>
> >> >
> >> > prefix wikibase: <http://wikiba.se/ontology#>
> >> >
> >> > PREFIX bd: <http://www.bigdata.com/rdf#>
> >> >
> >> > SELECT * where {
> >> >
> >> > bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
> >> >
> >> > service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
> >> >
> >> > select ?p ?propLabel ?o ?oLabel where {
> >> >
> >> > <http://www.wikidata.org/entity/Q640447> ?p ?o .
> >> >
> >> > ?prop wikibase:directClaim ?p . SERVICE wikibase:label {
> bd:serviceParam
> >> > wikibase:language "en,fr" .
> >> >
> >> > } } } }
> >> >
> >> >
> >> > In my real query, in place of the bind, I have some code which selects
> >> > some wikidata entities. The goal is to get a wikidata description of
> >> these
> >> > entities
> >> >
> >> > Have you some ideas?
> >> >
> >> >
> >> > --
> >> > Jean-Claude Moissinac
> >> >
> >> >
> >>
> >
> >
> > --
> >
> >
> > ---
> > Marco Neumann
> > KONA
> >
> >
>
> --
>
>
> ---
> Marco Neumann
> KONA
>

Re: using wdqs as a service in a sparql query

Posted by Marco Neumann <ma...@gmail.com>.
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT * where{
bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata).
SERVICE <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
select ?wikidata ?p ?propLabel ?o ?oLabel where {
?wikidata ?p ?o . ?prop wikibase:directClaim ?p .
SERVICE wikibase:label {bd:serviceParam wikibase:language "en,fr" .}
} } }

On Fri, Dec 20, 2019 at 10:56 AM Marco Neumann <ma...@gmail.com>
wrote:

> ok I see, how about the following
>
>
> On Fri, Dec 20, 2019 at 9:34 AM Jean-Claude Moissinac <
> jean-claude.moissinac@telecom-paristech.fr> wrote:
>
>> In the second code, the bind must be inside the service <...> {...}
>> --
>> Jean-Claude Moissinac
>>
>>
>>
>> Le jeu. 19 déc. 2019 à 16:48, Jean-Claude Moissinac <
>> jean-claude.moissinac@telecom-paristech.fr> a écrit :
>>
>> > Hello
>> >
>> > In an instance of Fuseki, I'm trying the following query
>> >
>> > PREFIX wdt: <http://www.wikidata.org/prop/direct/>
>> >
>> > prefix wikibase: <http://wikiba.se/ontology#>
>> >
>> > PREFIX bd: <http://www.bigdata.com/rdf#>
>> >
>> > SELECT * where
>> >
>> > {
>> >
>> > bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
>> >
>> > service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
>> >
>> > select ?p ?propLabel ?o ?oLabel where {
>> >
>> > ?wikidata ?p ?o . ?prop wikibase:directClaim ?p . SERVICE
>> wikibase:label {
>> > bd:serviceParam wikibase:language "en,fr" .
>> >
>> > } } } }
>> >
>> >
>> > which fails with an error 500 (Error 500: HTTP 500 error making the
>> query:
>> > Internal Server Error)
>> >
>> > While the following one gives results:
>> >
>> > PREFIX wdt: <http://www.wikidata.org/prop/direct/>
>> >
>> > prefix wikibase: <http://wikiba.se/ontology#>
>> >
>> > PREFIX bd: <http://www.bigdata.com/rdf#>
>> >
>> > SELECT * where {
>> >
>> > bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
>> >
>> > service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
>> >
>> > select ?p ?propLabel ?o ?oLabel where {
>> >
>> > <http://www.wikidata.org/entity/Q640447> ?p ?o .
>> >
>> > ?prop wikibase:directClaim ?p . SERVICE wikibase:label { bd:serviceParam
>> > wikibase:language "en,fr" .
>> >
>> > } } } }
>> >
>> >
>> > In my real query, in place of the bind, I have some code which selects
>> > some wikidata entities. The goal is to get a wikidata description of
>> these
>> > entities
>> >
>> > Have you some ideas?
>> >
>> >
>> > --
>> > Jean-Claude Moissinac
>> >
>> >
>>
>
>
> --
>
>
> ---
> Marco Neumann
> KONA
>
>

-- 


---
Marco Neumann
KONA

Re: using wdqs as a service in a sparql query

Posted by Marco Neumann <ma...@gmail.com>.
ok I see, how about the following


On Fri, Dec 20, 2019 at 9:34 AM Jean-Claude Moissinac <
jean-claude.moissinac@telecom-paristech.fr> wrote:

> In the second code, the bind must be inside the service <...> {...}
> --
> Jean-Claude Moissinac
>
>
>
> Le jeu. 19 déc. 2019 à 16:48, Jean-Claude Moissinac <
> jean-claude.moissinac@telecom-paristech.fr> a écrit :
>
> > Hello
> >
> > In an instance of Fuseki, I'm trying the following query
> >
> > PREFIX wdt: <http://www.wikidata.org/prop/direct/>
> >
> > prefix wikibase: <http://wikiba.se/ontology#>
> >
> > PREFIX bd: <http://www.bigdata.com/rdf#>
> >
> > SELECT * where
> >
> > {
> >
> > bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
> >
> > service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
> >
> > select ?p ?propLabel ?o ?oLabel where {
> >
> > ?wikidata ?p ?o . ?prop wikibase:directClaim ?p . SERVICE wikibase:label
> {
> > bd:serviceParam wikibase:language "en,fr" .
> >
> > } } } }
> >
> >
> > which fails with an error 500 (Error 500: HTTP 500 error making the
> query:
> > Internal Server Error)
> >
> > While the following one gives results:
> >
> > PREFIX wdt: <http://www.wikidata.org/prop/direct/>
> >
> > prefix wikibase: <http://wikiba.se/ontology#>
> >
> > PREFIX bd: <http://www.bigdata.com/rdf#>
> >
> > SELECT * where {
> >
> > bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
> >
> > service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
> >
> > select ?p ?propLabel ?o ?oLabel where {
> >
> > <http://www.wikidata.org/entity/Q640447> ?p ?o .
> >
> > ?prop wikibase:directClaim ?p . SERVICE wikibase:label { bd:serviceParam
> > wikibase:language "en,fr" .
> >
> > } } } }
> >
> >
> > In my real query, in place of the bind, I have some code which selects
> > some wikidata entities. The goal is to get a wikidata description of
> these
> > entities
> >
> > Have you some ideas?
> >
> >
> > --
> > Jean-Claude Moissinac
> >
> >
>


-- 


---
Marco Neumann
KONA

Re: using wdqs as a service in a sparql query

Posted by Jean-Claude Moissinac <je...@telecom-paristech.fr>.
In the second code, the bind must be inside the service <...> {...}
--
Jean-Claude Moissinac



Le jeu. 19 déc. 2019 à 16:48, Jean-Claude Moissinac <
jean-claude.moissinac@telecom-paristech.fr> a écrit :

> Hello
>
> In an instance of Fuseki, I'm trying the following query
>
> PREFIX wdt: <http://www.wikidata.org/prop/direct/>
>
> prefix wikibase: <http://wikiba.se/ontology#>
>
> PREFIX bd: <http://www.bigdata.com/rdf#>
>
> SELECT * where
>
> {
>
> bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
>
> service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
>
> select ?p ?propLabel ?o ?oLabel where {
>
> ?wikidata ?p ?o . ?prop wikibase:directClaim ?p . SERVICE wikibase:label {
> bd:serviceParam wikibase:language "en,fr" .
>
> } } } }
>
>
> which fails with an error 500 (Error 500: HTTP 500 error making the query:
> Internal Server Error)
>
> While the following one gives results:
>
> PREFIX wdt: <http://www.wikidata.org/prop/direct/>
>
> prefix wikibase: <http://wikiba.se/ontology#>
>
> PREFIX bd: <http://www.bigdata.com/rdf#>
>
> SELECT * where {
>
> bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
>
> service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
>
> select ?p ?propLabel ?o ?oLabel where {
>
> <http://www.wikidata.org/entity/Q640447> ?p ?o .
>
> ?prop wikibase:directClaim ?p . SERVICE wikibase:label { bd:serviceParam
> wikibase:language "en,fr" .
>
> } } } }
>
>
> In my real query, in place of the bind, I have some code which selects
> some wikidata entities. The goal is to get a wikidata description of these
> entities
>
> Have you some ideas?
>
>
> --
> Jean-Claude Moissinac
>
>

Re: using wdqs as a service in a sparql query

Posted by Jean-Claude Moissinac <je...@telecom-paristech.fr>.
Thank's for the reply.
But the intent is to select some instances of the ?wikidata variable
outside the service <> {...}
Your proposal works, but you can't obtain the ?wikidata instances outside
the service
The goal is to have some sparql code which select instances of ?wikidata
outside of the service and then, to get the triples associated to the
?wikidata instances in the service (so, in wikidata).
(the bind was just a way to illustrate a code which set a ?wikidata
instance outside the service).
It's seem to me that it is simple example of a fedarated query: I've
entities in a context (my fuseki triple store), and I would like to access
to what is known by wikidata about these entities.


--
Jean-Claude Moissinac



Le jeu. 19 déc. 2019 à 18:35, Marco Neumann <ma...@gmail.com> a
écrit :

> Jean-Claude, the variable isn't visible, or in scope, to your select
> statement
>
> this is how you can to do it
>
> PREFIX wdt: <http://www.wikidata.org/prop/direct/>
> PREFIX wikibase: <http://wikiba.se/ontology#>
> PREFIX bd: <http://www.bigdata.com/rdf#>
>
> SELECT * WHERE {
> SERVICE <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
> SELECT ?p ?propLabel ?o ?oLabel WHERE {
> BIND(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
> ?wikidata ?p ?o . ?prop wikibase:directClaim ?p .
> SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr" .}
> }
> }
> }
>
> On Thu, Dec 19, 2019 at 3:48 PM Jean-Claude Moissinac <
> jean-claude.moissinac@telecom-paristech.fr> wrote:
>
> > Hello
> >
> > In an instance of Fuseki, I'm trying the following query
> >
> > PREFIX wdt: <http://www.wikidata.org/prop/direct/>
> >
> > prefix wikibase: <http://wikiba.se/ontology#>
> >
> > PREFIX bd: <http://www.bigdata.com/rdf#>
> >
> > SELECT * where
> >
> > {
> >
> > bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
> >
> > service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
> >
> > select ?p ?propLabel ?o ?oLabel where {
> >
> > ?wikidata ?p ?o . ?prop wikibase:directClaim ?p . SERVICE wikibase:label
> {
> > bd:serviceParam wikibase:language "en,fr" .
> >
> > } } } }
> >
> >
> > which fails with an error 500 (Error 500: HTTP 500 error making the
> query:
> > Internal Server Error)
> >
> > While the following one gives results:
> >
> > PREFIX wdt: <http://www.wikidata.org/prop/direct/>
> >
> > prefix wikibase: <http://wikiba.se/ontology#>
> >
> > PREFIX bd: <http://www.bigdata.com/rdf#>
> >
> > SELECT * where {
> >
> > bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
> >
> > service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
> >
> > select ?p ?propLabel ?o ?oLabel where {
> >
> > <http://www.wikidata.org/entity/Q640447> ?p ?o .
> >
> > ?prop wikibase:directClaim ?p . SERVICE wikibase:label { bd:serviceParam
> > wikibase:language "en,fr" .
> >
> > } } } }
> >
> >
> > In my real query, in place of the bind, I have some code which selects
> some
> > wikidata entities. The goal is to get a wikidata description of these
> > entities
> >
> > Have you some ideas?
> >
> >
> > --
> > Jean-Claude Moissinac
> >
>
>
> --
>
>
> ---
> Marco Neumann
> KONA
>

Re: using wdqs as a service in a sparql query

Posted by Marco Neumann <ma...@gmail.com>.
Jean-Claude, the variable isn't visible, or in scope, to your select
statement

this is how you can to do it

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>

SELECT * WHERE {
SERVICE <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
SELECT ?p ?propLabel ?o ?oLabel WHERE {
BIND(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
?wikidata ?p ?o . ?prop wikibase:directClaim ?p .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,fr" .}
}
}
}

On Thu, Dec 19, 2019 at 3:48 PM Jean-Claude Moissinac <
jean-claude.moissinac@telecom-paristech.fr> wrote:

> Hello
>
> In an instance of Fuseki, I'm trying the following query
>
> PREFIX wdt: <http://www.wikidata.org/prop/direct/>
>
> prefix wikibase: <http://wikiba.se/ontology#>
>
> PREFIX bd: <http://www.bigdata.com/rdf#>
>
> SELECT * where
>
> {
>
> bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
>
> service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
>
> select ?p ?propLabel ?o ?oLabel where {
>
> ?wikidata ?p ?o . ?prop wikibase:directClaim ?p . SERVICE wikibase:label {
> bd:serviceParam wikibase:language "en,fr" .
>
> } } } }
>
>
> which fails with an error 500 (Error 500: HTTP 500 error making the query:
> Internal Server Error)
>
> While the following one gives results:
>
> PREFIX wdt: <http://www.wikidata.org/prop/direct/>
>
> prefix wikibase: <http://wikiba.se/ontology#>
>
> PREFIX bd: <http://www.bigdata.com/rdf#>
>
> SELECT * where {
>
> bind(<http://www.wikidata.org/entity/Q640447> as ?wikidata)
>
> service <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
>
> select ?p ?propLabel ?o ?oLabel where {
>
> <http://www.wikidata.org/entity/Q640447> ?p ?o .
>
> ?prop wikibase:directClaim ?p . SERVICE wikibase:label { bd:serviceParam
> wikibase:language "en,fr" .
>
> } } } }
>
>
> In my real query, in place of the bind, I have some code which selects some
> wikidata entities. The goal is to get a wikidata description of these
> entities
>
> Have you some ideas?
>
>
> --
> Jean-Claude Moissinac
>


-- 


---
Marco Neumann
KONA