[BioRuby] [GSoC] ORM styled NeXML

Jan Aerts jan.aerts at gmail.com
Thu Jul 29 17:38:24 UTC 2010


Hi Anurag,

It seems to me that this way of interaction with the NeXML data is a very
good option. The Ruby community is used to this type of representation so I
would definitely favour something like it.

jan. (on house-hunt in Belgium at the moment; apologies if it takes long to
respond)

On 29 July 2010 18:45, Anurag Priyam <anurag08priyam at gmail.com> wrote:

> An object invocation of NeXML is very much ORM like. An Otus and a Tree
> class could very well be represented as:
>
> class Otus
>   include Mapper
>
>   property :id, :label
>   has_n :trees
> end
>
> class Trees
>   include Mapper
>
>   property :id, :label
>   belongs_to :otus
> end
>
> And, one would be able to do following:
>
> otus1.trees << trees1
> otus1.trees = [ trees2, trees3]
> otus1.trees
> # => trees1, trees2, trees3
> trees1.otus
> # => otus1
>
> NeXML::Mapper module defines the magic methods property, has_n, and
> belongs_to which will use reflection to define the needed methods.
>
> The above representation of Otus and Trees class feels very succinct to me.
> It could be due to my Rails/Merb background but, others can see it as a DSL.
>
> What is the take of others on this coding style( including acceptance in
> BioRuby ) ?
>
> --
> Anurag Priyam,
> 3rd Year Undergraduate,
> Department of Mechanical Engineering,
> IIT Kharagpur.
> +91-9775550642
>



More information about the BioRuby mailing list