Functions(函数)¶
Functions enable code authors to write logic that can be executed quickly in operational contexts, such as dashboards and applications designed to empower decision-making processes. This logic is executed on the server side in an isolated environment.
Notably, functions include first-class support for authoring logic based on the Ontology. This includes support for reading the properties of various object types, traversing links, and flexibly making Ontology edits.
Common use cases for functions include:
- Returning object sets or variable values for use in Workshop.
- Displaying transformed values in a derived table column using Workshop's function-backed columns.
- Aggregating object type values to display as Workshop charts.
- Expressing a complex edit to the Ontology that updates many objects through a function backed action.
- Running logic in the backend to return information to be displayed in the frontend in Slate.
- Computing custom metrics or aggregations for display in Quiver.
- Querying external systems to enrich objects in the Ontology through external functions.
- Using Python functions as a sidecar container in Pipeline Builder.
The languages supported by functions are TypeScript ↗ and Python ↗.
For more information on feature support by language and choosing a language or language version, refer to the language feature support specifications.
To get started using functions in Foundry, we recommend the following tutorials:
- Getting started with TypeScript v1 functions
- Getting started with TypeScript v2 functions
- Getting started with Python functions
:::callout{theme="success" title="Palantir Learning portal"} Try our "Speedrun: Your first Ontology function" course ↗ on learn.palantir.com. :::
中文翻译¶
函数¶
函数(Functions) 使代码作者能够编写可在运营场景(如仪表盘和旨在赋能决策流程的应用程序)中快速执行的逻辑。这些逻辑在隔离环境中的服务器端执行。
值得注意的是,函数提供对基于本体论(Ontology)编写逻辑的一流支持。这包括支持读取各种对象类型(Object Types)的属性、遍历链接以及灵活地进行本体论编辑。
函数的常见用例包括:
- 返回对象集(Object Sets)或变量值,供Workshop使用。
- 使用Workshop的函数支持列在派生表列中显示转换后的值。
- 聚合对象类型值,以显示为Workshop图表。
- 通过函数支持的操作(Function Backed Action)表达对本体论的复杂编辑,以更新多个对象。
- 在后端运行逻辑,返回信息以在Slate的前端显示。
- 计算自定义指标或聚合结果,用于在Quiver中展示。
- 通过外部函数(External Functions)查询外部系统以丰富本体论中的对象。
- 在Pipeline Builder中将Python函数用作边车容器(Sidecar Container)。
函数支持的语言为TypeScript ↗和Python ↗。
有关各语言的功能支持详情以及如何选择语言或语言版本,请参阅语言功能支持规范。
要在Foundry中开始使用函数,我们推荐以下教程:
:::callout{theme="success" title="Palantir学习门户"} 请访问 learn.palantir.com,尝试我们的"速通课程:你的第一个本体论函数" ↗课程。 :::