Structs(结构体(Struct))¶
A struct is an Ontology property base type that allows users to create schema-based properties with multiple fields. Struct properties are created from struct type dataset columns. Struct property fields can have different data sources as long as the property is transformed into a single struct type column before being defined in the Ontology.
Many common object properties can be modeled as structs. For example, a Full Name property with the fields First Name and Last Name, or an Address property that includes Street, City, Postal Code, and Country fields.
Struct configuration¶
The following is a list of struct property constraints and allowed configurations:
- Structs have a depth of one and cannot be nested.
- Structs must have at least 1 field.
- Only the following field types are currently supported:
BOOLEANBYTEDATEDECIMALDOUBLEFLOATGEOPOINTINTEGERLONGSHORTSTRINGTIMESTAMP
Query semantics¶
Structs are indexed similarly to ElasticSearch object field types ↗, which means that arrays can have unintuitive behavior. For example, if you have an array of Full Name properties, an object containing [{"firstName": "Harvey", "lastName": "Dent"}, {"firstName": "Two", "lastName": "Face"}] would match a query for "firstName": "Harvey" AND "lastName": "Face". The two conditions are treated independently, rather than requiring to match on the same struct within the array.
Current levels of support¶
As support for struct property types expands, availability will vary across the Palantir platform.
Structs are currently supported in the following applications and services:
- Ontology Manager: Define and edit structs.
- Actions: Use actions to create and modify struct property values.
- Pipeline Builder: Define and edit structs.
- Workshop: Display and use struct properties as variables.
- Marketplace: Package and install struct properties.
- Object Explorer: Search for objects by their struct property values (struct field search is under development).
- Ontology SDK: Load struct properties and search for objects by their struct property values in Ontology SDK applications. Not all Ontology SDKs support struct properties. Refer to the OSDK unsupported property types for more information.
- Functions: Struct parameters and struct property edits are supported in TypeScript v2 and Python functions.
Structs will not be supported in Object Storage V1 (Phonograph) and can currently only be created from datasets and Restricted Views.
中文翻译¶
结构体(Struct)¶
结构体(Struct) 是一种本体论(Ontology)属性基础类型,允许用户创建包含多个字段的基于模式(schema)的属性。结构体属性由结构体类型数据集列创建。只要属性在定义到本体论(Ontology)之前被转换为单一的结构体类型列,结构体属性字段可以来自不同的数据源。
许多常见的对象属性都可以建模为结构体。例如,包含名字(First Name)和姓氏(Last Name)字段的全名(Full Name)属性,或者包含街道(Street)、城市(City)、邮政编码(Postal Code)和国家(Country)字段的地址(Address)属性。
结构体配置¶
以下是结构体属性的约束和允许配置列表:
- 结构体深度为一级,不可嵌套。
- 结构体必须至少包含1个字段。
- 目前仅支持以下字段类型:
BOOLEANBYTEDATEDECIMALDOUBLEFLOATGEOPOINTINTEGERLONGSHORTSTRINGTIMESTAMP
查询语义¶
结构体的索引方式与ElasticSearch对象字段类型 ↗类似,这意味着数组可能表现出不符合直觉的行为。例如,如果您有一个全名(Full Name)属性数组,其中包含[{"firstName": "Harvey", "lastName": "Dent"}, {"firstName": "Two", "lastName": "Face"}],则可能会匹配到"firstName": "Harvey" AND "lastName": "Face"的查询。这两个条件是独立处理的,而不是要求匹配数组中的同一个结构体。
当前支持级别¶
随着对结构体属性类型支持的扩展,在Palantir平台上的可用性将有所不同。
结构体目前支持以下应用程序和服务:
- 本体论管理器(Ontology Manager): 定义和编辑结构体。
- 操作(Actions): 使用操作来创建和修改结构体属性值。
- 管道构建器(Pipeline Builder): 定义和编辑结构体。
- 工作坊(Workshop): 显示结构体属性并将其用作变量。
- 市场(Marketplace): 打包和安装结构体属性。
- 对象浏览器(Object Explorer): 通过结构体属性值搜索对象(结构体字段搜索正在开发中)。
- 本体论SDK(Ontology SDK): 在本体论SDK(Ontology SDK)应用程序中加载结构体属性并通过结构体属性值搜索对象。并非所有本体论SDK(Ontology SDK)都支持结构体属性。有关更多信息,请参阅OSDK不支持的属性类型。
- 函数(Functions): TypeScript v2和Python函数支持结构体参数和结构体属性编辑。
结构体将不支持对象存储V1(Object Storage V1, Phonograph),目前只能从数据集和受限视图(Restricted Views)创建。