Skip to content

Commit 212c476

Browse files
committed
odata-dd-5 work on step 1
1 parent fdea272 commit 212c476

2 files changed

Lines changed: 68 additions & 2 deletions

File tree

231 KB
Loading

tutorials/odata-dd-5-annotations/odata-dd-5-annotations.md

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,72 @@ The members of the OData Technical Committee have worked hard on OData as a robu
2424

2525
---
2626

27-
### Step 1
27+
### Examine the rest of the entity model wrapper
2828

29-
...
29+
In the previous [Metadata](https://developers.sap.com/tutorials/odata-dd-4-metadata.html) tutorial we saw how the schema was presented within a context. That context is called the [entity model wrapper](https://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part3-csdl/odata-v4.0-errata03-os-part3-csdl-complete.html#_Toc453752500). We left the examination of part of that wrapper - the references to vocabularies, to this tutorial. Let's start by digging into those now.
30+
31+
Here's what the relevant section of the wrapper looks like (with a little bit of whitespace to help readability):
32+
33+
```xml
34+
<?xml version="1.0" encoding="utf-8"?>
35+
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
36+
<edmx:Reference
37+
Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Capabilities.V1.xml">
38+
<edmx:Include Alias="Capabilities" Namespace="Org.OData.Capabilities.V1"/>
39+
</edmx:Reference>
40+
<edmx:Reference
41+
Uri="https://sap.github.io/odata-vocabularies/vocabularies/Common.xml">
42+
<edmx:Include Alias="Common" Namespace="com.sap.vocabularies.Common.v1"/>
43+
</edmx:Reference>
44+
<edmx:Reference
45+
Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml">
46+
<edmx:Include Alias="Core" Namespace="Org.OData.Core.V1"/>
47+
</edmx:Reference>
48+
...
49+
</edmx:Edmx>
50+
```
51+
52+
What are these references? Well, section [3.3 Element edmx:Reference](https://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part3-csdl/odata-v4.0-errata03-os-part3-csdl-complete.html#_Toc453752504) of the CSDL standards document is helpful here (after section [3.1 Element edmx:Edmx](https://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part3-csdl/odata-v4.0-errata03-os-part3-csdl-complete.html#_Toc453752504) tells us that there can be zero or more of them).
53+
54+
Basically, `edmx:Reference` elements point to external CSDL documents, specific content from which (indicated by the `edmx:Include` elements within) is then added to the overall scope of the referring (OData metadata) document. Think of it like an "include" as found in various programming languages.
55+
56+
Note that each of the referenced external documents in our OData metadata document are resources in GitHub repositories:
57+
58+
- two belonging to OASIS in <https://oasis-tcs.github.io/odata-vocabularies/>
59+
- one belongint to SAP in <https://sap.github.io/odata-vocabularies/>
60+
61+
Taking the first of the three `<edmx:Reference>` elements here, we see that:
62+
63+
- the reference points to an [XML representation](https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Capabilities.V1.xml) of a CSDL document "Org.OData.Capabilities.V1"
64+
- moving one level up from the document resource's location, there is an [overview page](https://oasis-tcs.github.io/odata-vocabularies/vocabularies/) listing each of the OASIS Technical Committee vocabularies (including this "Capabilities" one), and for each of these resources there are HTML, XML and JSON representations
65+
- the HTML representation is especially useful for us as it describes the vocabulary's purpose in general, and gives details for each of the terms and types contained within it
66+
67+
![OASIS OData TC - Vocabularies](oasis-vocabularies-toc.png)
68+
69+
If we look at the XML representation in CSDL (i.e. EDMX) form, we see this:
70+
71+
```xml
72+
<?xml version="1.0" encoding="utf-8"?>
73+
...
74+
75+
Abstract:
76+
This document contains terms describing capabilities of an OData service.
77+
78+
-->
79+
<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
80+
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Authorization.V1.xml">
81+
<edmx:Include Alias="Authorization" Namespace="Org.OData.Authorization.V1" />
82+
</edmx:Reference>
83+
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml">
84+
<edmx:Include Alias="Core" Namespace="Org.OData.Core.V1" />
85+
</edmx:Reference>
86+
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Validation.V1.xml">
87+
<edmx:Include Alias="Validation" Namespace="Org.OData.Validation.V1" />
88+
</edmx:Reference>
89+
<edmx:DataServices>
90+
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Org.OData.Capabilities.V1" Alias="Capabilities">
91+
...
92+
</Schema>
93+
</edmx:DataServices>
94+
</edmx:Edmx>
95+
```

0 commit comments

Comments
 (0)