Skip to content

Commit

Permalink
example with duration
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoTheissen committed Sep 5, 2024
1 parent 0399fb4 commit a1dbba3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 25 deletions.
8 changes: 4 additions & 4 deletions docs/odata-csdl-json/odata-csdl-json.html
Original file line number Diff line number Diff line change
Expand Up @@ -2763,7 +2763,7 @@ <h3 id="1422-target"><a name="Target" href="#Target">14.2.2 Target</a></h3>
<h2 id="143-constant-expression"><a name="ConstantExpression" href="#ConstantExpression">14.3 Constant Expression</a></h2>
</summary>
<p>Constant expressions allow assigning a constant value to an applied term.</p>
<p>Primitive values of various types are represented as strings, therefore their type cannot be inferred from the constant expression alone. If such an ambiguous constant expression is an operand of a larger expression, clients MUST assume that the operand has the type demanded by the larger expression, for example, in a client-side function or in a comparison with another operand of known type. (In the <code>$Has</code> comparison in <a href="#disambiguate">example 75</a> <code>Fabric</code> has an enumeration type, therefore the constant expression <code>"Blue"</code> is an enumeration member, not a string or a binary value.)</p>
<p>Primitive values of various types are represented as strings, therefore their type cannot be inferred from the constant expression alone. If such an ambiguous constant expression is an operand of a larger expression, clients MUST assume that the operand has the type demanded by the larger expression, for example, in a client-side function or in a comparison with another operand of known type. (In the <code>$Le</code> comparison in <a href="#disambiguate">example 75</a> <code>Duration</code> is of type <code>Edm.Duration</code>, therefore the constant expression <code>"PT1H"</code> is a duration, not a string.)</p>
<details open><summary>
<h3 id="1431-binary"><a name="Binary" href="#Binary">14.3.1 Binary</a></h3>
</summary>
Expand Down Expand Up @@ -3300,17 +3300,17 @@ <h3 id="eq-ne-gt-ge-lt-le-has-and-in"><a name="Eq.21.5" href="#Eq.21.5"><code>$E
<span id="cb83-66"><a href="#cb83-66" aria-hidden="true" tabindex="-1"></a><span class="fu">{</span></span>
<span id="cb83-67"><a href="#cb83-67" aria-hidden="true" tabindex="-1"></a> <span class="dt">&quot;$Le&quot;</span><span class="fu">:</span> <span class="ot">[</span></span>
<span id="cb83-68"><a href="#cb83-68" aria-hidden="true" tabindex="-1"></a> <span class="fu">{</span></span>
<span id="cb83-69"><a href="#cb83-69" aria-hidden="true" tabindex="-1"></a> <span class="dt">&quot;$Path&quot;</span><span class="fu">:</span> <span class="st">&quot;Price&quot;</span></span>
<span id="cb83-69"><a href="#cb83-69" aria-hidden="true" tabindex="-1"></a> <span class="dt">&quot;$Path&quot;</span><span class="fu">:</span> <span class="st">&quot;Duration&quot;</span></span>
<span id="cb83-70"><a href="#cb83-70" aria-hidden="true" tabindex="-1"></a> <span class="fu">}</span><span class="ot">,</span></span>
<span id="cb83-71"><a href="#cb83-71" aria-hidden="true" tabindex="-1"></a> <span class="dv">100</span></span>
<span id="cb83-71"><a href="#cb83-71" aria-hidden="true" tabindex="-1"></a> <span class="st">&quot;PT1H&quot;</span></span>
<span id="cb83-72"><a href="#cb83-72" aria-hidden="true" tabindex="-1"></a> <span class="ot">]</span></span>
<span id="cb83-73"><a href="#cb83-73" aria-hidden="true" tabindex="-1"></a><span class="fu">}</span><span class="er">,</span></span>
<span id="cb83-74"><a href="#cb83-74" aria-hidden="true" tabindex="-1"></a><span class="fu">{</span></span>
<span id="cb83-75"><a href="#cb83-75" aria-hidden="true" tabindex="-1"></a> <span class="dt">&quot;$Has&quot;</span><span class="fu">:</span> <span class="ot">[</span></span>
<span id="cb83-76"><a href="#cb83-76" aria-hidden="true" tabindex="-1"></a> <span class="fu">{</span></span>
<span id="cb83-77"><a href="#cb83-77" aria-hidden="true" tabindex="-1"></a> <span class="dt">&quot;$Path&quot;</span><span class="fu">:</span> <span class="st">&quot;Fabric&quot;</span></span>
<span id="cb83-78"><a href="#cb83-78" aria-hidden="true" tabindex="-1"></a> <span class="fu">}</span><span class="ot">,</span></span>
<span id="cb83-79"><a href="#cb83-79" aria-hidden="true" tabindex="-1"></a> <span class="st">&quot;Blue&quot;</span></span>
<span id="cb83-79"><a href="#cb83-79" aria-hidden="true" tabindex="-1"></a> <span class="st">&quot;Red&quot;</span></span>
<span id="cb83-80"><a href="#cb83-80" aria-hidden="true" tabindex="-1"></a> <span class="ot">]</span></span>
<span id="cb83-81"><a href="#cb83-81" aria-hidden="true" tabindex="-1"></a><span class="fu">}</span><span class="er">,</span></span>
<span id="cb83-82"><a href="#cb83-82" aria-hidden="true" tabindex="-1"></a><span class="fu">{</span></span>
Expand Down
11 changes: 5 additions & 6 deletions docs/odata-csdl-json/odata-csdl-json.md
Original file line number Diff line number Diff line change
Expand Up @@ -3933,9 +3933,8 @@ cannot be inferred from the constant expression alone. If such
an ambiguous constant expression is an operand of a larger expression, clients MUST assume
that the operand has the type demanded by the larger expression, for example, in a
client-side function or in a comparison with another operand of known type.
(In the `$Has` comparison in [example 75](#disambiguate) `Fabric` has an enumeration type,
therefore the constant expression `"Blue"` is an
enumeration member, not a string or a binary value.)
(In the `$Le` comparison in [example 75](#disambiguate) `Duration` is of type
`Edm.Duration`, therefore the constant expression `"PT1H"` is a duration, not a string.)

### <a name="Binary" href="#Binary">14.3.1 Binary</a>

Expand Down Expand Up @@ -4858,17 +4857,17 @@ Example <a name="disambiguate" href="#disambiguate">75</a>:
{
"$Le": [
{
"$Path": "Price"
"$Path": "Duration"
},
100
"PT1H"
]
},
{
"$Has": [
{
"$Path": "Fabric"
},
"Blue"
"Red"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions docs/odata-csdl-xml/odata-csdl-xml.html
Original file line number Diff line number Diff line change
Expand Up @@ -3159,12 +3159,12 @@ <h3 id="expressions-edmeq-edmne-edmgt-edmge-edmlt-edmle-edmhas-and-edmin"><a nam
<span id="cb80-30"><a href="#cb80-30" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">Int</span>&gt;20&lt;/<span class="kw">Int</span>&gt;</span>
<span id="cb80-31"><a href="#cb80-31" aria-hidden="true" tabindex="-1"></a>&lt;/<span class="kw">Lt</span>&gt;</span>
<span id="cb80-32"><a href="#cb80-32" aria-hidden="true" tabindex="-1"></a>&lt;<span class="kw">Le</span>&gt;</span>
<span id="cb80-33"><a href="#cb80-33" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">Path</span>&gt;Price&lt;/<span class="kw">Path</span>&gt;</span>
<span id="cb80-34"><a href="#cb80-34" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">Int</span>&gt;100&lt;/<span class="kw">Int</span>&gt;</span>
<span id="cb80-33"><a href="#cb80-33" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">Path</span>&gt;Duration&lt;/<span class="kw">Path</span>&gt;</span>
<span id="cb80-34"><a href="#cb80-34" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">Duration</span>&gt;PT1H&lt;/<span class="kw">Duration</span>&gt;</span>
<span id="cb80-35"><a href="#cb80-35" aria-hidden="true" tabindex="-1"></a>&lt;/<span class="kw">Le</span>&gt;</span>
<span id="cb80-36"><a href="#cb80-36" aria-hidden="true" tabindex="-1"></a>&lt;<span class="kw">Has</span>&gt;</span>
<span id="cb80-37"><a href="#cb80-37" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">Path</span>&gt;Fabric&lt;/<span class="kw">Path</span>&gt;</span>
<span id="cb80-38"><a href="#cb80-38" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">EnumMember</span>&gt;org.example.Pattern/Blue&lt;/<span class="kw">EnumMember</span>&gt;</span>
<span id="cb80-38"><a href="#cb80-38" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">EnumMember</span>&gt;org.example.Pattern/Red&lt;/<span class="kw">EnumMember</span>&gt;</span>
<span id="cb80-39"><a href="#cb80-39" aria-hidden="true" tabindex="-1"></a>&lt;/<span class="kw">Has</span>&gt;</span>
<span id="cb80-40"><a href="#cb80-40" aria-hidden="true" tabindex="-1"></a>&lt;<span class="kw">In</span>&gt;</span>
<span id="cb80-41"><a href="#cb80-41" aria-hidden="true" tabindex="-1"></a> &lt;<span class="kw">Path</span>&gt;Size&lt;/<span class="kw">Path</span>&gt;</span>
Expand Down
6 changes: 3 additions & 3 deletions docs/odata-csdl-xml/odata-csdl-xml.md
Original file line number Diff line number Diff line change
Expand Up @@ -4758,12 +4758,12 @@ Example 75:
<Int>20</Int>
</Lt>
<Le>
<Path>Price</Path>
<Int>100</Int>
<Path>Duration</Path>
<Duration>PT1H</Duration>
</Le>
<Has>
<Path>Fabric</Path>
<EnumMember>org.example.Pattern/Blue</EnumMember>
<EnumMember>org.example.Pattern/Red</EnumMember>
</Has>
<In>
<Path>Size</Path>
Expand Down
17 changes: 8 additions & 9 deletions odata-csdl/14 Vocabulary and Annotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,8 @@ cannot be inferred from the constant expression alone. If such
an ambiguous constant expression is an operand of a larger expression, clients MUST assume
that the operand has the type demanded by the larger expression, for example, in a
client-side function or in a comparison with another operand of known type.
(In the `$Has` comparison in [example ##disambiguate] `Fabric` has an enumeration type,
therefore the constant expression `"Blue"` is an
enumeration member, not a string or a binary value.)
(In the `$Le` comparison in [example ##disambiguate] `Duration` is of type
`Edm.Duration`, therefore the constant expression `"PT1H"` is a duration, not a string.)
:

### ##subsubsec Binary
Expand Down Expand Up @@ -2093,17 +2092,17 @@ Example ##ex_disambiguate:
{
"$Le": [
{
"$Path": "Price"
"$Path": "Duration"
},
100
"PT1H"
]
},
{
"$Has": [
{
"$Path": "Fabric"
},
"Blue"
"Red"
]
},
{
Expand Down Expand Up @@ -2186,12 +2185,12 @@ Example ##ex:
<Int>20</Int>
</Lt>
<Le>
<Path>Price</Path>
<Int>100</Int>
<Path>Duration</Path>
<Duration>PT1H</Duration>
</Le>
<Has>
<Path>Fabric</Path>
<EnumMember>org.example.Pattern/Blue</EnumMember>
<EnumMember>org.example.Pattern/Red</EnumMember>
</Has>
<In>
<Path>Size</Path>
Expand Down

0 comments on commit a1dbba3

Please sign in to comment.