Skip to content

Commit

Permalink
New Batch vocabulary
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoTheissen committed Aug 29, 2024
1 parent 8649020 commit bde5886
Show file tree
Hide file tree
Showing 9 changed files with 189 additions and 143 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SAP Vocabularies for semantic markup of structured data published via [OData](ht
This repository defines the following SAP vocabularies:

- [Analytics: Analytical resources](vocabularies/Analytics.md)
- [Batch: Advanced batch requests](vocabularies/Batch.md) - _experimental_
- [CodeList: Code Lists](vocabularies/CodeList.md)
- [Common: Semantics common to all types of APIs](vocabularies/Common.md)
- [Communication: Contact information based on vCard](vocabularies/Communication.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.json": {
"$Include": [{ "$Namespace": "Org.OData.Core.V1", "$Alias": "Core" }]
},
"https://sap.github.io/odata-vocabularies/vocabularies/Common.json": {
"$Include": [{ "$Namespace": "com.sap.vocabularies.Common.v1", "$Alias": "Common" }]
"https://sap.github.io/odata-vocabularies/vocabularies/Batch.json": {
"$Include": [{ "$Namespace": "com.sap.vocabularies.Batch.v1", "$Alias": "Batch" }]
}
},
"corresponding.sample": {
Expand Down Expand Up @@ -33,11 +33,11 @@
{ "$Name": "items", "$Collection": true, "$Type": "self.SalesQuotationItemToBeCopied" }
],
"$ReturnType": { "$Type": "self.SalesOrder" },
"@Common.CorrespondingContentIDs": [
"@Batch.CorrespondingContentIDs": [
{
"@Core.Description": "Correspondence between sales quotation item and sales order item",
"ParameterValue": "items",
"ReturnedEntity": "$ReturnType/Items"
"ReturnedValue": "$ReturnType/Items"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml">
<edmx:Include Namespace="Org.OData.Core.V1" Alias="Core" />
</edmx:Reference>
<edmx:Reference Uri="https://sap.github.io/odata-vocabularies/vocabularies/Common.xml">
<edmx:Include Namespace="com.sap.vocabularies.Common.v1" Alias="Common" />
<edmx:Reference Uri="https://sap.github.io/odata-vocabularies/vocabularies/Batch.xml">
<edmx:Include Namespace="com.sap.vocabularies.Batch.v1" Alias="Batch" />
</edmx:Reference>
<edmx:DataServices>
<Schema Namespace="corresponding.sample" Alias="self" xmlns="http://docs.oasis-open.org/odata/ns/edm">
Expand All @@ -27,12 +27,12 @@
<Parameter Name="_it" Type="self.SalesQuotation" Nullable="false" />
<Parameter Name="items" Type="Collection(self.SalesQuotationItemToBeCopied)" />
<ReturnType Type="self.SalesOrder" Nullable="false" />
<Annotation Term="Common.CorrespondingContentIDs">
<Annotation Term="Batch.CorrespondingContentIDs">
<Collection>
<Record>
<Annotation Term="Core.Description" String="Correspondence between sales quotation item and sales order item" />
<PropertyValue Property="ParameterValue" PropertyPath="items" />
<PropertyValue Property="ReturnedEntity" NavigationPropertyPath="$ReturnType/Items" />
<PropertyValue Property="ReturnedValue" NavigationPropertyPath="$ReturnType/Items" />
</Record>
</Collection>
</Annotation>
Expand Down
45 changes: 45 additions & 0 deletions vocabularies/Batch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"$Version": "4.01",
"$Reference": {
"https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.json": {
"$Include": [{ "$Namespace": "Org.OData.Core.V1", "$Alias": "Core" }]
},
"https://sap.github.io/odata-vocabularies/vocabularies/Common.json": {
"$Include": [{ "$Namespace": "com.sap.vocabularies.Common.v1", "$Alias": "Common" }]
}
},
"com.sap.vocabularies.Batch.v1": {
"$Alias": "Batch",
"@Core.Description": "Terms for advanced batch request processing",
"@Core.Description#Published": "2024-08-29 © Copyright 2024 SAP SE. All rights reserved.",
"@Core.Links": [
{ "rel": "alternate", "href": "https://sap.github.io/odata-vocabularies/vocabularies/Batch.xml" },
{ "rel": "latest-version", "href": "https://sap.github.io/odata-vocabularies/vocabularies/Batch.json" },
{ "rel": "describedby", "href": "https://github.com/sap/odata-vocabularies/blob/main/vocabularies/Batch.md" }
],
"@Common.Experimental": true,
"CorrespondingContentIDs": {
"$Kind": "Term",
"$Collection": true,
"$Type": "Batch.CorrespondingContentID",
"$AppliesTo": ["Action"],
"@Common.Experimental": true,
"@Core.Description": "Correspondence between `Core.ContentID` in a parameter and in the return type of an action",
"@Core.LongDescription": "If values in the action invocation are annotated with `Core.ContentID`,\n the corresponding values returned by the action are annotated with the same `Core.ContentID`\n and can thus be referenced in subsequent requests within the same batch request."
},
"CorrespondingContentID": {
"$Kind": "ComplexType",
"@Common.Experimental": true,
"@Core.Description": "Establishes a correspondence between a value in a parameter and a value in the return type",
"@Core.LongDescription": "Given a sales quotation with items for coffee, sugar and paper,\nthe following batch request to [this service](../examples/Batch.CorrespondingContentIDs-sample.xml)\ninvokes an action to create a sales order for sugar and paper\nand adds a 10% discount for the sugar.\n```json\n{\"requests\": [{\n \"id\": \"1\",\n \"method\": \"post\",\n \"url\": \"SalesQuotation(68)/self.CreateSalesOrder\",\n \"body\": {\n \"items\": [\n {\"product\": \"Sugar\", \"@Core.ContentID\": \"I1\"},\n {\"product\": \"Paper\"}\n ]\n }\n}, {\n \"id\": \"2\",\n \"dependsOn\": [ \"1\" ],\n \"method\": \"post\",\n \"url\": \"$I1/Discounts\",\n \"body\": {\n \"percent\": 10\n }\n}]}\n```\nIn the response to the action invocation the sales order item for the sugar is annotated\nwith `\"@Core.ContentID\": \"I1\"`. The subsequent POST request can reference this item without knowing its key.",
"ParameterValue": {
"$Type": "Edm.AnyPropertyPath",
"@Core.Description": "Path to a value in a parameter that may be annotated with `Core.ContentID`"
},
"ReturnedValue": {
"$Type": "Edm.AnyPropertyPath",
"@Core.Description": "Path to a value in the return type that will be annotated with the same `Core.ContentID`"
}
}
}
}
48 changes: 48 additions & 0 deletions vocabularies/Batch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Batch Vocabulary
**Namespace: [com.sap.vocabularies.Batch.v1](Batch.xml)**

Terms for advanced batch request processing


## Terms

Term|Type|Description
:---|:---|:----------
[CorrespondingContentIDs](Batch.xml#L35) *([Experimental](Common.md#Experimental))*|\[[CorrespondingContentID](#CorrespondingContentID)\]|<a name="CorrespondingContentIDs"></a>Correspondence between `Core.ContentID` in a parameter and in the return type of an action<br>If values in the action invocation are annotated with `Core.ContentID`, the corresponding values returned by the action are annotated with the same `Core.ContentID` and can thus be referenced in subsequent requests within the same batch request.

<a name="CorrespondingContentID"></a>
## [CorrespondingContentID](Batch.xml#L44) *([Experimental](Common.md#Experimental))*
Establishes a correspondence between a value in a parameter and a value in the return type

Given a sales quotation with items for coffee, sugar and paper,
the following batch request to [this service](../examples/Batch.CorrespondingContentIDs-sample.xml)
invokes an action to create a sales order for sugar and paper
and adds a 10% discount for the sugar.
```json
{"requests": [{
"id": "1",
"method": "post",
"url": "SalesQuotation(68)/self.CreateSalesOrder",
"body": {
"items": [
{"product": "Sugar", "@Core.ContentID": "I1"},
{"product": "Paper"}
]
}
}, {
"id": "2",
"dependsOn": [ "1" ],
"method": "post",
"url": "$I1/Discounts",
"body": {
"percent": 10
}
}]}
```
In the response to the action invocation the sales order item for the sugar is annotated
with `"@Core.ContentID": "I1"`. The subsequent POST request can reference this item without knowing its key.

Property|Type|Description
:-------|:---|:----------
[ParameterValue](Batch.xml#L76)|AnyPropertyPath|Path to a value in a parameter that may be annotated with `Core.ContentID`
[ReturnedValue](Batch.xml#L79)|AnyPropertyPath|Path to a value in the return type that will be annotated with the same `Core.ContentID`
87 changes: 87 additions & 0 deletions vocabularies/Batch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.01">
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml">
<edmx:Include Alias="Core" Namespace="Org.OData.Core.V1" />
</edmx:Reference>
<edmx:Reference Uri="https://sap.github.io/odata-vocabularies/vocabularies/Common.xml">
<edmx:Include Alias="Common" Namespace="com.sap.vocabularies.Common.v1" />
</edmx:Reference>
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="com.sap.vocabularies.Batch.v1" Alias="Batch">
<Annotation Term="Core.Description">
<String>Terms for advanced batch request processing</String>
</Annotation>
<Annotation Term="Core.Description" Qualifier="Published">
<String>2024-08-29 © Copyright 2024 SAP SE. All rights reserved.</String>
</Annotation>
<Annotation Term="Core.Links">
<Collection>
<Record>
<PropertyValue Property="rel" String="latest-version" />
<PropertyValue Property="href" String="https://sap.github.io/odata-vocabularies/vocabularies/Batch.xml" />
</Record>
<Record>
<PropertyValue Property="rel" String="alternate" />
<PropertyValue Property="href" String="https://sap.github.io/odata-vocabularies/vocabularies/Batch.json" />
</Record>
<Record>
<PropertyValue Property="rel" String="describedby" />
<PropertyValue Property="href" String="https://github.com/sap/odata-vocabularies/blob/main/vocabularies/Batch.md" />
</Record>
</Collection>
</Annotation>
<Annotation Term="Common.Experimental" />

<Term Name="CorrespondingContentIDs" Type="Collection(Batch.CorrespondingContentID)" Nullable="false" AppliesTo="Action">
<Annotation Term="Common.Experimental" />
<Annotation Term="Core.Description" String="Correspondence between `Core.ContentID` in a parameter and in the return type of an action" />
<Annotation Term="Core.LongDescription">
<String>If values in the action invocation are annotated with `Core.ContentID`,
the corresponding values returned by the action are annotated with the same `Core.ContentID`
and can thus be referenced in subsequent requests within the same batch request.</String>
</Annotation>
</Term>
<ComplexType Name="CorrespondingContentID">
<Annotation Term="Common.Experimental" />
<Annotation Term="Core.Description" String="Establishes a correspondence between a value in a parameter and a value in the return type" />
<Annotation Term="Core.LongDescription">
<String>Given a sales quotation with items for coffee, sugar and paper,
the following batch request to [this service](../examples/Batch.CorrespondingContentIDs-sample.xml)
invokes an action to create a sales order for sugar and paper
and adds a 10% discount for the sugar.
```json
{"requests": [{
"id": "1",
"method": "post",
"url": "SalesQuotation(68)/self.CreateSalesOrder",
"body": {
"items": [
{"product": "Sugar", "@Core.ContentID": "I1"},
{"product": "Paper"}
]
}
}, {
"id": "2",
"dependsOn": [ "1" ],
"method": "post",
"url": "$I1/Discounts",
"body": {
"percent": 10
}
}]}
```
In the response to the action invocation the sales order item for the sugar is annotated
with `"@Core.ContentID": "I1"`. The subsequent POST request can reference this item without knowing its key.</String>
</Annotation>
<Property Name="ParameterValue" Type="Edm.AnyPropertyPath" Nullable="false">
<Annotation Term="Core.Description" String="Path to a value in a parameter that may be annotated with `Core.ContentID`" />
</Property>
<Property Name="ReturnedValue" Type="Edm.AnyPropertyPath" Nullable="false">
<Annotation Term="Core.Description" String="Path to a value in the return type that will be annotated with the same `Core.ContentID`" />
</Property>
</ComplexType>

</Schema>
</edmx:DataServices>
</edmx:Edmx>

35 changes: 0 additions & 35 deletions vocabularies/Common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1316,41 +1316,6 @@
"@Common.Experimental": true,
"@Core.IsURL": true,
"@Core.Description": "Base URL for WebSocket connections"
},
"CorrespondingContentIDs": {
"$Kind": "Term",
"$Collection": true,
"$Type": "Common.CorrespondingContentID",
"$AppliesTo": ["Action"],
"@Common.Experimental": true,
"@Core.Description": "Correspondence between `Core.ContentID` in a parameter and in the return type of an action",
"@Core.LongDescription": "If values in the action invocation are annotated with `Core.ContentID`,\n the corresponding values returned by the action are annotated with the same `Core.ContentID`\n and can thus be referenced in subsequent requests within the same batch request."
},
"CorrespondingContentID": {
"$Kind": "ComplexType",
"@Common.Experimental": true,
"@Core.Description": "Establishes a correspondence between a value or entity in a parameter and in the return type",
"@Core.LongDescription": "Given a sales quotation with items for coffee, sugar and paper,\nthe following batch request to [this service](../examples/Common.CorrespondingContentIDs-sample.xml)\ninvokes an action to create a sales order for sugar and paper\nand adds a 10% discount for the sugar.\n```json\n{\"requests\": [{\n \"id\": \"1\",\n \"method\": \"post\",\n \"url\": \"SalesQuotation(68)/self.CreateSalesOrder\",\n \"body\": {\n \"items\": [\n {\"product\": \"Sugar\", \"@Core.ContentID\": \"I1\"},\n {\"product\": \"Paper\"}\n ]\n }\n}, {\n \"id\": \"2\",\n \"dependsOn\": [ \"1\" ],\n \"method\": \"post\",\n \"url\": \"$I1/Discounts\",\n \"body\": {\n \"percent\": 10\n }\n}]}\n```\nIn the response to the action invocation the sales order item for the sugar is annotated\nwith `\"@Core.ContentID\": \"I1\"`. The subsequent POST request can reference this item without knowing its key.\n\nExactly one of `ParameterValue` and `ParameterEntity` and\nexactly one of `ReturnedValue` and `ReturnedEntity` must be given.",
"ParameterValue": {
"$Type": "Edm.PropertyPath",
"$Nullable": true,
"@Core.Description": "Path to a value in a parameter that may be annotated with `Core.ContentID`"
},
"ParameterEntity": {
"$Type": "Edm.NavigationPropertyPath",
"$Nullable": true,
"@Core.Description": "Path to an entity in a parameter that may be annotated with `Core.ContentID`"
},
"ReturnedValue": {
"$Type": "Edm.PropertyPath",
"$Nullable": true,
"@Core.Description": "Path to a value in the return type that will be annotated with the same `Core.ContentID`"
},
"ReturnedEntity": {
"$Type": "Edm.NavigationPropertyPath",
"$Nullable": true,
"@Core.Description": "Path to an entity in the return type that will be annotated with the same `Core.ContentID`"
}
}
}
}
43 changes: 0 additions & 43 deletions vocabularies/Common.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ Term|Type|Description
[mediaUploadLink](Common.xml#L1457) *([Experimental](Common.md#Experimental))*|URL|<a name="mediaUploadLink"></a>URL for uploading new media content to a Document Management Service<br>In contrast to the `@odata.mediaEditLink` this URL allows to upload new media content without directly changing a stream property or media resource. The upload request typically uses HTTP POST with `Content-Type: multipart/form-data` following RFC 7578. The upload request must contain one multipart representing the content of the file. The `name` parameter in the `Content-Disposition` header (as described in RFC 7578) is irrelevant, but the `filename` parameter is expected. If the request succeeds the response will contain a JSON body of `Content-Type: application/json` with a JSON property `readLink`. The newly uploaded media resource can be linked to the stream property by changing the `@odata.mediaReadLink` to the value of this `readLink` in a subsequent PATCH request to the OData entity.
[PrimitivePropertyPath](Common.xml#L1472) *([Experimental](Common.md#Experimental))*|[Tag](https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Core.V1.md#Tag)|<a name="PrimitivePropertyPath"></a>A term or term property with this tag whose type is (a collection of) `Edm.PropertyPath` MUST resolve to a primitive structural property
[WebSocketBaseURL](Common.xml#L1477) *([Experimental](Common.md#Experimental))*|URL|<a name="WebSocketBaseURL"></a>Base URL for WebSocket connections
[CorrespondingContentIDs](Common.xml#L1483) *([Experimental](Common.md#Experimental))*|\[[CorrespondingContentID](#CorrespondingContentID)\]|<a name="CorrespondingContentIDs"></a>Correspondence between `Core.ContentID` in a parameter and in the return type of an action<br>If values in the action invocation are annotated with `Core.ContentID`, the corresponding values returned by the action are annotated with the same `Core.ContentID` and can thus be referenced in subsequent requests within the same batch request.

<a name="TextFormatType"></a>
## [TextFormatType](Common.xml#L120)
Expand Down Expand Up @@ -442,45 +441,3 @@ Use terms [Aggregation.RecursiveHierarchy](https://github.com/oasis-tcs/odata-vo
**Type:** String

User ID

<a name="CorrespondingContentID"></a>
## [CorrespondingContentID](Common.xml#L1492) *([Experimental](Common.md#Experimental))*
Establishes a correspondence between a value or entity in a parameter and in the return type

Given a sales quotation with items for coffee, sugar and paper,
the following batch request to [this service](../examples/Common.CorrespondingContentIDs-sample.xml)
invokes an action to create a sales order for sugar and paper
and adds a 10% discount for the sugar.
```json
{"requests": [{
"id": "1",
"method": "post",
"url": "SalesQuotation(68)/self.CreateSalesOrder",
"body": {
"items": [
{"product": "Sugar", "@Core.ContentID": "I1"},
{"product": "Paper"}
]
}
}, {
"id": "2",
"dependsOn": [ "1" ],
"method": "post",
"url": "$I1/Discounts",
"body": {
"percent": 10
}
}]}
```
In the response to the action invocation the sales order item for the sugar is annotated
with `"@Core.ContentID": "I1"`. The subsequent POST request can reference this item without knowing its key.

Exactly one of `ParameterValue` and `ParameterEntity` and
exactly one of `ReturnedValue` and `ReturnedEntity` must be given.

Property|Type|Description
:-------|:---|:----------
[ParameterValue](Common.xml#L1527)|PropertyPath?|Path to a value in a parameter that may be annotated with `Core.ContentID`
[ParameterEntity](Common.xml#L1530)|NavigationPropertyPath?|Path to an entity in a parameter that may be annotated with `Core.ContentID`
[ReturnedValue](Common.xml#L1533)|PropertyPath?|Path to a value in the return type that will be annotated with the same `Core.ContentID`
[ReturnedEntity](Common.xml#L1536)|NavigationPropertyPath?|Path to an entity in the return type that will be annotated with the same `Core.ContentID`
Loading

0 comments on commit bde5886

Please sign in to comment.