Wikidata:Wikidata curricula/Activities/Find Commons Creator page without Commons category

From Wikidata
Jump to navigation Jump to search

The Commons Creator page (P1472) cannot exist without Commons category (P373).

See the constraint Property:P1472#P1472$AF8FAFBC-FB6C-4F6A-9ACD-356FA3EE39B4.

Find anomalies[edit]

The following query allows to find all creators without a commons category statement:

The following query uses these:

  • Properties: Commons Creator page (P1472)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, Commons category (P373)  View with Reasonator View with SQID
    # Commons Creator page without Commons category
    SELECT ?item ?itemLabel ?creatorLabel (SUBSTR(?name, 10 ) AS ?category) WHERE {
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],nl,fr,de,en,es,it". }
      ?item wdt:P1472 ?creator;
        wdt:P31 wd:Q5, ?instance.
      {
        ?article schema:about ?item;
          schema:name ?name;
          schema:isPartOf <https://commons.wikimedia.org/>.
      }
      FILTER(CONTAINS(STR(?article), "/Category:"))
      MINUS { ?item wdt:P373 ?commonscat. }
    }
    

Then you can process those transactions with QuickStatements.

Caveat[edit]

  • Make sure the UTF-8 accents are properly encoded
  • Make sure you replace any _ by " " (space; mandatory: the _ is not a valid character for Commons Categories)
  • You can use the Quickstatements V1 or V2 format with string parameters (note the number of double quotes)

V1 example:

Q2821533	P373	"Abel Rey"

V2 example:

qid,P373
Q2821533,"""Abel Rey"""