WikibaseIntegrator
WikibaseIntegrator copied to clipboard
Support query in a helper function
https://www.wikidata.org/w/api.php?action=help&modules=query that module enables search using the cirrussearch extensions on Wikidata, see https://www.mediawiki.org/wiki/Help:Extension:WikibaseCirrusSearch
It is much more powerful than wbsearchentities it seems.
Example search is here: https://www.wikidata.org/w/api.php?format=json&action=query&list=search&srprop=&srlimit=10&srsearch=-haswbstatement:P31=Q13442814%20-haswbstatement:P31=Q5633421%20breast%20cancer
Hello @dpriskorn Thank you for this issue. It's a really good idea.
I wonder how to create this function to be easily understandable by the user.
- Allow to pass Claim as parameter
- Use python dict
- Use string
I started with the first one, but there is so much different case (has/hasnot, AND/OR, etc.), so i'm afraid the user will be lost.
I'm thinking pass a string for now and a limit will suffice. We can just link to the documentation. 😃
There is probably no good way to support CirrusSearch without it being too complicated.
I am definitely interested in this functionality and would be happy to have a simple string as the parameter.
For instance, the documentation gives the example of kitten haswbstatement:P31=Q3305213
. I was hoping I could do
wbi_helpers.search_entities("kitten haswbstatement:P31=Q3305213")
But this confusingly returns ['Q3305213']
(the same as the property value).
While a more complex method taking dict or Claim could be implemented, a string seems good enough for the web UI and it's good enough for my use cases.
@dpriskorn @Thunderforge
I've created the #436 to add a call to the query/search API endpoint. But I can't really process the data because it only return "page" and not "Item" or "Lexeme".
It's good for you?
I would like it documented also with a Wikibase cirrus search example also. I can submit a patch if you would like 😀
I would like it documented also with a Wikibase cirrus search example also. I can submit a patch if you would like 😀
With pleasure 😄
@LeMyst This works great for my use cases. Thank you!