query-f503ba7223df9531226ebf5b11c22092

rq turtle/ttl

Fix a query that generates duplicates args in template?. The duplicate args problem is fixed in the generated wikicode by my bot WikiCleanerBot, but of course each time ListeriaBot updates the list it recreates the problem. How can the query be modified to prevent this duplication of args in the template? The current request is fr:Utilisateur:Popolon/Brouillon/Liste de mosquées de ChineI've an example of a query that currently generates duplicates args in template, automatically putting the page in the corresponding tracking category, in frwiki:

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT DISTINCT ?item ?div1 ?div2
WHERE
{ 
  ?item wdt:P17 wd:Q148 . 
  ?item wdt:P31/wdt:P279* wd:Q32815 .
  OPTIONAL {
      ?item wdt:P131* ?div1.
      ?div1 wdt:P31/wdt:P279* wd:Q9316670.
  }
  OPTIONAL {
      ?item wdt:P131* ?div2.
      ?div2 wdt:P31/wdt:P279* wd:Q13396669.
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?div1"):::projected v3("?div2"):::projected v1("?item"):::projected a1((" ")) a2((" ")) a3((" ")) c2(["wd:Q148"]):::iri c5(["wd:Q32815"]):::iri c7(["wd:Q9316670"]):::iri c8(["wd:Q13396669"]):::iri v1 --"wdt:P17"--> c2 v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c5 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P131".-> v2 v2 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P131".-> v3 v3 --"wdt:P31"--> a3 a3 --"wdt:P279"--> c8 end