Difference between revisions of "Wikidata/Bots"

From BITPlan Wiki
Jump to navigation Jump to search
Line 4: Line 4:
 
npm install -g wikibase-cli
 
npm install -g wikibase-cli
 
</source>
 
</source>
 
+
== Set language ==
 +
<source lang='bash'>
 +
wd config lang en
 +
</source>
 +
== Generate a template ==
 +
<source lang='bash'>
 +
wd gt Q98093643
 +
</source>
 +
<source lang='javascript'>
 +
module.exports = function () {
 +
  return {
 +
    id: 'Q98093643',
 +
    type: 'item',
 +
    labels: {
 +
      en: 'The Semantic Web - ISWC 2008: 7th International Semantic Web Conference, ISWC 2008, Karlsruhe, Germany, October 26-30, 2008. Proceedings',
 +
      nl: 'The Semantic Web - ISWC 2008: 7th International Semantic Web Conference, ISWC 2008, Karlsruhe, Germany, October 26-30, 2008. Proceedings'
 +
    },
 +
    descriptions: {
 +
      nl: 'wetenschappelijk artikel'
 +
    },
 +
    aliases: {
 +
      da: [
 +
        'ISWC 2008'
 +
      ],
 +
      de: [
 +
        'ISWC 2008'
 +
      ],
 +
      en: [
 +
        'ISWC 2008'
 +
      ]
 +
    },
 +
    claims: {
 +
      // DOI
 +
      P356: {
 +
        value: '10.1007/978-3-540-88564-1',
 +
        id: 'Q98093643$C1772065-4596-4134-844E-563AC0A1BD3E'
 +
      },
 +
      // instance of
 +
      P31: {
 +
        // proceedings
 +
        value: 'Q1143604',
 +
        id: 'Q98093643$985B02BD-E86C-44CF-A583-FFF43DFF9B01'
 +
      },
 +
      // title
 +
      P1476: {
 +
        value: {
 +
          text: 'The Semantic Web - ISWC 2008',
 +
          language: 'en'
 +
        },
 +
        id: 'Q98093643$DC6F830E-949E-49B2-8027-B042734F6EFB'
 +
      },
 +
      // publication date
 +
      P577: {
 +
        value: {
 +
          time: '2008-01-01T00:00:00.000Z',
 +
          timezone: 0,
 +
          before: 0,
 +
          after: 0,
 +
          precision: 9,
 +
          calendarmodel: 'http://www.wikidata.org/entity/Q1985727'
 +
        },
 +
        id: 'Q98093643$B2AF8C1E-1A55-4C79-8D2F-AA6291E045E5'
 +
      },
 +
      // published in
 +
      P1433: {
 +
        // Lecture Notes in Computer Science
 +
        value: 'Q924044',
 +
        id: 'Q98093643$990002D5-5338-496B-9246-4BD047B5C163'
 +
      },
 +
      // part of the series
 +
      P179: {
 +
        // Lecture Notes in Computer Science
 +
        value: 'Q924044',
 +
        qualifiers: {
 +
          // volume
 +
          P478: '5318'
 +
        },
 +
        id: 'Q98093643$65f6ddfe-4663-26da-3a33-78b537342de3'
 +
      },
 +
      // is proceedings from
 +
      P4745: {
 +
        // The 7th International Semantic Web Conference
 +
        value: 'Q48026643',
 +
        id: 'Q98093643$cf010689-4610-a5c4-bf85-8b0c20b0b043'
 +
      },
 +
      // language of work or name
 +
      P407: {
 +
        // English
 +
        value: 'Q1860',
 +
        id: 'Q98093643$8592a1b4-40d7-13f9-d2e8-93438ad137fd'
 +
      },
 +
      // short name
 +
      P1813: {
 +
        value: {
 +
          text: 'ISWC 2008',
 +
          language: 'en'
 +
        },
 +
        id: 'Q98093643$9f2cdd5c-4326-03f5-17c7-597ed3447f3f'
 +
      },
 +
      // ISBN-13
 +
      P212: [
 +
        {
 +
          value: '978-3-540-88563-4',
 +
          id: 'Q98093643$78ccabdb-4e34-d46a-db6f-a43b0d36390a'
 +
        },
 +
        {
 +
          value: '978-3-540-88564-1',
 +
          id: 'Q98093643$d485c5a9-417e-31e5-50d7-a531a0dfda22'
 +
        }
 +
      ],
 +
      // DBLP publication ID
 +
      P8978: {
 +
        value: 'conf/semweb/2008',
 +
        id: 'Q98093643$071415A6-5A1E-4901-A1ED-9B35ED84ABCB'
 +
      },
 +
      // Open Library ID
 +
      P648: {
 +
        value: 'OL23908686M',
 +
        id: 'Q98093643$AB56E98D-7102-468B-8E39-9C76602C41CD'
 +
      },
 +
      // K10plus PPN ID
 +
      P6721: {
 +
        value: '579171965',
 +
        id: 'Q98093643$7b25fc25-440d-38b5-ecfb-18a9a943cbc7'
 +
      },
 +
      // GND ID
 +
      P227: {
 +
        value: '990520765',
 +
        id: 'Q98093643$87f095e0-4fd3-6f0f-b61a-5ab708122e1d'
 +
      }
 +
    },
 +
    sitelinks: {}
 +
  }
 +
}
 +
</source>
 +
== Get all properties ==
 +
<source lang='bash'>
 +
</source>
 
= Example for Wikidata Bots =
 
= Example for Wikidata Bots =
 
* https://github.com/gbv/K10PlusBot
 
* https://github.com/gbv/K10PlusBot
 
* https://heardlibrary.github.io/digital-scholarship/host/wikidata/bot/
 
* https://heardlibrary.github.io/digital-scholarship/host/wikidata/bot/
 
* https://github.com/dpriskorn/LexUtils
 
* https://github.com/dpriskorn/LexUtils

Revision as of 10:54, 12 March 2022

Command Line interface

https://github.com/maxlath/wikibase-cli

npm install -g wikibase-cli

Set language

wd config lang en

Generate a template

wd gt Q98093643
module.exports = function () {
  return {
    id: 'Q98093643',
    type: 'item',
    labels: {
      en: 'The Semantic Web - ISWC 2008: 7th International Semantic Web Conference, ISWC 2008, Karlsruhe, Germany, October 26-30, 2008. Proceedings',
      nl: 'The Semantic Web - ISWC 2008: 7th International Semantic Web Conference, ISWC 2008, Karlsruhe, Germany, October 26-30, 2008. Proceedings'
    },
    descriptions: {
      nl: 'wetenschappelijk artikel'
    },
    aliases: {
      da: [
        'ISWC 2008'
      ],
      de: [
        'ISWC 2008'
      ],
      en: [
        'ISWC 2008'
      ]
    },
    claims: {
      // DOI
      P356: {
        value: '10.1007/978-3-540-88564-1',
        id: 'Q98093643$C1772065-4596-4134-844E-563AC0A1BD3E'
      },
      // instance of
      P31: {
        // proceedings
        value: 'Q1143604',
        id: 'Q98093643$985B02BD-E86C-44CF-A583-FFF43DFF9B01'
      },
      // title
      P1476: {
        value: {
          text: 'The Semantic Web - ISWC 2008',
          language: 'en'
        },
        id: 'Q98093643$DC6F830E-949E-49B2-8027-B042734F6EFB'
      },
      // publication date
      P577: {
        value: {
          time: '2008-01-01T00:00:00.000Z',
          timezone: 0,
          before: 0,
          after: 0,
          precision: 9,
          calendarmodel: 'http://www.wikidata.org/entity/Q1985727'
        },
        id: 'Q98093643$B2AF8C1E-1A55-4C79-8D2F-AA6291E045E5'
      },
      // published in
      P1433: {
        // Lecture Notes in Computer Science
        value: 'Q924044',
        id: 'Q98093643$990002D5-5338-496B-9246-4BD047B5C163'
      },
      // part of the series
      P179: {
        // Lecture Notes in Computer Science
        value: 'Q924044',
        qualifiers: {
          // volume
          P478: '5318'
        },
        id: 'Q98093643$65f6ddfe-4663-26da-3a33-78b537342de3'
      },
      // is proceedings from
      P4745: {
        // The 7th International Semantic Web Conference
        value: 'Q48026643',
        id: 'Q98093643$cf010689-4610-a5c4-bf85-8b0c20b0b043'
      },
      // language of work or name
      P407: {
        // English
        value: 'Q1860',
        id: 'Q98093643$8592a1b4-40d7-13f9-d2e8-93438ad137fd'
      },
      // short name
      P1813: {
        value: {
          text: 'ISWC 2008',
          language: 'en'
        },
        id: 'Q98093643$9f2cdd5c-4326-03f5-17c7-597ed3447f3f'
      },
      // ISBN-13
      P212: [
        {
          value: '978-3-540-88563-4',
          id: 'Q98093643$78ccabdb-4e34-d46a-db6f-a43b0d36390a'
        },
        {
          value: '978-3-540-88564-1',
          id: 'Q98093643$d485c5a9-417e-31e5-50d7-a531a0dfda22'
        }
      ],
      // DBLP publication ID
      P8978: {
        value: 'conf/semweb/2008',
        id: 'Q98093643$071415A6-5A1E-4901-A1ED-9B35ED84ABCB'
      },
      // Open Library ID
      P648: {
        value: 'OL23908686M',
        id: 'Q98093643$AB56E98D-7102-468B-8E39-9C76602C41CD'
      },
      // K10plus PPN ID
      P6721: {
        value: '579171965',
        id: 'Q98093643$7b25fc25-440d-38b5-ecfb-18a9a943cbc7'
      },
      // GND ID
      P227: {
        value: '990520765',
        id: 'Q98093643$87f095e0-4fd3-6f0f-b61a-5ab708122e1d'
      }
    },
    sitelinks: {}
  }
}

Get all properties

Example for Wikidata Bots