maxlath / wikibase-cli

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

wb search: --properties results get ignored when --json is specified #180

Open tmtmtmtm opened 9 months ago

tmtmtmtm commented 9 months ago

wb search can include other properties in the results: e.g. P31:

wd search --properties P31 Edgar Savisaar

id Q355241
Label Edgar Savisaar
Description Estonian politician
instance of (P31): human (Q5)
Wikipedia intro Edgar Savisaar (31 May 1950 – 29 December 2022) was an Estonian politician, one of the founding members of Popular Front of Estonia and the Centre Party. He served as the acting Prime Minister of Estonia, Minister of the Interior, Minister of Economic Affairs and Communications, and twice mayor of Tallinn. https://en.wikipedia.org/wiki/Edgar_Savisaar

id Q1720283
Label Edgar Savisaar's Cabinet
instance of (P31): Government of Estonia (Q2421589)

but when --json is specified those properties don't get included in the result:

wd search --properties P31 --json Edgar Savisaar

[
  {
    "id": "Q355241",
    "title": "Q355241",
    "pageid": 339003,
    "display": {
      "label": {
        "value": "Edgar Savisaar",
        "language": "en"
      },
      "description": {
        "value": "Estonian politician",
        "language": "en"
      }
    },
    "repository": "wikidata",
    "url": "//www.wikidata.org/wiki/Q355241",
    "concepturi": "http://www.wikidata.org/entity/Q355241",
    "label": "Edgar Savisaar",
    "description": "Estonian politician",
    "match": {
      "type": "label",
      "language": "en",
      "text": "Edgar Savisaar"
    }
  },
  {
    "id": "Q1720283",
    "title": "Q1720283",
    "pageid": 1653406,
    "display": {
      "label": {
        "value": "Edgar Savisaar's Cabinet",
        "language": "en"
      }
    },
    "repository": "wikidata",
    "url": "//www.wikidata.org/wiki/Q1720283",
    "concepturi": "http://www.wikidata.org/entity/Q1720283",
    "label": "Edgar Savisaar's Cabinet",
    "match": {
      "type": "label",
      "language": "en",
      "text": "Edgar Savisaar's Cabinet"
    }
  }
]