mchades commented on code in PR #13842:
URL: https://github.com/apache/gravitino/pull/13842#discussion_r4269024840


##########
docs/manage-semantic-model-metadata-using-gravitino.md:
##########
@@ -0,0 +1,551 @@
+---
+title: "Manage Semantic Model Metadata"
+slug: "/manage-semantic-model-metadata-using-gravitino"
+keyword: "semantic model management, semantic metadata, Ossie, Gravitino"
+license: "This software is licensed under the Apache License version 2."
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+## Introduction
+
+This page covers the Gravitino API for Semantic Models. For what a model 
contains, how its sources
+are validated, and how it relates to tables and views, see [Semantic 
Models](./semantic-models.md).
+For creating the catalog and schema a model lives in, see
+[Manage Catalogs and Schemas](./manage-catalogs-and-schemas.md).
+
+## Before You Start
+
+The examples use the `2.0.0-SNAPSHOT` server and clients. They assume:
+
+* A server at `http://localhost:8090` and an existing metalake named `example`.
+* A relational catalog named `sales`, with a schema named `mart`.
+* An existing source table `sales.mart.orders` with `order_id` and 
`order_amount` columns.
+
+See [Manage Relational 
Metadata](./manage-relational-metadata-using-gravitino.md) to create the
+source table. Add the credentials required by your deployment as described in
+[Authentication](./security/how-to-authenticate.md). With authorization 
enabled, the caller also
+needs the [model and source privileges](#ownership-and-privileges).
+
+Choose one language tab and follow its examples. Each language manages the 
same model names, so
+running create or import again in another language reports that the model 
already exists.
+Run the [drop examples](#drop-a-semantic-model) when you have finished.
+
+Java and Python model identifiers are relative to the loaded catalog 
(`schema.model`). Dataset
+sources use `catalog.schema.object` within the same metalake. For SDK 
configuration, see
+[Client Setup](./how-to-use-gravitino-client.md) and [Python 
Client](./how-to-use-python-client.md).
+
+<details>
+<summary>Java and Python client setup and imports</summary>
+
+Place the operation snippets inside the client block below. The block closes 
the client when
+finished; Java file operations also require the calling method to handle or 
declare `IOException`.
+
+<Tabs groupId='language' queryString>
+<TabItem value="java" label="Java">
+
+```java
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Map;
+import org.apache.gravitino.NameIdentifier;
+import org.apache.gravitino.Namespace;
+import org.apache.gravitino.client.GravitinoClient;
+import org.apache.gravitino.semantic.DataType;
+import org.apache.gravitino.semantic.Dataset;
+import org.apache.gravitino.semantic.DialectExpression;
+import org.apache.gravitino.semantic.Expression;
+import org.apache.gravitino.semantic.Field;
+import org.apache.gravitino.semantic.Metric;
+import org.apache.gravitino.semantic.OssieDocument;
+import org.apache.gravitino.semantic.OssieFormat;
+import org.apache.gravitino.semantic.SemanticModel;
+import org.apache.gravitino.semantic.SemanticModelCatalog;
+import org.apache.gravitino.semantic.SemanticModelChange;
+import org.apache.gravitino.semantic.SemanticModelDefinition;
+
+try (GravitinoClient client = GravitinoClient.builder("http://localhost:8090";)
+    .withMetalake("example").build()) {
+  SemanticModelCatalog models = 
client.loadCatalog("sales").asSemanticModelCatalog();
+  NameIdentifier ident = NameIdentifier.of("mart", "sales_model");
+
+  // Run the Java operation examples here.
+}
+```
+
+</TabItem>
+<TabItem value="python" label="Python">
+
+```python
+from pathlib import Path
+
+from gravitino import GravitinoClient, NameIdentifier
+from gravitino.api.semantic.data_type import DataType
+from gravitino.api.semantic.dataset import Dataset
+from gravitino.api.semantic.dialect_expression import DialectExpression
+from gravitino.api.semantic.expression import Expression
+from gravitino.api.semantic.field import Field
+from gravitino.api.semantic.metric import Metric
+from gravitino.api.semantic.semantic_model_change import SemanticModelChange
+from gravitino.api.semantic.semantic_model_definition import 
SemanticModelDefinition
+from gravitino.namespace import Namespace
+
+client = GravitinoClient(uri="http://localhost:8090";, metalake_name="example")
+try:
+    models = client.load_catalog("sales").as_semantic_model_catalog()
+    ident = NameIdentifier.of("mart", "sales_model")
+
+    # Run the Python operation examples here.
+finally:
+    client.close()
+```
+
+</TabItem>
+</Tabs>
+
+</details>
+
+## Semantic Model Operations
+
+### Create a Semantic Model
+
+A model needs a name and a definition with at least one dataset. This example 
defines a field and
+a revenue metric over the existing orders table. The native REST API nests the 
definition under
+`definition` and uses camelCase field names.

Review Comment:
   `datatype` is the field name defined by both the REST schema and DTOs, so 
the examples are correct. The wording now uses the exact field names, and the 
format comparison has been updated accordingly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to