Create an interface(创建接口(Interface))¶
Follow the steps below to create a new interface in Ontology Manager.
-
First, verify you are working within your ontology of choice by checking the Ontologies dropdown menu located at the top of the left side panel.
-
To create a new interface, you can do either of the following:
- At the top right of the page, select New > Interface.
-
From the left panel, select Interfaces > + New interface under the Resources section. Then, from the Interfaces page, select New interface from the top right corner of the screen.
-
The first page of the helper provides information about interfaces. Select Next.

-
Input the display name and API name for your interface. You can also optionally provide a description of the interface and select an appropriate icon.

-
Add properties to your interface. You can define properties locally on the interface (recommended) or use shared properties. For each property, choose whether it is required or optional.

For required properties, any object type that implements the interface must provide a mapping from a local property to the interface property. For optional properties, mapping may be skipped during implementation. Optional properties can be useful when building Marketplace packages to iterate on your interface without introducing upgrade blockers that may be difficult to resolve.
-
Select a project to save this interface to, then select Create.

-
Back in Ontology Manager, select Save in the upper right corner to make the change to your ontology.
Create interface link types (optional)¶
If you want this interface to link to another interface or object type, you can optionally add any interface link types to the interface.

- Select Link type constraints in the left side panel.
- Then, select Create new link type constraint in the top right corner.

If an interface link type is required for your modeling use case, any object type that implements the interface must add a new or existing link type that satisfies the interface link type constraints.
Create interface action type constraints (optional)¶
If you want an interface to define expected action capabilities across implementing object types, you can optionally add interface action type constraints to the interface.

- Select Action type constraints in the left side panel.
- Select Create new.
- Add the constraint metadata, choose whether implementation is required, and configure any parameter constraints.

If an interface action type constraint is required for your modeling use case, any object type that implements the interface must map the constraint to a concrete action type that satisfies the interface action type constraint.
中文翻译¶
创建接口(Interface)¶
按照以下步骤在本体管理器(Ontology Manager)中创建新接口。
-
首先,通过检查左侧面板顶部的本体(Ontologies)下拉菜单,确认您正在所需的 ontology 中操作。
-
要创建新接口,可执行以下任一操作:
- 在页面右上角,选择新建(New)> 接口(Interface)。
-
在左侧面板的资源(Resources)部分,选择接口(Interfaces)> + 新建接口(New interface)。然后在接口(Interfaces)页面中,点击屏幕右上角的新建接口(New interface)。
-
向导的第一页会提供接口的相关信息。选择下一步(Next)。

-
输入接口的显示名称(Display name)和 API 名称(API name)。您还可以选择性地提供接口描述并选择合适的图标。

-
为接口添加属性(Properties)。您可以在接口上本地定义属性(推荐),或使用共享属性(Shared properties)。对于每个属性,选择其为必需(Required)或可选(Optional)。

对于必需属性,任何实现该接口的对象类型(Object type)都必须提供从本地属性到接口属性的映射。对于可选属性,在实现过程中可以跳过映射。可选属性在构建 Marketplace 包时非常有用,可让您在不引入难以解决的升级阻碍的情况下迭代接口。
-
选择一个项目来保存此接口,然后选择创建(Create)。

-
返回本体管理器,点击右上角的保存(Save)以将更改应用到您的 ontology。
创建接口链接类型(可选)¶
如果您希望此接口链接到另一个接口或对象类型,可以选择性地为接口添加接口链接类型(Interface link types)。

- 在左侧面板中选择链接类型约束(Link type constraints)。
- 然后,点击右上角的创建新链接类型约束(Create new link type constraint)。

如果您的建模用例需要接口链接类型,任何实现该接口的对象类型都必须添加满足接口链接类型约束的新链接类型或现有链接类型。
创建接口动作类型约束(可选)¶
如果您希望接口定义实现对象类型的预期动作能力,可以选择性地为接口添加接口动作类型约束(Interface action type constraints)。

- 在左侧面板中选择动作类型约束(Action type constraints)。
- 选择创建新(Create new)。
- 添加约束元数据,选择实现是否为必需,并配置任何参数约束。

如果您的建模用例需要接口动作类型约束,任何实现该接口的对象类型都必须将约束映射到满足接口动作类型约束的具体动作类型(Action type)。