Jan, taking our discussion to the google group for wider audience. Answers inline.
On Fri, Feb 7, 2014 at 2:00 PM, Jan Krag <[email protected]> wrote: > Hi Peter. > ....... > For that reason, the new book is now in good use, and I am thoroughly > studying anything to do with the modelling part, as I am still very unsure > about the best model for my data. > I was actually considering doing a new GraphGist where I experiment with > various representations and how this influences my queries, but now I have > also started playing with the Angular frontend as well, so that will > compete for priority in stealing my evenings :-). > > I find that every time a read a little more about Cypher, it influences > the way I want to model my data. > E.g. I discovered the other day that you can add multiple labels to a > node, so now I am considering how this could improve my model and querying, > e.g. by moving gender from a "M" / "F" property to a label. I expect to hit > other things like this along the way. > Of course, the good thing about Neo, is that I can easily just modify my > data "live" after the fact. > > I do have one other question though. I only just started playing around > with Neo's REST interface yesterday, when suddenly got the idea that I > could start coding my AngularJS front-end directly against Neo4J instead of > having to also build a server-side service from day 1. > This however leads to two obvious questions that you might have a quick > answer for: > 1) is there some way to allow only "read" queries via REST, so I could > safely expose this? (still only for "development" purposes - I still expect > to build some sort of simple rest server later) > No there isn't at the moment, but I think it is pretty safe to just scan the incoming cypher queries for CREATE, SET, DELETE or MERGE and based on that disallow or throw some exception back to the client. This is something that eventually I believe will show up in the server itself, sounds like a reasonable request. Maybe you can raise an enhancement issue? > 2) I used the db/data/cypher POST yesterday, and this worked super, but > the result is rather complex and verbose for just getting a list of nodes > as I did yesterday (i.e. resulting in something like data[0][0]. > cat.data.id just to get a simple property of a returned node. Is there an > easy way to make it return something more "lightweight"? Maybe its just a > question of writing a modified Cypher? > > Yes. For one, you can just return an ID instead of the whole REST representation of a node, like MATCH (n) return ID(n) LIMIT 10 or, you can actually return JSON maps as literals, see http://docs.neo4j.org/chunked/milestone/syntax-collections.html#_literal_maps MATCH (n) RETURN { key : ID(n), collectionKey: [{ name: n.name }, { inner: "Map2" }]} as result http://console.neo4j.org/r/2t2pgq for an example. Again, sorry if I am bothering you with things that could be found in the > documentation. I just thought I would drop the question while I was writing > you anyway. You don't have to write a long answer, but just a few > keywords/pointers in the right direction would be a great help. > > (jan:Geek)-[:Enjoys]->(:Neo4J) > > > (peter:Geek)-[:LOVES_TO]->(help) -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
