[Wikidata] Best way to query Wikidata

2019-01-24 Thread Raveesh Meena
Hi,

I have a set of specific querie that my programme shoukd make to Wikidata.
How to best make such queries (information search) in terms of query
response time?

One approach that I am familar is to use APIs, such as Wikidata Toolkit API
, to query documents in
Wiki and parse each document (and perhaps follow hyperlinks) for obtaining
the specific feature values. I have tested this, but the queries could take
seconds. Now there could be many factors responsible for this such as
internet connection, the scheme for parsing wikidata graph, etc.

Another approach would be to use the Wikidata Query Service
 and SPARQL queries. This is also slow
sometimes.

My questions:

   - Are there benchmarks on response time performance of Wikidata Query
   Service  SPARQL queries?
   - Is there a JAVA API to the Wikidata Query Service
    interface?
   - Can SPARQL be used to query a dump of Wikidata?

Thanks and regards
Raveesh
___
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata


[Wikidata] Wikibase vs MediaWiki API

2018-12-03 Thread Raveesh Meena
Hi Lucas,

Thanks for explaining the differences in the results of searches using
Wikibase API
and MediaWiki API (reference thread below).

I have been using the Wikidata-Toolkit to query Wikidata using the
*wbsearchentities
<http://wikidata.github.io/Wikidata-Toolkit/org/wikidata/wdtk/wikibaseapi/WikibaseDataFetcher.html>*
implementation.
Now, the documentation about MediaWiki Action API
<https://www.mediawiki.org/wiki/API:Main_page#Uses_for_the_MediaWiki_Action_API>
seems to suggest that it is a web-service for accessing (wiki like)
databases .
I am currently interested in programatically querying Wikidata without
having to host a complete service and wondering if there are
easy to use MediaWiki API implementation (in Java) that I can use to
query Wikidata to fetch results corresponding to:

"action=query=search=SEARCHTERM=0|120
*"*

In other words, I want to know if there are libraries to achieve this
progamatically using Java.

Thanks and regards
Raveesh
>* On 12/1/18 2:38 AM, Lucas Werkmeister wrote:
*>>* wbsearchentities is a Wikibase-specific API; the normal MediaWiki search
*>>* function uses a different search configuration, which you can query in
*>>* the API via:
*>>>>* action=query=search=SEARCHTERM=0|120
*>>>>* For example:
*>>>>* 
https://www.wikidata.org/w/api.php?action=query=search=maruti=0|120=2
<https://www.wikidata.org/w/api.php?action=query=search=maruti=0%7C120=2>
*>>>>* Note that you need to sort the result list by the 'index' of each result
*>>* (I’m not sure why the API doesn’t do that for you).
*>>>>* Cheers,
*>>* Lucas
*>>>>* On 30.11.18 18:12, Raveesh Meena wrote:
*>>>* Hi,
*>>>>>>* The search results obtained by these two approaches are ordered
*>>>* differently:
*>>>>>>* method1: using the wikidata API
*>>>* <https://www.wikidata.org/w/api.php?action=help=main
<https://www.wikidata.org/w/api.php?action=help=main>>
*>>>* 
https://www.wikidata.org/w/api.php?action=wbsearchentities=Maruti=en
<https://www.wikidata.org/w/api.php?action=wbsearchentities=Maruti=en>
*>>>>>>* method2: search on wikidata Page
*>>>* 
<https://www.wikidata.org/w/index.php?search===Special%3ASearch=Go
<https://www.wikidata.org/w/index.php?search===Special%3ASearch=Go>>
*>>>* 
https://www.wikidata.org/w/index.php?search==Maruti=Special%3ASearch=Go
<https://www.wikidata.org/w/index.php?search==Maruti=Special%3ASearch=Go>
*>>>>>>* Intrestingly, in method2, the search suggestion drop-down list has the
*>>>* same order as that of method1 (see screenshot).
*>>>>>>* q1. How can I obtain results in the same order as that of method2
*>>>* using the wikidata API (i.e., method 1).
*>>>>>>* q2. Which of the two ordering is in general more
*>>>* "relevant/accurate/better"
*>>>>>>* Thanks for any help/hints.
*>>>>>>* Best regards,
*>>>* Raveesh
*>>>
___
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata


[Wikidata] HTTPS Proxy and Authentication

2018-09-04 Thread Raveesh Meena
Hi,

I am testing the sample example FetchOnlineDataExample but getting a Java
related error:

*Could not retrive data: java.io.IOException: Unable to tunnel through
proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required"*

Thinking that this issue seems to be related to Java's proxy settings I
have tried my bit and now wanted to seek a confirmation whether the logic
of establishing a HTTPS connection and authentication will work, given I
pass the following JVM Arguments during runtime:

-Dhttps.proxyHost=xxx.xxx.xx.xx -Dhttps.proxyPort=
-Dhttps.proxyUser=UserId -Dhttps.proxyPassword=Password
-Djdk.http.auth.tunneling.disabledSchemes=""

The last parameter is something I picked from various forums where it is
argued that Java 8 onwards Basic authentication scheme has been
deactivated. (
http://www.oracle.com/technetwork/java/javase/8u111-relnotes-3124969.html )

Actually, passing the Arguments did not resolve the error. Hence I wanted
to clarify if there are any Limitation on the Toolkit end.

Error logs

*** Wikidata Toolkit: FetchOnlineDataExample
--

*** This program fetches individual data using the wikidata.org API.
*** It does not download any dump files.
--

*** Fetching data for one entity:
2018-09-04 18:23:04 ERROR - Could not retrive data: java.io.IOException:
Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy
Authentication Required"
Exception in thread "main" java.lang.NullPointerException
at examples.FetchOnlineDataExample.main(FetchOnlineDataExample.java:100)
___
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata