Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

Parser xsodata

Antoaneta edited this page Jun 18, 2021 · 19 revisions

Parser for xsodata

The information on how to develop the design-time data-persistence model for an XSK application using the XSODATA syntax

Reference

SAP Help

Tutorial: Use the SAP HANA OData Interface

OData Service-Definition Examples (XS Advanced)

Supported syntax from the parser

Supportable xsodata syntax (XSKXsodataParser) XTransformer MTransfrmer HTransformer Comments
HANA v1/v2 odata service definition SUPPORTED SUPPORTED not relevant not relevant documentation
HANA v1/v2 odata namespace definition SUPPORTED SUPPORTED SUPPORTED not relevant documentation
HANA v1/v2 odata object exposure SUPPORTED SUPPORTED SUPPORTED not relevant documentation
HANA v1/v2 odata property projection SUPPORTED SUPPORTED SUPPORTED not relevant documentation
HANA v1/v2 odata key specification SUPPORTED SUPPORTED using sap:filterable NOT SUPPORTED not relevant documentation
HANA v1/v2 odata associations SUPPORTED SUPPORTED SUPPORTED not relevant documentation
HANA v1/v2 odata aggregations SUPPORTED SUPPORTED using sap:semantics="aggregate" NOT SUPPORTED not relevant documentation
HANA v1/v2 odata parameters entitysets SUPPORTED No odata representation exist not relevant not relevant documentation
HANA v1/v2 odata Etag support NOT SUPPORTED NOT SUPPORTED NOT SUPPORTED not relevant documentation
HANA v1/v2 odata nullable properties SUPPORTED No odata representation exist NOT SUPPORTED not relevant documentation
HANA v1/v2 odata configurable cash settings SUPPORTED No odata representation exist NOT SUPPORTED not relevant documentation
HANA v2 OData Hints for SQL Select Statements SUPPORTED No odata representation exist NOT SUPPORTED not relevant documentation
HANA v2 OData Entity Limits SUPPORTED NOT SUPPORTED NOT SUPPORTED not relevant documentation
HANA v1/v2 modifications SUPPORTED SUPPORTED [forbidden: using sap:creatable, sap:updatable, sap:deletable], [events - no odata representation exist] not relevant SUPPORTED documentation
HANA v1/v2 validation scrips with XS JavaScript SUPPORTED no odata representation exist not relevant SUPPORTED documentation
HANA v1/v2 validation exit with SQL script SUPPORTED no odata representation exist not relevant SUPPORTED documentation

Grammar definition:

Link

Modules

https://github.com/SAP/xsk/tree/main/modules/parsers/parser-xsodata

Transformers

XSKOData2ODataHTransformer

Uses the OData2ODataHTransformer.transform() method. The xsodata modification artifacts are converted to odata artifacts. See the table for the supportable operations.

xsodata modification artifacts convert to odata
create using on
forbidden forbid
before before
after after
precommit not supported
postcommit not supported

Example of .xsodata will generated the following OData2ODataHTransformer

"sample.odata::table1"
      update events (before "sample.odata::beforeMethod", precommit "sample.odata::beforeMethod")
      delete events (after "sample.odata::afterMethod")
      create forbidden;

| ODATAH_METHOD | ODATAH_TYPE | ODATAH_HANDLER             |
|---------------|-------------|----------------------------|
| update        | before      | sample.odata::beforeMethod |
| delete        | after       | sample.odata::afterMethod  |
| create        | fordid      | N/A                        |

Example of .xsodata will generated the following OData2ODataHTransformer

     create using "sample.odata::createMethod"
     update events (precommit "sample.odata::precommitMethod")
     delete forbidden;

| ODATAH_METHOD | ODATAH_TYPE | ODATAH_HANDLER             |
|---------------|-------------|----------------------------|
| create        | on          | sample.odata::createMethod |
| delete        | fordid      | N/A                        |

XSKOData2ODataMTransformer

Dirigible Odata supports the following Multiplicity values: ZERO_TO_ONE("0..1"), MANY("*"), ONE("1");

XSODATA Multiplicity '1..' is converted to '', because '1..*' is not supported from odata.

XSKOData2ODataMTransformer rely on ForeignKey definitions on DB side. if there are no ForeignKey constraint between tables in the DB, then all navigations must be defined inside .odata file, otherwise no navigations will be exposed though the odata service.

Inside xsodata file we can specify which properties can be exposed using the 'with' and 'without' section:

service namespace "np"{
   "sample.odata::table1" as "Table1" without ("COLUMN1");
   "sample.odata::table2" as "Table2" with ("COLUMN1", "COLUMN2");
}

XSK XSODATA Supportability for Annotations

SAP ODATA Annotations for XSOData XS2

SAP Annotations for OData Version 2.0

Annotation Element Dirigible Annotation Supportability
Element edm:Schema
Element edm:EntityContainer
Element edm:EntitySet ✔️
Element edm:EntityType ✔️
Element edm:Property ✔️
Element edm:NavigationProperty ✔️
Element edm:FunctionImport
Element sap:value-constraint
Element edm:Parameter
Element edm:AssociationSet ✔️

For all the list of annotations check the official documentation SAP OData Annotations v2.X

XSODATA Supportability Annotation Element Parameter Name Parameter Value The following values are supported in the following cases
edm:EntityType sap:semantics Undefined Defaul Value is Undefined
✔️ aggregate Where aggregation is defined for the entity set of the entity type using "aggregates" expression in .xsodata file
aggregate Where the entity type represents a calculation view, which has a measure attribute
parameters if the entity type represents input parameters for a calculation view
edm:EntitySet sap:addressable TRUE Default Value is true
FALSE “false” if the entity set represents either a calculation view or input parameters for a calculation view.
sap:creatable TRUE Default Value is true
✔️ FALSE The "create forbidden" setting is defined for the entity set in the OData service definition (.xsodata) file
FALSE The entity set represents a database view, for example, a table or a calculation view.
FALSE The entity set represents input parameters for a calculation view.
FALSE “aggregation” is defined for the entity set, for example, using the “aggregates always” expression in the OData service definition (.xsodata) file.
sap:updatable TRUE Default Value is true
✔️ FALSE The "update forbidden" setting is defined for the entity set in the OData service definition (.xsodata) file
FALSE The entity set represents a database view, for example, a table or a calculation view.
FALSE The entity set represents input parameters for a calculation view.
FALSE “aggregation” is defined for the entity set, for example, using the “aggregates always” expression in the OData service definition (.xsodata) file.
FALSE A generated key is defined for the entity set.
sap:deletable TRUE Default Value is true
✔️ FALSE The "delete forbidden" setting is defined for the entity set in the OData service definition (.xsodata) file
FALSE The entity set represents a database view, for example, a table or a calculation view.
FALSE The entity set represents input parameters for a calculation view.
FALSE “aggregation” is defined for the entity set, for example, using the “aggregates always” expression in the OData service definition (.xsodata) file.
FALSE A generated key is defined for the entity set.
Entity-Type edm:Property sap:semantics Undefined Undefined; there is no defined default value
currency-code check official docmentation for more detail
unit-of-measure check official docmentation for more detail
dtstart check official docmentation for more detail
dtend check official docmentation for more detail
sap:parameter Undefined Undefined; there is no defined default value
mandatory check official docmentation for more detail
optional check official docmentation for more detail
sap:label Undefined Undefined; there is no defined default value
Additional Supported Values check official docmentation for more detail
sap:filterable TRUE Default Value is true
FALSE The property represents a generated key
FALSE The property represents a measure attribute of a calculation view
FALSE The property is used in the aggregation, defined as the “aggregates always” expression in the XS OData service-definition (.xsodata) file.
sap:display-format Undefined Undefined; there is no defined default value
Date The “Date” value can be used if the SQL DATE type is used for the property on the database side.
sap:aggregation-role Undefined Undefined; there is no defined default value
measure The “measure” value can be used if the property represents a measure attribute of a calculation view or is used in the aggregation that is defined in the “aggregates always” expression in the XS advanced OData service-definition (.xsodata) file.
sap:unit Undefined Undefined; there is no defined default value
Additional Supported Values check official docmentation for more detail
sap:filter-restriction Undefined Undefined; there is no defined default value
single-value check official docmentation for more detail
multi-value check official docmentation for more detail
interval check official docmentation for more detail
edm:NavigationProperty sap:creatable TRUE Default Value is true
FALSE The annotation value is always “false” because neither “deep insert” (POST request payload containing data for both parent and related entity) nor POST request for the .../EntitySet(key)/navPropertyName URL is supported in XS OData for XS advanced.
sap:filterable TRUE Default Value is true
FALSE The annotation value is always “false” because navigation properties cannot be used in a $filter system query option in XS OData for XS advanced.
edm:AssociationSet sap:creatable TRUE Default Value is true
FALSE “false” if the association set connects entity sets for calculation view results and calculation view input parameters.
sap:updatable TRUE Default Value is true
FALSE “false” if the association set connects entity sets for calculation view results and calculation view input parameters.
sap:deletable TRUE Default Value is true
FALSE “false” if the association set connects entity sets for calculation view results and calculation view input parameters.
FEATURES SUPPORTED IN XSK REMARKS
Aggregation
Association ✔️ DONE
Key Specification ✔️ DONE
Parameter Entity Sets
Projection ✔️ DONE
HANA TableType Dirigible supported type for odata
CALC VIEW ✔️
GLOBAL TEMPORARARY
SHARED TEMPORARARY
NO LOGGING TEMPORARY
SYNONYM
SYSTEM TABLE
TABLE ✔️
USER DEFINED
COLUMN VIEW
VIEW ✔️
JOIN VIEW
OLAP VIEW
HIERARCHY VIEW
Conditions Implemented Remarks
1 ✔️
2 ✔️
3 ✔️
4 ✔️
5 ✔️
6 can not be imlemented
7 ✔️
8 ✔️
9 calculation views and analytic views processing
10 ✔️
11 ✔️ calculation views and analytic views processing
12 ✔️ calculation views and analytic views processing

-Xsodata do not handle Calculation Views

HANA TableType Implemented Transformers
TABLE ✔️
VIEW ✔️
CALC VIEW