Re: [Wikidata] Fwd: Querying Wikidata

2019-01-09 Thread Stas Malyshev
Hi!

> Thank's for your reply.
> All the failing queries was on the following model
> 
> SELECT distinct ?candidate ?label WHERE {
>   SERVICE wikibase:mwapi {
>   bd:serviceParam wikibase:api "EntitySearch" .
>   bd:serviceParam wikibase:endpoint "www.wikidata.org 
> " .
>   bd:serviceParam mwapi:search "Musée Cernuschi" .
>   bd:serviceParam mwapi:language "fr" .
>   bd:serviceParam wikibase:limit 5 .
>   ?candidate wikibase:apiOutputItem mwapi:item .
>   }
> 
> ?candidate wdt:P17 wd:Q142 . 
>  
>   SERVICE wikibase:mwapi {
>   bd:serviceParam wikibase:api "EntitySearch" .
>   bd:serviceParam wikibase:endpoint "www.wikidata.org 
> " .
>   bd:serviceParam mwapi:search "Paris" .
>   bd:serviceParam mwapi:language "fr" .
>   bd:serviceParam wikibase:limit 5 .
>   ?city wikibase:apiOutputItem mwapi:item .
>   } 
>   ?candidate wdt:P131 ?city .
>  
>   ?candidate rdfs:label ?label;
>  filter(lang(?label)="fr")
> } 

Could you describe in a bit more detail what you're trying to do here?
Doing two service calls is not a pattern one would commonly use... It
can be slow if query optimizer misunderstands such query, too. I feel
I'd have a bit more insight if I understood what you are trying to
achieve with this query.

-- 
Stas Malyshev
smalys...@wikimedia.org

___
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata


Re: [Wikidata] Fwd: Querying Wikidata

2019-01-09 Thread Jean-Claude Moissinac
Thank's for your reply.
All the failing queries was on the following model

SELECT distinct ?candidate ?label WHERE {
  SERVICE wikibase:mwapi {
  bd:serviceParam wikibase:api "EntitySearch" .
  bd:serviceParam wikibase:endpoint "www.wikidata.org" .
  bd:serviceParam mwapi:search "Musée Cernuschi" .
  bd:serviceParam mwapi:language "fr" .
  bd:serviceParam wikibase:limit 5 .
  ?candidate wikibase:apiOutputItem mwapi:item .
  }

?candidate wdt:P17 wd:Q142 .

  SERVICE wikibase:mwapi {
  bd:serviceParam wikibase:api "EntitySearch" .
  bd:serviceParam wikibase:endpoint "www.wikidata.org" .
  bd:serviceParam mwapi:search "Paris" .
  bd:serviceParam mwapi:language "fr" .
  bd:serviceParam wikibase:limit 5 .
  ?city wikibase:apiOutputItem mwapi:item .
  }
  ?candidate wdt:P131 ?city .

  ?candidate rdfs:label ?label;
 filter(lang(?label)="fr")
}

I don't think that are queries producing big load.

I had a lot of response sometimes empty, sometimes correct on such
query testing the same query several times.

But, I can't reproduce such results this week. And, so, it is
difficult to analyze the problem without reproducing it.

--
Jean-Claude Moissinac



Le mer. 9 janv. 2019 à 00:29, Stas Malyshev  a
écrit :

> Hi!
>
> > Is there a good mean to query the sparql wdqs service of wikidata?
> > I've tried some python code to do it, with relative success.
> > Success, because some requests gives the expected result.
> > Relative, because the same query sometimes gives an empty response
> > either from my code or directly in the WDQS interface, where it's
> > possible to see that a sparql query sometimes gives an empty response,
> > sometimes the expected reponse without message or status to know that
> > the response is erroneous.
> > (demo is difficult, because it seems to depend of the load of the wdqs
> > service)
>
> Looks like you're running some heavy queries. So the question would be,
> which queries are those and how often do you run them?
>
> > I've found the following info:
> > *
> >
> https://www.mediawiki.org/wiki/Wikidata_Query_Service/User_Manual#Query_limits
> ,
> > which suggest a possible error HTTP code |429, which I never receive|
>
> 429 means you're calling the service too fast or too frequently. If you
> are just running a single query, you never get 429.
>
> > * https://phabricator.wikimedia.org/T179879, which suggest a possible
> > connexion with OAuth, but such possibility is never documented in the
> > official documentation
>
> https://phabricator.wikimedia.org/T179879 is an open task, thus it's not
> implemented yet.
>
> > None of them gives a practical method to get a response and trust it.
>
> Any method that uses HTTP access to SPARQL endpoint would give you the
> same result. Which depends on query. So I'd suggest providing some info
> about the queries and specific issues you're having, and then we could
> see if it's possible to improve it.
>
> --
> Stas Malyshev
> smalys...@wikimedia.org
>
___
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata


Re: [Wikidata] Fwd: Querying Wikidata

2019-01-08 Thread Stas Malyshev
Hi!

> Is there a good mean to query the sparql wdqs service of wikidata?
> I've tried some python code to do it, with relative success.
> Success, because some requests gives the expected result.
> Relative, because the same query sometimes gives an empty response
> either from my code or directly in the WDQS interface, where it's
> possible to see that a sparql query sometimes gives an empty response,
> sometimes the expected reponse without message or status to know that
> the response is erroneous.
> (demo is difficult, because it seems to depend of the load of the wdqs
> service)

Looks like you're running some heavy queries. So the question would be,
which queries are those and how often do you run them?

> I've found the following info:
> *
> https://www.mediawiki.org/wiki/Wikidata_Query_Service/User_Manual#Query_limits,
> which suggest a possible error HTTP code |429, which I never receive|

429 means you're calling the service too fast or too frequently. If you
are just running a single query, you never get 429.

> * https://phabricator.wikimedia.org/T179879, which suggest a possible
> connexion with OAuth, but such possibility is never documented in the
> official documentation

https://phabricator.wikimedia.org/T179879 is an open task, thus it's not
implemented yet.

> None of them gives a practical method to get a response and trust it.

Any method that uses HTTP access to SPARQL endpoint would give you the
same result. Which depends on query. So I'd suggest providing some info
about the queries and specific issues you're having, and then we could
see if it's possible to improve it.

-- 
Stas Malyshev
smalys...@wikimedia.org

___
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata


[Wikidata] Fwd: Querying Wikidata

2019-01-07 Thread Thomas Douillard
I think there is a higher probability of answer on the dedicated mailng
list, so I take the freedom to transfer the message (originally posted on
the sematic web mailing list)

-- Forwarded message -
From: Jean-Claude Moissinac 
Date: lun. 7 janv. 2019 à 11:04
Subject: Querying Wikidata
To: semantic-web 


Hello,

Is there a good mean to query the sparql wdqs service of wikidata?
I've tried some python code to do it, with relative success.
Success, because some requests gives the expected result.
Relative, because the same query sometimes gives an empty response either
from my code or directly in the WDQS interface, where it's possible to see
that a sparql query sometimes gives an empty response, sometimes the
expected reponse without message or status to know that the response is
erroneous.
(demo is difficult, because it seems to depend of the load of the wdqs
service)
I've found the following info:
*
https://www.mediawiki.org/wiki/Wikidata_Query_Service/User_Manual#Query_limits,
which suggest a possible error HTTP code 429, which I never receive
* https://phabricator.wikimedia.org/T179879, which suggest a possible
connexion with OAuth, but such possibility is never documented in the
official documentation

None of them gives a practical method to get a response and trust it.

Have you some advices?
(comment: this question is relative to the post
https://onsem.wp.imt.fr/2019/01/06/paris-musees-and-wikidata-establishing-links/
)


--
Jean-Claude Moissinac
___
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata