On Tue, Apr 7, 2020 at 8:16 PM Jan-Christoph Klie <klie@ukp.informatik.tu-darmstadt.de> wrote:

Hello,

When we issue queries using the MWAPI [1] programatically, we sometimes get a 500 error. I would guess that happens in more than 30% of the cases. The following SPARQL query causes the error:

    SELECT DISTINCT *
    WHERE {
        SERVICE wikibase:mwapi {
            bd:serviceParam wikibase:api "EntitySearch" .
            bd:serviceParam wikibase:endpoint "www.wikidata.org" .
            bd:serviceParam wikibase:limit "once" .
            bd:serviceParam mwapi:search "integre" .
            bd:serviceParam mwapi:language "en" .
            ?subj wikibase:apiOutputItem mwapi:item .
        }
    }
    LIMIT 2000


Hi,

unless I'm mistaken you don't seem to need to query this endpoint nor need SPARQL to search entities in wikidata.
Have you looked at using the wbsearchentities[0] API endpoint. The SPARQL request you pasted in your message seems to be fulfilled using this API request: https://www.wikidata.org/w/api.php?action=wbsearchentities&format=json&limit=50&language=en&search=integre&type=item in a much more efficient way.
As to why the service is returning timeouts so often this is something we will be looking into.

0: https://www.wikidata.org/w/api.php?action=help&modules=wbsearchentities