Page MenuHomePhabricator

Queries return empty
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Create a new wikibase.cloud instance
  • Create two items, one property and a statement linking the three ("a pebble Q1 is an instance P1 of a rock Q2")
  • Switch to the query service and run:
select ?item ?itemLabel where {
 ?item wdt:P1 wd:Q2 .
}

What happens?:

Zero results. (Even after several days)

What should have happened instead?:

One result: Q1.

Other information:

I conducted this test against the version of wikibase.cloud available on January 9, 2023.

A possibly related issue is that when I created multiple properties, then viewed the page wiki/Special:ListProperties, not all properties appeared immediately, but they did after checking hours/days later. If this turns out to be unrelated I'll file a separate ticket.

Event Timeline

I see the same behavior on a fresh Docker install. I checked out wikibase-release-pipeline commit 6f7f418d1434229142650ae1e19db391857fcad9, copied the contents of examples/ to another directory, created an .env file, and ran COMPOSE_HTTP_TIMEOUT=3000 docker-compose -f docker-compose.yml -f docker-compose.extra.yml up -d.

After that I did exactly what I described above and also got zero hits.

I can confirm that in my local environment wikibase.cloud behaves the same way (and I've definitely experienced the issue with properties only showing up after some time on Special:ListProperties, but I'm also not sure if it's related)

What's interesting is that I see all the data of the two items and the property if I use this query:
select * { ?a ?b ?c }

Which let's me assume that the data is available for the Query Service.

So I wonder if there is something wrong with the query? (Unfortunately my SPARQL skills aren't developed yet, maybe I finally should put the time into learning it 😅)
Specifically I wonder if the used prefixes should be different, as they may be wikidata specific? (wdt: and wd:)

Expanding on the thought of my last comment: on my local machine wikibase.cloud setup I created a wiki and followed your steps, and the following query gives me the expected result:

PREFIX wd:  <https://t326643-test.wbaas.localhost/entity/>
PREFIX wdt: <https://t326643-test.wbaas.localhost/prop/direct/>

select ?item ?itemLabel where {
 ?item wdt:P1 wd:Q2
}

image.png (653×813 px, 59 KB)

Now, I recreated this on wikibase.cloud because I wanted to share the actual wiki and Query Service instance, but interestingly enough it doesn't work over there: Link to Query Service

I've been hoping against hope that this is something I'm doing wrong. However I think those prefixes are universal to Wikibase despite the choice of letters, for two reasons:

What's interesting is that in the meantime my example on wikibase.cloud now works (kind of; the item label is missing somehow). I guess the Query Service wasn't updated fast enough yesterday.

I think I'll have to bring this to some engineers with more experience with sparql/wikibase

This issue was just reported on Telegram as well:

21/02/2023 14:58 CET
anyone having issues with queries. Very basic queries not returning any results for me
https://lcpindex.wikibase.cloud/

wd: and wdt: default to Wikidata on Wikibase Cloud, as far as WDQS backend is concerned. You can override it by manually setting endpoints, but that is what it is set to. The autocomplete used to be Wikidata too, but was changed, making it easier for those who override those prefixes, but compounding the problem for those who don't.

This is ultimately rooted in WDQS being the Wikidata Query Service - I made a proposal that might address it for Cloud in T335448, although it'd mean that autocomplete (and Cradle) would need to be smarter, too - perhaps looking at path elements of all prefixes (and needing to read/know them).

Thanks @GreenReaper ! I'm glad to know it's the prefixes. This works for me:

PREFIX wd:  <https://tw-made-an-instance-of.wikibase.cloud/entity/>
PREFIX wdt: <https://tw-made-an-instance-of.wikibase.cloud/prop/direct/>

select ?item ?itemLabel where {
 ?item wdt:P1 wd:Q2 .
}
danshick-wmde triaged this task as Lowest priority.