> For the complete documentation index, see [llms.txt](https://docs.cybus.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cybus.io/2-8-0/unified-namespace/map-your-unified-namespace-to-connectware.md). Agents can also search and read this documentation through its [MCP server](https://docs.cybus.io/~gitbook/mcp).

# Map Your Unified Namespace to Connectware

Declare the hierarchy, naming convention, asset types, and machines of an existing UNS design as namespaces, models, assets, and mounts.

If your company already has a UNS design, you can declare it in Connectware. Connectware then builds the topics of every asset from the design and checks names and attribute values when you install a service. This page maps each part of a design to a Connectware resource and shows the choices you make along the way.

The examples follow ACME, the fictional company of [Example Factory](https://docs.cybus.io/2-8-0/unified-namespace/example-factory.md), which has the complete service commissioning files. To try the resources with a single asset first, see [Set Up a Unified Namespace](https://docs.cybus.io/2-8-0/unified-namespace/set-up-a-unified-namespace.md).

## Prerequisites

To map your design, you will need the following:

* Your UNS design: the hierarchy levels and node names, the asset types and their values, the naming convention, and the IDs of your machines.
* Basic knowledge of [service commissioning files](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files.md).
* A Connectware user who can install services.
* An MQTT client that connects to Connectware with read access to the topics of your namespace, such as MQTT Explorer. See [Connecting an MQTT Client to Publish and Subscribe Data](https://docs.cybus.io/2-8-0/guides/machine-connectivity/gateways-generic-protocols/connecting-an-mqtt-client-to-publish-and-subscribe-data.md).

## The Example Design

The UNS design of ACME has the following parts:

* **Topic pattern**: `<enterprise>/<site>/<area>/<line>/<machine>/<value>`, for example `acme/hamburg/assembly/line-north/mill01/spindleSpeed`.
* **Naming convention**: Lowercase letters, digits, and hyphens for the hierarchy and the machines. camelCase for the values.
* **Asset types**: CNC mills, hardening ovens, and power meters. Every machine reports its state.
* **Machine IDs**: An ID link on the type plate and a number in the ERP system.

## Map Your Design

Each part of a design has a place in Connectware:

| Your design                           | In Connectware                                                                                                                                                                                                                                        | ACME example                           |
| ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
| First topic segment                   | [root](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-namespace.md#root) of a Cybus::Namespace                                                                                                                    | `acme`                                 |
| Hierarchy levels and their nodes      | [structure](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-namespace.md#structure) of the namespace                                                                                                               | `hamburg/assembly/line-north`          |
| Naming convention                     | `naming` [policy](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-namespace.md#policy) of the namespace                                                                                                            | `^[a-z0-9-]+$`                         |
| Asset type                            | [Cybus::Model](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-model.md)                                                                                                                                           | `CncMill`                              |
| Live values of an asset type          | [data](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-model.md#data) of the model                                                                                                                                 | `spindleSpeed`                         |
| Units and semantic IDs of values      | `unit` and `semanticId` of a [data](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-model.md#data) property                                                                                                        | `unit: rpm`                            |
| Facts entered at commissioning        | [attributes](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-model.md#attributes) of the model                                                                                                                     | `serialNumber`                         |
| Values that several asset types share | A base model that other models [implement](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-model.md#implements)                                                                                                    | `MachineState` with `state`            |
| Links between machines                | [relations](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-model.md#relations) of the model                                                                                                                       | A mill is `measuredBy` a power meter   |
| Machine                               | [Cybus::Asset](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-asset.md)                                                                                                                                           | `mill01`                               |
| IDs of the machine                    | [identity](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-asset.md#identity) of the asset                                                                                                                         | The ID link from the type plate        |
| Location of the machine               | [Cybus::Mount](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-mount.md), or the [mount](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-asset.md#mount) shorthand of the asset | `uns:acme/hamburg/assembly/line-north` |
| Component of a machine                | An asset [mounted below](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-mount.md#at) the asset of the machine                                                                                                     | `spindle` below `mill01`               |
| A line or cell with values of its own | An asset that [promotes](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-asset.md#promote) the node                                                                                                                | `line-north` with `availability`       |
| Read access to a part of the tree     | A `uns:` grant in a [role](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-role.md#resource)                                                                                                                       | `uns:acme/hamburg`                     |

## Decide the Scope and Ownership

Decide the scope and the owners first, because they set which service declares each resource.

### Choose the Scope of a Namespace

A namespace can cover your whole company or one site. The root is a single topic segment, because it must not contain `/`. The scope affects your topics as follows:

* **One namespace for the company**: The root is the enterprise, such as `acme`, and each site is a node. Every topic starts with `acme`, as in the design. One service owns the tree of every site, because only the service that declares a namespace can change it.
* **One namespace per site**: The root is the site, such as `hamburg`, and every topic starts with it. The enterprise segment of the design has no place of its own above the root. Each site owns its tree in its own service.

Either way, the models can live in a service of their own that every namespace uses.

Choose the scope before other services build on the namespace. Once they place assets in it or hold `uns:` grants on it, Connectware refuses to change the root.

### Split the Namespace into Services

The resources of a namespace can live in different services. Only the service that declares a namespace, model, or asset can change it. So the split decides which team owns which part of your design. ACME splits it as follows:

* A model library service with every model.
* A namespace service with the tree, the policies, the line asset, and a role with a `uns:` grant.
* One service per machine that places itself, with its asset, its connection, its endpoints, and any role with an `asset:` grant on it.
* For a machine that the tree team places: a service with its asset, a placement service with its mount, and a data service with its connection and endpoints. See [Decide Who Places the Machines](#decide-who-places-the-machines).
* A KPI service that calculates the availability of the line from the state of the mills.

Once other services depend on a node, a model, or an asset, Connectware refuses changes that would break them. For example, you cannot remove a node while a mount of another service uses it. You also cannot remove a model while assets of other services follow it. So renaming them later means changing the dependent services first.

The split also sets the install order, because a service can only reference resources that are already installed. For the order of ACME, see [Install the Services](https://docs.cybus.io/2-8-0/unified-namespace/example-factory.md#install-the-services).

## Declare the Hierarchy

The `root` of the namespace is the first topic segment. The `tree` holds the nodes below it, and each key is a topic segment. The `levels` name the levels of your design and are informational only.

{% code lineNumbers="true" %}

```yaml
acme:
  type: Cybus::Namespace
  properties:
    root: acme
    structure:
      levels: [site, area, line]
      tree:
        hamburg:
          assembly:
            line-north: {}
            line-south: {}
          hardening: {}
    policy:
      placement: tree-only
      modeling: required
      naming: '^[a-z0-9-]+$'
```

{% endcode %}

### Decide Where Assets May Go

With the default `placement: tree-only`, a mount can only use a node that the tree declares. So the tree stays the one place that defines your hierarchy. With `placement: open`, a mount may create new branches, and the installation returns a warning that names each undeclared path.

With `modeling: required`, every asset in the namespace must follow a model. An asset that declares its data inline cannot be mounted in it.

## Match Your Naming Convention

The `naming` policy is a regular expression. The root, every node name, and every mount key must match it. The default allows lowercase letters, digits, `_`, and `-`. ACME allows no underscores, so it sets `^[a-z0-9-]+$`.

Some names fail the installation under any policy, because Connectware reserves them. Examples are `set`, `res`, names that start with `$`, and plain numbers such as `7`. Use a name such as `line7` instead. See [Naming Rules](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-namespace.md#naming-rules).

Your design might name things in ways that need a translation:

* **Machine names that cannot be resource IDs**: The mount key defaults to the resource ID of the asset. Resource IDs cannot contain hyphens, so a machine such as `cnc-mill-01` needs another resource ID and a `key`. For example, name the asset `cncMill01` and set `key: cnc-mill-01` in its mount. See [Resource ID Naming Requirements](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources.md#resource-id-naming-requirements).
* **Value names with hyphens**: Data property names start with a letter and contain only letters, digits, and underscores. So a value such as `spindle-speed` becomes `spindleSpeed` or `spindle_speed`. Property names do not have to match the `naming` policy.
* **Display names**: The tree has no display names. Each key is the topic segment itself.

## Model Your Asset Types

Declare one model per asset type. Values that the machine writes become data properties, and each one gets a topic below the asset. Facts that you enter when you commission a machine become attributes. Connectware publishes them in the `$meta` topic of the asset. Mark an attribute with `required: true` if every machine must set it. Put the units and semantic IDs of your design into the `unit` and `semanticId` of each data property.

Values that several asset types share go into a base model. Other models inherit them through `implements`. In the model library of ACME, `CncMill` and `HardeningOven` inherit `state` from `MachineState`. See [The Model Library](https://docs.cybus.io/2-8-0/unified-namespace/example-factory.md#the-model-library).

Links to other machines, such as the power meter that measures a mill, are [relations](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-model.md#relations) of the model.

By default, an installed model version cannot change. Any change to its data properties or attributes needs a new version. If you expect new versions, reference models with their version, such as `CncMill@1`. The service that owns a model can only add a second version once every reference to the model names its version. See [Model Versioning](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-namespace.md#model-versioning).

## Declare Your Machines

Declare one asset per machine, with its model and its attribute values. Its resource ID is the asset ID, which other services use to reference it. The `identity` holds the IDs of the real machine and stays the same when the asset moves:

* `globalAssetId`: The global ID of the machine, ideally an IEC 61406 ID link, such as the one on the type plate.
* `specificAssetIds`: Further IDs as name and value pairs, such as the number in your ERP system.

For the complete asset of Mill 01, see [The Machines](https://docs.cybus.io/2-8-0/unified-namespace/example-factory.md#the-machines).

A component with values of its own, such as a spindle, can be an asset too. Mount it below the asset of its machine, so that its topics start with the base topic of the machine, such as `acme/hamburg/assembly/line-north/mill01/spindle`. See [at](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-mount.md#at).

### Decide Who Places the Machines

A machine can be placed in one of the following ways:

* **The machine service places it**: The asset uses the `mount` shorthand, as Mill 01 does. The team that owns the machine decides where it lives.
* **A central placement service places it**: The asset has no mount, and a Cybus::Mount in another service places it. The team that owns the tree can then move machines without changing the machine services. An endpoint can only reference a data property of a placed asset. So the connection and the endpoints of the machine need a third service, which you install after the placement service. See [Central Placement](https://docs.cybus.io/2-8-0/unified-namespace/example-factory.md#central-placement).

A line or a cell with values of its own, such as its availability, can be an asset too. It promotes its node, so its topics live at the node path itself, such as `acme/hamburg/assembly/line-north/availability`.

## Connect Machine Data

A new endpoint references a data property instead of a topic, such as `asset: mill01.spindleSpeed`. See [How Data Reaches the Namespace](https://docs.cybus.io/2-8-0/unified-namespace/unified-namespace.md#how-data-reaches-the-namespace).

For an existing service that already publishes on its own topics, choose one of the following:

* **Change the endpoint**: Replace its `topic` with an `asset` reference. The endpoint then publishes on the UNS topic only. MQTT clients that subscribe to the old topic must switch to the new one.
* **Add a mapping**: Keep the existing service as it is. A mapping subscribes to its topic and publishes to the data property, such as `asset: mill01.spindleSpeed`. The data then arrives on both topics, so existing clients keep working while new clients use the UNS topic.

ACME brings a power meter that cannot change its topic into the namespace with such a mapping. See [The Machines](https://docs.cybus.io/2-8-0/unified-namespace/example-factory.md#the-machines).

## Grant Access

Read access can follow the tree. A role with a `uns:` grant on a node, such as `uns:acme/hamburg`, can read every topic below it. An `asset:` grant covers the topics of one asset, wherever it is placed. See [Access to the Namespace](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-namespace.md#access-to-the-namespace) and [Topics of an Asset](https://docs.cybus.io/2-8-0/data-flows/service-commissioning-files/resources/cybus-asset.md#topics-of-an-asset).

Where you declare a role depends on its grants:

* **`uns:` grants**: In the namespace service, or in any service that you install after it.
* **`asset:` grants**: In the machine service, or in any service that you install after the asset is placed. An `asset:` grant needs a placed asset when you install the service.

## Verification

Once the services are installed and enabled, compare the namespace with your design:

1. Request `GET /api/v2/uns/namespaces/acme/tree`. The response lists the nodes of the namespace and the assets with their base topics. Check that each machine has the base topic that your topic pattern gives it, such as `acme/hamburg/assembly/line-north/mill01`. See [Topic Explorer API](https://docs.cybus.io/2-8-0/reference/api-reference/topic-explorer-api.md).
2. Subscribe to `acme/#` with your MQTT client. You receive the retained `$meta` message of every placed asset, followed by the values that endpoints and mappings publish.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.cybus.io/2-8-0/unified-namespace/map-your-unified-namespace-to-connectware.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
