[Neo] General questions
Max, Thanks a lot for detailed example. I got it now - I guess I need a bit time to get used Neo thinking J Regards, Ilya P.S. If only I can figure out how to reply to the same thread in this forum. No matter what I try it creates new thread - maybe because when I click e-mail link it opens in outlook. Anybody can suggest how to avoid this - please let me know. ___ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo] General questions
Hi Ilya! 1) Inheritance. Suppose I want to draw tree where every node is derived from other node; say Car à Sedan à Toyota So when creating Toyota node I don’t need to recreate same properties and relationships that Sedan has. I think this example can help you: http://blog.neo4j.org/2010/03/modeling-categories-in-graph-database.html Java code for the example is found here (blog post uses Python): http://github.com/neo4j-examples/java-shop-categories 2) Multi value properties When it come to properties I see I can store key=value pairs but what if I want to store key=values For example, I’d like to have property possibleColors where my values are red, blue, green, etc Neo4j has multivalue properties, see: http://api.neo4j.org/current/org/neo4j/graphdb/PropertyContainer.html#setProperty%28java.lang.String,%20java.lang.Object%29 Do I need to create separate nodes and properties for each color? I'd go for having a node represent each color, and then draw relationships from car nodes to all color nodes that are possible for that car. Then you can store extra information on the color as properties on the color node (and by adding relationships for example to the manufacturer node or whatever). 3) Interfaces If I have the following: person – drives - car, person – drives - boat Is there a way to define drives interface which might have its own properties that can be used as template or even reused in both relationships above? If not what’s the good approach to achieve this? In our IMDB example we have Actor --Role-- Movie, where the Role is a wrapper around the realtionship. Not sure if that's what you're looking for. http://wiki.neo4j.org/content/IMDB_The_Domain Or maybe your looking for something like meta model? http://components.neo4j.org/neo4j-meta-model/ 4) Categorizing/grouping multiple nodes including relationships What is the best strategy of grouping nodes if I want to include relationships as well? For example, person 1 – owns à car 1car 1 – sold à person 2 then car 1 -- sold àperson 3 I want to keep track of how long each person had car 1; this also need to account for each person having more than one car. Not sure what your requirements are here. One simple way to model this would be purchased and sold relationships between persons and cars, both having a property keeping the date. Depending on your needs, you could have a current_owner relationship as well. 5) Neo clustering (load balancing) / accessing from multiple sources From what I read I understand that Neo only accessible from JVM that runs it. I leave this one for someone else to chime in on! /anders ___ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo] General questions
Max and Anders, Thanks much for your replies and detail info! I think I have better understanding now about reusability via inheritance and interfaces. I see now that if I want to define things once and then extend/reuse them I simply need to create my own wrappers in language of choice (ie Java) IMDB role as wrapper around relationship is perfect example. For multi-value I like setProperty API very useful. Categorizing/grouping I realized I mightve not been very clear. So let me provide different example. Suppose I haveActor starts in à Show airs on à Network I want to keep track when given actor started in given show that air on given Network. Id like to keep this 3 way relationship as constant but have property (or something similar) that will keep track of dates when Actors/networks change while relationships and show remain constant. Max, for clustering, I checked Restful API (very useful) but still ties everything into one app server that neo is running under. I wont be able to run that server as cluster unless I have some smart logic that will have server not running Neo hit other server that runs Neo via Rest API which is messy. Its definitely possibility but hope there better way. Regards, Ilya ___ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo] General questions
Ilya, Remember that we have no 3 way relationships (as in types), you have use a node for anything that connects more than two objects. So break down Show into Episodes if you want to to track the 1st (or only) airing of that episode. Actor 1 = Node 1 Class Actor Show 1 = Node 2 Class Show Network 1 = Node 3 Class Network Season 1 = Node 4 Class Season Season 2 = Node 5 Class Season Episodes 1-12 = Nodes 6-17 Class Episodes Network 2 = Node 18 Class Network Episodes 13-24 = Nodes 19-30 Class Episodes Actor 1 STARRED_ON Show 1 Actor 1 APPEARED_ON Episode 3 Actor 1 APPEARED_ON Episode 20 Episode 1 AIRED_ON Network 1 Episode 20 AIRED_ON Network 2 -- Now, if you want to keep track of Re-Runs on different networks then you have to change that AIRED_ON relationship into a Node class. Aired_on 1 PLAYED_ON Network 2 Aired_on 1 IS_A Episode 20 The trick for me has been to find all the many-to-many relationships and break them down into nodes and if the idea is to eventually have a data warehouse with slowly changing dimensions, then bake those in as Instances. With the rest API NEO4j becomes a web server. Have 50 of them if you want, multicast the writes, load balance the reads, etc. Suppose I haveActor – starts in à Show – airs on à Network I want to keep track when given actor started in given show that air on given Network. I’d like to keep this 3 way relationship as constant but have property (or something similar) that will keep track of dates when Actors/networks change while relationships and show remain constant. On Sun, May 2, 2010 at 4:44 PM, ilya il...@nyc.rr.com wrote: Max and Anders, Thanks much for your replies and detail info! I think I have better understanding now about reusability via inheritance and interfaces. I see now that if I want to define things once and then extend/reuse them I simply need to create my own wrappers in language of choice (ie Java) IMDB role as wrapper around relationship is perfect example. For multi-value I like setProperty API – very useful. Categorizing/grouping – I realized I might’ve not been very clear. So let me provide different example. Suppose I haveActor – starts in à Show – airs on à Network I want to keep track when given actor started in given show that air on given Network. I’d like to keep this 3 way relationship as constant but have property (or something similar) that will keep track of dates when Actors/networks change while relationships and show remain constant. Max, for clustering, I checked Restful API (very useful) but still ties everything into one app server that neo is running under. I won’t be able to run that server as cluster unless I have some smart logic that will have server not running Neo hit other server that runs Neo via Rest API which is messy. It’s definitely possibility but hope there better way. Regards, Ilya ___ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo] General questions
Hi all, I went through all docs on Neo site and it looks very interesting. However, I still have couple of things I was wondering about that I couldnt find answers to. I hope I can get some information or someone can point me in the right direction on some of these. Sorry for many questions but really appreciate it even if only some can be answered. 1) Inheritance. Suppose I want to draw tree where every node is derived from other node; say Car à Sedan à Toyota So when creating Toyota node I dont need to recreate same properties and relationships that Sedan has. Is there something in Neo that will help me achieve this? If not whats the best (or good approach) of achieving this? (ie assuming I use Java - should I keep my own class hierarchy?) At the same time I wonder how this structure will affect indexing/searching (ie find all car/sedan/Toyotas) 2) Multi value properties When it come to properties I see I can store key=value pairs but what if I want to store key=values For example, Id like to have property possibleColors where my values are red, blue, green, etc Do I need to create separate nodes and properties for each color? 3) Interfaces If I have the following: person drives - car, person drives - boat Is there a way to define drives interface which might have its own properties that can be used as template or even reused in both relationships above? If not whats the good approach to achieve this? 4) Categorizing/grouping multiple nodes including relationships What is the best strategy of grouping nodes if I want to include relationships as well? For example, person 1 owns à car 1car 1 sold à person 2 then car 1 -- sold àperson 3 I want to keep track of how long each person had car 1; this also need to account for each person having more than one car. 5) Neo clustering (load balancing) / accessing from multiple sources From what I read I understand that Neo only accessible from JVM that runs it. So if I want to access it from the web I would probably setup Application server such as JBoss and have it run in the same JVM. How does one address the following: - In case I want to do load balancing say run 2 JBoss instances in cluster mode that need to access Neo? - What if I want to connect to Neo both via web and via stand alone process (probably run on different machine) for batch processing. Sorry for too many questions but these are really important for my architecture. Thanks a lot, Ilya ___ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo] General questions
Hi all, I went through all docs on Neo site and it looks very interesting. However, I still have couple of things I was wondering about that I couldnt find answers to. I hope I can get some information or someone can point me in the right direction on some of these. Sorry for many questions but really appreciate it even if only some can be answered. 1) Inheritance. Suppose I want to draw tree where every node is derived from other node; say Car à Sedan à Toyota So when creating Toyota node I dont need to recreate same properties and relationships that Sedan has. Is there something in Neo that will help me achieve this? If not whats the best (or good approach) of achieving this? (ie assuming I use Java - should I keep my own class hierarchy?) At the same time I wonder how this structure will affect indexing/searching (ie find all car/sedan/Toyotas) 2) Multi value properties When it come to properties I see I can store key=value pairs but what if I want to store key=values For example, Id like to have property possibleColors where my values are red, blue, green, etc Do I need to create separate nodes and properties for each color? 3) Interfaces If I have the following: person drives - car, person drives - boat Is there a way to define drives interface which might have its own properties that can be used as template or even reused in both relationships above? If not whats the good approach to achieve this? 4) Categorizing/grouping multiple nodes including relationships What is the best strategy of grouping nodes if I want to include relationships as well? For example, person 1 owns à car 1car 1 sold à person 2 then car 1 -- sold àperson 3 I want to keep track of how long each person had car 1; this also need to account for each person having more than one car. 5) Neo clustering (load balancing) / accessing from multiple sources From what I read I understand that Neo only accessible from JVM that runs it. So if I want to access it from the web I would probably setup Application server such as JBoss and have it run in the same JVM. How does one address the following: - In case I want to do load balancing say run 2 JBoss instances in cluster mode that need to access Neo? - What if I want to connect to Neo both via web and via stand alone process (probably run on different machine) for batch processing. Sorry for too many questions but these are really important for my architecture. Thanks a lot, Ilya ___ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo] General questions
I'm no expert, but I tried to answer your questions. On Sat, May 1, 2010 at 7:23 PM, ilya il...@nyc.rr.com wrote: Hi all, I went through all docs on Neo site and it looks very interesting. However, I still have couple of things I was wondering about that I couldn’t find answers to. I hope I can get some information or someone can point me in the right direction on some of these. Sorry for many questions but really appreciate it even if only some can be answered. 1) Inheritance. Suppose I want to draw tree where every node is derived from other node; say Car à Sedan à Toyota So when creating Toyota node I don’t need to recreate same properties and relationships that Sedan has. Is there something in Neo that will help me achieve this? If not what’s the best (or good approach) of achieving this? (ie assuming I use Java - should I keep my own class hierarchy?) At the same time I wonder how this structure will affect indexing/searching (ie find all car/sedan/Toyotas) Just create a Camry Se Node that IS_A Sedan and IS_A Car. Traverse IS_A relationships and add property where the property doesn't already exist. 2) Multi value properties When it come to properties I see I can store key=value pairs but what if I want to store key=values For example, I’d like to have property possibleColors where my values are red, blue, green, etc Do I need to create separate nodes and properties for each color? You can store a delimited string as a property or use JSON. 3) Interfaces If I have the following: person – drives - car, person – drives - boat Is there a way to define drives interface which might have its own properties that can be used as template or even reused in both relationships above? If not what’s the good approach to achieve this? Drives can be a relationship type which has its own properties which you can customize. Remember that NEO doesn't really enforce the properties in a node or a relationship, so you can add whatever you want. 4) Categorizing/grouping multiple nodes including relationships What is the best strategy of grouping nodes if I want to include relationships as well? For example, person 1 – owns à car 1car 1 – sold à person 2 then car 1 -- sold àperson 3 I want to keep track of how long each person had car 1; this also need to account for each person having more than one car. 3 Person nodes, 2 Car nodes Person 1 OWNED (relationship: start_date, end_date) Car 1 Node Person 1 OWNED (relationship: start_date, end_date) Car 2 Node Person 2 OWNED (relationship: start_date, end_date) Car 1 Node For multi relationship objects you switch from a relationship to a node. Trasfer Node - Sold_By Relationship to Person 1 Trasfer Node - Sold_to Relationship to Person 2 Trasfer Node - Thing_Sold Relationship to Car 1 Transfer Node can have a property of transfer_date, and transfer_price 5) Neo clustering (load balancing) / accessing from multiple sources From what I read I understand that Neo only accessible from JVM that runs it. So if I want to access it from the web I would probably setup Application server such as JBoss and have it run in the same JVM. How does one address the following: - In case I want to do load balancing say run 2 JBoss instances in cluster mode that need to access Neo? - What if I want to connect to Neo both via web and via stand alone process (probably run on different machine) for batch processing. See work on REST API. Sorry for too many questions but these are really important for my architecture. Thanks a lot, Ilya ___ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user ___ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user