> ## Documentation Index
> Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Camel.toolkits.data commons toolkit

<a id="camel.toolkits.data_commons_toolkit" />

<a id="camel.toolkits.data_commons_toolkit.DataCommonsToolkit" />

## DataCommonsToolkit

```python theme={"system"}
class DataCommonsToolkit(BaseToolkit):
```

A class representing a toolkit for Data Commons.

This class provides methods for querying and retrieving data from the
Data Commons knowledge graph. It includes functionality for:

* Executing SPARQL queries
* Retrieving triples associated with nodes
* Fetching statistical time series data
* Analyzing property labels and values
* Retrieving places within a given place type
* Obtaining statistical values for specific variables and locations

All the data are grabbed from the knowledge graph of Data Commons.
Refer to [https://datacommons.org/browser/](https://datacommons.org/browser/) for more details.

<a id="camel.toolkits.data_commons_toolkit.DataCommonsToolkit.__init__" />

### **init**

```python theme={"system"}
def __init__(self, timeout: Optional[float] = None):
```

Initialize the DataCommonsToolkit.

**Parameters:**

* **timeout** (Optional\[float], optional): Maximum time in seconds to wait for API calls to complete. If None, will wait indefinitely. (default: :obj:`None`)

<a id="camel.toolkits.data_commons_toolkit.DataCommonsToolkit.get_triples_outgoing" />

### get\_triples\_outgoing

```python theme={"system"}
def get_triples_outgoing(self, dcids: Union[str, List[str]]):
```

Retrieve triples associated with nodes for outgoing relationships.

**Parameters:**

* **dcids** (Union\[str, List\[str]]): A single DCID or a list of DCIDs to query.

**Returns:**

Optional\[Dict\[str, List\[tuple]]]: A dictionary where keys are
DCIDs and values are lists of associated triples if success,
(default: :obj:`None`) otherwise.

<a id="camel.toolkits.data_commons_toolkit.DataCommonsToolkit.get_triples_incoming" />

### get\_triples\_incoming

```python theme={"system"}
def get_triples_incoming(self, dcids: Union[str, List[str]]):
```

Retrieve triples associated with nodes for incoming relationships.

**Parameters:**

* **dcids** (Union\[str, List\[str]]): A single DCID or a list of DCIDs to query.

**Returns:**

Optional\[Dict\[str, List\[tuple]]]: A dictionary where keys are
DCIDs and values are lists of associated triples if success,
(default: :obj:`None`) otherwise.

<a id="camel.toolkits.data_commons_toolkit.DataCommonsToolkit.get_stat" />

### get\_stat

```python theme={"system"}
def get_stat(
    self,
    date: str,
    entity_dcids: Union[str, List[str]],
    variable_dcids: Union[str, List[str]]
):
```

Retrieve statistical time series for a place.

**Parameters:**

* **date** (str): The date option for the observations. Use 'all' for all dates, 'latest' for the most recent data, or provide a date as a string (e.g., "2026").
* **entity\_dcids** (Union\[str, List\[str]]): Entity IDs to filter the data.
* **variable\_dcids** (Union\[str, List\[str]]): The variable(s) to fetch observations for. This can be a single variable ID or a list of IDs.

**Returns:**

Optional\[Dict\[str, Any]]: A dictionary containing the statistical
time series data if success, (default: :obj:`None`) otherwise.

<a id="camel.toolkits.data_commons_toolkit.DataCommonsToolkit.get_property_labels" />

### get\_property\_labels

```python theme={"system"}
def get_property_labels(self, dcids: Union[str, List[str]], out: bool = True):
```

Retrieves and analyzes property labels for given DCIDs.

**Parameters:**

* **dcids** (Union\[str, List\[str]]): A single DCID or a list of DCIDs to query.
* **out** (bool): Whether to fetch outgoing properties (default: :obj:`True`)

**Returns:**

Optional\[Dict\[str, List\[str]]]: Analysis results for each DCID if
success, (default: :obj:`None`) otherwise.

<a id="camel.toolkits.data_commons_toolkit.DataCommonsToolkit.get_property_values" />

### get\_property\_values

```python theme={"system"}
def get_property_values(
    self,
    dcids: Union[str, List[str]],
    properties: Union[str, List[str]],
    constraints: Optional[str] = None,
    out: Optional[bool] = True
):
```

Retrieves and analyzes property values for given DCIDs.

**Parameters:**

* **dcids** (Union\[str, List\[str]]): A single DCID or a list of DCIDs to query.
* **properties** (Union\[str, List\[str]]): The property or properties to analyze.
* **constraints** (Optional\[str]): Additional constraints for the query. (default: :obj:`None`)
* **out** (bool, optional): Whether to fetch outgoing properties. (default: :obj:`True`)

**Returns:**

Optional\[Dict\[str, Any]]: Analysis results for each DCID if
success, (default: :obj:`None`) otherwise.

<a id="camel.toolkits.data_commons_toolkit.DataCommonsToolkit.get_places_in" />

### get\_places\_in

```python theme={"system"}
def get_places_in(
    self,
    place_dcids: Union[str, List[str]],
    children_type: Optional[str] = None
):
```

Retrieves places within a given place type.

**Parameters:**

* **place\_dcids** (Union\[str, List\[str]]): A single DCID or a list of DCIDs to query.
* **children\_type** (Optional\[str]): The type of the child entities to fetch. If None, fetches all child types. (default: :obj:`None`)

**Returns:**

Optional\[Dict\[str, Any]]: Analysis results for each DCID if
success, (default: :obj:`None`) otherwise.

<a id="camel.toolkits.data_commons_toolkit.DataCommonsToolkit.get_tools" />

### get\_tools

```python theme={"system"}
def get_tools(self):
```

**Returns:**

List\[FunctionTool]: A list of FunctionTool objects representing
the functions in the toolkit.
