diff --git a/_posts/2012-01-19-format-efficiency-take-2-really-clean-json.html b/_posts/2012-01-19-format-efficiency-take-2-really-clean-json.html index 4557e94..00ca771 100644 --- a/_posts/2012-01-19-format-efficiency-take-2-really-clean-json.html +++ b/_posts/2012-01-19-format-efficiency-take-2-really-clean-json.html @@ -112,25 +112,25 @@

Approach

Capturing control information as patterns

I mentioned patterns several times already. Let me make this more concrete. As we discussed before in the OData mailing list, we’re adding support for annotations to metadata using vocabularies. In order to support this JSON-based “light” format we introduce a vocabulary that captures how to derive all bits of control information from the regular object data. We’ll have the details of every pattern documented in the official spec, but here are a few to show what they look like.

This one shows the base URL for the service, and is used for all relative URLs in other patterns:

-

    <ValueAnnotationTerm="odata.urls.baseurlexpression"Target="ODataDemo.DemoService">

+

    <ValueAnnotation Term="odata.urls.baseurlexpression" Target="ODataDemo.DemoService">

      <String>https://services.odata.org/OData/OData.svc/</String>

    </ValueAnnotation>

These two show two URL construction rules, one to obtain the URL of a collection (a set) and one to obtain the URL of an individual element within that collection:

-

    <ValueAnnotationTerm="odata.urls.setexpression"Target="ODataDemo.DemoService.Products"

-

                     String="Products/"/>

+

    <ValueAnnotation Term="odata.urls.setexpression" Target="ODataDemo.DemoService.Products"

+

                     String="Products/"/>

 

-

    <ValueAnnotationTerm="odata.urls.keylookupexpression"Target="ODataDemo.DemoService.Products">

-

      <ApplyFunction="KeyConcat">

+

    <ValueAnnotation Term="odata.urls.keylookupexpression" Target="ODataDemo.DemoService.Products">

+

      <Apply Function="KeyConcat">

        <String>(</String>

        <Path>ID</Path>

        <String>)/</String>

      </Apply>

    </ValueAnnotation> 

Finally, here’s one that’s not a URL but a plain value, in this case the ETag for each element (doesn’t apply to the “Product” type, but included here as an example):

-

    <ValueAnnotationTerm="odata.json.etagexpression"Target="ODataDemo.DemoService.Products">

-

      <ApplyFunction="Concat">

+

    <ValueAnnotation Term="odata.json.etagexpression" Target="ODataDemo.DemoService.Products">

+

      <Apply Function="Concat">

        <String>W/"</String>

-

        <ApplyFunction="RawValue">

+

        <Apply Function="RawValue">

          <Path>Version</Path>

        </Apply>

        <String>"</String>

diff --git a/index.html b/index.html index e34c32e..a05b196 100644 --- a/index.html +++ b/index.html @@ -10,8 +10,8 @@ -