gridsome-source-wikidata

0.0.11 • Public • Published

gridsome-source-wikidata

Install

  • yarn add gridsome-source-wikidata
  • npm install gridsome-source-wikidata

Usage

module.exports = {
  plugins: [
    {
      use: "gridsome-source-wikidata",
      options: {
        url: "https://query.wikidata.org/sparql",
        sparql: `SELECT DISTINCT ?item ?paintingLabel (MIN(?images) AS ?image) WHERE {
          ?painting (wdt:P31/(wdt:P279*)) wd:Q3305213;
            wdt:P170 wd:Q762;
            wdt:P18 ?images;
          BIND(REPLACE(STR(?painting), "^.*/", "") AS ?item)
          SERVICE wikibase:label {
            bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
            ?painting rdfs:label ?paintingLabel.
          }
        }
        GROUP BY ?item ?painting ?paintingLabel ?image
        LIMIT 10`,
        typeName: "Painting",
        baseDir: "/content/images/",
        verbose: "true"
      }
    },
  templates: {
    Painting: "/:item"
  }
}

Query SPARQL in Wikidata Query Service

Property Description Mandatory
url https://query.wikidata.org/sparql true
sparql SPARQL examples true
typeName Specify template correlation true
baseDir download file folder false; default: /content/
cacheFile cache file name false; default: .cache.json
cacheEnabled cache toggle false; default: true
ttl time to live for cached values: ttl=0=infinite false; default: 24 * 60 * 60 * 1000 ms = 24h
verbose set verbose mode false

Open issues

  • add fine grained filters for URI downloads

Package Sidebar

Install

npm i gridsome-source-wikidata

Weekly Downloads

0

Version

0.0.11

License

none

Unpacked Size

13.2 kB

Total Files

6

Last publish

Collaborators

  • hunsalz