Page MenuHomePhabricator

List properties that are (only) used as qualifiers
Closed, ResolvedPublic

Description

When you look at https://www.wikidata.org/wiki/Q28925575, you will see that P670 (street number) is (only) used as a qualifier for P669 (street address), rather than a main property.
(unlike P281, which is used both as a qualifier and as a main property)

Now, when I use the inteGraality-template on https://www.wikidata.org/wiki/Wikidata:WikiProject_Netherlands_Public_Libraries/Completeness/BasicPropertiesLibraryBranches

and I add P670 to the list of P-numbers

|properties=P361,P18,P1705,P17,P131,P276,P625,P6375,P669,**P670,**P281,P1329,P968,P856,P973

and render the template, all the cells in the column for P670 have white backgrounds (0% match), as is shown in the current table. (while P670 is used very many times, so I would expect non-white backgrounds and non-zero percentages)

I guess this is due to the fact that P670 is used (only) as a qualifier, rather than a main property.

Event Timeline

OlafJanssen renamed this task from List properties that are (only) used a qualifier to List properties that are (only) used as qualifiers.Jul 18 2019, 11:05 AM
OlafJanssen updated the task description. (Show Details)

Mentioned in SAL (#wikimedia-cloud) [2019-10-25T14:08:21Z] <wm-bot> <jeanfred> Deploy latest from Git master: 6a055c2 (T228405)

JeanFred claimed this task.
JeanFred triaged this task as Medium priority.
JeanFred subscribed.

I have now implemented this, as part of the WikidataCon “Service Pack” update.

There is now extended syntax supported for columns, reused from Listeria: P1/P2 (covering the above usecase) and P1/Q1/P2 (covering the “Find account ID on Wikia” usecase)

@OlafJanssen See https://www.wikidata.org/wiki/User:Jean-Fr%C3%A9d%C3%A9ric/Sandbox6 for a take on your example (thanks *so much* for providing an example, that was super useful when frantically coding)

Note, however, that I was hitting timeouts with that particular column with your query − had to simplify the selector SPARQL (to not be recursive). I did not dig deeper into this.

The changeset implementing this is 6a055c2 − happy for others to check the SPARQL for sanity :) (see eg the unit test:

SELECT ?grouping (COUNT(DISTINCT ?entity) as ?count) WHERE {
  ?entity wdt:P31 wd:Q41960 .
  ?entity wdt:P551 ?grouping .
  FILTER EXISTS { ?entity p:P1 [ ps:P1 [] ; pq:P2 [] ] } .
}
GROUP BY ?grouping
HAVING (?count > 20)
ORDER BY DESC(?count)
LIMIT 1000

One caveat: this will not be 'smart' and merge the usage of the property. In the Library branches example, P670 is mostly used as a qualifier, but a few times as a main property. Filing a P669/P670 column will not take into account the usage of P670 as top-statement. I don’t plan to support that use case in the future.