User:MichaelSchoenitzer/quickpresets

Screenshot with the example of a human person. The value 'Citizenship' is greyed out, because is already present.

quickpresets is a User script, that allows you to add common statements with only one click. It it though to be customizeable. You can configure it to present you the presets you use most often with as little clicks as possible.

InstallationEdit

To use this gadget add the following into in your common.js:

importScript( 'User:MichaelSchoenitzer/quickpresets.js' );

ConfigurationEdit

The tool is configured by creating a js-page (for example quickpresets_settings.js) in your usernamespace and loading it from your common.js before the loading of quickpresets:

importScript( 'User:YourName/quickpresets_settings.js' );
importScript( 'User:MichaelSchoenitzer/quickpresets.js' );

You can start by copying the content of the default config (which shows presets for human (Q5) and software (Q7397)) and modify it as you wish.

The format of the configuration is like this:

quick_props = [
   {
      qid: 5,               // Only apply this preset-block for items with instance of (P31) set to 5
      name: "Human",        // Label that should be shown for this group
      defaults: [           // List all Preset for this group
         {
            name: "Gender",
            pid: 21,        // ID of the property that should be proposed
            values: [       // values of the items that should be proposed for this pid
               {name: "male", qid: 6581097},
               {name: "femal", qid: 6581072},
               {name: "intersexual", qid: 1097630},
               //...
                 ]
         },
         {
            name: "Citizenship",
            pid: 27,
            values: [
               {name: "USA", qid: 30},
               {name: "Germany", qid: 183},
               //...
               ]
         },
      // Next group of presets for another type of items comes here.
      ]
   },
]

Hint:

  • Do not add presets for too many different types since quickpresets will do a sparql-query for every type on every item!
  • You can add presets for items without any instance of (P31) by adding a preset-group where the qid is null
  • You can add presets for items with any arbitrary instance of (P31) by adding a preset-group where the qid is 0
  • The tool will not only work for items with instance of (P31) set to the specified value, but also for value that are a subclass of (P279) of it (incl. recursive applying).

ChangelogEdit

  • 2017-12-24: Initial version
  • 2017-12-30: Announce on Wikidata:Project_chat and Wikidata:Tools
  • 2017-12-31: Add Support "no instance of (P31)"
  • 2018-01-01: Add Support "any instance of (P31)"
  • 2018-01-15: Fixed a bug.
  • 2018-02-01: new version
    • New Feature: If adding a instance of (P31) reload the interfaces
    • New Feature: Support properties with datatype string
    • Improvement: Items are now added 3x as fast
    • A few bug-fixes
  • 2018-02-02: Show Properties without presets compactly & Link this site in the edit summary

Bugs & TodosEdit

  • BUG: Make width identical to the rest
  • BUG: Showing wrong interface on properties
  • i18n
    • multilingual strings
  • Support for other Datatypes
    • Strings --   OK
    • URL --   OK (could still be improved)
  • v2: Add interface to allow easily configure own setting – WIP
  • v2: Add properties via Javascript not Api, so that they can be edited without reloading. – WIP, stalled due to an issue
  • v2: Add sources?