[Nitro] schema_inheritance

TRANS transfire at gmail.com
Sun Dec 25 12:39:07 EST 2005

On 12/25/05, Emmanuel Piperakis <epiperak at softlab.ece.ntua.gr> wrote:
> Trans,
> what it does is,
> in the case of subclasses if in the superclass you include the line
> schema_inheritance Og create 1 table for all the subclasses and puts the
> UNION of all properties in this table + one new column called ogtype that
> distinguishes the subclass by holding the .class of the subclass (aka the
> name of the Subclass). If schema inheritance is not used then each class
> and subclass has its own table.
> eg. (to use the same example)
> class Project
>   property :xmas, String
>   schema_inheritance
> end
> class ForeignProject < Project
>   property :gift, String
> end
> class DomesticProject < Project
>   property :santa, String
> end
> Og creates one table with the following columns (at least for version 0.25
> and NOT for 0.26)
> ogtype
> ogxmas
> oggift
> ogsanta
> oid

Thanks. I think I understand.

> schema_inheritance is necessary for certain kind of queries... do not ask
> me not to use it as a solution... ;-)

Well, I certaily wouldn't tell you to do that! :-)

On the Og implementation side though I do find it kind of interesting,
even a bit unexpected, of the way to do that, i.e. using a superclass
to create the union. But I guess it actually makes good sense.

But why not call is union_inheritance instead? That seems more
intuitive. Perhaps evn better, would a mixin, or a superclass, be more
appropriate here? Eg.

  class Project
    is Union
    property :xmas, String


  class Project < Union
    property :xmas, String

Also, what's the reason for the field names to be prefixed by 'og'?


More information about the Nitro-general mailing list