Re: [Neo4j] Traverse Order By
Peter perhaps you could update the docs of ServerPlugin to reflect that and perhaps show an example from one of the two plugins ? Cheers Michael Am 10.08.2011 um 16:02 schrieb Peter Neubauer: > Also, > That is true officially, but un practice you can return any valid > representation. Look at the Cypher plugin dir return types other than nodes > etc. > > Also, you can use an unmanaged extension for full control over both url and > return format. > > /peter > > Sent from my phone. > On Aug 10, 2011 2:16 PM, "Igor Dovgiy" wrote: >> If you can cope with some limitations of Neo4j official plugin system (the >> biggest thing for me is a bit limited choice of responce options: it can > be >> either collection of Nodes, or Relationships, or Pathes data, packed with >> JSON), may I suggest using it instead. ) >> >> In this case your DB works in server mode, and you can happily bombard it >> with many queries from many clients' instances via standard REST API, >> expanded with your plugin. >> >> And yes, we're using this kind of architecture, and kinda like it. ) >> >> -- >> -- iD >> >> On 10 August 2011 13:10, sometime wrote: >> >>> I wrote this plugin. Everything works as it should (on local). >>> I put this plugin (as web-application) on a server that is running neo4j. >>> In >>> order to receive the data - I'll do a GET-request to that > web-applications. >>> In web applications to initialize neo4j I use >>> >>> GraphDatabaseService graphDb = new EmbeddedGraphDatabase >>> ("/path_to_neo4j/data/graph.db"); >>> >>> When i do GET-request - I get an error >>> >>> Unable to lock store [/path_to_neo4j/graph.db/neostore], this is usually > a >>> result of some other Neo4j kernel running using the same store. >>> >>> I understand that the application needs to lock the entire database to > make >>> the traverse a request for it. But the base operates in real time and the >>> application should not block the base. >>> Maybe somehow I can make request to the application by URL? Or some way I >>> can make request to traverse the base without locking? >>> >>> -- >>> View this message in context: >>> > http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Traverse-Order-By-tp3209366p3242058.html >>> Sent from the Neo4j Community Discussions 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 > ___ > 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] Traverse Order By
Also, That is true officially, but un practice you can return any valid representation. Look at the Cypher plugin dir return types other than nodes etc. Also, you can use an unmanaged extension for full control over both url and return format. /peter Sent from my phone. On Aug 10, 2011 2:16 PM, "Igor Dovgiy" wrote: > If you can cope with some limitations of Neo4j official plugin system (the > biggest thing for me is a bit limited choice of responce options: it can be > either collection of Nodes, or Relationships, or Pathes data, packed with > JSON), may I suggest using it instead. ) > > In this case your DB works in server mode, and you can happily bombard it > with many queries from many clients' instances via standard REST API, > expanded with your plugin. > > And yes, we're using this kind of architecture, and kinda like it. ) > > -- > -- iD > > On 10 August 2011 13:10, sometime wrote: > >> I wrote this plugin. Everything works as it should (on local). >> I put this plugin (as web-application) on a server that is running neo4j. >> In >> order to receive the data - I'll do a GET-request to that web-applications. >> In web applications to initialize neo4j I use >> >> GraphDatabaseService graphDb = new EmbeddedGraphDatabase >> ("/path_to_neo4j/data/graph.db"); >> >> When i do GET-request - I get an error >> >> Unable to lock store [/path_to_neo4j/graph.db/neostore], this is usually a >> result of some other Neo4j kernel running using the same store. >> >> I understand that the application needs to lock the entire database to make >> the traverse a request for it. But the base operates in real time and the >> application should not block the base. >> Maybe somehow I can make request to the application by URL? Or some way I >> can make request to traverse the base without locking? >> >> -- >> View this message in context: >> http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Traverse-Order-By-tp3209366p3242058.html >> Sent from the Neo4j Community Discussions 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 ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Traverse Order By
Yes you are able to do that: * if you are running in a neo4j-server you have to access the database via the GraphDatabaseService instance that is provided from the server (because the server _owns_ it) * that's why inside a neo4j-rest server you have to get access to that instance, and that's why you have to participate in the server infrastructure by providing a ServerPlugin or Unmanaged Extension * if you are running standalone you _own_ the single GraphDatabaseService instance * EmbeddedReadOnlyDatabase only shows a snapshot Michael Am 10.08.2011 um 15:06 schrieb sometime: > I do not understand. > I have data in the database is always changing (added, removed), and because > of that my web-application needs to return different data. > I will be able to receive relevant information from the database Neo4? > > -- > View this message in context: > http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Traverse-Order-By-tp3209366p3242487.html > Sent from the Neo4j Community Discussions 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] Traverse Order By
I do not understand. I have data in the database is always changing (added, removed), and because of that my web-application needs to return different data. I will be able to receive relevant information from the database Neo4? -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Traverse-Order-By-tp3209366p3242487.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Traverse Order By
Not really, as this gives you only a snapshot from the time of the creation, no updates. Was discussed several times on the mailing list. Cheers Michael Am 10.08.2011 um 14:45 schrieb sometime: > I found the solution. > Initialization should be done like this: > > GraphDatabaseService graphDb = new > EmbeddedReadOnlyGraphDatabase("/home/sometime/neo4j/data/graph.db"); > > -- > View this message in context: > http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Traverse-Order-By-tp3209366p3242431.html > Sent from the Neo4j Community Discussions 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] Traverse Order By
I found the solution. Initialization should be done like this: GraphDatabaseService graphDb = new EmbeddedReadOnlyGraphDatabase("/home/sometime/neo4j/data/graph.db"); -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Traverse-Order-By-tp3209366p3242431.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Traverse Order By
The probleme here is that there is already a running database instance (that serves the rest-request and everything else). If you put your code into a ServerPlugin or UnmanagedExtension you can in both cases get an instance of that GraphDatabaseService passed into your method that you then just use. Here are some examples: http://docs.neo4j.org/chunked/snapshot/server-plugins.html http://docs.neo4j.org/chunked/snapshot/server-unmanaged-extensions.html Cheers Michael Am 10.08.2011 um 14:16 schrieb Igor Dovgiy: > If you can cope with some limitations of Neo4j official plugin system (the > biggest thing for me is a bit limited choice of responce options: it can be > either collection of Nodes, or Relationships, or Pathes data, packed with > JSON), may I suggest using it instead. ) > > In this case your DB works in server mode, and you can happily bombard it > with many queries from many clients' instances via standard REST API, > expanded with your plugin. > > And yes, we're using this kind of architecture, and kinda like it. ) > > -- > -- iD > > On 10 August 2011 13:10, sometime wrote: > >> I wrote this plugin. Everything works as it should (on local). >> I put this plugin (as web-application) on a server that is running neo4j. >> In >> order to receive the data - I'll do a GET-request to that web-applications. >> In web applications to initialize neo4j I use >> >> GraphDatabaseService graphDb = new EmbeddedGraphDatabase >> ("/path_to_neo4j/data/graph.db"); >> >> When i do GET-request - I get an error >> >> Unable to lock store [/path_to_neo4j/graph.db/neostore], this is usually a >> result of some other Neo4j kernel running using the same store. >> >> I understand that the application needs to lock the entire database to make >> the traverse a request for it. But the base operates in real time and the >> application should not block the base. >> Maybe somehow I can make request to the application by URL? Or some way I >> can make request to traverse the base without locking? >> >> -- >> View this message in context: >> http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Traverse-Order-By-tp3209366p3242058.html >> Sent from the Neo4j Community Discussions 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 ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Traverse Order By
If you can cope with some limitations of Neo4j official plugin system (the biggest thing for me is a bit limited choice of responce options: it can be either collection of Nodes, or Relationships, or Pathes data, packed with JSON), may I suggest using it instead. ) In this case your DB works in server mode, and you can happily bombard it with many queries from many clients' instances via standard REST API, expanded with your plugin. And yes, we're using this kind of architecture, and kinda like it. ) -- -- iD On 10 August 2011 13:10, sometime wrote: > I wrote this plugin. Everything works as it should (on local). > I put this plugin (as web-application) on a server that is running neo4j. > In > order to receive the data - I'll do a GET-request to that web-applications. > In web applications to initialize neo4j I use > > GraphDatabaseService graphDb = new EmbeddedGraphDatabase > ("/path_to_neo4j/data/graph.db"); > > When i do GET-request - I get an error > > Unable to lock store [/path_to_neo4j/graph.db/neostore], this is usually a > result of some other Neo4j kernel running using the same store. > > I understand that the application needs to lock the entire database to make > the traverse a request for it. But the base operates in real time and the > application should not block the base. > Maybe somehow I can make request to the application by URL? Or some way I > can make request to traverse the base without locking? > > -- > View this message in context: > http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Traverse-Order-By-tp3209366p3242058.html > Sent from the Neo4j Community Discussions 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] Traverse Order By
I wrote this plugin. Everything works as it should (on local). I put this plugin (as web-application) on a server that is running neo4j. In order to receive the data - I'll do a GET-request to that web-applications. In web applications to initialize neo4j I use GraphDatabaseService graphDb = new EmbeddedGraphDatabase ("/path_to_neo4j/data/graph.db"); When i do GET-request - I get an error Unable to lock store [/path_to_neo4j/graph.db/neostore], this is usually a result of some other Neo4j kernel running using the same store. I understand that the application needs to lock the entire database to make the traverse a request for it. But the base operates in real time and the application should not block the base. Maybe somehow I can make request to the application by URL? Or some way I can make request to traverse the base without locking? -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Traverse-Order-By-tp3209366p3242058.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Traverse Order By
Just my two cents: I actually wrote sort of a similar plugin: it implemented a slightly modified 'breadth-first' logic, where nodes were added to PriorityQueue (rather than simple queue, as in original ordering class). Hope this'll help... ) On 29 July 2011 17:02, Jim Webber wrote: > Hey, > > Retrieving "popular" nodes not directly possible with the REST API. > > Even in Java, you'd have to sort your result set manually since you don't > know ahead of time how the search is going to traverse your graph. > > It is only once you have your result set (which may be large) that you can > sort, and then deliver popular nodes back ahead of unpopular ones. > > If you're keen to do this via the REST API, I would suggest a writing > plugin that implements this logic in Java, and have that plugin exposed to > your client application. Be aware that such a plugin might have interesting > memory requirements if you end up processing large graphs. > > Jim > ___ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > -- -- iD ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Traverse Order By
Hey, Retrieving "popular" nodes not directly possible with the REST API. Even in Java, you'd have to sort your result set manually since you don't know ahead of time how the search is going to traverse your graph. It is only once you have your result set (which may be large) that you can sort, and then deliver popular nodes back ahead of unpopular ones. If you're keen to do this via the REST API, I would suggest a writing plugin that implements this logic in Java, and have that plugin exposed to your client application. Be aware that such a plugin might have interesting memory requirements if you end up processing large graphs. Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] Traverse Order By
Hi! For example, we have social graph: http://www.donskov.net/graph.jpg Nodes is humans. If the nodes have a relation - so they are friends. I need to get all friends friends and all friends friends friends etc. on node 4 (see example). I post this: { "order": "breadth_first", "uniqueness": "node", "relationships": [ { "type": "KNOWS", "direction": "out" } ], "return_filter":{ "language": "javascript", "body": "position.length() > 1" }, "max_depth": 999 } But i need sort result list by count of incomig relations from friends. Explanation: in example node 10 have relation from node 2 and node 5, and this nodes (2 and 5) - is are friends of our start node (4), so node 10 should be the first node than 5 (because nodes 1 and 9 have one relation from node(4)'s friends). How do I change the query to get this sorted? ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
[Neo4j] Traverse Order By
Hi! For example, we have social graph: http://www.donskov.net/graph.jpg Nodes is humans. If the nodes have a relation - so they are friends. I need to get all friends friends and all friends friends friends etc. on node 4 (see example). I post this: { "order": "breadth_first", "uniqueness": "node", "relationships": [ { "type": "KNOWS", "direction": "out" } ], "return_filter":{ "language": "javascript", "body": "position.length() > 1" }, "max_depth": 999 } But i need sort result list by count of incomig relations from friends. Explanation: in example node 10 have relation from node 2 and node 5, and this nodes (2 and 5) - is are friends of our start node (4), so node 10 should be the first node than 5 (because nodes 1 and 9 have one relation from node(4)'s friends). How do I change the query to get this sorted? -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Traverse-Order-By-tp3209364p3209364.html Sent from the Neo4j Community Discussions mailing list archive at Nabble.com. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user