You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/odata-dd-5-annotations/odata-dd-5-annotations.md
+28-4Lines changed: 28 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ The members of the OData Technical Committee have worked hard on OData as a robu
28
28
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
30
31
-
Here's what the relevant section of the wrapper looks like (with a little bit of whitespace to help readability):
31
+
Here's what the relevant section of the wrapper in [the Northbreeze OData service's metadata document](https://odd.cfapps.eu10.hana.ondemand.com/northbreeze/$metadata) looks like:
32
32
33
33
```xml
34
34
<?xml version="1.0" encoding="utf-8"?>
@@ -49,9 +49,17 @@ Here's what the relevant section of the wrapper looks like (with a little bit of
49
49
</edmx:Edmx>
50
50
```
51
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).
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 within an `<edmx:Edmx>` element).
53
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.
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.
55
+
56
+
Think of it like an "include" or "import" as found in various programming languages; these references might look like this in JavaScript, for example:
57
+
58
+
```javascript
59
+
import { "Org.OData.Capabilities.V1" as "Capabilities" } from"https://oasis-tcs.github.io/.../Org.OData.Capabilities.V1.xml";
60
+
import { "com.sap.vocabularies.Common.v1" as "Common" } from"https://sap.github.io/.../Common.xml";
61
+
import { "Org.OData.Core.V1" as "Core" } from"https://oasis-tcs.github.io/.../Org.OData.Core.V1.xml";
62
+
```
55
63
56
64
Note that each of the referenced external documents in our OData metadata document are resources in GitHub repositories:
57
65
@@ -66,7 +74,7 @@ Taking the first of the three `<edmx:Reference>` elements here, we see that:
It just so happens that in this referenced CSDL document, there _is_ only one schema, but there could be more. So an `<edmx:Include>` element forms an important part of the `<edmx:Reference>` (indeed, [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) states that at least one `<edmx:Include>` or `<edmx:IncludeAnnotation>` is mandatory) and serves to identify a particular schema to be included, from the referenced vocabulary. The `<edmx:Include>` element does one more thing here - it specifies a short name, in the form of a value for an `Alias` attribute, which can be used to refer to that imported vocabulary schema. Just like the `as` aliasing in our imaginary JavaScript equivalent example earlier.
0 commit comments