Re: [Neo4j] write to graph with python
can you post the entire context and initialization settings? On 6/23/11, Michael Hunger wrote: > Is that the python REST binding or the python binding for a local graph > database? > > If you run the server you have to work with the REST API (and bindings for > that): > > http://components.neo4j.org/neo4j-server/snapshot/rest.html > and here > http://docs.neo4j.org/chunked/1.4-SNAPSHOT/rest-api.html > > one of the python REST bindings is here: > https://github.com/jblomo/neo4j-rest-client > > there are others; > http://wiki.neo4j.org/content/Main_Page#Language_and_framework_bindings > > Cheers > > Michael > > Am 22.06.2011 um 19:21 schrieb Khanh Nguyen: > >> Hi, >> >> I'm new with neo4j. I set up the server and install python binding for >> neo4j. I can monitor the server through my browser. Then I tried to >> create 100 nodes in python >> with graphdb.transaction: for i in range(100): gb.node() >> >> but the web interfact doesn't seem to reflect the updates. What am I >> missing? Thanks. >> >> Regards, >> >> -k >> ___ >> Neo4j mailing list >> User@lists.neo4j.org >> https://lists.neo4j.org/mailman/listinfo/user > > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > -- Aliabbas Petiwala M.Tech CSE ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] How to rotate the logical log
2011/6/22 Pere Urbon Bayes > HI, is there any way to force the rotation of the logical log of neo4j? > > I can guess is something like > > // get the XaDataSource for the native store > TxModule txModule = ((EmbeddedGraphDatabase) > graphDb).getConfig().getTxModule(); > XaDataSourceManager xaDsMgr = txModule.getXaDataSourceManager(); > XaDataSource xaDs = xaDsMgr.getXaDataSource( "nioneodb" ); > > xaDs.rotateLogicalLog() > That is the way to do it yes. > > > but as seen in the community source code, > > public void rotateLogicalLog() throws IOException > { > >throw new UnsupportedOperationException( getClass().getName() ); >} > > I am missing something? and I can not find the correct implementation > of this methods into the NiNeoDataSource. > > org.neo4j.kernel.impl.transaction.xaframework.XaDataSource have that implementation, yes. But as you can see org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource extends org.neo4j.kernel.impl.transaction.xaframework.LogBackedXaDataSource which has a correct implementation of that method. So your piece of code there works they way you'd like. > > /purbon > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Compound query sort by score
That should be possibly, I can't think of any reason why not. 2011/6/22 Milena Araujo > Hello all ! > > So, looking here: > > http://docs.neo4j.org/chunked/snapshot/indexing-lucene-extras.html#indexing-lucene-sort > There's an example of how to sort by score and later on, how to make a > compound query. > Is it possible to do both ? > Something like: hits = movies.query( new QueryContext("title:*Matrix* AND > year:1999" ).sortByScore() ); > > Thanks, > > Milena Araujo. > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] write to graph with python
Is that the python REST binding or the python binding for a local graph database? If you run the server you have to work with the REST API (and bindings for that): http://components.neo4j.org/neo4j-server/snapshot/rest.html and here http://docs.neo4j.org/chunked/1.4-SNAPSHOT/rest-api.html one of the python REST bindings is here: https://github.com/jblomo/neo4j-rest-client there are others; http://wiki.neo4j.org/content/Main_Page#Language_and_framework_bindings Cheers Michael Am 22.06.2011 um 19:21 schrieb Khanh Nguyen: > Hi, > > I'm new with neo4j. I set up the server and install python binding for > neo4j. I can monitor the server through my browser. Then I tried to > create 100 nodes in python > >>> with graphdb.transaction: for i in range(100): gb.node() > > but the web interfact doesn't seem to reflect the updates. What am I > missing? Thanks. > > Regards, > > -k > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] write to graph with python
Hi, I'm new with neo4j. I set up the server and install python binding for neo4j. I can monitor the server through my browser. Then I tried to create 100 nodes in python >> with graphdb.transaction: for i in range(100): gb.node() but the web interfact doesn't seem to reflect the updates. What am I missing? Thanks. Regards, -k ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] How to rotate the logical log
HI, is there any way to force the rotation of the logical log of neo4j? I can guess is something like // get the XaDataSource for the native store TxModule txModule = ((EmbeddedGraphDatabase) graphDb).getConfig().getTxModule(); XaDataSourceManager xaDsMgr = txModule.getXaDataSourceManager(); XaDataSource xaDs = xaDsMgr.getXaDataSource( "nioneodb" ); xaDs.rotateLogicalLog() but as seen in the community source code, public void rotateLogicalLog() throws IOException { throw new UnsupportedOperationException( getClass().getName() ); } I am missing something? and I can not find the correct implementation of this methods into the NiNeoDataSource. /purbon ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] Compound query sort by score
Hello all ! So, looking here: http://docs.neo4j.org/chunked/snapshot/indexing-lucene-extras.html#indexing-lucene-sort There's an example of how to sort by score and later on, how to make a compound query. Is it possible to do both ? Something like: hits = movies.query( new QueryContext("title:*Matrix* AND year:1999" ).sortByScore() ); Thanks, Milena Araujo. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Can I model a Graph data structure without persisting it in DB using Neo4j ?
I am confused, elements is defined as @RelatedTo(type = "ELEMENT", elementClass = Element.class, direction = OUTGOING) private Set elements; if I call getElements() without persisting the node first, will it not return null ? It is throwing null pointer exception. When I persist the node before calling getElements, then it returns empty set. This is in line with my original email. Do you want me to do something else? Please let me know On Wed, Jun 22, 2011 at 8:39 PM, Michael Hunger < michael.hun...@neotechnology.com> wrote: > getElements() returns a set of your elements. If you do an add(element) on > those then you build up an in-memory structure. > > So if you use just the getters and setters of your instances you can > navigate this structure, but you can't use any of the graph operations > supplied by neo4j (remember it is still just in memory) > > Cheers > > Michael > > Am 22.06.2011 um 17:06 schrieb V: > > Michael - > > In my quest for a cleaner solution , I am coming back to your original > reply > > What do you mean by *"Right now this works only with the getElements().add > method."* > Please elaborate . > > Thanks for your help . > > > On Sun, Jun 19, 2011 at 2:34 AM, Michael Hunger < > michael.hun...@neotechnology.com> wrote: > >> Right now this works only with the getElements().add method. >> >> But then you don't get all the graph methods (traversals and such). >> >> We discussed some time ago writing a virtual graph layer on top of the >> real nodes and relationships for SDG. >> (That should be then used to have a simpler handling of attached/detached >> nodes and keeping back-references for cluster-persistance). >> >> >> But that hasn't happend yet and I'm not convinced it will make it in the >> 1.1. timeframe. >> >> Cheers >> >> Michael >> >> P.S. You can still persist your graph and remove the nodes later (either >> index them on a "transient" index or keep their node-id's somewhere). >> >> >> Am 18.06.2011 um 03:40 schrieb V: >> >> Any suggestions on this please ? >> >> >> On Fri, Jun 17, 2011 at 11:03 PM, V wrote: >> >>> I created a graph model with 2 classes Node and Element as follows: >>> >>> public class Node { >>> >>> @RelatedTo(type = "ELEMENT", elementClass = Element.class, direction = >>> OUTGOING) >>> private Set Element; >>> >>> >>> public void addElement(Element e) { >>> relateTo(e, Relationships.ELEMENT.toString()); >>> } >>> >>> } >>> >>> public class Element{ >>> >>>public String name; >>> >>> } >>> I want to create an in memory graph structure without persisting the >>> nodes as follows : >>> >>> Node n = new Node(); >>> n.addElement(new Element()); >>> >>> *However it throws an exception as the Node n has not been persisted so >>> the call to relateTo(..) fails. * >>> >>> If instead I do >>> n.persist() >>> and then call addElement(..) it works fine as the aspect kicks in. >>> >>> Any workaround for this ? That is, is there a way I can still use the >>> above style without persisting the Node object ? >>> >>> >>> My application needs this as first I create a structure and persist it, >>> and then I create another structure to pass around some values to the >>> persisted structure when doing some computations. >>> >>> -Karan >>> >>> >>> >>> >> >> > > ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Can I model a Graph data structure without persisting it in DB using Neo4j ?
getElements() returns a set of your elements. If you do an add(element) on those then you build up an in-memory structure. So if you use just the getters and setters of your instances you can navigate this structure, but you can't use any of the graph operations supplied by neo4j (remember it is still just in memory) Cheers Michael Am 22.06.2011 um 17:06 schrieb V: > Michael - > > In my quest for a cleaner solution , I am coming back to your original reply > > What do you mean by "Right now this works only with the getElements().add > method." > Please elaborate . > > Thanks for your help . > > > On Sun, Jun 19, 2011 at 2:34 AM, Michael Hunger > wrote: > Right now this works only with the getElements().add method. > > But then you don't get all the graph methods (traversals and such). > > We discussed some time ago writing a virtual graph layer on top of the real > nodes and relationships for SDG. > (That should be then used to have a simpler handling of attached/detached > nodes and keeping back-references for cluster-persistance). > > > But that hasn't happend yet and I'm not convinced it will make it in the 1.1. > timeframe. > > Cheers > > Michael > > P.S. You can still persist your graph and remove the nodes later (either > index them on a "transient" index or keep their node-id's somewhere). > > > Am 18.06.2011 um 03:40 schrieb V: > >> Any suggestions on this please ? >> >> >> On Fri, Jun 17, 2011 at 11:03 PM, V wrote: >> I created a graph model with 2 classes Node and Element as follows: >> >> public class Node { >> >> @RelatedTo(type = "ELEMENT", elementClass = Element.class, direction = >> OUTGOING) >> private Set Element; >> >> >> public void addElement(Element e) { >> relateTo(e, Relationships.ELEMENT.toString()); >> } >> >> } >> >> public class Element{ >> >>public String name; >> >> } >> I want to create an in memory graph structure without persisting the nodes >> as follows : >> >> Node n = new Node(); >> n.addElement(new Element()); >> >> However it throws an exception as the Node n has not been persisted so the >> call to relateTo(..) fails. >> >> If instead I do >> n.persist() >> and then call addElement(..) it works fine as the aspect kicks in. >> >> Any workaround for this ? That is, is there a way I can still use the above >> style without persisting the Node object ? >> >> >> My application needs this as first I create a structure and persist it, and >> then I create another structure to pass around some values to the persisted >> structure when doing some computations. >> >> -Karan >> >> >> >> > > ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Can I model a Graph data structure without persisting it in DB using Neo4j ?
Michael - In my quest for a cleaner solution , I am coming back to your original reply What do you mean by *"Right now this works only with the getElements().add method."* Please elaborate . Thanks for your help . On Sun, Jun 19, 2011 at 2:34 AM, Michael Hunger < michael.hun...@neotechnology.com> wrote: > Right now this works only with the getElements().add method. > > But then you don't get all the graph methods (traversals and such). > > We discussed some time ago writing a virtual graph layer on top of the real > nodes and relationships for SDG. > (That should be then used to have a simpler handling of attached/detached > nodes and keeping back-references for cluster-persistance). > > > But that hasn't happend yet and I'm not convinced it will make it in the > 1.1. timeframe. > > Cheers > > Michael > > P.S. You can still persist your graph and remove the nodes later (either > index them on a "transient" index or keep their node-id's somewhere). > > > Am 18.06.2011 um 03:40 schrieb V: > > Any suggestions on this please ? > > > On Fri, Jun 17, 2011 at 11:03 PM, V wrote: > >> I created a graph model with 2 classes Node and Element as follows: >> >> public class Node { >> >> @RelatedTo(type = "ELEMENT", elementClass = Element.class, direction = >> OUTGOING) >> private Set Element; >> >> >> public void addElement(Element e) { >> relateTo(e, Relationships.ELEMENT.toString()); >> } >> >> } >> >> public class Element{ >> >>public String name; >> >> } >> I want to create an in memory graph structure without persisting the nodes >> as follows : >> >> Node n = new Node(); >> n.addElement(new Element()); >> >> *However it throws an exception as the Node n has not been persisted so >> the call to relateTo(..) fails. * >> >> If instead I do >> n.persist() >> and then call addElement(..) it works fine as the aspect kicks in. >> >> Any workaround for this ? That is, is there a way I can still use the >> above style without persisting the Node object ? >> >> >> My application needs this as first I create a structure and persist it, >> and then I create another structure to pass around some values to the >> persisted structure when doing some computations. >> >> -Karan >> >> >> >> > > ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Find 2nd degree friends in order of mutual friend
On Wed, Jun 22, 2011 at 4:04 PM, Andres Taylor < andres.tay...@neotechnology.com> wrote: > As part of the next milestone, which should come out tomorrow, we'll > package a* Cypher-plugin*, that allows you to do Gremlin queries over the > wire: http://docs.neo4j.org/chunked/1.4-SNAPSHOT/gremlin-plugin.html We'll package both a Cypher plugin, and a Gremlin plugin, but you are only interested in the Gremlin one. Sorry for the typo. Andrés ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Find 2nd degree friends in order of mutual friend
As part of the next milestone, which should come out tomorrow, we'll package a Cypher-plugin, that allows you to do Gremlin queries over the wire: http://docs.neo4j.org/chunked/1.4-SNAPSHOT/gremlin-plugin.html If you are using a snapshot version, it should already be there. Andrés On Wed, Jun 22, 2011 at 3:22 PM, Fajar Maulana Firdaus wrote: > I have been reading a little bit about gremlin, I think it is really great. > > However is it possible to get similar result using REST API? > > regards, > > > On Fri, Jun 17, 2011 at 8:31 PM, Marko Rodriguez >wrote: > > > Hi, > > > > In Gremlin (http://gremlin.tinkerpop.com), friends of a friend (FOAF) > who > > are not my friends: > > > >x = [] as Set > >g.v(1).out('friend').aggregate(x).out('friend').except(x) > > > > - x is a Set to save intermediate friend vertices to to exclude (except) > > from the final step. > > - g is your graph (e.g. g = new Neo4jGraph('/tmp/graph')) > > - g.v(1) will grab vertex 1 by its id > > > > If you give me some particular things you want to say, I can provide you > > the Gremlin code to do it. > > > > Thanks, > > Marko. > > > > http://markorodriguez.com > > > > On Jun 17, 2011, at 7:08 AM, faja...@gmail.com wrote: > > > > > Oh thank you, > > > > > > As I mentioned, I am new to neo4j. So a little sample code would be > very > > useful in my learning process. :) > > > > > > My current state is that I managed to add few nodes, and add friend > > relationship between several nodes. > > > > > > User - friend - other node. > > > > > > Friend is relationship > > > > > > I don't have a very big node number so I think your suggested approach > > will work. > > > > > > Fajar > > > > > > Sent from my BlackBerry® smartphone from Sinyal Bagus XL, Nyambung > > Teruuusss...! > > > > > > -Original Message- > > > From: Peter Neubauer > > > Sender: user-boun...@lists.neo4j.org > > > Date: Fri, 17 Jun 2011 14:12:48 > > > To: Neo4j user discussions > > > Reply-To: Neo4j user discussions > > > Subject: Re: [Neo4j] Find 2nd degree friends in order of mutual friend > > > > > > Hi Fajar, > > > this is a depth 2 traversal from the person in question. While > > > exhaustively traversing his friends, you increase the group count as > > > for each FOAF you get on the second step. > > > > > > However, we have seen edge cases with supernodes where in a social > > > network, persons can have 50K friends. There, you might use heuristics > > > or indexing approaches to make this very fast. > > > > > > If you have some more details, I could write down the query in Gremlin > > > or Cypher ( > http://docs.neo4j.org/chunked/snapshot/cypher-query-lang.html > > ), > > > but in principle, it would be like > > > https://github.com/tinkerpop/gremlin/wiki (actually using 3 steps, I > > > think we could get it down to 2) for Gremlin. > > > > > > In neo4j, if things are not cached, only the parts the data that are > > > needed for this traversal wil be loaded from disk, so you don't need > > > to hold all the graph in cache for this, since it is a data-local > > > operation. > > > > > > HTH > > > > > > Cheers, > > > > > > /peter neubauer > > > > > > GTalk: neubauer.peter > > > Skype peter.neubauer > > > Phone +46 704 106975 > > > LinkedIn http://www.linkedin.com/in/neubauer > > > Twitter http://twitter.com/peterneubauer > > > > > > http://www.neo4j.org - Your high performance graph > > database. > > > http://startupbootcamp.org/- Öresund - Innovation happens HERE. > > > http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing > party. > > > > > > > > > > > > On Fri, Jun 17, 2011 at 1:33 PM, Fajar Maulana Firdaus > > > wrote: > > >> Hi all, > > >> > > >> I am new to neo4j and excited to know more about graph database. > > >> > > >> First of all, could anyone please help me to figure out the > > documentation > > >> about the query or rest client? > > >> > > >> Then, back to my question, I want to find 2nd degree friends but > ordered > > by > > >> number of mutual friend. I understand that if I have all data in > memory, > > I > > >> could've traverse the graph to 2nd level, and keep counter for each > > nodes in > > >> 2nd level. So in away its like finding all paths from start node to > all > > >> second degree friend, but if we do that, it would be inefficient. > > >> > > >> Does anyone have any idea how to do this with neo4j? > > >> > > >> Thank you, > > >> Fajarmf > > >> ___ > > >> Neo4j mailing list > > >> User@lists.neo4j.org > > >> https://lists.neo4j.org/mailman/listinfo/user > > >> > > > ___ > > > Neo4j mailing list > > > User@lists.neo4j.org > > > https://lists.neo4j.org/mailman/listinfo/user > > > ___ > > > Neo4j mailing list > > > User@lists.neo4j.org > > > https://lists.neo4j.org/mailman/listinfo/user > > > >
Re: [Neo4j] Find 2nd degree friends in order of mutual friend
Hi Fajar, You can do that by writing either server plugins, or unmanaged extensions. Here is how: http://docs.neo4j.org/chunked/milestone/server-plugins.html http://docs.neo4j.org/chunked/milestone/server-unmanaged-extensions.html Cheers, Dario Am 22.06.11 15:22 schrieb "Fajar Maulana Firdaus" unter : > I have been reading a little bit about gremlin, I think it is really great. > > However is it possible to get similar result using REST API? > > regards, > > > On Fri, Jun 17, 2011 at 8:31 PM, Marko Rodriguez wrote: > >> Hi, >> >> In Gremlin (http://gremlin.tinkerpop.com), friends of a friend (FOAF) who >> are not my friends: >> >>x = [] as Set >>g.v(1).out('friend').aggregate(x).out('friend').except(x) >> >> - x is a Set to save intermediate friend vertices to to exclude (except) >> from the final step. >> - g is your graph (e.g. g = new Neo4jGraph('/tmp/graph')) >> - g.v(1) will grab vertex 1 by its id >> >> If you give me some particular things you want to say, I can provide you >> the Gremlin code to do it. >> >> Thanks, >> Marko. >> >> http://markorodriguez.com >> >> On Jun 17, 2011, at 7:08 AM, faja...@gmail.com wrote: >> >>> Oh thank you, >>> >>> As I mentioned, I am new to neo4j. So a little sample code would be very >> useful in my learning process. :) >>> >>> My current state is that I managed to add few nodes, and add friend >> relationship between several nodes. >>> >>> User - friend - other node. >>> >>> Friend is relationship >>> >>> I don't have a very big node number so I think your suggested approach >> will work. >>> >>> Fajar >>> >>> Sent from my BlackBerry® smartphone from Sinyal Bagus XL, Nyambung >> Teruuusss...! >>> >>> -Original Message- >>> From: Peter Neubauer >>> Sender: user-boun...@lists.neo4j.org >>> Date: Fri, 17 Jun 2011 14:12:48 >>> To: Neo4j user discussions >>> Reply-To: Neo4j user discussions >>> Subject: Re: [Neo4j] Find 2nd degree friends in order of mutual friend >>> >>> Hi Fajar, >>> this is a depth 2 traversal from the person in question. While >>> exhaustively traversing his friends, you increase the group count as >>> for each FOAF you get on the second step. >>> >>> However, we have seen edge cases with supernodes where in a social >>> network, persons can have 50K friends. There, you might use heuristics >>> or indexing approaches to make this very fast. >>> >>> If you have some more details, I could write down the query in Gremlin >>> or Cypher (http://docs.neo4j.org/chunked/snapshot/cypher-query-lang.html >> ), >>> but in principle, it would be like >>> https://github.com/tinkerpop/gremlin/wiki (actually using 3 steps, I >>> think we could get it down to 2) for Gremlin. >>> >>> In neo4j, if things are not cached, only the parts the data that are >>> needed for this traversal wil be loaded from disk, so you don't need >>> to hold all the graph in cache for this, since it is a data-local >>> operation. >>> >>> HTH >>> >>> Cheers, >>> >>> /peter neubauer >>> >>> GTalk: neubauer.peter >>> Skype peter.neubauer >>> Phone +46 704 106975 >>> LinkedIn http://www.linkedin.com/in/neubauer >>> Twitter http://twitter.com/peterneubauer >>> >>> http://www.neo4j.org - Your high performance graph >> database. >>> http://startupbootcamp.org/- Öresund - Innovation happens HERE. >>> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. >>> >>> >>> >>> On Fri, Jun 17, 2011 at 1:33 PM, Fajar Maulana Firdaus >>> wrote: Hi all, I am new to neo4j and excited to know more about graph database. First of all, could anyone please help me to figure out the >> documentation about the query or rest client? Then, back to my question, I want to find 2nd degree friends but ordered >> by number of mutual friend. I understand that if I have all data in memory, >> I could've traverse the graph to 2nd level, and keep counter for each >> nodes in 2nd level. So in away its like finding all paths from start node to all second degree friend, but if we do that, it would be inefficient. Does anyone have any idea how to do this with neo4j? Thank you, Fajarmf ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user >>> ___ >>> Neo4j mailing list >>> User@lists.neo4j.org >>> https://lists.neo4j.org/mailman/listinfo/user >>> ___ >>> Neo4j mailing list >>> User@lists.neo4j.org >>> https://lists.neo4j.org/mailman/listinfo/user >> >> ___ >> Neo4j mailing list >> User@lists.neo4j.org >> https://lists.neo4j.org/mailman/listinfo/user >> > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listi
Re: [Neo4j] Find 2nd degree friends in order of mutual friend
I have been reading a little bit about gremlin, I think it is really great. However is it possible to get similar result using REST API? regards, On Fri, Jun 17, 2011 at 8:31 PM, Marko Rodriguez wrote: > Hi, > > In Gremlin (http://gremlin.tinkerpop.com), friends of a friend (FOAF) who > are not my friends: > >x = [] as Set >g.v(1).out('friend').aggregate(x).out('friend').except(x) > > - x is a Set to save intermediate friend vertices to to exclude (except) > from the final step. > - g is your graph (e.g. g = new Neo4jGraph('/tmp/graph')) > - g.v(1) will grab vertex 1 by its id > > If you give me some particular things you want to say, I can provide you > the Gremlin code to do it. > > Thanks, > Marko. > > http://markorodriguez.com > > On Jun 17, 2011, at 7:08 AM, faja...@gmail.com wrote: > > > Oh thank you, > > > > As I mentioned, I am new to neo4j. So a little sample code would be very > useful in my learning process. :) > > > > My current state is that I managed to add few nodes, and add friend > relationship between several nodes. > > > > User - friend - other node. > > > > Friend is relationship > > > > I don't have a very big node number so I think your suggested approach > will work. > > > > Fajar > > > > Sent from my BlackBerry® smartphone from Sinyal Bagus XL, Nyambung > Teruuusss...! > > > > -Original Message- > > From: Peter Neubauer > > Sender: user-boun...@lists.neo4j.org > > Date: Fri, 17 Jun 2011 14:12:48 > > To: Neo4j user discussions > > Reply-To: Neo4j user discussions > > Subject: Re: [Neo4j] Find 2nd degree friends in order of mutual friend > > > > Hi Fajar, > > this is a depth 2 traversal from the person in question. While > > exhaustively traversing his friends, you increase the group count as > > for each FOAF you get on the second step. > > > > However, we have seen edge cases with supernodes where in a social > > network, persons can have 50K friends. There, you might use heuristics > > or indexing approaches to make this very fast. > > > > If you have some more details, I could write down the query in Gremlin > > or Cypher (http://docs.neo4j.org/chunked/snapshot/cypher-query-lang.html > ), > > but in principle, it would be like > > https://github.com/tinkerpop/gremlin/wiki (actually using 3 steps, I > > think we could get it down to 2) for Gremlin. > > > > In neo4j, if things are not cached, only the parts the data that are > > needed for this traversal wil be loaded from disk, so you don't need > > to hold all the graph in cache for this, since it is a data-local > > operation. > > > > HTH > > > > Cheers, > > > > /peter neubauer > > > > GTalk: neubauer.peter > > Skype peter.neubauer > > Phone +46 704 106975 > > LinkedIn http://www.linkedin.com/in/neubauer > > Twitter http://twitter.com/peterneubauer > > > > http://www.neo4j.org - Your high performance graph > database. > > http://startupbootcamp.org/- Öresund - Innovation happens HERE. > > http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party. > > > > > > > > On Fri, Jun 17, 2011 at 1:33 PM, Fajar Maulana Firdaus > > wrote: > >> Hi all, > >> > >> I am new to neo4j and excited to know more about graph database. > >> > >> First of all, could anyone please help me to figure out the > documentation > >> about the query or rest client? > >> > >> Then, back to my question, I want to find 2nd degree friends but ordered > by > >> number of mutual friend. I understand that if I have all data in memory, > I > >> could've traverse the graph to 2nd level, and keep counter for each > nodes in > >> 2nd level. So in away its like finding all paths from start node to all > >> second degree friend, but if we do that, it would be inefficient. > >> > >> Does anyone have any idea how to do this with neo4j? > >> > >> Thank you, > >> Fajarmf > >> ___ > >> Neo4j mailing list > >> User@lists.neo4j.org > >> https://lists.neo4j.org/mailman/listinfo/user > >> > > ___ > > Neo4j mailing list > > User@lists.neo4j.org > > https://lists.neo4j.org/mailman/listinfo/user > > ___ > > Neo4j mailing list > > User@lists.neo4j.org > > https://lists.neo4j.org/mailman/listinfo/user > > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] design decision and owl \ semantic support
Hi Folks, we are looking forward to make an OWL ontology database as a mirror of a relational database for an upcoming social network semantic website is it a good decision to make? actually we can go for three options: 1 complete owl\graph database, no relational db 2 owl mirror of relational db 3 only relational how can owL Ontology database be efficient than a relational one considering that we will need to query a lot of external databases like dbpedia,freebase etc? for the second option, ontological databases requires us to make a query against hundreds of different schemata and classes properties which seems to be a costly affair. And is it a wise decision to go for a complete ontological database for a social networking website ? The project is involves sharing of lot of small chunks of information across an array of distributed users building a personalized model of the user. ontotext, http://www.systap.com,http://www.opencalais.com/ provides a solution for semantic repositories , whereas neo4j is a graph database its really difficult to determine which is the best option and how to make the website ready for the semantic web. -- Aliabbas Petiwala M.Tech CSE -- Aliabbas Petiwala M.Tech CSE ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Unexpected error
Are you indexing this in a single transaction or what's the isolation for inserts? 2011/6/20 Massimo Lusetti > On Thu, Jun 16, 2011 at 5:20 PM, Mattias Persson > wrote: > > > Hi, could you clarify a bit what you mean? Do you have one node which is > > indexed in one index with millions of key/value pairs? What about > > relationships, you said that you had many relationships to a single node. > > How many relationships can one node have in your model? > > I have one node indexed in one index with one indexed property named > which have millions values, fox ex: > - Node id 10 is indexed within index "identify" with this key / value > pairs: >KEYVALUE > identity 1 > identity 2 > identity 3 > ... ... > identity 250.000.000 > > These key/value pairs are the only present in that specific index and > are unique. > > I have to finish the load of my data into DB but perhaps it could have > 100.000.000 relationships. > > Thanks for any hint you could give... > -- > Massimo > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] REST Traversal docs
Be aware that for the 1.4 M05 release these have been updated. Key names for your traversers are now separated by underscores rather than spaces in the docs and in the code*. Jim * OK, we actually are a bit permissive in the code, but you should assume underscores. On 22 Jun 2011, at 13:03, noppanit wrote: > Just to add you could have a look at here > http://components.neo4j.org/neo4j/1.4-SNAPSHOT/apidocs/org/neo4j/graphdb/Path.html > > for the object you can use in javascript as well. > > -- > View this message in context: > http://neo4j-user-list.438527.n3.nabble.com/Neo4j-REST-Traversal-docs-tp3094335p3095019.html > Sent from the Neo4J User List mailing list archive at Nabble.com. > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Multiple-source lowest-cost path search
The Dijkstra algorithm continues until it finds the end node. It could easily be modified to not stop there, just exhaust the graph and output it's entire set instead. Look at: https://github.com/neo4j/community/blob/master/graph-algo/src/main/java/org/neo4j/graphalgo/impl/path/Dijkstra.java ...and I'd rewrite the findAllPaths method to something like: public Iterable findAllPaths( Node start, final Node end ) { final Traverser traverser = TRAVERSAL.expand( expander ).order( new SelectorFactory( costEvaluator ) ).traverse( start ); return new Iterable() { public Iterator iterator() { return new StopAfterWeightIterator( traverser.iterator(), costEvaluator ); } }; } and also in: https://github.com/neo4j/community/blob/master/graph-algo/src/main/java/org/neo4j/graphalgo/impl/util/StopAfterWeightIterator.java I'd rewrite fetchNextOrNull to something like (of course, by then the class name would not be true anymore :) ): protected WeightedPath fetchNextOrNull() { if ( !paths.hasNext() ) { return null; } return new WeightedPathImpl( costEvaluator, paths.next() ); } These are just thoughts, but they ought to work right out out of this box. Best, Mattias 2011/6/20 Giacomo Bernardi > I'm not sure I understand your answer. > > What I'd like to build is a graph where every node that is not a > source has a shortest path to any one of the sources. > > Any idea? > > I see that neo4j's Dijkstra implementation requires to specify a start > AND and end node. Isn't there at least a version that calculates the > path for a start node and every other end node? > > Thanks! > > > On 20 June 2011 03:53, Akhil wrote: > > On 6/19/2011 7:11 PM, Giacomo Bernardi wrote: > >> I'd like to build a second graph in which each e in (S-E) is connected > > From what i understood, connecting S-E to an arbitary node A1 and S > > with another arbitary node A2 and finding the lowest cost shortest path > > between A1 and A2 should give you the solution > > ___ > > Neo4j mailing list > > User@lists.neo4j.org > > https://lists.neo4j.org/mailman/listinfo/user > > > > > > -- > Giacomo "mino" Bernardi > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] REST Traversal docs
Just to add you could have a look at here http://components.neo4j.org/neo4j/1.4-SNAPSHOT/apidocs/org/neo4j/graphdb/Path.html for the object you can use in javascript as well. -- View this message in context: http://neo4j-user-list.438527.n3.nabble.com/Neo4j-REST-Traversal-docs-tp3094335p3095019.html Sent from the Neo4J User List mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user