Hi Adrian!

On Wed, Nov 5, 2014 at 11:41 AM, Adrian Pohl <[email protected]> wrote:
> Hello,
>
> I have a list of place names and want to find the according wikidata item
> with this name. The list includes "Köln, "Düsseldorf" but also parts of
> towns which are recorded as compounds of the superior administrative entity
> and the district like "Schmallenberg-Westernbödefeld" or "Kerpen-Manheim".
>
> If I lookup these via the Wikidata API with the wbsearchentities action I
> get no problems with "Köln" and the like [1] but won't get any results for
> compounds, see e.g. [2] although both strings are part of the label and the
> description of a wikidata item.

The Wikidata wbsearchentities API is currently a prefix-search only.

>
> Via the wikidata interface I get the right result, though.[3]
>
> I have looked quite some time but couldn't find a way to query wikidata
> programatically and get results similar to the website search. Thus, my
> question is:
>
> Is there a way to query wikidata via an API over both the label fields and
> the description?

You could use the mediawiki search module, that should give you the
same results that you got on the website search:

e.g. 
http://www.wikidata.org/w/api.php?action=query&list=search&format=json&srsearch=Kerpen-Manheim&srnamespace=0&continue=

>
> Background
>
> I am working at the North Rhine-Westphalian Library Service Center (hbz)and
> we are currently building a new website for the Northrhine-Westphalian
> bibliography. [4] This bibliography collects articles, books and other media
> about places in the German federal state of Northrhine- Westphalia. Each
> record contains a string which indicates which place a resource is about. As
> soon as we have those links to Wikidata we will think about how to link to a
> list of bibliographic resources about a place from the place's wikipedia
> page. See the GitHub issue on this particular problem at [5].
>
> All the best
> Adrian

Hope that helps!
Good luck with your project!

cheers, tobi

>
> [1]
> https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Köln&language=de&format=json
>
> [2]
> https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Kerpen%20Manheim&language=de&format=json
>
> [3] https://www.wikidata.org/w/index.php?search=Kerpen+Manheim
>
> [4] http://lobid.org/nwbib
>
> [5] https://github.com/hbz/nwbib/issues/42
> --
> Adrian Pohl
> hbz - Hochschulbibliothekszentrum des Landes NRW
> Tel: (+49)(0)221 - 400 75 235
> http://www.hbz-nrw.de
>
> _______________________________________________
> Wikidata-tech mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/wikidata-tech



-- 
Tobi Gritschacher
Software Developer & SCRUM Master - Wikidata - http://www.wikidata.org

Imagine a world, in which every single human being can freely
share in the sum of all knowledge. That‘s our commitment.

Wikimedia Deutschland e.V. | Tempelhofer Ufer 23-24 | 10963 Berlin
Phone +49 (0)30 219 158 260

http://wikimedia.de

Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e.V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg
unter der Nummer 23855 B. Als gemeinnützig anerkannt durch das
Finanzamt für Körperschaften I Berlin, Steuernummer 27/681/51985.

_______________________________________________
Wikidata-tech mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-tech

Reply via email to