OASIS Open Data Protocol (OData) TC

 View Only
  • 1.  RE: instance annotations

    Posted 02-22-2021 18:02




    Ralf,
     
    Just curious .
     
    What is SAP s rational for applying a Term to an instance (i.e. a realization of a model element), as opposed to adding a property/method to the model element?
     
    Thanks,
    George
     


    From: Handl, Ralf <ralf.handl@sap.com>
    Sent: Monday, February 22, 2021 12:22 PM
    To: Ericson, George; Michael Pizzo; Christof Sprenger
    Cc: odata@lists.oasis-open.org
    Subject: RE: instance annotations


     

    [EXTERNAL EMAIL]

    We use the tagging term Common.IsInstanceAnnotation to mark terms that are intended for instance annotations, see

    https://github.com/SAP/odata-vocabularies/blob/master/vocabularies/Common.md#IsInstanceAnnotation
     
    PS:
    @Michael Pizzo ,

    @Christof Sprenger : I did not receive your mails in this thread, only George s response to your mails.

     


    From: odata@lists.oasis-open.org < odata@lists.oasis-open.org >
    On Behalf Of Ericson, George
    Sent: Monday, 22 February 2021 17:24
    To: Michael Pizzo < mikep@microsoft.com >; Christof Sprenger < chrispre@microsoft.com >
    Cc: odata@lists.oasis-open.org
    Subject: [odata] RE: instance annotations


     
    There are examples where an annotation is meant to be applied to an instance and not the model that describes the instance.
     
    For example in the Redfish vocabulary there is this:

           < Term   Name = "Settings"   Type = "Settings.Settings" >

             < Annotation   Term = "OData.Description"   String = "The link to the settings resource that represents the settings to apply to this resource." />

           </ Term >
     
    As I understand it, this Term could have been alternatively defined as a Settings property of the model that it is applied to.

     
    My preference would be to use instance annotations only as a way to pass information about the underlying Model that an instance is realized from.  If we want to dig deeper, we could ask a representative of the Redfish team to provide more
    rational.
     
    Thanks,
    George
     
     


    From: odata@lists.oasis-open.org < odata@lists.oasis-open.org >
    On Behalf Of Michael Pizzo
    Sent: Saturday, February 20, 2021 2:01 PM
    To: Christof Sprenger
    Cc: odata@lists.oasis-open.org
    Subject: [odata] RE: instance annotations


     

    [EXTERNAL EMAIL]

    We don't currently have a way to specify that an annotation term is intended for use as an instance annotation to my recollection, it has never come up.
     
    How would this information be useful to the client?  Is it just a matter of documenting how the term is intended to be used, or is it required at runtime in order to invoke some type of logic?
     
    If it's part of documenting the usage, then we generally try to convey that in the description having a machine-readable way to determine if a term is intended as an instance annotation is useful if code needs to determine applicability.
     
    For comparison, the AppliesTo attribute for metadata annotations is intended to help schema designers know where they can put what terms (i.e., you can have a drop-down of terms that are applicable to a particular model element without
    having to understand the semantics of the term.)  AppliesTo is * not * intended to be restrictive (i.e., clients should not throw an error if a term is used somewhere that is not called out in AppliesTo).
     
    Similarly, clients should never error due to an unexpected/unknown instance annotation, so I wouldn't add a way to distinguish a term as intended for an instance annotation in order to add client validation.
     


    From: odata@lists.oasis-open.org < odata@lists.oasis-open.org >
    On Behalf Of Christof Sprenger
    Sent: Thursday, February 18, 2021 2:58 PM
    To: odata@lists.oasis-open.org
    Subject: [EXTERNAL] [odata] instance annotations


     
    Hello,
     
    I would have expected to find something in the annotation term applicability table that allows me to specify that an annotation is intended as an instance annotation.

     
    OData
    Common Schema Definition Language (CSDL) XML Representation Version 4.01 (oasis-open.org)
     
    Am I misunderstanding something how a term is supposed to be defined that can be used as an

    instance annotation ? Or is this a gap in the standard?
     
    Christof






  • 2.  RE: instance annotations

    Posted 02-23-2021 06:59




    I do not see a clear distinction between "model annotations" and "instance annotations": The former express their value at design time whereas the latter do it only at runtime, but the meaning
    is the same. For example, consider the following segment from an entity type definition:
     
    {
    "Amount": {"$Type": "Edm.Decimal"},
    "Amount@Measures.ISOCurrency": {"$Path": "Currency"},
    "Currency": {"$Type": "Edm.String"}
    }
     
    and assume the server generates the payload
     
    {
    "Amount": 12,
    "Currency": "EUR"
    }
     
    Then the model annotation allows the OData client to deduce the
    ISOCurrency and augment the payload to
     
    {
    "Amount": 12,
    "Amount@Measures.ISOCurrency": "EUR",
    "Currency": "EUR"
    }
     
    But the server could also have returned that payload
    including the instance annotation, relieving the client of the duty to deduce the currency by itself.
     
    In this example, having both
    Amount@Measures.ISOCurrency and
    Currency may seem redundant, but imagine that the currency is not part of the same entity type but comes via navigation from another entity type:
     
    {
    "Amount": {"$Type": "Edm.Decimal"},
    "Amount@Measures.ISOCurrency": {"$Path": "toCompany/Currency"},
    "toCompany": {"$Kind": "NavigationProperty", "$Type": "self.Company"}
    }
     
    Then it makes sense for the server to return the currency as an instance annotation in the first entity type rather than expand the result set with the other entity type:
     
    {
    "Amount": 12,
    "Amount@Measures.ISOCurrency": "EUR"
    }
     
     


    From: odata@lists.oasis-open.org <odata@lists.oasis-open.org>
    On Behalf Of Ericson, George
    Sent: Montag, 22. Februar 2021 19:02
    To: Handl, Ralf <ralf.handl@sap.com>; Michael Pizzo <mikep@microsoft.com>; Christof Sprenger <chrispre@microsoft.com>
    Cc: odata@lists.oasis-open.org
    Subject: [odata] RE: instance annotations


     
    Ralf,
     
    Just curious .
     
    What is SAP s rational for applying a Term to an instance (i.e. a realization of a model element), as opposed to adding a property/method to the model element?
     
    Thanks,
    George
     


    From: Handl, Ralf < ralf.handl@sap.com >

    Sent: Monday, February 22, 2021 12:22 PM
    To: Ericson, George; Michael Pizzo; Christof Sprenger
    Cc: odata@lists.oasis-open.org
    Subject: RE: instance annotations


     

    [EXTERNAL EMAIL]

    We use the tagging term Common.IsInstanceAnnotation to mark terms that are intended for instance annotations, see

    https://github.com/SAP/odata-vocabularies/blob/master/vocabularies/Common.md#IsInstanceAnnotation
     
    PS:
    @Michael Pizzo ,

    @Christof Sprenger : I did not receive your mails in this thread, only George s response to your mails.

     


    From:
    odata@lists.oasis-open.org < odata@lists.oasis-open.org >
    On Behalf Of Ericson, George
    Sent: Monday, 22 February 2021 17:24
    To: Michael Pizzo < mikep@microsoft.com >; Christof Sprenger < chrispre@microsoft.com >
    Cc: odata@lists.oasis-open.org
    Subject: [odata] RE: instance annotations


     
    There are examples where an annotation is meant to be applied to an instance and not the model that describes the instance.
     
    For example in the Redfish vocabulary there is this:

           < Term   Name = "Settings"   Type = "Settings.Settings" >

             < Annotation   Term = "OData.Description"   String = "The link to the settings resource that represents the settings to apply to this resource." />

           </ Term >
     
    As I understand it, this Term could have been alternatively defined as a Settings property of the model that it is applied to.

     
    My preference would be to use instance annotations only as a way to pass information about the underlying Model that an instance is realized from.  If we want to dig deeper, we could ask a representative of the
    Redfish team to provide more rational.
     
    Thanks,
    George
     
     


    From:
    odata@lists.oasis-open.org < odata@lists.oasis-open.org >
    On Behalf Of Michael Pizzo
    Sent: Saturday, February 20, 2021 2:01 PM
    To: Christof Sprenger
    Cc: odata@lists.oasis-open.org
    Subject: [odata] RE: instance annotations


     

    [EXTERNAL EMAIL]

    We don't currently have a way to specify that an annotation term is intended for use as an instance annotation to my recollection, it has never come up.
     
    How would this information be useful to the client?  Is it just a matter of documenting how the term is intended to be used, or is it required at runtime in order to invoke some type of logic?
     
    If it's part of documenting the usage, then we generally try to convey that in the description having a machine-readable way to determine if a term is intended as an instance annotation is useful if code needs
    to determine applicability.
     
    For comparison, the AppliesTo attribute for metadata annotations is intended to help schema designers know where they can put what terms (i.e., you can have a drop-down of terms that are applicable to a particular
    model element without having to understand the semantics of the term.)  AppliesTo is * not * intended to be restrictive (i.e., clients should not throw an error if a term is used somewhere that is not called out in AppliesTo).
     
    Similarly, clients should never error due to an unexpected/unknown instance annotation, so I wouldn't add a way to distinguish a term as intended for an instance annotation in order to add client validation.
     


    From:
    odata@lists.oasis-open.org < odata@lists.oasis-open.org >
    On Behalf Of Christof Sprenger
    Sent: Thursday, February 18, 2021 2:58 PM
    To: odata@lists.oasis-open.org
    Subject: [EXTERNAL] [odata] instance annotations


     
    Hello,
     
    I would have expected to find something in the annotation term applicability table that allows me to specify that an annotation is intended as an instance annotation.

     
    OData
    Common Schema Definition Language (CSDL) XML Representation Version 4.01 (oasis-open.org)
     
    Am I misunderstanding something how a term is supposed to be defined that can be used as an

    instance annotation ? Or is this a gap in the standard?
     
    Christof






  • 3.  RE: instance annotations

    Posted 02-23-2021 16:10




    We also use instance annotations to extend the

    OData Error Response which only allows adding annotations to its JSON objects.
     
    In this case there is no model element where we could attach a metadata annotation .
     


    From: odata@lists.oasis-open.org <odata@lists.oasis-open.org>
    On Behalf Of Ericson, George
    Sent: Monday, 22 February 2021 19:02
    To: Handl, Ralf <ralf.handl@sap.com>; Michael Pizzo <mikep@microsoft.com>; Christof Sprenger <chrispre@microsoft.com>
    Cc: odata@lists.oasis-open.org
    Subject: [odata] RE: instance annotations


     
    Ralf,
     
    Just curious .
     
    What is SAP s rational for applying a Term to an instance (i.e. a realization of a model element), as opposed to adding a property/method to the model element?
     
    Thanks,
    George
     


    From: Handl, Ralf < ralf.handl@sap.com >

    Sent: Monday, February 22, 2021 12:22 PM
    To: Ericson, George; Michael Pizzo; Christof Sprenger
    Cc: odata@lists.oasis-open.org
    Subject: RE: instance annotations


     

    [EXTERNAL EMAIL]

    We use the tagging term Common.IsInstanceAnnotation to mark terms that are intended for instance annotations, see

    https://github.com/SAP/odata-vocabularies/blob/master/vocabularies/Common.md#IsInstanceAnnotation
     
    PS:
    @Michael Pizzo ,

    @Christof Sprenger : I did not receive your mails in this thread, only George s response to your mails.

     


    From:
    odata@lists.oasis-open.org < odata@lists.oasis-open.org >
    On Behalf Of Ericson, George
    Sent: Monday, 22 February 2021 17:24
    To: Michael Pizzo < mikep@microsoft.com >; Christof Sprenger < chrispre@microsoft.com >
    Cc: odata@lists.oasis-open.org
    Subject: [odata] RE: instance annotations


     
    There are examples where an annotation is meant to be applied to an instance and not the model that describes the instance.
     
    For example in the Redfish vocabulary there is this:

           < Term   Name = "Settings"   Type = "Settings.Settings" >

             < Annotation   Term = "OData.Description"   String = "The link to the settings resource that represents the settings to apply to this resource." />

           </ Term >
     
    As I understand it, this Term could have been alternatively defined as a Settings property of the model that it is applied to.

     
    My preference would be to use instance annotations only as a way to pass information about the underlying Model that an instance is realized from.  If we want to dig deeper, we could ask a representative of the Redfish
    team to provide more rational.
     
    Thanks,
    George
     
     


    From:
    odata@lists.oasis-open.org < odata@lists.oasis-open.org >
    On Behalf Of Michael Pizzo
    Sent: Saturday, February 20, 2021 2:01 PM
    To: Christof Sprenger
    Cc: odata@lists.oasis-open.org
    Subject: [odata] RE: instance annotations


     

    [EXTERNAL EMAIL]

    We don't currently have a way to specify that an annotation term is intended for use as an instance annotation to my recollection, it has never come up.
     
    How would this information be useful to the client?  Is it just a matter of documenting how the term is intended to be used, or is it required at runtime in order to invoke some type of logic?
     
    If it's part of documenting the usage, then we generally try to convey that in the description having a machine-readable way to determine if a term is intended as an instance annotation is useful if code needs to determine
    applicability.
     
    For comparison, the AppliesTo attribute for metadata annotations is intended to help schema designers know where they can put what terms (i.e., you can have a drop-down of terms that are applicable to a particular model
    element without having to understand the semantics of the term.)  AppliesTo is * not * intended to be restrictive (i.e., clients should not throw an error if a term is used somewhere that is not called out in AppliesTo).
     
    Similarly, clients should never error due to an unexpected/unknown instance annotation, so I wouldn't add a way to distinguish a term as intended for an instance annotation in order to add client validation.
     


    From:
    odata@lists.oasis-open.org < odata@lists.oasis-open.org >
    On Behalf Of Christof Sprenger
    Sent: Thursday, February 18, 2021 2:58 PM
    To: odata@lists.oasis-open.org
    Subject: [EXTERNAL] [odata] instance annotations


     
    Hello,
     
    I would have expected to find something in the annotation term applicability table that allows me to specify that an annotation is intended as an instance annotation.

     
    OData
    Common Schema Definition Language (CSDL) XML Representation Version 4.01 (oasis-open.org)
     
    Am I misunderstanding something how a term is supposed to be defined that can be used as an

    instance annotation ? Or is this a gap in the standard?
     
    Christof