citation-js / toolforge-tool

Tool for Wikimedia Toolforge
https://citation-js.toolforge.org/
MIT License
0 stars 0 forks source link

Input: references #2

Open larsgw opened 8 months ago

larsgw commented 8 months ago

As we want to restrict input, we cannot pass extra information from references along with stated in. This means missing out on reference URL, retrieved, and identifiers. The tool can instead take reference URIs as input and retrieve that information itself.

SELECT ?ref ?statedIn ?formatterUrl ?identifier ?referenceUrl ?retrieved WHERE {
  VALUES ?ref { wdref:005bca173b32a7c8f623bbeb832a152889e8f4e3 }
  OPTIONAL {
    ?ref pr:P248 ?statedIn .
    OPTIONAL {
      ?statedIn ^wdt:P9073 ?identifierProperty .
      ?identifierProperty wikibase:reference ?identifierPropertyReference .
      OPTIONAL {
        ?identifierProperty wdt:P1630 ?formatterUrl .
      }
      ?ref ?identifierPropertyReference ?identifier .
    }
  }
  OPTIONAL {
    ?ref pr:P854 ?referenceUrl .
  }
  OPTIONAL {
    ?ref pr:P813 ?retrieved .
  }
}