Just a reminder,
We are starting to phase out the table, it will stop getting updated from end of the next week and will be dropped two or three weeks from now, the wb_terms table now have term_full_entity_id instead which is not replicated to labs yet [0] but it will very soon.


From: Magnus Manske <magnusmanske@googlemail.com>
Date: Thu, Jun 1, 2017 at 5:21 PM
Subject: Re: [Wikidata-tech] Breaking change: "wb_entity_per_page" table will not be updated and replicated on ToolLabs anymore
To: Daniel Kinzler <daniel.kinzler@wikimedia.de>, Wikidata technical discussion <wikidata-tech@lists.wikimedia.org>

The original code predated SPARQL, so I have to change it anyway. The example I gave is small enough for SPARQL, but others will not be.

On Thu, Jun 1, 2017 at 4:11 PM Daniel Kinzler <daniel.kinzler@wikimedia.de> wrote:
Am 01.06.2017 um 16:59 schrieb Magnus Manske:
> As an example from my BEACON tool, I want all properties that have a formatter
> property, with English label. That SQL is now:
> SELECT DISTINCT page_title,term_text FROM pagelinks,page,wb_terms WHERE
> page_namespace=120 AND substr(page_title,2)=term_entity_id and
> term_entity_type='property' and term_language='en' and term_type='label' and
> pl_from=page_id and pl_title='P1630' and pl_namespace=120 and
> pl_from_namespace=120 ORDER BY term_text
> Note the "substr". My first attempt was "page_title=concat('Q',term_entity_id)",
> but that took forever.
> If we indeed get a full entity ID=page title column for wb_terms, and
> for wb_items_per_site etc., that would at least fix the on-the-fly compute. I
> shall thus wait with code updates until I get the full story, and not just
> piece-by-piece...

There is currently no plan to put the full ID into wb_items_per_site or
wb_property_info, because these tables are bound to a specific entity type.
Whether we want to do this would be a whole new discussion.

For what you are doing there, it's  probably a lot easier to use the query
service. SPARQL:

SELECT DISTINCT ?property ?propertyLabel
    ?property a wikibase:Property .
    ?property wdt:P1630  ?format .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }

Daniel Kinzler
Principal Platform Engineer

Wikimedia Deutschland
Gesellschaft zur Förderung Freien Wissens e.V.
Wikidata-tech mailing list