Topic on User talk:Matěj Suchánek

Jura1 (talkcontribs)

For instance of Q47150325, the sitelink titles aren't necessarily ideal labels

Matěj Suchánek (talkcontribs)

I agree. But we can run a bot over all of them with the correct label (if I had a pattern for each language).

Jura1 (talkcontribs)

For languages I had that, it's mostly done. Could you skip these for now? It took considerable effort to delete all the Wikinews strings in these items.

Matěj Suchánek (talkcontribs)

This is a query that can be used to import labels in any language if the language has a proper label for the given month:

SELECT ?item ?lang ?new WITH {
  SELECT DISTINCT ?lang ?month ?pattern {
    VALUES ?lang { 'es' 'tr' } .
    ?item wdt:P31 wd:Q47150325;
          wdt:P585 ?date;
          rdfs:label ?label FILTER( LANG( ?label ) = ?lang ) .
    ?item ^schema:about [ schema:inLanguage ?lang; schema:name ?title ] FILTER( ?title != ?label ) .
    BIND( YEAR( ?date ) AS ?year ) .
    BIND( MONTH( ?date ) AS ?month ) .
    BIND( DAY( ?date ) AS ?day ) .
    BIND( REPLACE( ?label, STR( ?year ), '\\$year' ) AS ?pattern1 ) .
    BIND( REPLACE( ?pattern1, STR( ?day ), '\\$day' ) AS ?pattern ) .
    FILTER( ?label != ?pattern1 && ?pattern1 != ?pattern ) .
    FILTER( !REGEX( ?pattern, '\\$day.*\\$day' ) ) .
  }
} AS %patterns WHERE {
  INCLUDE %patterns .
  ?item wdt:P31 wd:Q47150325;
        wdt:P585 ?date .
  FILTER( MONTH( ?date ) = ?month ) .
  BIND( REPLACE( ?pattern, '\\$year', STR( YEAR( ?date ) ) ) AS ?_new ) .
  BIND( REPLACE( ?_new, '\\$day', STR( DAY( ?date ) ) ) AS ?new ) .
  MINUS { ?item rdfs:label ?new } .
} ORDER BY ?date ?lang

Try it!

Jura1 (talkcontribs)

Looks good. It seems to be an endless work as your bot keeps adding more:

Reply to "labels"