I would like to create a REST service in my application that has
request/response behavior shown in the following two scenarios:


http://example/claims?id=Q170790&lang=en

{
  “id”: “Q170790”,
  “label”: “mathematician”,
  “claims”: [
    {
      “property”: {
        “id”: “P279”,
        “label”: “subclass of”
      },
      “value”: [
        {
          “id”: “Q816264”,
          “label”: “formal science”
        }
      ]
    },
    {
      “property”: {
        “id”: “P425”,
        “label”: “field of this profession”
      },
      “value”: [
        {
          “id”: “Q395”,
          “label”: “mathematics”
        }
      ]
    }
  ]
}


http://example/claims?id=Q170790&lang=fr

{
  “id”: “Q170790”,
  “label”: “math\u00e9maticien”,
  “claims”: [
    {
      “property”: {
        “id”: “P279”,
        “label”: “sous-classe de”
      },
      “value”: [
        {
          “id”: “Q816264”,
          “label”: “science formelle”
        }
      ]
    },
    {
      “property”: {
        “id”: “P425”,
        “label”: “domaine d'occupation”
      },
      “value”: [
        {
          “id”: “Q395”,
          “label”: “math\u00e9matiques”
        }
      ]
    }
  ]
}


I'm trying to identify the best Wikidata API queries to support this
functionality, ideally only requiring one invocation.  The closest one
I've found is something like the following, but it seems that I'd have
to make an additional query to get the label for each Q item returned:
https://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q170790&languages=fr

Is there a way to somehow include the desired information in one query?

Regards,
James Weaver

_______________________________________________
Wikidata mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata

Reply via email to