User:Lectrician1/CheckPropertyExamples.js

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
$(function() {
  mw.hook("wikibase.entityPage.entityLoaded").add(async function(e) {
    if ('P1629' in e.claims) {
      let query = `SELECT ?example ?exampleValue ?y WHERE {
  VALUES ?propertyWd {wd:${e.id}}
  ?propertyWd p:P1855 ?statement.
  ?propertyWd wikibase:qualifier ?pq.
  ?statement ps:P1855 ?example;
             ?pq ?exampleValue.
  
  ?propertyWd wikibase:directClaim ?propertyWdt.
  
  BIND (exists{?example ?propertyWdt ?exampleValue} AS ?y)
}`
      let results = await $.post("https://query.wikidata.org/sparql?format=json", {
        query: query
      })
      
      for (example of results.results.bindings) {
        if 
      }

      console.log(result)

    }
  })
})