[ome-devel] Rethinking inheritance in the data model

Roger Leigh rleigh at dundee.ac.uk
Wed Oct 28 16:08:26 GMT 2015


There are currently two types of inheritance, which differ in behaviour
and have different types of limitation:

   <abstract>
     used by ManufacturerSpec, Reference, Settings, Annotation (and
derived abstract annotation types)

   <abstractproprietary>
     used by ROI:Shape and LightSource

In the generated code, the former is used for complexTypes rather than
elements, which means the abstract classes are not realised as elements
in the XML.  For the latter, derived classes are contained within the
parent element, and so do appear in the XML.

For concrete model object types, there is no difference in the generated
code.  The differences come into play when looking at the generated code
for the MetadataStore with regard to indexing and accessor chaining, and
in the abstract base classes.  I'd like to propose unifying these so
that we have a single consistent way of indexing and working with
abstract types, primarily to get correct code generation for Mask ROIs,
but also to make the API consistent for all uses.  However, this would
result in some necessary incompatible API changes.

It's not currently possible to generate Mask BinData methods because
<abstractproprietary> results in code like this:

     getShape(shapeIndex).getMask()

rather than the desired

     ((Mask) getShape(shapeIndex))

This is because of Shape being an element rather than a complexType, and
it containing Mask.  On the other hand, the benefit of this method is
that there's a single set of shape indexes for all element types.  In
contrast, <abstract> can generate proper accessors because there is only
a single element, but it has the downside that for e.g. Annotations it
results in a separate index for each annotation type, and for some
classes, such as Annotation, have a very inefficient use of back
references for every possible annotation type, where a single list could
be used otherwise.

Both types have problems generating some methods in the MetadataStore;
see the hardcoded methods in templates for examples of each, e.g. for
annotations and light sources and shapes.

Suggestion:
- Remove <abstractproprietary> completely in favour of <abstract>
- Use a single index for each abstract base type, rather than one for
each concrete type
- Fix the generator and templates to generate all methods correctly
- Move the backreferences to a common location, e.g. OMEModel, which
would greatly reduce the overhead of using annotations

Is this something which we could do as part of the regions work?


Regards,
Roger

--
Dr Roger Leigh -- Open Microscopy Environment
Wellcome Trust Centre for Gene Regulation and Expression,
College of Life Sciences, University of Dundee, Dow Street,
Dundee DD1 5EH Scotland UK   Tel: (01382) 386364

The University of Dundee is a registered Scottish Charity, No: SC015096


More information about the ome-devel mailing list