/v1/property/values/in/linked

Return property values for properties that can be chained for multiple degrees in the knowledge graph.

For example, in the following diagram:

Example of a chained property

The property containedInPlace is chained. Buenos Aires is contained in Argentina, which is itself contained in South America – implying Buenos Aires is also contained in South America. With this endpoint, you could query for countries in South America (returning Argentina) or for cities in South America (returning Buenos Aires).

Request

GET Request

http://api.datacommons.org/v1/property/values/in/linked/{CONTAINING_PLACE}/containedInPlace?value_node_type={place_type}&key={your_api_key}

Path Parameters

Name Description
CONTAINING_PLACE
Required
DCID of the parent place to query.

Query Parameters

Name Type Description
key
Required
string Your API key. See the page on authentication for a demo key, as well as instructions on how to get your own key.
value_node_type
Required
string The type of place to get results for (e.g. state, country, city, county). For a list of available values, see the Knowledge Graph page on Place.

Response

The response looks like:

{
  "values":
  [
    {
      "name": "Place Name",
      "dcid": "Place DCID"
    }, ...
  ]
}

Response fields

Name Type Description
values list List of place nodes that are contained in the queried parent place.

Examples

Example 1: Get all states in a country.

Get all states in India (DCID: country/IND).

Request:

  $ curl --request GET --url \
  'https://api.datacommons.org/v1/property/values/in/linked/country/IND/containedInPlace?value_node_type=State&key=AIzaSyCTI4Xz-UW_G2Q2RfknhcfdAnTHq5X5XuI'

Response:

{
  "values":
  [
    {
      "name": "Gujarat",
      "dcid": "wikidataId/Q1061"
    },
    {
      "name": "Andhra Pradesh",
      "dcid": "wikidataId/Q1159"
    },
    < ... output truncated for brevity ...>
    {
      "name": "Daman and Diu",
      "dcid": "wikidataId/Q66710"
    },
    {
      "name": "Telangana",
      "dcid": "wikidataId/Q677037"
    }
  ]
}

Page last updated: November 27, 2024 • Send feedback about this page