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 <[email protected]> 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 > WHERE { > ?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 [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-tech
