Importing Data from Pharo

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Importing Data from Pharo

Sean P. DeNigris
Administrator
I have a few Pharo apps that simply offer querying of an unchanging database of objects - think something like a train schedule. I often want to offer these via Amber. Creating the Amber UI is easy enough. The thing that usually slows me down is importing the data. I know I can use Pharo as a backend and keep the data there, but since there is no editing involved, it would greatly simplify things to keep everything in Amber. The typical ways to store objects in Pharo are Fuel or STON. But as far as I know, neither of these are compatible with Amber, are they? What I've done in the past is write a custom serializer that creates class-side constructor methods to re-create the data, but feels like too much extra work.

Is anyone else running into this complication i.e. wanting to move data from Pharo to Amber? If so, what is the best practice here? Would it be worth it to port something to facilitate... maybe STON?

Thanks!
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Importing Data from Pharo

Herby Vojčík
Amber is able to read chunk format, so if you are able to do a fileout that defines all the objects, it should be able to read it.

Also, I think I have seen some amver-ston on github.

Herby

Dňa 13. júna 2015 5:38:06 CEST používateľ "Sean P. DeNigris" <[hidden email]> napísal:

> I have a few Pharo apps that simply offer querying of an unchanging
> database
> of objects - think something like a train schedule. I often want to
> offer
> these via Amber. Creating the Amber UI is easy enough. The thing that
> usually slows me down is importing the data. I know I can use Pharo as
> a
> backend and keep the data there, but since there is no editing
> involved, it
> would greatly simplify things to keep everything in Amber. The typical
> ways
> to store objects in Pharo are Fuel or STON. But as far as I know,
> neither of
> these are compatible with Amber, are they? What I've done in the past
> is
> write a custom serializer that creates class-side constructor methods
> to
> re-create the data, but feels like too much extra work.
>
> Is anyone else running into this complication i.e. wanting to move
> data from
> Pharo to Amber? If so, what is the best practice here? Would it be
> worth it
> to port something to facilitate... maybe STON?
>
> Thanks!
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context:
> http://forum.world.st/Importing-Data-from-Pharo-tp4832187.html
> Sent from the Amber Smalltalk mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Importing Data from Pharo

Amber Smalltalk mailing list
In reply to this post by Sean P. DeNigris
Hi Sean,

On Sat, Jun 13, 2015 at 5:38 AM, Sean P. DeNigris <[hidden email]> wrote:
I have a few Pharo apps that simply offer querying of an unchanging database
of objects - think something like a train schedule. I often want to offer
these via Amber. Creating the Amber UI is easy enough. The thing that
usually slows me down is importing the data. I know I can use Pharo as a
backend and keep the data there, but since there is no editing involved, it
would greatly simplify things to keep everything in Amber. The typical ways
to store objects in Pharo are Fuel or STON. But as far as I know, neither of
these are compatible with Amber, are they? What I've done in the past is
write a custom serializer that creates class-side constructor methods to
re-create the data, but feels like too much extra work.


STON is an extension of the JSON notation, if I understood this correctly from a recent thread on the Pharo mailinglist.
Is that right?

What Amber supports out of the box is JSON (obviously).
So far there is no support for Fuel of STON but STON might work if it could be transformed to/queried as plain JSON.

 
Is anyone else running into this complication i.e. wanting to move data from
Pharo to Amber? If so, what is the best practice here? Would it be worth it
to port something to facilitate... maybe STON?


STON is going to be integrated into Pharo 5, right?
In that case it might be worth to have a library written in Amber which supports reading/writing STON so an Amber application can easily exchange data with a Pharo server.
I think that using the regular JSON parser will not work here (correct me if I am wrong).
The question is if writing a new parser (Amber uses PEG.js for parsing) would be required for a STON library or if the Amber internal parser could be reused in this case.


Best,
Manfred

 
Thanks!



-----
Cheers,
Sean

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Importing Data from Pharo

Sean P. DeNigris
Administrator
In reply to this post by Herby Vojčík
Herby Vojčík wrote
Amber is able to read chunk format, so if you are able to do a fileout that defines all the objects, it should be able to read it.
Ah, interesting idea. Not exactly what I'm looking for, but good to know :)

Herby Vojčík wrote
amver-ston on github.
I'll check into it. Thanks for the pointer!
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Importing Data from Pharo

Sean P. DeNigris
Administrator
In reply to this post by Sean P. DeNigris
Sean P. DeNigris wrote
What I've done in the past is write a custom serializer that creates class-side constructor methods to re-create the data, but feels like too much extra work.
Poking around, I discovered that #storeOn: gives me most of what I need for free. The limit I noticed is that internal references are not kept (you get two copies), but that doesn't matter for the simple cases I have in mind.
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Importing Data from Pharo

Sean P. DeNigris
Administrator
In reply to this post by Amber Smalltalk mailing list
Amber Smalltalk mailing list wrote
STON is an extension of the JSON notation, if I understood this correctly
from a recent thread on the Pharo mailinglist.
Is that right?
[snip]
IDK enough about STON to answer well. I'm forwarding to Pharo Dev...
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Importing Data from Pharo

Sean P. DeNigris
Administrator
In reply to this post by Herby Vojčík
Herby Vojčík wrote
Also, I think I have seen some amver-ston on github.
This looks like it will be the way to go, but unfortunately is not ready at the moment. But there is hope - I reported a few issues and already one is fixed :)
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Importing Data from Pharo

Sean P. DeNigris
Administrator
In reply to this post by Sean P. DeNigris
Sean P. DeNigris wrote
...move data from Pharo to Amber? ... what is the best practice here?
Until amber-ston is ready, for now I will use NeoJSON. When converting JSON to an St object, is there a better way than `e keysAndValuesDo: [ :k :v | instance instVarAt: k put: v ]`?
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Importing Data from Pharo

Herby Vojčík
Sean P. DeNigris wrote:
> Sean P. DeNigris wrote
>> ...move data from Pharo to Amber? ... what is the best practice here?
>
> Until amber-ston is ready, for now I will use NeoJSON. When converting JSON
> to an St object, is there a better way than `e keysAndValuesDo: [ :k :v |
> instance instVarAt: k put: v ]`?

If you want to fill ivars, then not; if you want to read it into Dictionary, there is some helpers are there (SmalltalkImage >> readJSObject:, JSObjectProxy >> addObjectVariablesTo:)


--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.