You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@polaris.apache.org by "flyrain (via GitHub)" <gi...@apache.org> on 2026/06/17 22:21:58 UTC

[PR] Feat/osi semantic models [polaris]

flyrain opened a new pull request, #4816:
URL: https://github.com/apache/polaris/pull/4816

   Wire the Open Semantic Interchange (OSI) semantic-model REST endpoints behind the ENABLE_SEMANTIC_MODELS feature flag (default false until the implementation lands).
   
   - spec: semantic-models-api.yaml defining create/list/load/update/drop under namespaces, plus catalog-service wiring
   - generated models + API enabled in polaris-catalog-service build
   - feature flag, REST resource paths, and endpoint set
   
   ## Checklist
   - [ ] 🛡️ Don't disclose security issues! (contact security@apache.org)
   - [ ] đź”— Clearly explained why the changes are needed, or linked related issues: Fixes #
   - [ ] đź§Ş Added/updated tests with good coverage, or manually tested (and explained how)
   - [ ] đź’ˇ Added comments for complex logic
   - [ ] đź§ľ Updated `CHANGELOG.md` (if needed)
   - [ ] 📚 Updated documentation in `site/content/in-dev/unreleased` (if needed)
   


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3431829237


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'

Review Comment:
   The implementation currently returns HTTP 501 (Not Implemented) for this operation when ENABLE_SEMANTIC_MODELS is enabled, but the OpenAPI spec doesn’t document a 501 response. Adding it here will keep the spec aligned with the current stub behavior behind the feature flag.



##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'

Review Comment:
   The implementation currently returns HTTP 501 (Not Implemented) for this operation when ENABLE_SEMANTIC_MODELS is enabled, but the OpenAPI spec doesn’t document a 501 response. Adding it here will keep the spec aligned with the current stub behavior behind the feature flag.



##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'

Review Comment:
   The implementation currently returns HTTP 501 (Not Implemented) for this operation when ENABLE_SEMANTIC_MODELS is enabled, but the OpenAPI spec doesn’t document a 501 response. Adding it here will keep the spec aligned with the current stub behavior behind the feature flag.



##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'

Review Comment:
   The implementation currently returns HTTP 501 (Not Implemented) for this operation when ENABLE_SEMANTIC_MODELS is enabled, but the OpenAPI spec doesn’t document a 501 response. Adding it here will keep the spec aligned with the current stub behavior behind the feature flag.



##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1446,6 +1446,7 @@ public ConfigResponse getConfig() {
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   `getConfig()` now conditionally advertises semantic-model endpoints, but the runtime service’s existing config test coverage only asserts generic-table endpoints. Please add a corresponding assertion for ENABLE_SEMANTIC_MODELS (enabled/disabled) so this new advertised behavior is covered.



##########
polaris-core/src/main/java/org/apache/polaris/core/config/FeatureConfiguration.java:
##########
@@ -372,6 +372,13 @@ public static void enforceFeatureEnabledOrThrow(
           .defaultValue(true)
           .buildFeatureConfiguration();
 
+  public static final FeatureConfiguration<Boolean> ENABLE_SEMANTIC_MODELS =
+      PolarisConfiguration.<Boolean>builder()
+          .key("ENABLE_SEMANTIC_MODELS")
+          .description("If true, the semantic-model (OSI) endpoints are enabled")
+          .defaultValue(false) // keep it to false until the implementation is done
+          .buildFeatureConfiguration();

Review Comment:
   A new feature flag is introduced (ENABLE_SEMANTIC_MODELS). The repository’s configuration reference docs currently list ENABLE_GENERIC_TABLES/ENABLE_POLICY_STORE but not this new flag (e.g., site/content/in-dev/unreleased/configuration/config-sections/flags-polaris_features.md). Please check whether the config reference generator/source needs to be updated and the docs regenerated so users can discover and configure this flag.



##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'

Review Comment:
   The implementation currently returns HTTP 501 (Not Implemented) for this operation when ENABLE_SEMANTIC_MODELS is enabled, but the OpenAPI spec doesn’t document a 501 response. Adding it here will keep the spec aligned with the current stub behavior behind the feature flag.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3441414575


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"

Review Comment:
   Maybe we should go directly to `0.2.0.dev` as we are close to release `0.2.0`.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #4816:
URL: https://github.com/apache/polaris/pull/4816#issuecomment-4835691998

   Let's give some more time for previous reviewers to have another look.


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3493719734


##########
polaris-core/src/main/java/org/apache/polaris/core/rest/PolarisResourcePaths.java:
##########
@@ -48,6 +48,12 @@ public class PolarisResourcePaths {
       "/polaris/v1/{prefix}/namespaces/{namespace}/policies/{policy-name}/mappings";
   public static final String V1_APPLICABLE_POLICIES = "/polaris/v1/{prefix}/applicable-policies";
 
+  // Semantic Model endpoints
+  public static final String V1_SEMANTIC_MODELS =
+      "/polaris/v1/{prefix}/namespaces/{namespace}/semantic-models";
+  public static final String V1_SEMANTIC_MODEL =
+      "/polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}";

Review Comment:
   I can rework later this to introduce dynamic endpoint registration.
   
   It is true though that this class specifically is becoming a bag of loosely-coupled constants.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3484577064


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,412 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+        Upon successful creation, the response returns the model's initial entity-version.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+
+        Upon a successful update, the model's entity-version changes and the new value is returned.
+
+        Updates use optimistic concurrency: supply the `entity-version` you last read for this
+        model, and the update succeeds only if it matches the version currently stored in the
+        catalog. A mismatch fails with 409.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        409:
+          description:
+            Conflict - the supplied entity-version does not match the stored version. The client
+            may retry after fetching the latest version.
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelVersionMismatch:
+                  $ref: '#/components/examples/SemanticModelVersionMismatchError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"
+        semantic_model: '{"name":"tpcds_retail_model","description":"retail analytics","datasets":[{"name":"store_sales","source":"public.store_sales","primary_key":["ss_item_sk","ss_ticket_number"]}],"metrics":[{"name":"total_sales","expression":{"dialects":[{"dialect":"ANSI_SQL","expression":"SUM(ss_ext_sales_price)"}]}}]}'
+
+    SemanticModelIdentifier:
+      type: object
+      required:
+        - namespace
+        - name
+      properties:
+        namespace:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace'
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+
+    CreateSemanticModelRequest:
+      type: object
+      required:
+        - name
+        - document
+      properties:
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    UpdateSemanticModelRequest:
+      type: object
+      required:
+        - document
+        - entity-version
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+        entity-version:
+          type: string
+          description: |
+            An opaque string identifying the version the client last read for this semantic model. The update applies 
+            only if it matches the version currently stored in the catalog (optimistic concurrency).
+
+    LoadSemanticModelResponse:
+      type: object
+      required:
+        - document
+        - entity-version
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+        entity-version:
+          type: string
+          description: |
+            An opaque string identifying the current version of the stored semantic-model entity. It
+            changes whenever the model is updated. 
+
+    ListSemanticModelsResponse:
+      type: object
+      properties:
+        next-page-token:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/PageToken'
+        identifiers:
+          type: array
+          uniqueItems: true
+          items:
+            $ref: '#/components/schemas/SemanticModelIdentifier'

Review Comment:
   or etag? I think I understand the use case. Do we want to do it now? Or just waiting for a overhaul for all entity list operation. 



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3470192908


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.

Review Comment:
   it could refer to tables/views in different ns, see more details in the section "Resolving source references" of the design doc, https://docs.google.com/document/d/1ZdI-1w_5LbyCMhvUhLCtOt-N1Z89L2P-oiGLaYayCZg/edit?tab=t.0



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3443003695


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:

Review Comment:
   Well, this means that OSI/Ossie effectively defines the shape of JSON payloads in this API.
   
   What's is the vision for evolving this Polaris API definition in conjunction with Ossie's evolution?
   
   Are we going to add a new `vN` here for every Ossie spec version?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3454755091


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/semanticmodel/SemanticModelCatalogAdapter.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.service.catalog.semanticmodel;
+
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.SecurityContext;
+import org.apache.polaris.core.config.FeatureConfiguration;
+import org.apache.polaris.core.config.RealmConfig;
+import org.apache.polaris.core.context.CallContext;
+import org.apache.polaris.core.context.RealmContext;
+import org.apache.polaris.service.catalog.api.PolarisCatalogSemanticModelApiService;
+import org.apache.polaris.service.catalog.common.CatalogAdapter;
+import org.apache.polaris.service.types.CreateSemanticModelRequest;
+import org.apache.polaris.service.types.UpdateSemanticModelRequest;
+
+/**
+ * Stub adapter for the OSI semantic-model API. The endpoints are wired and gated by {@link
+ * FeatureConfiguration#ENABLE_SEMANTIC_MODELS}, but every operation returns {@code 501 Not
+ * Implemented}. Persistence, validation, authorization, and source-link resolution land in
+ * subsequent phases.
+ */
+@RequestScoped
+public class SemanticModelCatalogAdapter

Review Comment:
   I sent a `dev` email about this: https://lists.apache.org/thread/hfwt1vt7505w5ysqs7sm293fqzoob7xm
   
   I believe OSI code should follow the modularization pattern established by #4115



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3484402616


##########
extensions/semantic-models/impl/src/main/java/org/apache/polaris/service/catalog/semanticmodel/SemanticModelCatalogAdapter.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.service.catalog.semanticmodel;
+
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.SecurityContext;
+import org.apache.polaris.core.config.FeatureConfiguration;
+import org.apache.polaris.core.config.RealmConfig;
+import org.apache.polaris.core.context.CallContext;
+import org.apache.polaris.core.context.RealmContext;
+import org.apache.polaris.service.catalog.api.PolarisCatalogSemanticModelApiService;
+import org.apache.polaris.service.catalog.common.CatalogAdapter;
+import org.apache.polaris.service.types.CreateSemanticModelRequest;
+import org.apache.polaris.service.types.UpdateSemanticModelRequest;
+
+/**
+ * Stub adapter for the OSI semantic-model API. The endpoints are wired and gated by {@link
+ * FeatureConfiguration#ENABLE_SEMANTIC_MODELS}, but every operation returns {@code 501 Not
+ * Implemented}. Persistence, validation, authorization, and source-link resolution land in
+ * subsequent phases.
+ */
+@RequestScoped
+public class SemanticModelCatalogAdapter

Review Comment:
   made the change per suggestion, please take a look



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3493425958


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   So, I guess we'll work on that in a separate PR?.. @flyrain : how does that sound?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3441415819


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"

Review Comment:
   Maybe we should go directly to 0.2.0.dev as we are close to release 0.2.0.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3443172666


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   `dev` discussion: https://lists.apache.org/thread/bov6nhryqjmtrxw5nxhss0o0c4ntn6o0



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3493425958


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   So, I guess we'll work on that in a separate (follow-up) PR?.. @flyrain : how does that sound?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3461337954


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/semanticmodel/SemanticModelCatalogAdapter.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.service.catalog.semanticmodel;
+
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.SecurityContext;
+import org.apache.polaris.core.config.FeatureConfiguration;
+import org.apache.polaris.core.config.RealmConfig;
+import org.apache.polaris.core.context.CallContext;
+import org.apache.polaris.core.context.RealmContext;
+import org.apache.polaris.service.catalog.api.PolarisCatalogSemanticModelApiService;
+import org.apache.polaris.service.catalog.common.CatalogAdapter;
+import org.apache.polaris.service.types.CreateSemanticModelRequest;
+import org.apache.polaris.service.types.UpdateSemanticModelRequest;
+
+/**
+ * Stub adapter for the OSI semantic-model API. The endpoints are wired and gated by {@link
+ * FeatureConfiguration#ENABLE_SEMANTIC_MODELS}, but every operation returns {@code 501 Not
+ * Implemented}. Persistence, validation, authorization, and source-link resolution land in
+ * subsequent phases.
+ */
+@RequestScoped
+public class SemanticModelCatalogAdapter

Review Comment:
   1: From my POV, all current changes in `runtime/service` should be in a new gradle module.
   
   2: yes, `runtime/server` is to have a runtime dep on the new module.
   
   I'll post a dev email about this soon.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "singhpk234 (via GitHub)" <gi...@apache.org>.
singhpk234 commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3493303023


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,412 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+        Upon successful creation, the response returns the model's initial entity-version.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+
+        Upon a successful update, the model's entity-version changes and the new value is returned.
+
+        Updates use optimistic concurrency: supply the `entity-version` you last read for this
+        model, and the update succeeds only if it matches the version currently stored in the
+        catalog. A mismatch fails with 409.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        409:
+          description:
+            Conflict - the supplied entity-version does not match the stored version. The client
+            may retry after fetching the latest version.
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelVersionMismatch:
+                  $ref: '#/components/examples/SemanticModelVersionMismatchError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"
+        semantic_model: '{"name":"tpcds_retail_model","description":"retail analytics","datasets":[{"name":"store_sales","source":"public.store_sales","primary_key":["ss_item_sk","ss_ticket_number"]}],"metrics":[{"name":"total_sales","expression":{"dialects":[{"dialect":"ANSI_SQL","expression":"SUM(ss_ext_sales_price)"}]}}]}'
+
+    SemanticModelIdentifier:
+      type: object
+      required:
+        - namespace
+        - name
+      properties:
+        namespace:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace'
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+
+    CreateSemanticModelRequest:
+      type: object
+      required:
+        - name
+        - document
+      properties:
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    UpdateSemanticModelRequest:
+      type: object
+      required:
+        - document
+        - entity-version
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+        entity-version:
+          type: string
+          description: |
+            An opaque string identifying the version the client last read for this semantic model. The update applies 
+            only if it matches the version currently stored in the catalog (optimistic concurrency).
+
+    LoadSemanticModelResponse:
+      type: object
+      required:
+        - document
+        - entity-version
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+        entity-version:
+          type: string
+          description: |
+            An opaque string identifying the current version of the stored semantic-model entity. It
+            changes whenever the model is updated. 
+
+    ListSemanticModelsResponse:
+      type: object
+      properties:
+        next-page-token:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/PageToken'
+        identifiers:
+          type: array
+          uniqueItems: true
+          items:
+            $ref: '#/components/schemas/SemanticModelIdentifier'

Review Comment:
   i think both are valid, it good to have imho we can always make it later ? but i feel its just a small addition, which can help in exchange ... but totally your call 



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3470100174


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"

Review Comment:
   That's a good point, I think using 0.2.0 makes sense. This is important when we introduce the validator. Here is just an example for the version string. Do you prefer a string like `0.2.0.dev`? I can make the change if that's so.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "adnanhemani (via GitHub)" <gi...@apache.org>.
adnanhemani commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3439440326


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"
+        semantic_model: '{"name":"tpcds_retail_model","description":"retail analytics","datasets":[{"name":"store_sales","source":"public.store_sales","primary_key":["ss_item_sk","ss_ticket_number"]}],"metrics":[{"name":"total_sales","expression":{"dialects":[{"dialect":"ANSI_SQL","expression":"SUM(ss_ext_sales_price)"}]}}]}'
+
+    SemanticModelIdentifier:
+      type: object
+      required:
+        - namespace
+        - name
+      properties:
+        namespace:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace'
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+
+    CreateSemanticModelRequest:
+      type: object
+      required:
+        - name
+        - document
+      properties:
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    UpdateSemanticModelRequest:
+      type: object
+      required:
+        - document
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    LoadSemanticModelResponse:
+      type: object
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    ListSemanticModelsResponse:
+      type: object
+      properties:
+        next-page-token:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/PageToken'
+        identifiers:
+          type: array
+          uniqueItems: true
+          items:
+            $ref: '#/components/schemas/SemanticModelIdentifier'
+
+  responses:
+    CreateSemanticModelResponse:
+      description: Semantic model object result after creating a semantic model
+      content:
+        application/json:
+          schema:
+            $ref: '#/components/schemas/LoadSemanticModelResponse'
+
+    LoadSemanticModelResponse:
+      description: Semantic model object result when loading a semantic model
+      content:
+        application/json:
+          schema:
+            $ref: '#/components/schemas/LoadSemanticModelResponse'

Review Comment:
   Should this be a required property?



##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:

Review Comment:
   Should this potentially be 201 rather than 200?



##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   If this is an issue to send these endpoints, then we should discuss on the mailing list to keep all or remove all IMO.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3443022252


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.

Review Comment:
   What is the value of including JSON in JSON as a string? Why not use a free-form JSON object?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3441411277


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:

Review Comment:
   OSI/Ossie defines the "content/payload", not the API.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3439176594


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   This follows the conventions of other Polaris specific endpoints like generic table and policy ones.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3470101868


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"

Review Comment:
   Same as https://github.com/apache/polaris/pull/4816#discussion_r3470100174



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3493143322


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   This comment thread was initially about the very presence of OSI endpoints in the IRC config response. has been discussed on `dev` and I think we can consider this comment thread resolved.
   
   https://lists.apache.org/thread/15g7mbfs74fv1z41q2s7f9xtq45xqyov
   
   I opened a fresh comment about the pluggability aspect of these endpoints.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "singhpk234 (via GitHub)" <gi...@apache.org>.
singhpk234 commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3493296049


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,412 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+        Upon successful creation, the response returns the model's initial entity-version.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+
+        Upon a successful update, the model's entity-version changes and the new value is returned.
+
+        Updates use optimistic concurrency: supply the `entity-version` you last read for this
+        model, and the update succeeds only if it matches the version currently stored in the
+        catalog. A mismatch fails with 409.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        409:
+          description:
+            Conflict - the supplied entity-version does not match the stored version. The client
+            may retry after fetching the latest version.
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelVersionMismatch:
+                  $ref: '#/components/examples/SemanticModelVersionMismatchError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"
+        semantic_model: '{"name":"tpcds_retail_model","description":"retail analytics","datasets":[{"name":"store_sales","source":"public.store_sales","primary_key":["ss_item_sk","ss_ticket_number"]}],"metrics":[{"name":"total_sales","expression":{"dialects":[{"dialect":"ANSI_SQL","expression":"SUM(ss_ext_sales_price)"}]}}]}'
+
+    SemanticModelIdentifier:
+      type: object
+      required:
+        - namespace
+        - name
+      properties:
+        namespace:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace'
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+
+    CreateSemanticModelRequest:
+      type: object
+      required:
+        - name
+        - document
+      properties:
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    UpdateSemanticModelRequest:
+      type: object
+      required:
+        - document
+        - entity-version
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+        entity-version:
+          type: string
+          description: |
+            An opaque string identifying the version the client last read for this semantic model. The update applies 

Review Comment:
   its good to have this defined to make sure consistent parsing behaviour for the parsers ? for example UTF-8 with 255 is what glue exposes ? 



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain merged PR #4816:
URL: https://github.com/apache/polaris/pull/4816


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "adam-christian-software (via GitHub)" <gi...@apache.org>.
adam-christian-software commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3454600761


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/semanticmodel/SemanticModelCatalogAdapter.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.service.catalog.semanticmodel;
+
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.SecurityContext;
+import org.apache.polaris.core.config.FeatureConfiguration;
+import org.apache.polaris.core.config.RealmConfig;
+import org.apache.polaris.core.context.CallContext;
+import org.apache.polaris.core.context.RealmContext;
+import org.apache.polaris.service.catalog.api.PolarisCatalogSemanticModelApiService;
+import org.apache.polaris.service.catalog.common.CatalogAdapter;
+import org.apache.polaris.service.types.CreateSemanticModelRequest;
+import org.apache.polaris.service.types.UpdateSemanticModelRequest;
+
+/**
+ * Stub adapter for the OSI semantic-model API. The endpoints are wired and gated by {@link
+ * FeatureConfiguration#ENABLE_SEMANTIC_MODELS}, but every operation returns {@code 501 Not
+ * Implemented}. Persistence, validation, authorization, and source-link resolution land in
+ * subsequent phases.
+ */
+@RequestScoped
+public class SemanticModelCatalogAdapter
+    implements PolarisCatalogSemanticModelApiService, CatalogAdapter {
+
+  private final RealmConfig realmConfig;
+
+  @Inject
+  public SemanticModelCatalogAdapter(CallContext callContext) {
+    this.realmConfig = callContext.getRealmConfig();
+  }
+
+  private void ensureEnabled() {
+    FeatureConfiguration.enforceFeatureEnabledOrThrow(
+        realmConfig, FeatureConfiguration.ENABLE_SEMANTIC_MODELS);
+  }
+
+  private static Response notImplemented() {
+    return Response.status(Response.Status.NOT_IMPLEMENTED).build();
+  }
+
+  @Override
+  public Response createSemanticModel(
+      String prefix,
+      String namespace,
+      CreateSemanticModelRequest createSemanticModelRequest,
+      RealmContext realmContext,
+      SecurityContext securityContext) {
+    ensureEnabled();
+    return notImplemented();

Review Comment:
   I appreciate that you are showing us how you are going to be moving forward with building this feature, however I would appreciate TODOs here. While the code does a fantastic job at documenting what the code does, it does not do a good enough job (in this case) for why it is doing that.
   
   Could you add TODOs to mark that you will be following up here?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3493114814


##########
polaris-core/src/main/java/org/apache/polaris/core/rest/PolarisResourcePaths.java:
##########
@@ -48,6 +48,12 @@ public class PolarisResourcePaths {
       "/polaris/v1/{prefix}/namespaces/{namespace}/policies/{policy-name}/mappings";
   public static final String V1_APPLICABLE_POLICIES = "/polaris/v1/{prefix}/applicable-policies";
 
+  // Semantic Model endpoints
+  public static final String V1_SEMANTIC_MODELS =
+      "/polaris/v1/{prefix}/namespaces/{namespace}/semantic-models";
+  public static final String V1_SEMANTIC_MODEL =
+      "/polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}";

Review Comment:
   Ideally, I think this should be plugged in via `extensions/semantic-models`... based on Alex's suggestion in:
   
   https://lists.apache.org/thread/15g7mbfs74fv1z41q2s7f9xtq45xqyov
   
   https://lists.apache.org/thread/bkopxz1014hcmoqkkymxstp63tb1bfcv



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3493463264


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   Sounds good, let's use that PR for follow-up work :+1:



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3484401571


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   moved to a new module, please a look



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3484529140


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,412 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+        Upon successful creation, the response returns the model's initial entity-version.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+
+        Upon a successful update, the model's entity-version changes and the new value is returned.
+
+        Updates use optimistic concurrency: supply the `entity-version` you last read for this
+        model, and the update succeeds only if it matches the version currently stored in the
+        catalog. A mismatch fails with 409.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        409:
+          description:
+            Conflict - the supplied entity-version does not match the stored version. The client
+            may retry after fetching the latest version.
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelVersionMismatch:
+                  $ref: '#/components/examples/SemanticModelVersionMismatchError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"
+        semantic_model: '{"name":"tpcds_retail_model","description":"retail analytics","datasets":[{"name":"store_sales","source":"public.store_sales","primary_key":["ss_item_sk","ss_ticket_number"]}],"metrics":[{"name":"total_sales","expression":{"dialects":[{"dialect":"ANSI_SQL","expression":"SUM(ss_ext_sales_price)"}]}}]}'
+
+    SemanticModelIdentifier:
+      type: object
+      required:
+        - namespace
+        - name
+      properties:
+        namespace:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace'
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+
+    CreateSemanticModelRequest:
+      type: object
+      required:
+        - name
+        - document
+      properties:
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    UpdateSemanticModelRequest:
+      type: object
+      required:
+        - document
+        - entity-version
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+        entity-version:
+          type: string
+          description: |
+            An opaque string identifying the version the client last read for this semantic model. The update applies 

Review Comment:
   Why do we enforce its utf8 and fixed size? I'd be happy to do that if that makes things better.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3438901863


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:

Review Comment:
   Who owns this API definition? Polaris?



##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/semanticmodel/SemanticModelCatalogAdapter.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.service.catalog.semanticmodel;
+
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.SecurityContext;
+import org.apache.polaris.core.config.FeatureConfiguration;
+import org.apache.polaris.core.config.RealmConfig;
+import org.apache.polaris.core.context.CallContext;
+import org.apache.polaris.core.context.RealmContext;
+import org.apache.polaris.service.catalog.api.PolarisCatalogSemanticModelApiService;
+import org.apache.polaris.service.catalog.common.CatalogAdapter;
+import org.apache.polaris.service.types.CreateSemanticModelRequest;
+import org.apache.polaris.service.types.UpdateSemanticModelRequest;
+
+/**
+ * Stub adapter for the OSI semantic-model API. The endpoints are wired and gated by {@link
+ * FeatureConfiguration#ENABLE_SEMANTIC_MODELS}, but every operation returns {@code 501 Not
+ * Implemented}. Persistence, validation, authorization, and source-link resolution land in
+ * subsequent phases.
+ */
+@RequestScoped
+public class SemanticModelCatalogAdapter

Review Comment:
   Do we have consensus that the Semantic Model API is included into the Polaris service by default (which is the case in this PR)?



##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   Why would Polaris return "semantic model" endpoints in response to an Iceberg REST Catalog config request?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3439172628


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/semanticmodel/SemanticModelCatalogAdapter.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.service.catalog.semanticmodel;
+
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.SecurityContext;
+import org.apache.polaris.core.config.FeatureConfiguration;
+import org.apache.polaris.core.config.RealmConfig;
+import org.apache.polaris.core.context.CallContext;
+import org.apache.polaris.core.context.RealmContext;
+import org.apache.polaris.service.catalog.api.PolarisCatalogSemanticModelApiService;
+import org.apache.polaris.service.catalog.common.CatalogAdapter;
+import org.apache.polaris.service.types.CreateSemanticModelRequest;
+import org.apache.polaris.service.types.UpdateSemanticModelRequest;
+
+/**
+ * Stub adapter for the OSI semantic-model API. The endpoints are wired and gated by {@link
+ * FeatureConfiguration#ENABLE_SEMANTIC_MODELS}, but every operation returns {@code 501 Not
+ * Implemented}. Persistence, validation, authorization, and source-link resolution land in
+ * subsequent phases.
+ */
+@RequestScoped
+public class SemanticModelCatalogAdapter

Review Comment:
   This PR and dev mailing list thread(https://lists.apache.org/thread/f30wyywz0gtt72troct3849vbc4s4xyt) are part of consensus building. Feel free to chime in. 



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3461337954


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/semanticmodel/SemanticModelCatalogAdapter.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.service.catalog.semanticmodel;
+
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.SecurityContext;
+import org.apache.polaris.core.config.FeatureConfiguration;
+import org.apache.polaris.core.config.RealmConfig;
+import org.apache.polaris.core.context.CallContext;
+import org.apache.polaris.core.context.RealmContext;
+import org.apache.polaris.service.catalog.api.PolarisCatalogSemanticModelApiService;
+import org.apache.polaris.service.catalog.common.CatalogAdapter;
+import org.apache.polaris.service.types.CreateSemanticModelRequest;
+import org.apache.polaris.service.types.UpdateSemanticModelRequest;
+
+/**
+ * Stub adapter for the OSI semantic-model API. The endpoints are wired and gated by {@link
+ * FeatureConfiguration#ENABLE_SEMANTIC_MODELS}, but every operation returns {@code 501 Not
+ * Implemented}. Persistence, validation, authorization, and source-link resolution land in
+ * subsequent phases.
+ */
+@RequestScoped
+public class SemanticModelCatalogAdapter

Review Comment:
   1: From my POV, all current changes in `runtime/service` should be in a new gradle module.
   
   Additionally, changes in `IcebergCatalogHandler` (endpoints) should be deferred and the rationale for them discussed on `dev`.
   
   2: yes, `runtime/server` is to have a runtime dep on the new module.
   
   I'll post a dev email about this soon.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3470243021


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"
+        semantic_model: '{"name":"tpcds_retail_model","description":"retail analytics","datasets":[{"name":"store_sales","source":"public.store_sales","primary_key":["ss_item_sk","ss_ticket_number"]}],"metrics":[{"name":"total_sales","expression":{"dialects":[{"dialect":"ANSI_SQL","expression":"SUM(ss_ext_sales_price)"}]}}]}'
+
+    SemanticModelIdentifier:
+      type: object
+      required:
+        - namespace
+        - name
+      properties:
+        namespace:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace'
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+
+    CreateSemanticModelRequest:
+      type: object
+      required:
+        - name
+        - document
+      properties:
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    UpdateSemanticModelRequest:
+      type: object
+      required:
+        - document
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    LoadSemanticModelResponse:
+      type: object
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    ListSemanticModelsResponse:
+      type: object
+      properties:
+        next-page-token:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/PageToken'
+        identifiers:
+          type: array
+          uniqueItems: true
+          items:
+            $ref: '#/components/schemas/SemanticModelIdentifier'
+
+  responses:
+    CreateSemanticModelResponse:
+      description: Semantic model object result after creating a semantic model
+      content:
+        application/json:
+          schema:
+            $ref: '#/components/schemas/LoadSemanticModelResponse'
+
+    LoadSemanticModelResponse:
+      description: Semantic model object result when loading a semantic model
+      content:
+        application/json:
+          schema:
+            $ref: '#/components/schemas/LoadSemanticModelResponse'

Review Comment:
   Checked the IRC and other response. Looks like we never make it required,  e.g., https://github.com/apache/polaris/blob/d65430992619f657e65392b52122a058953d529d/spec/iceberg-rest-catalog-open-api.yaml#L5046



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3470276459


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/semanticmodel/SemanticModelCatalogAdapter.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.service.catalog.semanticmodel;
+
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.SecurityContext;
+import org.apache.polaris.core.config.FeatureConfiguration;
+import org.apache.polaris.core.config.RealmConfig;
+import org.apache.polaris.core.context.CallContext;
+import org.apache.polaris.core.context.RealmContext;
+import org.apache.polaris.service.catalog.api.PolarisCatalogSemanticModelApiService;
+import org.apache.polaris.service.catalog.common.CatalogAdapter;
+import org.apache.polaris.service.types.CreateSemanticModelRequest;
+import org.apache.polaris.service.types.UpdateSemanticModelRequest;
+
+/**
+ * Stub adapter for the OSI semantic-model API. The endpoints are wired and gated by {@link
+ * FeatureConfiguration#ENABLE_SEMANTIC_MODELS}, but every operation returns {@code 501 Not
+ * Implemented}. Persistence, validation, authorization, and source-link resolution land in
+ * subsequent phases.
+ */
+@RequestScoped
+public class SemanticModelCatalogAdapter
+    implements PolarisCatalogSemanticModelApiService, CatalogAdapter {
+
+  private final RealmConfig realmConfig;
+
+  @Inject
+  public SemanticModelCatalogAdapter(CallContext callContext) {
+    this.realmConfig = callContext.getRealmConfig();
+  }
+
+  private void ensureEnabled() {
+    FeatureConfiguration.enforceFeatureEnabledOrThrow(
+        realmConfig, FeatureConfiguration.ENABLE_SEMANTIC_MODELS);
+  }
+
+  private static Response notImplemented() {
+    return Response.status(Response.Status.NOT_IMPLEMENTED).build();
+  }
+
+  @Override
+  public Response createSemanticModel(
+      String prefix,
+      String namespace,
+      CreateSemanticModelRequest createSemanticModelRequest,
+      RealmContext realmContext,
+      SecurityContext securityContext) {
+    ensureEnabled();
+    return notImplemented();

Review Comment:
    Good call, added per-operation TODOs marking the follow-up work (auth, OSI-schema validation, and persistence) and why each returns 501 for now. Done in the new commit.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "singhpk234 (via GitHub)" <gi...@apache.org>.
singhpk234 commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3484494401


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,412 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+        Upon successful creation, the response returns the model's initial entity-version.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+
+        Upon a successful update, the model's entity-version changes and the new value is returned.
+
+        Updates use optimistic concurrency: supply the `entity-version` you last read for this
+        model, and the update succeeds only if it matches the version currently stored in the
+        catalog. A mismatch fails with 409.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        409:
+          description:
+            Conflict - the supplied entity-version does not match the stored version. The client
+            may retry after fetching the latest version.
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelVersionMismatch:
+                  $ref: '#/components/examples/SemanticModelVersionMismatchError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"
+        semantic_model: '{"name":"tpcds_retail_model","description":"retail analytics","datasets":[{"name":"store_sales","source":"public.store_sales","primary_key":["ss_item_sk","ss_ticket_number"]}],"metrics":[{"name":"total_sales","expression":{"dialects":[{"dialect":"ANSI_SQL","expression":"SUM(ss_ext_sales_price)"}]}}]}'
+
+    SemanticModelIdentifier:
+      type: object
+      required:
+        - namespace
+        - name
+      properties:
+        namespace:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace'
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+
+    CreateSemanticModelRequest:
+      type: object
+      required:
+        - name
+        - document
+      properties:
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    UpdateSemanticModelRequest:
+      type: object
+      required:
+        - document
+        - entity-version
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+        entity-version:
+          type: string
+          description: |
+            An opaque string identifying the version the client last read for this semantic model. The update applies 
+            only if it matches the version currently stored in the catalog (optimistic concurrency).
+
+    LoadSemanticModelResponse:
+      type: object
+      required:
+        - document
+        - entity-version
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+        entity-version:
+          type: string
+          description: |
+            An opaque string identifying the current version of the stored semantic-model entity. It
+            changes whenever the model is updated. 
+
+    ListSemanticModelsResponse:
+      type: object
+      properties:
+        next-page-token:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/PageToken'
+        identifiers:
+          type: array
+          uniqueItems: true
+          items:
+            $ref: '#/components/schemas/SemanticModelIdentifier'

Review Comment:
   wonder if we should send entity-version too ? we would be having that too ? 



##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,412 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+        Upon successful creation, the response returns the model's initial entity-version.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+
+        Upon a successful update, the model's entity-version changes and the new value is returned.
+
+        Updates use optimistic concurrency: supply the `entity-version` you last read for this
+        model, and the update succeeds only if it matches the version currently stored in the
+        catalog. A mismatch fails with 409.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        409:
+          description:
+            Conflict - the supplied entity-version does not match the stored version. The client
+            may retry after fetching the latest version.
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelVersionMismatch:
+                  $ref: '#/components/examples/SemanticModelVersionMismatchError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"
+        semantic_model: '{"name":"tpcds_retail_model","description":"retail analytics","datasets":[{"name":"store_sales","source":"public.store_sales","primary_key":["ss_item_sk","ss_ticket_number"]}],"metrics":[{"name":"total_sales","expression":{"dialects":[{"dialect":"ANSI_SQL","expression":"SUM(ss_ext_sales_price)"}]}}]}'
+
+    SemanticModelIdentifier:
+      type: object
+      required:
+        - namespace
+        - name
+      properties:
+        namespace:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace'
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+
+    CreateSemanticModelRequest:
+      type: object
+      required:
+        - name
+        - document
+      properties:
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    UpdateSemanticModelRequest:
+      type: object
+      required:
+        - document
+        - entity-version
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+        entity-version:
+          type: string
+          description: |
+            An opaque string identifying the version the client last read for this semantic model. The update applies 

Review Comment:
   minor : do we need to say its UTF8 and restrict the size ? 



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3493143322


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   This comment thread was initially about the very presence of OSI endpoints in the IRC config response. This has been discussed on `dev` and I think we can consider this comment thread resolved.
   
   https://lists.apache.org/thread/15g7mbfs74fv1z41q2s7f9xtq45xqyov
   
   I opened a fresh comment about the pluggability aspect of these endpoints.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3443068384


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   Following a existing pattern does not automatically make the change correct :shrug: 



##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   Following an existing pattern does not automatically make the change correct :shrug: 



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3443068384


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   Following an existing pattern does not automatically make the change correct :shrug: 
   
   What is the rationale for exposing these new endpoints in the IRC config response?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "singhpk234 (via GitHub)" <gi...@apache.org>.
singhpk234 commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3454826458


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.

Review Comment:
   ```suggestion
           physical tables and views under same namespace .
   ```



##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"
+        semantic_model: '{"name":"tpcds_retail_model","description":"retail analytics","datasets":[{"name":"store_sales","source":"public.store_sales","primary_key":["ss_item_sk","ss_ticket_number"]}],"metrics":[{"name":"total_sales","expression":{"dialects":[{"dialect":"ANSI_SQL","expression":"SUM(ss_ext_sales_price)"}]}}]}'
+
+    SemanticModelIdentifier:
+      type: object
+      required:
+        - namespace
+        - name
+      properties:
+        namespace:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace'
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+
+    CreateSemanticModelRequest:
+      type: object
+      required:
+        - name
+        - document
+      properties:
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    UpdateSemanticModelRequest:

Review Comment:
   How are we planning to handle to concurrent updates ? 
   what if we expose a entityVersion in this response to achieve OCC ? in this way polaris client would just expect to sent this entityVersion and CAS only succeeds when its eq to version sent ? 
   
   much like what Glue did for supporting non irc spec impl 



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3456359376


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"
+        semantic_model: '{"name":"tpcds_retail_model","description":"retail analytics","datasets":[{"name":"store_sales","source":"public.store_sales","primary_key":["ss_item_sk","ss_ticket_number"]}],"metrics":[{"name":"total_sales","expression":{"dialects":[{"dialect":"ANSI_SQL","expression":"SUM(ss_ext_sales_price)"}]}}]}'
+
+    SemanticModelIdentifier:
+      type: object
+      required:
+        - namespace
+        - name
+      properties:
+        namespace:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace'
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+
+    CreateSemanticModelRequest:
+      type: object
+      required:
+        - name
+        - document
+      properties:
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    UpdateSemanticModelRequest:

Review Comment:
   That's a good point. Exposing the entity version makes sense, I was trying to introduce versioning a bit later. Given it's critical for OCC, let's add it now.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3470084194


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:

Review Comment:
   It's a good point. I was using 200 here to be consistent with the Policy/Iceberg convention in Polaris. Let me know if u strongly feel about it. We can discuss more.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3470243021


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"
+        semantic_model: '{"name":"tpcds_retail_model","description":"retail analytics","datasets":[{"name":"store_sales","source":"public.store_sales","primary_key":["ss_item_sk","ss_ticket_number"]}],"metrics":[{"name":"total_sales","expression":{"dialects":[{"dialect":"ANSI_SQL","expression":"SUM(ss_ext_sales_price)"}]}}]}'
+
+    SemanticModelIdentifier:
+      type: object
+      required:
+        - namespace
+        - name
+      properties:
+        namespace:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace'
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+
+    CreateSemanticModelRequest:
+      type: object
+      required:
+        - name
+        - document
+      properties:
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    UpdateSemanticModelRequest:
+      type: object
+      required:
+        - document
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    LoadSemanticModelResponse:
+      type: object
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    ListSemanticModelsResponse:
+      type: object
+      properties:
+        next-page-token:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/PageToken'
+        identifiers:
+          type: array
+          uniqueItems: true
+          items:
+            $ref: '#/components/schemas/SemanticModelIdentifier'
+
+  responses:
+    CreateSemanticModelResponse:
+      description: Semantic model object result after creating a semantic model
+      content:
+        application/json:
+          schema:
+            $ref: '#/components/schemas/LoadSemanticModelResponse'
+
+    LoadSemanticModelResponse:
+      description: Semantic model object result when loading a semantic model
+      content:
+        application/json:
+          schema:
+            $ref: '#/components/schemas/LoadSemanticModelResponse'

Review Comment:
   Checked the IRC and other response. Looks like we never make it required,  e.g., https://github.com/apache/polaris/blob/main/spec/iceberg-rest-catalog-open-api.yaml#L4735-L4735



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on PR #4816:
URL: https://github.com/apache/polaris/pull/4816#issuecomment-4834644855

   Overall, this PR LGTM :+1: 


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3493417837


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   thanks for the review, @dimas-b! a pluggable endpoints config SGTM



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3493644848


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,412 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+        Upon successful creation, the response returns the model's initial entity-version.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+
+        Upon a successful update, the model's entity-version changes and the new value is returned.
+
+        Updates use optimistic concurrency: supply the `entity-version` you last read for this
+        model, and the update succeeds only if it matches the version currently stored in the
+        catalog. A mismatch fails with 409.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        409:
+          description:
+            Conflict - the supplied entity-version does not match the stored version. The client
+            may retry after fetching the latest version.
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelVersionMismatch:
+                  $ref: '#/components/examples/SemanticModelVersionMismatchError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.
+      example:
+        version: "0.1.1"
+        semantic_model: '{"name":"tpcds_retail_model","description":"retail analytics","datasets":[{"name":"store_sales","source":"public.store_sales","primary_key":["ss_item_sk","ss_ticket_number"]}],"metrics":[{"name":"total_sales","expression":{"dialects":[{"dialect":"ANSI_SQL","expression":"SUM(ss_ext_sales_price)"}]}}]}'
+
+    SemanticModelIdentifier:
+      type: object
+      required:
+        - namespace
+        - name
+      properties:
+        namespace:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/Namespace'
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+
+    CreateSemanticModelRequest:
+      type: object
+      required:
+        - name
+        - document
+      properties:
+        name:
+          $ref: '#/components/schemas/SemanticModelName'
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+
+    UpdateSemanticModelRequest:
+      type: object
+      required:
+        - document
+        - entity-version
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+        entity-version:
+          type: string
+          description: |
+            An opaque string identifying the version the client last read for this semantic model. The update applies 
+            only if it matches the version currently stored in the catalog (optimistic concurrency).
+
+    LoadSemanticModelResponse:
+      type: object
+      required:
+        - document
+        - entity-version
+      properties:
+        document:
+          $ref: '#/components/schemas/SemanticModelDocument'
+        entity-version:
+          type: string
+          description: |
+            An opaque string identifying the current version of the stored semantic-model entity. It
+            changes whenever the model is updated. 
+
+    ListSemanticModelsResponse:
+      type: object
+      properties:
+        next-page-token:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/PageToken'
+        identifiers:
+          type: array
+          uniqueItems: true
+          items:
+            $ref: '#/components/schemas/SemanticModelIdentifier'

Review Comment:
   Discussed offline a bit. We agreed to postpone it due to the following reason: I'm a bit concern that the listing behavior is not consistent with other entities in that way. In case of introducing a complete different way to list with versions in the future, either in IRC or in Polaris, there could be potentially conflicts.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "singhpk234 (via GitHub)" <gi...@apache.org>.
singhpk234 commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3484499358


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.

Review Comment:
   make sense !



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "adam-christian-software (via GitHub)" <gi...@apache.org>.
adam-christian-software commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3461300741


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/semanticmodel/SemanticModelCatalogAdapter.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.service.catalog.semanticmodel;
+
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.SecurityContext;
+import org.apache.polaris.core.config.FeatureConfiguration;
+import org.apache.polaris.core.config.RealmConfig;
+import org.apache.polaris.core.context.CallContext;
+import org.apache.polaris.core.context.RealmContext;
+import org.apache.polaris.service.catalog.api.PolarisCatalogSemanticModelApiService;
+import org.apache.polaris.service.catalog.common.CatalogAdapter;
+import org.apache.polaris.service.types.CreateSemanticModelRequest;
+import org.apache.polaris.service.types.UpdateSemanticModelRequest;
+
+/**
+ * Stub adapter for the OSI semantic-model API. The endpoints are wired and gated by {@link
+ * FeatureConfiguration#ENABLE_SEMANTIC_MODELS}, but every operation returns {@code 501 Not
+ * Implemented}. Persistence, validation, authorization, and source-link resolution land in
+ * subsequent phases.
+ */
+@RequestScoped
+public class SemanticModelCatalogAdapter

Review Comment:
   So, @dimas-b , just getting completely clear about your feedback. You are asking:
   1. Move the SemanticModelCatalogAdapter class to a separate Gradle module. I assume you are advocating for extensions/semanticmodels.
   2. Register this new module in runtime/server/build.gradle.kts with something like runtimeOnly(project(":polaris-extensions-semantic-models"))



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3454359356


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   Replied to the thread, a Polaris client is also an IRC client, with more capabilities, which relies on these, e.g., `PolarisEndpoints.getSupportedGenericTableEndpoints()` to work correctly. 



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3454553188


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   IRC clients should not need to call non-IRC endpoints.
   
   I'd prefer to avoid overloading the IRC config response. Dealing with existing non-IRC endpoints there can be deferred, of course, but I do not see a reason for adding new non-IRC endpoints there.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3439155275


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:

Review Comment:
   Polaris owns it. The OSI doesn't specify them.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3431950281


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'

Review Comment:
   The implementation is unavailable temporally. I don't think we should add this status to spec. 



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "adam-christian-software (via GitHub)" <gi...@apache.org>.
adam-christian-software commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3461464895


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/semanticmodel/SemanticModelCatalogAdapter.java:
##########
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.service.catalog.semanticmodel;
+
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.SecurityContext;
+import org.apache.polaris.core.config.FeatureConfiguration;
+import org.apache.polaris.core.config.RealmConfig;
+import org.apache.polaris.core.context.CallContext;
+import org.apache.polaris.core.context.RealmContext;
+import org.apache.polaris.service.catalog.api.PolarisCatalogSemanticModelApiService;
+import org.apache.polaris.service.catalog.common.CatalogAdapter;
+import org.apache.polaris.service.types.CreateSemanticModelRequest;
+import org.apache.polaris.service.types.UpdateSemanticModelRequest;
+
+/**
+ * Stub adapter for the OSI semantic-model API. The endpoints are wired and gated by {@link
+ * FeatureConfiguration#ENABLE_SEMANTIC_MODELS}, but every operation returns {@code 501 Not
+ * Implemented}. Persistence, validation, authorization, and source-link resolution land in
+ * subsequent phases.
+ */
+@RequestScoped
+public class SemanticModelCatalogAdapter

Review Comment:
   Cool. @flyrain - You good with moving the adapter to the new module and having the runtime/server have a runtime dep on the new module?
   
   For the IcebergCatalogHandler, I think we have that discussion in the separate thread.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "adam-christian-software (via GitHub)" <gi...@apache.org>.
adam-christian-software commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3454489143


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:

Review Comment:
   So, the Detailed Design says:
   
   > OSI is an evolving specification. Polaris stores the document's declared OSI version (spec_version) and validates the document against the corresponding bundled schema version.
   > Polaris may support multiple OSI versions simultaneously, allowing users to upgrade Polaris independently of their semantic models. A model written as OSI 0.1.1 remains a 0.1.1 model until explicitly updated by the user.
   > Documents declaring an unsupported OSI version are rejected with 400 Bad Request. Polaris does not automatically migrate or rewrite semantic models during server upgrades. This follows the same principle as Iceberg format evolution: version upgrades are explicit user actions rather than side effects of infrastructure upgrades.
   
   and 
   
   > Validation
   > Schema validation: Writes validate against the bundled OSI JSON Schema. A new OsiDocumentValidator produces BadRequestException with JSON-Pointer field paths on failure. The validator is strict: unknown top-level fields cause a 400. Forward compatibility with newer OSI versions is handled by upgrading Polaris's bundled schema as an explicit, coordinated action, not by silently accepting unvalidated content. Vendor-specific or experimental fields belong in custom_extensions, which the schema does allow.
   > Source table validation: Validate that every dataset.source resolves to a Polaris TABLE_LIKE entity at write time; writes with unresolved sources fail with 400.
   > Source table column validation: Not supported in v1.
   
   So, there won't be any change to the Polaris REST APIs when the OSI Spec changes since it's just passing back-and-forth JSON, but there will be some business logic changes whenever OSI is upgraded in Polaris.



##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   Yeah, I wouldn't block the PR on figuring this out.
   
   While I agree that advertising the other APIs in the IcebergCatalogHandler is unnecessary coupling and I do think that we should improve this by decoupling it, I do see the pattern here and we should take this as a separate discussion.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3469735720


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   @flyrain : 
   
   > Replied to the thread [....]
   
   Please see the latest proposal from @adutra in that thread.
   
   From my POV, following the `dev` discussion, exposing OSI endpoints in the IRC config is acceptable.
   
   However, `runtime/service` should not have hard dependencies on the OSI REST API implementation.



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3470666986


##########
spec/polaris-catalog-apis/semantic-models-api.yaml:
##########
@@ -0,0 +1,369 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+---
+paths:
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+
+    post:
+      tags:
+        - Semantic Model API
+      summary: Create a semantic model in the given namespace
+      operationId: createSemanticModel
+      description: |
+        Creates a semantic model in the specified namespace.
+
+        A semantic model is an Open Semantic Interchange (OSI) document describing
+        datasets, fields, relationships, metrics, and AI context for a logical analytics surface above
+        physical tables and views.
+
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/CreateSemanticModelRequest'
+      responses:
+        200:
+          $ref: '#/components/responses/CreateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        409:
+          description: Conflict - A semantic model with this name already exists in the namespace
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelAlreadyExists:
+                  $ref: '#/components/examples/SemanticModelAlreadyExistsError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: List semantic models in the given namespace
+      operationId: listSemanticModels
+      description: |
+        List semantic-model identifiers under a namespace.
+      parameters:
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-token'
+        - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/page-size'
+
+      responses:
+        200:
+          $ref: '#/components/responses/ListSemanticModelsResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - The namespace specified does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                NamespaceNotFound:
+                  $ref: '../iceberg-rest-catalog-open-api.yaml#/components/examples/NoSuchNamespaceError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+  /polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}:
+    parameters:
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/prefix'
+      - $ref: '../iceberg-rest-catalog-open-api.yaml#/components/parameters/namespace'
+      - $ref: '#/components/parameters/semantic-model-name'
+
+    get:
+      tags:
+        - Semantic Model API
+      summary: Load a semantic model
+      operationId: loadSemanticModel
+      description: Load a semantic model from the catalog.
+      responses:
+        200:
+          $ref: '#/components/responses/LoadSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToGetDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    put:
+      tags:
+        - Semantic Model API
+      summary: Update a semantic model
+      operationId: updateSemanticModel
+      description: |
+        Replace a semantic model's document with a new one.
+      requestBody:
+        required: true
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/UpdateSemanticModelRequest'
+
+      responses:
+        200:
+          $ref: '#/components/responses/UpdateSemanticModelResponse'
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToUpdateDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+    delete:
+      tags:
+        - Semantic Model API
+      summary: Drop a semantic model from the catalog
+      operationId: dropSemanticModel
+      description: Remove a semantic model from the catalog.
+      responses:
+        204:
+          description: Success, no content
+        400:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/BadRequestErrorResponse'
+        401:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/UnauthorizedResponse'
+        403:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ForbiddenResponse'
+        404:
+          description: Not Found - the requested semantic model does not exist
+          content:
+            application/json:
+              schema:
+                $ref: '../iceberg-rest-catalog-open-api.yaml#/components/schemas/IcebergErrorResponse'
+              examples:
+                SemanticModelToDeleteDoesNotExist:
+                  $ref: '#/components/examples/NoSuchSemanticModelError'
+        503:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServiceUnavailableResponse'
+        5XX:
+          $ref: '../iceberg-rest-catalog-open-api.yaml#/components/responses/ServerErrorResponse'
+
+components:
+  parameters:
+    semantic-model-name:
+      name: semantic-model-name
+      in: path
+      required: true
+      schema:
+        $ref: '#/components/schemas/SemanticModelName'
+
+  schemas:
+
+    SemanticModelName:
+      type: string
+      description:
+        A semantic model name. A valid name consists of uppercase and lowercase letters (A-Z, a-z),
+        digits (0-9), hyphens (-), and underscores (_).
+      pattern: '^[A-Za-z0-9\-_]+$'
+      example: 'tpcds_retail_model'
+
+    SemanticModelDocument:
+      type: object
+      description: An Open Semantic Interchange (OSI) document body.
+      required:
+        - version
+        - semantic_model
+      properties:
+        version:
+          type: string
+          description: The OSI spec version.
+          example: "0.1.1"
+        semantic_model:
+          type: string
+          description: The OSI semantic model serialized as a JSON string.

Review Comment:
   The service validator has to parse it anyways, I don't think a string is inappropriate. Although, I don't have any preference. Should I change it to `object`?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "snazy (via GitHub)" <gi...@apache.org>.
snazy commented on PR #4816:
URL: https://github.com/apache/polaris/pull/4816#issuecomment-4890922991

   This change broke the build with Gradle configuration cache: #4978


-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "flyrain (via GitHub)" <gi...@apache.org>.
flyrain commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3493448363


##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1534,22 +1436,17 @@ public ConfigResponse getConfig() {
     Map<String, String> properties =
         PolarisEntity.of(resolvedReferenceCatalog.getEntity()).getPropertiesAsMap();
 
+    String prefix = prefixParser().catalogNameToPrefix(catalogName());
     return ConfigResponse.builder()
         .withDefaults(properties) // catalog properties are defaults
-        .withOverrides(
-            ImmutableMap.of(
-                "prefix",
-                prefixParser().catalogNameToPrefix(catalogName()),
-                // Polaris does not handle custom namespace separators;
-                // always communicate the default namespace separator to clients.
-                RESTCatalogProperties.NAMESPACE_SEPARATOR,
-                NamespaceUtils.DEFAULT_NAMESPACE_SEPARATOR_ENCODED))
+        .withOverrides(ImmutableMap.of("prefix", prefix))
         .withEndpoints(
             ImmutableList.<Endpoint>builder()
                 .addAll(DEFAULT_ENDPOINTS)
                 .addAll(VIEW_ENDPOINTS)
                 .addAll(PolarisEndpoints.getSupportedGenericTableEndpoints(realmConfig()))
                 .addAll(PolarisEndpoints.getSupportedPolicyEndpoints(realmConfig()))
+                .addAll(PolarisEndpoints.getSupportedSemanticModelEndpoints(realmConfig()))

Review Comment:
   yeah, I think @adam-christian-software  has filed a new PR for that, https://github.com/apache/polaris/pull/4926/changes. Are we good here?



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Feat: Add OSI semantic-model API scaffolding [polaris]

Posted by "dimas-b (via GitHub)" <gi...@apache.org>.
dimas-b commented on code in PR #4816:
URL: https://github.com/apache/polaris/pull/4816#discussion_r3493114814


##########
polaris-core/src/main/java/org/apache/polaris/core/rest/PolarisResourcePaths.java:
##########
@@ -48,6 +48,12 @@ public class PolarisResourcePaths {
       "/polaris/v1/{prefix}/namespaces/{namespace}/policies/{policy-name}/mappings";
   public static final String V1_APPLICABLE_POLICIES = "/polaris/v1/{prefix}/applicable-policies";
 
+  // Semantic Model endpoints
+  public static final String V1_SEMANTIC_MODELS =
+      "/polaris/v1/{prefix}/namespaces/{namespace}/semantic-models";
+  public static final String V1_SEMANTIC_MODEL =
+      "/polaris/v1/{prefix}/namespaces/{namespace}/semantic-models/{semantic-model-name}";

Review Comment:
   Ideally, I think this should be plugged in via `extensions/semantic-models`, I think... based on Alex's suggestion in:
   
   https://lists.apache.org/thread/15g7mbfs74fv1z41q2s7f9xtq45xqyov
   
   https://lists.apache.org/thread/bkopxz1014hcmoqkkymxstp63tb1bfcv



-- 
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: issues-unsubscribe@polaris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org