Perl Object Relational Mapping

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Perl Object Relational Mapping

JD Wong
Hi dev,

Is there any way to access the objectstore using perl?

Cheers,
-JD

_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Perl Object Relational Mapping

Alex Kalderimis-2
Not directly - I believe the idea was mooted in the past. Theoretically a DBI driver could be written. What would you like to do that you can't achieve with the web service API?

Alex



-------- Original message --------
Subject: [InterMine Dev] Perl Object Relational Mapping
From: JD Wong <[hidden email]>
To: Intermine Developer List <[hidden email]>
CC:


Hi dev,

Is there any way to access the objectstore using perl?

Cheers,
-JD

_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Perl Object Relational Mapping

JD Wong
What would you like to do that you can't achieve with the web service API?

Create a full representation of an intermine object including not only attributes but references and collections.  This would be instantiated as a perl object, with the references and such represented as id numbers that could be dereferenced and expanded if needed with separate queries.

-JD

On Tue, Jan 17, 2012 at 5:07 PM, Alex Kalderimis <[hidden email]> wrote:
Not directly - I believe the idea was mooted in the past. Theoretically a DBI driver could be written. What would you like to do that you can't achieve with the web service API?

Alex



-------- Original message --------
Subject: [InterMine Dev] Perl Object Relational Mapping
From: JD Wong <[hidden email]>
To: Intermine Developer List <[hidden email]>
CC:


Hi dev,

Is there any way to access the objectstore using perl?

Cheers,
-JD


_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Perl Object Relational Mapping

Alex Kalderimis-2
In reply to this post by JD Wong
you can do that with the API. When retrieving results as records (nested data) the data attributes in the view are populated automatically, and unspecified ones are fetched lazily when requested. This behaviour is similar to that of ORM systems like DBIx::Class. This functionality exists in both Perl and Python. Obviously if you are processing lots of results it is much slower than using pre-fetching, but would be convenient for single objects. I can send some examples around tomorrow.

Alex



-------- Original message --------
Subject: Re: [InterMine Dev] Perl Object Relational Mapping
From: JD Wong <[hidden email]>
To: Alex Kalderimis <[hidden email]>
CC: [hidden email]


What would you like to do that you can't achieve with the web service API?

Create a full representation of an intermine object including not only attributes but references and collections.  This would be instantiated as a perl object, with the references and such represented as id numbers that could be dereferenced and expanded if needed with separate queries.

-JD

On Tue, Jan 17, 2012 at 5:07 PM, Alex Kalderimis <[hidden email]> wrote:
Not directly - I believe the idea was mooted in the past. Theoretically a DBI driver could be written. What would you like to do that you can't achieve with the web service API?

Alex



-------- Original message --------
Subject: [InterMine Dev] Perl Object Relational Mapping
From: JD Wong <[hidden email]>
To: Intermine Developer List <[hidden email]>
CC:


Hi dev,

Is there any way to access the objectstore using perl?

Cheers,
-JD


_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Perl Object Relational Mapping

JD Wong
Thanks Alex!  That would be very helpful

Cheers,
-JD

On Tue, Jan 17, 2012 at 5:38 PM, Alex Kalderimis <[hidden email]> wrote:
you can do that with the API. When retrieving results as records (nested data) the data attributes in the view are populated automatically, and unspecified ones are fetched lazily when requested. This behaviour is similar to that of ORM systems like DBIx::Class. This functionality exists in both Perl and Python. Obviously if you are processing lots of results it is much slower than using pre-fetching, but would be convenient for single objects. I can send some examples around tomorrow.

Alex



-------- Original message --------
Subject: Re: [InterMine Dev] Perl Object Relational Mapping
From: JD Wong <[hidden email]>
To: Alex Kalderimis <[hidden email]>
CC: [hidden email]


What would you like to do that you can't achieve with the web service API?

Create a full representation of an intermine object including not only attributes but references and collections.  This would be instantiated as a perl object, with the references and such represented as id numbers that could be dereferenced and expanded if needed with separate queries.

-JD

On Tue, Jan 17, 2012 at 5:07 PM, Alex Kalderimis <[hidden email]> wrote:
Not directly - I believe the idea was mooted in the past. Theoretically a DBI driver could be written. What would you like to do that you can't achieve with the web service API?

Alex



-------- Original message --------
Subject: [InterMine Dev] Perl Object Relational Mapping
From: JD Wong <[hidden email]>
To: Intermine Developer List <[hidden email]>
CC:


Hi dev,

Is there any way to access the objectstore using perl?

Cheers,
-JD



_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: Perl Object Relational Mapping

Alex Kalderimis-2
As promised, some examples - these have been tested with:
 - perl: Webservice::InterMine 0.9910
 - python: intermine 0.99.07
 - ruby: intermine 0.99.03

There were a few bug fixes - but they have been released today.

All best

Alex

On 18/01/12 04:38, JD Wong wrote:

> Thanks Alex!  That would be very helpful
>
> Cheers,
> -JD
>
> On Tue, Jan 17, 2012 at 5:38 PM, Alex Kalderimis <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     you can do that with the API. When retrieving results as records
>     (nested data) the data attributes in the view are populated
>     automatically, and unspecified ones are fetched lazily when
>     requested. This behaviour is similar to that of ORM systems like
>     DBIx::Class. This functionality exists in both Perl and Python.
>     Obviously if you are processing lots of results it is much slower
>     than using pre-fetching, but would be convenient for single objects.
>     I can send some examples around tomorrow.
>
>     Alex
>
>
>
>     -------- Original message --------
>     Subject: Re: [InterMine Dev] Perl Object Relational Mapping
>     From: JD Wong <[hidden email] <mailto:[hidden email]>>
>     To: Alex Kalderimis <[hidden email] <mailto:[hidden email]>>
>     CC: [hidden email] <mailto:[hidden email]>
>
>
>         What would you like to do that you can't achieve with the web
>         service API?
>
>
>     Create a full representation of an intermine object including not
>     only attributes but references and collections.  This would be
>     instantiated as a perl object, with the references and such
>     represented as id numbers that could be dereferenced and expanded if
>     needed with separate queries.
>
>     -JD
>
>     On Tue, Jan 17, 2012 at 5:07 PM, Alex Kalderimis <[hidden email]
>     <mailto:[hidden email]>> wrote:
>
>         Not directly - I believe the idea was mooted in the past.
>         Theoretically a DBI driver could be written. What would you like
>         to do that you can't achieve with the web service API?
>
>         Alex
>
>
>
>         -------- Original message --------
>         Subject: [InterMine Dev] Perl Object Relational Mapping
>         From: JD Wong <[hidden email] <mailto:[hidden email]>>
>         To: Intermine Developer List <[hidden email]
>         <mailto:[hidden email]>>
>         CC:
>
>
>         Hi dev,
>
>         Is there any way to access the objectstore using perl?
>
>         Cheers,
>         -JD
>
>
>

_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev

test-lazy.pl (376 bytes) Download Attachment
test-lazy.py (357 bytes) Download Attachment
test-lazy.rb (472 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Perl Object Relational Mapping

JD Wong
In reply to this post by JD Wong
Is there a way to generically grab all references in an object en masse regardless of the specific paths of each one?

-JD

On Fri, Jan 20, 2012 at 2:22 PM, Alex Kalderimis <[hidden email]> wrote:
by specifying their paths on the view of a query. 

Eg: the following will be lazy:

  $service->select("Gene.*")

The following will eagerly pre-fetch all protein attributes as well:

  $service->select("Gene.*", "proteins.*")





-------- Original message --------
Subject: Re: [InterMine Dev] Perl Object Relational Mapping
From: JD Wong <[hidden email]>
To: Alex Kalderimis <[hidden email]>
CC:


Hi Alex,

CPAN updated itself, enabling code execution.  It all works well now, but I was wondering: 
how do I force the reference objects to be populated automatically in an intermine class object like attributes are?

Thanks,
-JD

On Wed, Jan 18, 2012 at 10:42 AM, Alex Kalderimis <[hidden email]> wrote:
The module probably hasn't made it through to the CPAN mirrors yet. Make
sure that you have 0.9910. This will have required an update of the
Model package as well.

Alex

On 18/01/12 15:40, JD Wong wrote:
> Thanks Alex, but I get:
>
> eve
> Can't call method "name" on an undefined value at ... line 9
>
> from the perl script before and after I updated the library.  When I
> comment out line 9 (say $eve->organism->name;) I get:
>
> Can't locate object method "proteins_count" via package
> "InterMine::genomic::01::Gene" at line 11
>
> when I comment that (#say $eve->proteins_count, " proteins";) out I get:
>
> Can't locate object method "pathways_count" via package
> "InterMine::genomic::01::Gene" at line 13
>
> Cheers,
> -JD
>
> On Wed, Jan 18, 2012 at 10:01 AM, Alex Kalderimis <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     As promised, some examples - these have been tested with:
>      - perl: Webservice::InterMine 0.9910
>      - python: intermine 0.99.07
>      - ruby: intermine 0.99.03
>
>     There were a few bug fixes - but they have been released today.
>
>     All best
>
>     Alex
>
>     On 18/01/12 04:38, JD Wong wrote:
>     > Thanks Alex!  That would be very helpful
>     >
>     > Cheers,
>     > -JD
>     >
>     > On Tue, Jan 17, 2012 at 5:38 PM, Alex Kalderimis
>     <[hidden email] <mailto:[hidden email]>
>     > <mailto:[hidden email] <mailto:[hidden email]>>> wrote:
>     >
>     >     you can do that with the API. When retrieving results as records
>     >     (nested data) the data attributes in the view are populated
>     >     automatically, and unspecified ones are fetched lazily when
>     >     requested. This behaviour is similar to that of ORM systems like
>     >     DBIx::Class. This functionality exists in both Perl and Python.
>     >     Obviously if you are processing lots of results it is much slower
>     >     than using pre-fetching, but would be convenient for single
>     objects.
>     >     I can send some examples around tomorrow.
>     >
>     >     Alex
>     >
>     >
>     >
>     >     -------- Original message --------
>     >     Subject: Re: [InterMine Dev] Perl Object Relational Mapping
>     >     From: JD Wong <[hidden email] <mailto:[hidden email]>
>     <mailto:[hidden email] <mailto:[hidden email]>>>
>     >     To: Alex Kalderimis <[hidden email]
>     <mailto:[hidden email]> <mailto:[hidden email]
>     <mailto:[hidden email]>>>
>     >     CC: [hidden email] <mailto:[hidden email]>
>     <mailto:[hidden email] <mailto:[hidden email]>>
>     >
>     >
>     >         What would you like to do that you can't achieve with the web
>     >         service API?
>     >
>     >
>     >     Create a full representation of an intermine object including not
>     >     only attributes but references and collections.  This would be
>     >     instantiated as a perl object, with the references and such
>     >     represented as id numbers that could be dereferenced and
>     expanded if
>     >     needed with separate queries.
>     >
>     >     -JD
>     >
>     >     On Tue, Jan 17, 2012 at 5:07 PM, Alex Kalderimis
>     <[hidden email] <mailto:[hidden email]>
>     >     <mailto:[hidden email] <mailto:[hidden email]>>> wrote:
>     >
>     >         Not directly - I believe the idea was mooted in the past.
>     >         Theoretically a DBI driver could be written. What would
>     you like
>     >         to do that you can't achieve with the web service API?
>     >
>     >         Alex
>     >
>     >
>     >
>     >         -------- Original message --------
>     >         Subject: [InterMine Dev] Perl Object Relational Mapping
>     >         From: JD Wong <[hidden email]
>     <mailto:[hidden email]> <mailto:[hidden email]
>     <mailto:[hidden email]>>>
>     >         To: Intermine Developer List <[hidden email]
>     <mailto:[hidden email]>
>     >         <mailto:[hidden email] <mailto:[hidden email]>>>
>     >         CC:
>     >
>     >
>     >         Hi dev,
>     >
>     >         Is there any way to access the objectstore using perl?
>     >
>     >         Cheers,
>     >         -JD
>     >
>     >
>     >
>
>



_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev