Uploaded image for project: 'OASIS Open Data Protocol (OData) TC'
  1. OASIS Open Data Protocol (OData) TC
  2. ODATA-535

Define specialization for terms

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.0_CS01
    • Fix Version/s: V4.0_CSD03
    • Component/s: CSDL XML, Vocabularies
    • Labels:
      None
    • Environment:

      [Proposed][Applied for Review]

    • Proposal:
      Hide

      Add attribute BaseTerm to element Term to express term specialization.

      When applying a term with a base term, the base term MUST also be applied with the same qualifier, and so on until a term without a base term is reached. If the type of the specialized term is structured and directly or indirectly inherits from the type of its base term, property values that already have been specified in the annotation(s) for the base type(s) need not be specified again.

      Note: this proposal only solves the third problem stated in the description. The other three problems can be solved by cooperatively annotating term applications, as sketched in the examples below with the terms custom.IsA and custom.ItemIsA. Even if we would allow to use terms interchangeably with types in Term and Property elements, the additional semantics would only be expressed in the definitions of the terms and structured types, and not in annotations using these terms, violating the second goal in the description.

      Examples
      ========
      <Schema Namespace="X">
      <Term Name="Person" Type="X.PersonType" />
      <Term Name="Team" Type="Collection(X.PersonType)">
      <Annotation Term="custom.ItemIsA" String="X.Person" />
      </Term>
      </Schema>
      <Schema Namespace="Y">
      <Term Name="Developer" BaseTerm="X.Person" Type="Y.DeveloperType" />
      <ComplexType Name="DeveloperType" BaseType="X.PersonType">
      <!-- additional properties -->
      </ComplexType>

      <Annotations Target="Some.EntityType">
      <Annotation Term="X.Person">
      <Record>
      <!-- property values defined on X.PersonType go here -->
      </Record>
      </Annotation>
      <Annotation Term="Y.Developer">
      <Record>
      <!-- property values not already specified in the base term annotation go here -->
      </Record>
      </Annotation>
      </Annotations>

      <Term Name="DevelopmentTeam" Type="Collection(Y.DeveloperType)">
      <Annotation Term="custom.ItemIsA" String="Y.Developer" />
      <Annotation Term="custom.IsA" String="X.Team" />
      <!--
      cannot express that with BaseType because it would be hard to have
      both a DevelopmentTeam and a Team annotation and then correlate the records
      -->
      </Term>

      <Annotations Target="Some.EntityType">
      <Annotation Term="Y.DevelopmentTeam">
      <Annotation Term="custom.IsA" String="X.Team" />
      <Path>SomeNavProp/@Y.Developer</Path>
      </Annotation>
      </Annotations>

      <Term Name="ScrumTeam" BaseTerm="Y.DevelopmentTeam" Type="Y.ScrumTeamType" />
      <ComplexType Name="ScrumTeamType">
      <Property Name="ScrumMaster" Type="Y.DeveloperType">
      <Annotation Term="custom.IsA" String="Y.Developer X.Person" />
      </Property>
      </ComplexType>
      <Annotations Target="Some.EntityType">
      <Annotation Term="Y.DevelopmentTeam">
      <Annotation Term="custom.IsA" String="X.Team" />
      <Path>SomeNavProp/@Y.Developer</Path>
      </Annotation>
      <Annotation Term="Y.ScrumTeam">
      <Record>
      <PropertyValue Property="ScrumMaster">
      <Annotation Term="custom.IsA" String="Y.Developer X.Person" />
      <!--
      cannot express that in complex type definition unless we make
      terms and types interchangeably everywhere
      -->
      <Record>
      <!-- property values for Y.DeveloperType go here -->
      </Record>
      </PropertyValue>
      </Record>
      </Annotation>
      </Annotations>
      </Schema>

      Accepted: https://www.oasis-open.org/committees/download.php/50924/odata-meeting-55_on-20131003-minutes.html#odata-535

      Show
      Add attribute BaseTerm to element Term to express term specialization. When applying a term with a base term, the base term MUST also be applied with the same qualifier, and so on until a term without a base term is reached. If the type of the specialized term is structured and directly or indirectly inherits from the type of its base term, property values that already have been specified in the annotation(s) for the base type(s) need not be specified again. Note: this proposal only solves the third problem stated in the description. The other three problems can be solved by cooperatively annotating term applications, as sketched in the examples below with the terms custom.IsA and custom.ItemIsA. Even if we would allow to use terms interchangeably with types in Term and Property elements, the additional semantics would only be expressed in the definitions of the terms and structured types, and not in annotations using these terms, violating the second goal in the description. Examples ======== <Schema Namespace="X"> <Term Name="Person" Type="X.PersonType" /> <Term Name="Team" Type="Collection(X.PersonType)"> <Annotation Term="custom.ItemIsA" String="X.Person" /> </Term> </Schema> <Schema Namespace="Y"> <Term Name="Developer" BaseTerm="X.Person" Type="Y.DeveloperType" /> <ComplexType Name="DeveloperType" BaseType="X.PersonType"> <!-- additional properties --> </ComplexType> <Annotations Target="Some.EntityType"> <Annotation Term="X.Person"> <Record> <!-- property values defined on X.PersonType go here --> </Record> </Annotation> <Annotation Term="Y.Developer"> <Record> <!-- property values not already specified in the base term annotation go here --> </Record> </Annotation> </Annotations> <Term Name="DevelopmentTeam" Type="Collection(Y.DeveloperType)"> <Annotation Term="custom.ItemIsA" String="Y.Developer" /> <Annotation Term="custom.IsA" String="X.Team" /> <!-- cannot express that with BaseType because it would be hard to have both a DevelopmentTeam and a Team annotation and then correlate the records --> </Term> <Annotations Target="Some.EntityType"> <Annotation Term="Y.DevelopmentTeam"> <Annotation Term="custom.IsA" String="X.Team" /> <Path>SomeNavProp/@Y.Developer</Path> </Annotation> </Annotations> <Term Name="ScrumTeam" BaseTerm="Y.DevelopmentTeam" Type="Y.ScrumTeamType" /> <ComplexType Name="ScrumTeamType"> <Property Name="ScrumMaster" Type="Y.DeveloperType"> <Annotation Term="custom.IsA" String="Y.Developer X.Person" /> </Property> </ComplexType> <Annotations Target="Some.EntityType"> <Annotation Term="Y.DevelopmentTeam"> <Annotation Term="custom.IsA" String="X.Team" /> <Path>SomeNavProp/@Y.Developer</Path> </Annotation> <Annotation Term="Y.ScrumTeam"> <Record> <PropertyValue Property="ScrumMaster"> <Annotation Term="custom.IsA" String="Y.Developer X.Person" /> <!-- cannot express that in complex type definition unless we make terms and types interchangeably everywhere --> <Record> <!-- property values for Y.DeveloperType go here --> </Record> </PropertyValue> </Record> </Annotation> </Annotations> </Schema> Accepted: https://www.oasis-open.org/committees/download.php/50924/odata-meeting-55_on-20131003-minutes.html#odata-535
    • Resolution:
      Show
      https://www.oasis-open.org/committees/download.php/50921/odata-v4.0-wd04-part3-csdl-2013-10-03(3).docx https://tools.oasis-open.org/version-control/browse/wsvn/odata/trunk/spec/schemas/MetadataService.edmx?rev=495 https://tools.oasis-open.org/version-control/browse/wsvn/odata/trunk/spec/vocabularies/Org.OData.Core.V1.xml?rev=490 https://tools.oasis-open.org/version-control/browse/wsvn/odata/trunk/spec/schemas/edm.xsd?rev=490 Accepted: https://www.oasis-open.org/committees/download.php/50924/odata-meeting-55_on-20131003-minutes.html#odata-535

      Description

      When merging type terms and value terms we lost the possibility to define terms that are a specialization of other terms, e.g. "a developer is a person with programming skills".

      Given:

      • term Person using complex PersonType

      What we can currently do:

      • define a complex DeveloperType that inherits from PersonType
      • annotate something with term Person and use a record of type DeveloperType

      <Annotation Term="X.Person">
      <Record Type="Y.DeveloperType">
      <PropertyValue Property="Name" Path="Fullname" /> <!-- defined on PersonType -->
      <PropertyValue Property="ProgrammingSkills" Path="ListOfSkills" /> <!-- defined on DeveloperType -->
      </Record>
      </Annotation>

      So someone knowing the term Person will find this term with additional properties defined on the DeveloperType.

      Drawback: no term "Developer"; semantic "is a developer" is expressed indirectly.
      Drawback: supports only one level. If an Architect is a special Developer, then the "is a developer" semantics is lost because the record's type is "Z.ArchitectType" and Y.DeveloperType is no longer mentioned in the annotation.

      Goals:

      • define a term Developer and indicate in the term definition that it specializes term Person
      • annotate something with term Developer in a way that someone knowing only Person and with no access to the definition of term Developer can recognize a Developer as a Person. This should also work with longer specialization chains

      Other use cases:

      • a Team is a collection of Person instances
      • a DevelopmentTeam is a Team, and also a collection of Developer instances
      • a ScrumTeam is a DevelopmentTeam with a ScrumMaster
      • a ScrumMaster is a Developer which is a Person

        Attachments

          Activity

            People

            • Assignee:
              handl Ralf Handl
              Reporter:
              handl Ralf Handl
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: