Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar weeks are locale-dependent #155

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/Common.Timezone-sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
"timezone.sample": {
"WorkerTimeSheet": {
"$Kind": "EntityType",
"WorkingWeek": {
"$Nullable": true,
"@Common.IsCalendarYearWeek": true,
"@Common.Locale": "de-DE"
},
"ClockInDateTime": {
"$Type": "Edm.DateTimeOffset",
"$Nullable": true,
Expand Down
6 changes: 5 additions & 1 deletion examples/Common.Timezone-sample.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
<edmx:DataServices>
<Schema Namespace="timezone.sample" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<EntityType Name="WorkerTimeSheet">
<Property Name="WorkingWeek" Type="Edm.String">
<Annotation Term="Common.IsCalendarYearWeek"/>
<Annotation Term="Common.Locale" String="de-DE"/>
</Property>
<Property Name="ClockInDateTime" Type="Edm.DateTimeOffset">
<Annotation Term="Common.Timezone" Path="ClockInTimezone"/>
</Property>
<Property Name="ClockInTimezone" Type="Edm.String"/>
</EntityType>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
</edmx:Edmx>
20 changes: 12 additions & 8 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Annotation Examples
# Examples

Annotation examples are authored in XML and automatically translated to JSON.
## [Composition](Common.Composition-sample.xml)

Example file names should start with the alias-qualified term name, followed by a dash, an optional "qualifier" for the example file, and end with `examples.xml`, e.g.
This example shows how to declare a composition relationship between entity types of a business object.

- `Common.SideEffects-examples.xml`
- `Common.SideEffects-really.tricky.examples.xml`
## [SAP Object Node Type](Common.SAPObjectNodeType-sample.xml)

Each example file can contain one or more examples.
This example shows how to declare SAP Object Node Types.

Examples should be documented with `Core.Description`.
## [Temporal properties](Common.Timezone-sample.xml)

You can use the copy template `_vocab.Term-examples.xml` as a quickstart.
This example shows annotations of temporal properties: calendar weeks and timestamps.

## [Dynamic properties](DynamicProperties-sample.xml)

This example shows how dynamic properties that result from data aggregation can be handled in analogy with
structural properties.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 32 additions & 13 deletions vocabularies/Common.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,20 +151,34 @@
"$Nullable": true,
"$AppliesTo": [
"Property",
"Parameter"
"Parameter",
"ReturnType"
],
"@Common.Experimental": true,
"@Core.Description": "The point in time represented by the annotated property or parameter shall be interpreted in the given time zone",
"@Core.LongDescription": "Time zones shall be specified according to the [IANA](https://www.iana.org/time-zones) standard.\n If this annotation is absent or null, points in time are typically interpreted in the current user's or default time zone.",
"@Core.Description": "The point in time represented by the annotated property, parameter or return type must be interpreted in the given time zone",
"@Core.LongDescription": "Time zones must be specified according to the [IANA](https://www.iana.org/time-zones) standard.\n If this annotation is absent or null, points in time are typically interpreted in the current user's or default time zone.",
"@Core.RequiresType": "Edm.DateTimeOffset"
},
"Locale": {
"$Kind": "Term",
"$Nullable": true,
"$AppliesTo": [
"Property",
"Parameter",
"ReturnType"
],
"@Common.Experimental": true,
"@Core.Description": "The value of the annotated property, parameter or return type must be interpreted in the given locale",
"@Core.LongDescription": "Locales must be specified through a [Unicode Locale Identifier](https://www.unicode.org/reports/tr35/tr35.html#Identifiers).\n If this annotation is absent or null, the current user's or default locale is used.\n An example for the applicability of this annotation are calendar weeks, whose meaning is locale-dependent."
},
"IsDigitSequence": {
"$Kind": "Term",
"$Type": "Core.Tag",
"$DefaultValue": true,
"$AppliesTo": [
"Property",
"Parameter"
"Parameter",
"ReturnType"
],
"@Core.Description": "Contains only digits",
"@Core.RequiresType": "Edm.String"
Expand All @@ -175,7 +189,8 @@
"$DefaultValue": true,
"$AppliesTo": [
"Property",
"Parameter"
"Parameter",
"ReturnType"
],
"@Core.Description": "Contains just uppercase characters",
"@Core.RequiresType": "Edm.String"
Expand All @@ -186,7 +201,8 @@
"$DefaultValue": true,
"$AppliesTo": [
"Property",
"Parameter"
"Parameter",
"ReturnType"
],
"@Core.Description": "Annotated property or parameter is a currency code"
},
Expand All @@ -196,7 +212,8 @@
"$DefaultValue": true,
"$AppliesTo": [
"Property",
"Parameter"
"Parameter",
"ReturnType"
],
"@Core.Description": "Annotated property or parameter is a unit of measure"
},
Expand Down Expand Up @@ -242,7 +259,8 @@
"Property",
"EntitySet",
"Term",
"Parameter"
"Parameter",
"ReturnType"
],
"@Core.Description": "The annotated set or collection contains at least this number of items"
},
Expand All @@ -254,7 +272,8 @@
"Property",
"EntitySet",
"Term",
"Parameter"
"Parameter",
"ReturnType"
],
"@Core.Description": "The annotated set or collection contains at most this number of items"
},
Expand Down Expand Up @@ -994,7 +1013,7 @@
"$AppliesTo": [
"Property"
],
"@Core.Description": "Property encodes a calendar week number as string following the logical pattern WW consisting of two digits.\n The string matches the regex pattern 0[1-9]|[1-4][0-9]|5[0-3]\n ",
"@Core.Description": "Property encodes a calendar week number as string following the logical pattern WW consisting of two digits.\n The string matches the regex pattern 0[1-9]|[1-4][0-9]|5[0-4]\n ",
"@Core.RequiresType": "Edm.String",
"@Common.MutuallyExclusiveTerm#DatePart": true
},
Expand Down Expand Up @@ -1060,7 +1079,7 @@
"$AppliesTo": [
"Property"
],
"@Core.Description": "Property encodes a calendar year and week as string following the logical pattern (-?)YYYY(Y*)WW consisting \n of an optional minus sign for years B.C. followed by at least six digits, where the last two digits represent week number in the year.\n The string matches the regex pattern -?([1-9][0-9]{3,}|0[0-9]{3})(0[1-9]|[1-4][0-9]|5[0-3]) \n ",
"@Core.Description": "Property encodes a calendar year and week as string following the logical pattern (-?)YYYY(Y*)WW consisting \n of an optional minus sign for years B.C. followed by at least six digits, where the last two digits represent week number in the year.\n The string matches the regex pattern -?([1-9][0-9]{3,}|0[0-9]{3})(0[1-9]|[1-4][0-9]|5[0-4]) \n ",
"@Core.RequiresType": "Edm.String",
"@Common.MutuallyExclusiveTerm#DatePart": true
},
Expand Down Expand Up @@ -1137,7 +1156,7 @@
"$AppliesTo": [
"Property"
],
"@Core.Description": "Property encodes a fiscal week number as string following the logical pattern WW consisting of two digits. \n The string matches the regex pattern 0[1-9]|[1-4][0-9]|5[0-3]",
"@Core.Description": "Property encodes a fiscal week number as string following the logical pattern WW consisting of two digits.",
"@Core.RequiresType": "Edm.String",
"@Common.MutuallyExclusiveTerm#DatePart": true
},
Expand All @@ -1148,7 +1167,7 @@
"$AppliesTo": [
"Property"
],
"@Core.Description": "Property encodes a fiscal year and week as string following the logical pattern YYYYWW consisting of \n six digits, where the last two digits represent the week number in the year. \n The string matches the regex pattern [1-9][0-9]{3}(0[1-9]|[1-4][0-9]|5[0-3])",
"@Core.Description": "Property encodes a fiscal year and week as string following the logical pattern YYYYWW consisting of \n six digits, where the last two digits represent the week number in the year.",
"@Core.RequiresType": "Edm.String",
"@Common.MutuallyExclusiveTerm#DatePart": true
},
Expand Down
Loading