如何在 ALPS 描述符中将 collection 的事物描述为词汇表 属性?
How to describe a collection of thing as a vocabulary property in ALPS descriptor?
为了在 application-centric 问题中描述 REST APIs,我正在试用 ALPS 描述符及其工具。
假设我有一个 object“艺术作品”,艺术作品具有以下属性:标题、艺术形式、作者等。
我应该如何描述属性“作者”?在 OpenAPI 规范中很简单,只需说“type: Array”,然后在“items”下指定引用。在 ALPS 中描述 collection 的等效方法是什么?
我正在使用 YAML 格式来描述 API。
我当前的描述符如下所示:
descriptors:
# vocabulary properties
- id: "identifier"
type: "semantic"
text: "Unique identifier within Alpha Org. This is not the serial number of the item. This identifier is automatically generated when a new artwork item is created in the system."
ref: "https://schema.org/identifier"
- id: "headline"
type: "semantic"
text: "Title of the artwork"
ref: "https://schema.org/headline"
- id: "artform"
type: "semantic"
text: "Form of the artwork: painting? photograph? sculpture? others?"
ref: "https://schema.org/artform"
- id: "authors"
type: "semantic"
text: "Authors of this artwork"
ref: "https://schema.org/author"
- id: "serialNumber"
type: "semantic"
text: "Serial number of the artwork. If the artwork does not have a serial number, such as an original painting from an artist, then this number is simply the examplar number, usually 1."
ref: "https://schema.org/serialNumber"
- id: "description"
type: "semantic"
text: "Description of the artwork"
ref: "https://schema.org/description"
- id: "obtainDate"
type: "semantic"
text: "Date on which Alpha Org obtained the ownership of this artwork."
ref: "https://schema.org/Date"
- id: "itemLocation"
type: "semantic"
text: "Location of the storage of the artwork item"
ref: "https://schema.org/itemLocation"
- id: "images"
type: "semantic"
text: "Images of the artwork"
ref: "https://schema.org/image"
ALPS 描述不区分单个项目和集合。从模型 POV 来看,任何东西都可以是一个集合,从实现 POV 来看,每个实现该 ALPS 描述的服务都会做出自己的决定。
作为一种常见做法,我通常在重要时使用 IANA link-rel 值
rel: item and rel: collection
有一个小实用程序 (ALPS UNIFIED) 展示了如何将 ALPS 描述转换为 OpenAPI 定义:
https://github.com/mamund/alps-unified
为了在 application-centric 问题中描述 REST APIs,我正在试用 ALPS 描述符及其工具。
假设我有一个 object“艺术作品”,艺术作品具有以下属性:标题、艺术形式、作者等。
我应该如何描述属性“作者”?在 OpenAPI 规范中很简单,只需说“type: Array”,然后在“items”下指定引用。在 ALPS 中描述 collection 的等效方法是什么?
我正在使用 YAML 格式来描述 API。
我当前的描述符如下所示:
descriptors:
# vocabulary properties
- id: "identifier"
type: "semantic"
text: "Unique identifier within Alpha Org. This is not the serial number of the item. This identifier is automatically generated when a new artwork item is created in the system."
ref: "https://schema.org/identifier"
- id: "headline"
type: "semantic"
text: "Title of the artwork"
ref: "https://schema.org/headline"
- id: "artform"
type: "semantic"
text: "Form of the artwork: painting? photograph? sculpture? others?"
ref: "https://schema.org/artform"
- id: "authors"
type: "semantic"
text: "Authors of this artwork"
ref: "https://schema.org/author"
- id: "serialNumber"
type: "semantic"
text: "Serial number of the artwork. If the artwork does not have a serial number, such as an original painting from an artist, then this number is simply the examplar number, usually 1."
ref: "https://schema.org/serialNumber"
- id: "description"
type: "semantic"
text: "Description of the artwork"
ref: "https://schema.org/description"
- id: "obtainDate"
type: "semantic"
text: "Date on which Alpha Org obtained the ownership of this artwork."
ref: "https://schema.org/Date"
- id: "itemLocation"
type: "semantic"
text: "Location of the storage of the artwork item"
ref: "https://schema.org/itemLocation"
- id: "images"
type: "semantic"
text: "Images of the artwork"
ref: "https://schema.org/image"
ALPS 描述不区分单个项目和集合。从模型 POV 来看,任何东西都可以是一个集合,从实现 POV 来看,每个实现该 ALPS 描述的服务都会做出自己的决定。
作为一种常见做法,我通常在重要时使用 IANA link-rel 值
rel: item and rel: collection
有一个小实用程序 (ALPS UNIFIED) 展示了如何将 ALPS 描述转换为 OpenAPI 定义: https://github.com/mamund/alps-unified