users@jaxb.java.net

Schema best practice for modeling UML association

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Fri, 11 Jan 2008 17:03:51 -0500

Dear Colleagues,

I have the following simple schema that defines a type hierarchy with
base IdentifiableType and derived types FooType and BarType.
The BaseType defines an id attribute that uniquely identifies the
object. It also defines a dependsUpon attribute which is intended to
reference
a concrete sub-type of IdentifiableType. I am looking for guidance on
how to design my schema to that the generated bindings will use Java
object reference exemplified by the getDependsUpon method below:

Class IdentifiableType {
  String getId();
  IdentifiableType getDependsUpon();
}

What I want to avoid is a getter that returns the id value for the
dependency object shown below:
  String getDependsUpon();

The simplified schema is as follows and I have the flexibility to make
changes to it to accomplish what I need in the bindings.

  <complexType abstract="true" name="IdentifiableType">
    <attribute name="id" type="anyURI" use="required"/>
    <attribute name="dependsUpon" type="anyURI" use="optional"/>
  </complexType>

  <complexType name="FooType">
    <complexContent>
      <extension base="tns:IdentifiableType">
     ....
      </extension>
    </complexContent>
  </complexType>
 
  <complexType name="BarType">
    <complexContent>
      <extension base="tns:IdentifiableType">
     ....
      </extension>
    </complexContent>
  </complexType>
 
TIA for your help.

-- 
Regards,
Farrukh Najmi
Web: http://www.wellfleetsoftware.com