creating models from rest

26 views
Skip to first unread message

W.S. Hager

unread,
Dec 27, 2012, 5:28:52 PM12/27/12
to persevere...@googlegroups.com
Hello,

In persvere-example-wiki/app I came across some comments about allowing the creation of models via REST. How does this work?

Thanks.

--

W.S. Hager
Lagua Web Solutions
http://lagua.nl

Ben Hockey

unread,
Jan 2, 2013, 11:31:22 AM1/2/13
to persevere...@googlegroups.com

changes to the class model (which can happen via REST since you exposed it) will be observed so that you could potentially create new models.  you could then persist these models via whatever store is backing the model you created to represent models.  it also provides a way for you to query the server via REST to see what models exist.

i haven't used this myself and i'm not sure how many others have tried to use it so report any issues you find.

ben...

W.S. Hager

unread,
Jan 2, 2013, 5:17:19 PM1/2/13
to persevere...@googlegroups.com
Hi Ben,

Thanks for your reply. Creating classes works, but they seem to be only available to admins. I assume I could create facets in the same way, but it looks like I have to write something first. I'm most willing to do this, but perhaps we can have some discussion first about the best way to achieve the common goal. Allow me to elaborate on my own needs.

At first I thought I would be helped by creating only two models, Node and Relationship, and mimic the neo4j graph db api, only very plainly. The anonymous models work great for my purposes, but mongodb can have only a limited number of indices per collection, and I'm running out, so I'll have to create submodels. Everything was restful, but not anymore... Creating submodels via rest shouldn't be hard with the extends property (didn't test this yet). Creating facets is a bit more complex, for the need to extend from Permissive/Restrictive. Perhaps 'extends' could be used here to indicate the authorization level?

As an aside, shouldn't indices on models be propagated to the storage layer? In mongodb this would be very simple, but perhaps there is a reason not to do this?

Looking forward to any input.

Thanks.

Wouter


2013/1/2 Ben Hockey <neonst...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "Persevere" group.
To view this discussion on the web visit https://groups.google.com/d/msg/persevere-framework/-/piwj_5Thj_AJ.
To post to this group, send email to persevere...@googlegroups.com.
To unsubscribe from this group, send email to persevere-frame...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/persevere-framework?hl=en.

W.S. Hager

unread,
Jan 3, 2013, 2:41:46 PM1/3/13
to persevere...@googlegroups.com
This code will simply expose modelModels to the public:

https://github.com/wshager/persevere-example-wiki/blob/master/app.js#L55-L58


2013/1/2 W.S. Hager <wsh...@gmail.com>

W.S. Hager

unread,
Jan 3, 2013, 3:03:36 PM1/3/13
to persevere...@googlegroups.com
Hi,

To be able to RESTfully create facets there needs to be a more complete inheritance system, but more importantly: one should be able to create methods. Since JSON is expected there currently is no way to do this. I don't know the best way to improve this.

Cheers,
Wouter


2013/1/3 W.S. Hager <wsh...@gmail.com>

W.S. Hager

unread,
Jan 3, 2013, 3:14:40 PM1/3/13
to persevere...@googlegroups.com
Perhaps creating facets over REST is just a bridge too far...


2013/1/3 W.S. Hager <wsh...@gmail.com>
Reply all
Reply to author
Forward
0 new messages