---
sidebar:
  label: roboto.uri
  order: 33
title: roboto.uri
---
## Module Contents

### ROBOTO_URI_IN_TEXT_PATTERN

```python
roboto.uri.ROBOTO_URI_IN_TEXT_PATTERN
```

`from roboto.uri import ROBOTO_URI_IN_TEXT_PATTERN`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/uri.py#L48-L50)

Regular expression that finds `roboto://` URIs in text, such as an answer from Roboto's AI.

It also matches text `RobotoUri.parse` rejects, such as an unknown type or more than one path segment, so a caller that turns each match into a link turns a malformed URI into one too, instead of leaving it as raw text.

### ROBOTO_URI_SCHEME

```python
roboto.uri.ROBOTO_URI_SCHEME = 'roboto'
```

`from roboto.uri import ROBOTO_URI_SCHEME`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/uri.py#L14-L14)

Scheme of every `RobotoUri`: the `roboto` in `roboto://`.

### RobotoUri

```python
class roboto.uri.RobotoUri
```

`from roboto.uri import RobotoUri`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/uri.py#L59-L164)

A reference to one Roboto entity, such as a dataset or file, as `roboto://<type>/<id>` text.

The URI names the entity without naming a web address. Roboto writes one as the subject of a platform event, as the target of a file that links to another file, and in answers from Roboto's AI. The Roboto web app opens a URI of most types at the entity's page.

`str()` writes the URI as text, with `t` and `v` query parameters for `timestamp_ns` and `version`. `str(RobotoUri.parse(text))` equals `text` only when `text` is already in that form: a lowercase type, no empty path segments, and no query parameters other than `t` and `v`, in that order.

**Raises**

- `ValueError`: `id` is empty, `timestamp_ns` is below 0, or `version` is below 1.

**Attributes**

- **RobotoUri.id** (`str`): ID of the entity, such as `ds_12345` for a dataset.

- **RobotoUri.timestamp_ns** (`int | None`) = `None`: Instant the URI points at, in nanoseconds since the Unix epoch, or `None` if it points at no instant.

  Written as the `t` query parameter. Pages in the Roboto web app that show data over time open at this instant; other pages ignore it.

- **RobotoUri.type** (`RobotoUriType`): Type of entity the URI names.

- **RobotoUri.version** (`int | None`) = `None`: Version of the entity the URI points at, or `None` if it names no version.

  Written as the `v` query parameter. The URI of a file that links to another file carries one, so the link keeps pointing at the version of the target it was made against.

#### RobotoUri.parse()

```python
@classmethod
def parse(text: str) -> RobotoUri
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/uri.py#L114-L152)

Parse `roboto://<type>/<id>` text, with its optional `t` and `v` query parameters, into a URI.

The type is matched without regard to case, and query parameters other than `t` and `v` are ignored.

**Parameters**

- **text** (`str`): The URI, and nothing else. To find URIs inside longer text, match it against `ROBOTO_URI_IN_TEXT_PATTERN` first.

**Raises**

- `ValueError`: `text` is not a `roboto://` URI, its type is not a member of `RobotoUriType`, it has no entity ID or more than one path segment, its `t` is not a whole number at or above 0, or its `v` is not a whole number at or above 1.

**Returns**

- `RobotoUri`

### RobotoUriType

```python
class roboto.uri.RobotoUriType
```

`from roboto.uri import RobotoUriType`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/uri.py#L24-L45)

Bases: `roboto.compat.StrEnum`

Type of entity a `RobotoUri` names, written as the `<type>` in `roboto://<type>/<id>`.

A `roboto://` URI whose type is not a member names no entity. The Roboto web app reserves other types, such as `ui`, for links to its own controls, so treat an unknown type as a link to something other than an entity, not as corrupt data.

**Attributes**

- **RobotoUriType.Collection** = `'collection'`
- **RobotoUriType.Dataset** = `'dataset'`
- **RobotoUriType.Device** = `'device'`
- **RobotoUriType.DeviceType** = `'device_type'`
- **RobotoUriType.Event** = `'event'`
- **RobotoUriType.File** = `'file'`
- **RobotoUriType.Invocation** = `'invocation'`
- **RobotoUriType.Layout** = `'layout'`
- **RobotoUriType.MessagePath** = `'msgpath'`
- **RobotoUriType.Org** = `'org'`
- **RobotoUriType.Session** = `'session'`
- **RobotoUriType.Topic** = `'topic'`
- **RobotoUriType.Trigger** = `'trigger'`
- **RobotoUriType.Workspace** = `'workspace'`

### TIMESTAMP_QUERY_PARAM

```python
roboto.uri.TIMESTAMP_QUERY_PARAM = 't'
```

`from roboto.uri import TIMESTAMP_QUERY_PARAM`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/uri.py#L17-L17)

Query parameter that holds the instant a URI points at, in nanoseconds since the Unix epoch.

### VERSION_QUERY_PARAM

```python
roboto.uri.VERSION_QUERY_PARAM = 'v'
```

`from roboto.uri import VERSION_QUERY_PARAM`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/uri.py#L20-L20)

Query parameter that holds the version of the entity a URI points at.
