Op 12-3-2019 om 18:46 schreef Ben Coman:Then in Playground do...�� �� collectionUrl :=�� 'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True'.�� �� json := NeoJSONReader fromString: (ZnEasy get: collectionUrl) contents.�� �� paintings := Paintings fromJSON: json.�� �� paintings inspect.
and then debug trace through that whole thing.Is that what you were trying to do?�� Or have I got the wrong end of the stick?
cheers -ben
There is a one to one relationship between the objectNumber and a Painting
I do not use the imageUrl found on this url because it's to big .
So what I try now is first put all the objectNumber in a collection
and use that collection on a second url to fetch a image of the right size
I hope im clear what I try to do in this step
so numbers should be a collection of objectNumbers
and paintings a collection of painting with the info I need
so to recap
this one must give me a collection of objectNumbers : 'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True'.
and the objectNumbers I can use for this url :��
https://www.rijksmuseum.nl/api/nl/collection/<one objectNumber/tiles?key=14OGzuak&format=json and I do not store the objectNumber in Paintings because I do not use it to display it in a seaside project.
Op 12-3-2019 om 18:46 schreef Ben Coman:
On Wed, 13 Mar 2019 at 00:43, Roelof Wobben <r.wobben@home.nl> wrote:
> I did try to make this idea work but now im complete lost.
>
> Right now the collection that should contain the objectNumbers is total empty
> anyone who can see where I went wrong.
>
> I included my code so far.
A few things...!Paintings class methodsFor: 'instance creation' stamp: 'RoelofWobben 3/12/2019 17:26'!getImagesDataFromJSON: json| instance |instance := Painting new.(json at: #values)do: [ :artObjectJson |��| painting |painting := Painting new.painting imageUrl: (json at: #name).instance addPainting: painting ].^ instance! !
You are adding a painting to a painting, which semantically makes no sense.i.e. where #addPainting: is sent to "instance" , that is holding a Painting.
I would not expect your Painting class to have a method addPainting:
Paintings should have that method.
btw, Stop using "instance" as a variable name.����Its as bad as variables named "a", "i", "t", "z" - it provides no semantic context.
--------------------Object subclass: #Paintings
instanceVariableNames: 'paintings numbers'
Paintings classinstanceVariableNames: 'numbers paintings'!
You've defined these variables on both the instance-side and class-side.I'll hazard a guess that you should delete the class-side definition.��
----------------------------------
TBApplicationRootComponent initialize!Object subclass: #Painting
instanceVariableNames: 'imageUrl'
Why are you *not* storing objectNumber inside each Painting?What is the relationship between paintings and objectNumbers?Is it one-to-many or one-to-one?
-------------------!Paintings methodsFor: 'instance creation' stamp: 'RoelofWobben 3/11/2019 08:05'!initializesuper initialize.numbers := OrderedCollection new! !
Why do you *not* initialize variable "paintings" to "OrderedCollection new" ?Aren't you dealing with a collection of paintings?
----------------There is lots more confusing me here, so before going further,in a fresh new image, can you load NeoJSON and the attached fileout.
Then in Playground do...�� �� collectionUrl :=�� 'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True'.�� �� json := NeoJSONReader fromString: (ZnEasy get: collectionUrl) contents.�� �� paintings := Paintings fromJSON: json.�� �� paintings inspect.
and then debug trace through that whole thing.Is that what you were trying to do?�� Or have I got the wrong end of the stick?
cheers -ben
Oke, I try to tell what I want
Right now I only want to fetch the objectNumber is a collection.
so I can use that in a later step.
There is a one to one relationship between the objectNumber and a Painting
I do not use the imageUrl found on this url because it's to big .
So what I try now is first put all the objectNumber in a collection
and use that collection on a second url to fetch a image of the right size
I hope im clear what I try to do in this step
so numbers should be a collection of objectNumbers and paintings a collection of painting with the info I need
so to recap
this one must give me a collection of objectNumbers : 'https://www.rijksmuseum.nl/api/nl/collection?key=14OGzuak&format=json&type=schilderij&toppieces=True'.
and the objectNumbers I can use for this url :��
https://www.rijksmuseum.nl/api/nl/collection/<one objectNumber/tiles?key=14OGzuak&format=json and I do not store the objectNumber in Paintings because I do not use it to display it in a seaside project. Roelof