Skip to content

Commit

Permalink
Hierarchy directory in $batch requests
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoTheissen committed Jan 10, 2024
1 parent b6d8974 commit 2ae6745
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 31 deletions.
2 changes: 1 addition & 1 deletion vocabularies/Hierarchy.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"RecursiveHierarchyActionsType": {
"$Kind": "ComplexType",
"@Common.Experimental": true,
"@Core.LongDescription": "The qualified action names identify actions for maintaining nodes in the recursive hierarchy,\n which are specific for the given annotation qualifier.\n These binding parameter of the actions MUST be the entity type on which the recursive hierarchy is defined.\n The resource path of the binding parameter MUST traverse the hierarchy collection,\n including any hierarchy directory.",
"@Core.LongDescription": "The qualified action names identify actions for maintaining nodes in the recursive hierarchy,\nwhich are specific for the given annotation qualifier.\nThese binding parameter of the actions MUST be the entity type on which the recursive hierarchy is defined.\nThe resource path of the binding parameter MUST traverse the hierarchy collection,\nincluding any hierarchy directory. If the resource path contains a Content ID reference to an earlier request,\nthe hierarchy directory MUST be determined from the resource path of that request.\n```json\n{\"requests\": [{\n \"id\": \"1\",\n \"method\": \"post\",\n \"url\": \"HierarchyDirectory(1)/Nodes('A')/Children\",\n \"body\": {\n \"Name\": \"child of A\"\n }\n}, {\n \"id\": \"2\",\n \"dependsOn\": [\"1\"],\n \"method\": \"post\",\n \"url\": \"$1/Hierarchy.ChangeNextSibling\",\n \"body\": {\n \"NextSibling\": null\n }\n}]}\n```",
"ChangeNextSiblingAction": {
"$Type": "Common.QualifiedName",
"$Nullable": true,
Expand Down
71 changes: 45 additions & 26 deletions vocabularies/Hierarchy.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ Term|Type|Description
:---|:---|:----------
[RecursiveHierarchy](./Hierarchy.xml#L41:~:text=<Term%20Name="-,RecursiveHierarchy,-") *([Experimental](Common.md#Experimental))*|[RecursiveHierarchyType](#RecursiveHierarchyType)|<a name="RecursiveHierarchy"></a>Hierarchy-specific information in the result set of a hierarchical request<br>The [base term](https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Aggregation.V1.html#RecursiveHierarchy) governs what are the nodes and parents in the hierarchy, whereas this term defines derived information.
[RecursiveHierarchyActions](./Hierarchy.xml#L154:~:text=<Term%20Name="-,RecursiveHierarchyActions,-") *([Experimental](Common.md#Experimental))*|[RecursiveHierarchyActionsType](#RecursiveHierarchyActionsType)|<a name="RecursiveHierarchyActions"></a>Actions for maintaining the recursive hierarchy defined by the [base term](https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Aggregation.V1.html#RecursiveHierarchy)<br>When an annotation with this term is present, the [`ParentNavigationProperty`](https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Aggregation.V1.html#RecursiveHierarchyType) in the base term must not have a collection-valued segment prior to its last segment.
[MatchCount](./Hierarchy.xml#L184:~:text=<Term%20Name="-,MatchCount,-") *([Experimental](Common.md#Experimental))*|Int64|<a name="MatchCount"></a>Instance annotation on the result of an `$apply` query option containing the number of matching nodes after hierarchical transformations<br>The service MAY designate a subset of the `$apply` result as "matching nodes". For requests following the pattern described [here](#RecursiveHierarchyType), this subset is the output set of the `filter` or `search` transformation that occurs as the fourth parameter of the last `ancestors` transformation or occurs nested into it.<br> For requests not following this pattern, the subset NEED NOT be defined.<br> This instance annotation is available if [`RecursiveHierarchy/Matched`](#RecursiveHierarchyType) and [`RecursiveHierarchy/MatchedDescendantCount`](#RecursiveHierarchyType) are also available.
[RecursiveHierarchySupported](./Hierarchy.xml#L266:~:text=<Term%20Name="-,RecursiveHierarchySupported,-") *([Experimental](Common.md#Experimental))*|[Tag](https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Core.V1.md#Tag)|<a name="RecursiveHierarchySupported"></a>Whether the annotated collection acts as a [`RecursiveHierarchy`](#RecursiveHierarchy) with the given qualifier<br>This tag is applied to a collection with the same qualifier as the [`RecursiveHierarchy`](#RecursiveHierarchy) term which is applied to its entity type. The recursive hierarchy can then only be addressed through a collection where this tag is true.
[MatchCount](./Hierarchy.xml#L203:~:text=<Term%20Name="-,MatchCount,-") *([Experimental](Common.md#Experimental))*|Int64|<a name="MatchCount"></a>Instance annotation on the result of an `$apply` query option containing the number of matching nodes after hierarchical transformations<br>The service MAY designate a subset of the `$apply` result as "matching nodes". For requests following the pattern described [here](#RecursiveHierarchyType), this subset is the output set of the `filter` or `search` transformation that occurs as the fourth parameter of the last `ancestors` transformation or occurs nested into it.<br> For requests not following this pattern, the subset NEED NOT be defined.<br> This instance annotation is available if [`RecursiveHierarchy/Matched`](#RecursiveHierarchyType) and [`RecursiveHierarchy/MatchedDescendantCount`](#RecursiveHierarchyType) are also available.
[RecursiveHierarchySupported](./Hierarchy.xml#L285:~:text=<Term%20Name="-,RecursiveHierarchySupported,-") *([Experimental](Common.md#Experimental))*|[Tag](https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Core.V1.md#Tag)|<a name="RecursiveHierarchySupported"></a>Whether the annotated collection acts as a [`RecursiveHierarchy`](#RecursiveHierarchy) with the given qualifier<br>This tag is applied to a collection with the same qualifier as the [`RecursiveHierarchy`](#RecursiveHierarchy) term which is applied to its entity type. The recursive hierarchy can then only be addressed through a collection where this tag is true.


## Actions

<a name="ChangeNextSibling"></a>
### [ChangeNextSibling](./Hierarchy.xml#L276:~:text=<Action%20Name="-,ChangeNextSibling,-") *([Experimental](Common.md#Experimental))*
### [ChangeNextSibling](./Hierarchy.xml#L295:~:text=<Action%20Name="-,ChangeNextSibling,-") *([Experimental](Common.md#Experimental))*

Move a node among its siblings

Parameter|Type|Description
:--------|:---|:----------
**[Node](./Hierarchy.xml#L280:~:text=<Action%20Name="-,ChangeNextSibling,-")**|EntityType|**Binding parameter:** The node T to be moved
[NextSibling](./Hierarchy.xml#L283:~:text=<Action%20Name="-,ChangeNextSibling,-")|ComplexType?|Key of the node's new next sibling S (null if the node shall become the last sibling)<br>This parameter has properties with the same names as the key properties of the entity type. next(T) = S after the action. If R is a node with next(R) = S before the action, then next(R) = T after the action, even if S = null. It is an error if S has a different parent than T.
**[Node](./Hierarchy.xml#L299:~:text=<Action%20Name="-,ChangeNextSibling,-")**|EntityType|**Binding parameter:** The node T to be moved
[NextSibling](./Hierarchy.xml#L302:~:text=<Action%20Name="-,ChangeNextSibling,-")|ComplexType?|Key of the node's new next sibling S (null if the node shall become the last sibling)<br>This parameter has properties with the same names as the key properties of the entity type. next(T) = S after the action. If R is a node with next(R) = S before the action, then next(R) = T after the action, even if S = null. It is an error if S has a different parent than T.


<a name="CopyNode"></a>
### [CopyNode](./Hierarchy.xml#L312:~:text=<Action%20Name="-,CopyNode,-") *([Experimental](Common.md#Experimental))*
### [CopyNode](./Hierarchy.xml#L331:~:text=<Action%20Name="-,CopyNode,-") *([Experimental](Common.md#Experimental))*

Copy a node and its descendants

Expand All @@ -52,15 +52,15 @@ by a PATCH that binds the parent navigation property (for example, `Superordinat

Parameter|Type|Description
:--------|:---|:----------
**[Node](./Hierarchy.xml#L335:~:text=<Action%20Name="-,CopyNode,-")**|EntityType|**Binding parameter:** The node to be copied
[&rarr;](./Hierarchy.xml#L338:~:text=<Action%20Name="-,CopyNode,-")|EntityType|The copied node
**[Node](./Hierarchy.xml#L354:~:text=<Action%20Name="-,CopyNode,-")**|EntityType|**Binding parameter:** The node to be copied
[&rarr;](./Hierarchy.xml#L357:~:text=<Action%20Name="-,CopyNode,-")|EntityType|The copied node



## Functions

<a name="TopLevels"></a>
### [TopLevels](./Hierarchy.xml#L212:~:text=<Function%20Name="-,TopLevels,-") *([Experimental](Common.md#Experimental))*
### [TopLevels](./Hierarchy.xml#L231:~:text=<Function%20Name="-,TopLevels,-") *([Experimental](Common.md#Experimental))*

Returns the first n levels of a hierarchical collection in preorder with individual nodes expanded or collapsed

Expand All @@ -76,14 +76,14 @@ This function can be used as a transformation whose input set has a recursive hi

Parameter|Type|Description
:--------|:---|:----------
**[InputSet](./Hierarchy.xml#L226:~:text=<Function%20Name="-,TopLevels,-")**|\[EntityType\]|**Binding parameter**
[HierarchyNodes](./Hierarchy.xml#L227:~:text=<Function%20Name="-,TopLevels,-")|\[EntityType\]|A collection, given through a `$root` expression
[HierarchyQualifier](./Hierarchy.xml#L230:~:text=<Function%20Name="-,TopLevels,-")|[HierarchyQualifier](https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Aggregation.V1.md#HierarchyQualifier)|
[NodeProperty](./Hierarchy.xml#L231:~:text=<Function%20Name="-,TopLevels,-")|String|Property path to the node identifier, evaluated relative to the binding parameter
*[Levels](./Hierarchy.xml#L234:~:text=<Function%20Name="-,TopLevels,-")*|Int64|*Optional parameter:* The number n of levels to be output, absent means all levels
*[Show](./Hierarchy.xml#L241:~:text=<Function%20Name="-,TopLevels,-")*|\[String\]|*Optional parameter:* Identifiers of nodes to be shown
*[ExpandLevels](./Hierarchy.xml#L247:~:text=<Function%20Name="-,TopLevels,-")*|\[[TopLevelsExpandType](#TopLevelsExpandType)\]|*Optional parameter:* Nodes to be expanded
[&rarr;](./Hierarchy.xml#L253:~:text=<Function%20Name="-,TopLevels,-")|\[EntityType\]|
**[InputSet](./Hierarchy.xml#L245:~:text=<Function%20Name="-,TopLevels,-")**|\[EntityType\]|**Binding parameter**
[HierarchyNodes](./Hierarchy.xml#L246:~:text=<Function%20Name="-,TopLevels,-")|\[EntityType\]|A collection, given through a `$root` expression
[HierarchyQualifier](./Hierarchy.xml#L249:~:text=<Function%20Name="-,TopLevels,-")|[HierarchyQualifier](https://github.com/oasis-tcs/odata-vocabularies/blob/main/vocabularies/Org.OData.Aggregation.V1.md#HierarchyQualifier)|
[NodeProperty](./Hierarchy.xml#L250:~:text=<Function%20Name="-,TopLevels,-")|String|Property path to the node identifier, evaluated relative to the binding parameter
*[Levels](./Hierarchy.xml#L253:~:text=<Function%20Name="-,TopLevels,-")*|Int64|*Optional parameter:* The number n of levels to be output, absent means all levels
*[Show](./Hierarchy.xml#L260:~:text=<Function%20Name="-,TopLevels,-")*|\[String\]|*Optional parameter:* Identifiers of nodes to be shown
*[ExpandLevels](./Hierarchy.xml#L266:~:text=<Function%20Name="-,TopLevels,-")*|\[[TopLevelsExpandType](#TopLevelsExpandType)\]|*Optional parameter:* Nodes to be expanded
[&rarr;](./Hierarchy.xml#L272:~:text=<Function%20Name="-,TopLevels,-")|\[EntityType\]|


<a name="RecursiveHierarchyType"></a>
Expand Down Expand Up @@ -143,21 +143,40 @@ Property|Type|Description


The qualified action names identify actions for maintaining nodes in the recursive hierarchy,
which are specific for the given annotation qualifier.
These binding parameter of the actions MUST be the entity type on which the recursive hierarchy is defined.
The resource path of the binding parameter MUST traverse the hierarchy collection,
including any hierarchy directory.
which are specific for the given annotation qualifier.
These binding parameter of the actions MUST be the entity type on which the recursive hierarchy is defined.
The resource path of the binding parameter MUST traverse the hierarchy collection,
including any hierarchy directory. If the resource path contains a Content ID reference to an earlier request,
the hierarchy directory MUST be determined from the resource path of that request.
```json
{"requests": [{
"id": "1",
"method": "post",
"url": "HierarchyDirectory(1)/Nodes('A')/Children",
"body": {
"Name": "child of A"
}
}, {
"id": "2",
"dependsOn": ["1"],
"method": "post",
"url": "$1/Hierarchy.ChangeNextSibling",
"body": {
"NextSibling": null
}
}]}
```

Property|Type|Description
:-------|:---|:----------
[ChangeNextSiblingAction](./Hierarchy.xml#L171:~:text=<ComplexType%20Name="-,RecursiveHierarchyActionsType,-")|[QualifiedName?](Common.md#QualifiedName)|
[CopyAction](./Hierarchy.xml#L179:~:text=<ComplexType%20Name="-,RecursiveHierarchyActionsType,-")|[QualifiedName?](Common.md#QualifiedName)|
[ChangeNextSiblingAction](./Hierarchy.xml#L190:~:text=<ComplexType%20Name="-,RecursiveHierarchyActionsType,-")|[QualifiedName?](Common.md#QualifiedName)|
[CopyAction](./Hierarchy.xml#L198:~:text=<ComplexType%20Name="-,RecursiveHierarchyActionsType,-")|[QualifiedName?](Common.md#QualifiedName)|

<a name="TopLevelsExpandType"></a>
## [TopLevelsExpandType](./Hierarchy.xml#L255:~:text=<ComplexType%20Name="-,TopLevelsExpandType,-") *([Experimental](Common.md#Experimental))*
## [TopLevelsExpandType](./Hierarchy.xml#L274:~:text=<ComplexType%20Name="-,TopLevelsExpandType,-") *([Experimental](Common.md#Experimental))*
Information about nodes to be expanded

Property|Type|Description
:-------|:---|:----------
[NodeID](./Hierarchy.xml#L258:~:text=<ComplexType%20Name="-,TopLevelsExpandType,-")|String|Identifier of a node to be expanded
[Levels](./Hierarchy.xml#L261:~:text=<ComplexType%20Name="-,TopLevelsExpandType,-")|Int64?|Number of levels to be expanded, null means all levels, 0 means collapsed
[NodeID](./Hierarchy.xml#L277:~:text=<ComplexType%20Name="-,TopLevelsExpandType,-")|String|Identifier of a node to be expanded
[Levels](./Hierarchy.xml#L280:~:text=<ComplexType%20Name="-,TopLevelsExpandType,-")|Int64?|Number of levels to be expanded, null means all levels, 0 means collapsed
27 changes: 23 additions & 4 deletions vocabularies/Hierarchy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,29 @@ the following collections of hierarchy nodes are distinguished:
<Annotation Term="Common.Experimental" />
<Annotation Term="Core.LongDescription">
<String>The qualified action names identify actions for maintaining nodes in the recursive hierarchy,
which are specific for the given annotation qualifier.
These binding parameter of the actions MUST be the entity type on which the recursive hierarchy is defined.
The resource path of the binding parameter MUST traverse the hierarchy collection,
including any hierarchy directory.</String>
which are specific for the given annotation qualifier.
These binding parameter of the actions MUST be the entity type on which the recursive hierarchy is defined.
The resource path of the binding parameter MUST traverse the hierarchy collection,
including any hierarchy directory. If the resource path contains a Content ID reference to an earlier request,
the hierarchy directory MUST be determined from the resource path of that request.
```json
{"requests": [{
"id": "1",
"method": "post",
"url": "HierarchyDirectory(1)/Nodes('A')/Children",
"body": {
"Name": "child of A"
}
}, {
"id": "2",
"dependsOn": ["1"],
"method": "post",
"url": "$1/Hierarchy.ChangeNextSibling",
"body": {
"NextSibling": null
}
}]}
```</String>
</Annotation>
<Property Name="ChangeNextSiblingAction" Type="Common.QualifiedName" Nullable="true">
<Annotation Term="Core.ImplementsSignature" String="Hierarchy.ChangeNextSibling" />
Expand Down

0 comments on commit 2ae6745

Please sign in to comment.