maxlath / wikibase-cli

read and edit a Wikibase instance from the command line
MIT License
227 stars 24 forks source link

Adding claim an qualifier at the same time? #154

Closed EvaSeidlmayer closed 2 years ago

EvaSeidlmayer commented 2 years ago

I can add a claim to an item wb edit-entitiy {'id': 'Q223813', 'claims': {'P242': {'value': 'Q223817', 'references': [{'P149': 'Q223807'}]}}} And afterwards it works to add a qualifier wb aq 'Q223813$8D9789BF-BA6E-4870-9687-F3079F1FBD69' P551 '21'

Is there a way to add both at the same time? this does not work out: wb edit-entity {'id': 'Q223813', 'claims': {'P242': {'value': 'Q223817', 'qualifier': [{'P95657': 'Gabriella Rustici'}, {'P551': '21'}], 'references': [{'P149': 'Q223807'}]}}}

thank you!

maxlath commented 2 years ago

It's qualifiers and not qualifier, and qualifiers must be an object (unlike references that may be an array of objects):

wb edit-entity '{
  "id": "Q223813",
  "claims": {
    "P242": {
      "value": "Q223817",
      "qualifiers":
        {
          "P95657": "Gabriella Rustici"
          "P551": "21"
        }
      ],
      "references": [
        {
          "P149": "Q223807"
        }
      ]
    }
  }
}'

Notes:

EvaSeidlmayer commented 2 years ago

Fantastic! I only had to add a comma and remove a square bracket!

 '{
  "id": "Q223813",
  "claims": {
    "P242": {
      "value": "Q223817",
      "qualifiers":
        {
          "P95657": "Gabriella Rustici",
          "P551": "21"
        },
      "references": [
        {
          "P149": "Q223807"
        }
      ]
    }
  }
}'

Thank you very much!