Re: [Neo4j] REST api get list of all relationship properties (unique)
Hi Peter, thanks a lot for your answer! Our alternative will be to keep a copy of the properties in memcached. Another option would have been to create a second graph, which is used only to store the properties in nodes/relationships, but from my view this has the disadvantage of different semantics per graph. Regards Jure -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/REST-api-get-list-of-all-relationship-properties-unique-tp3458852p3530472.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] REST api get list of all relationship properties (unique)
Jure, for this, I think there is no explicit support in Neo4j. I guess you will have to iterate and build up an in-memory list of the unique RelTypes as you go. Anyone having a better idea? 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 - NOSQL for the Enterprise. http://startupbootcamp.org/ - Öresund - Innovation happens HERE. On Mon, Nov 21, 2011 at 7:39 PM, Jure Zakotnik j...@gmx.de wrote: Hi, it's the question, how to get the unique set of relationship properties in the graph, without querying/traversing all of the properties. Since I can only index nodes/relationships, the index API does not seem to be an option. Example: 1M relationships, each of them having one of 10 properties (..but I don't know the 10 properties in advance). I'm happy if there's a simple query or solution that I just haven't found yet :-) Regards, Jure -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/REST-api-get-list-of-all-relationship-properties-unique-tp3458852p3525603.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] REST api get list of all relationship properties (unique)
So, are you talking about the performance on a supernode, or on an arbitrary set of 1M relationships from e.g. a variable length Cypher query? 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 - NOSQL for the Enterprise. http://startupbootcamp.org/ - Öresund - Innovation happens HERE. On Sun, Nov 6, 2011 at 7:25 PM, Jure Zakotnik j...@gmx.de wrote: Hi Peter, sounds good, I'll check how to contribute.. Meanwhile I was working on the original question of the thread - getting a list of unique properties used in the relationships. Since the lucene indexer in neo4j always uses nodes or relationships, I don't see a way to extract a list of relationship poperties, without retrieving all relationships as well (e.g. 1M relationships with 5 different properties), which could result in bad performance. Did I overlook something? The other option would be a separate key-value-store or lucene index, but I would like to keep only neo4j as persistence.. The use-case is an UI to create a relationship with auto-complete on existing properties. Regards, Jure -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/REST-api-get-list-of-all-relationship-properties-unique-tp3458852p3484986.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] REST api get list of all relationship properties (unique)
Hi, it's the question, how to get the unique set of relationship properties in the graph, without querying/traversing all of the properties. Since I can only index nodes/relationships, the index API does not seem to be an option. Example: 1M relationships, each of them having one of 10 properties (..but I don't know the 10 properties in advance). I'm happy if there's a simple query or solution that I just haven't found yet :-) Regards, Jure -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/REST-api-get-list-of-all-relationship-properties-unique-tp3458852p3525603.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] REST api get list of all relationship properties (unique)
Hi Peter, sounds good, I'll check how to contribute.. Meanwhile I was working on the original question of the thread - getting a list of unique properties used in the relationships. Since the lucene indexer in neo4j always uses nodes or relationships, I don't see a way to extract a list of relationship poperties, without retrieving all relationships as well (e.g. 1M relationships with 5 different properties), which could result in bad performance. Did I overlook something? The other option would be a separate key-value-store or lucene index, but I would like to keep only neo4j as persistence.. The use-case is an UI to create a relationship with auto-complete on existing properties. Regards, Jure -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/REST-api-get-list-of-all-relationship-properties-unique-tp3458852p3484986.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] REST api get list of all relationship properties (unique)
Hi I tried the .toString() and it throws the same error. Which is strange, since in the RepresentationConverter, the string should be returned fine if no other representation is found. Could the error be somewhere else? I also forked the Gremlin plugin, but need to get familiar with it (first time usage). Actually the getRawGraph was only an example, I'm still trying to do some lucene magic to get a list of all unique properties in the graph.. Regards Jure -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/REST-api-get-list-of-all-relationship-properties-unique-tp3458852p3481516.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] REST api get list of all relationship properties (unique)
Jure, you could just write a testcase that does exactly this - send g.getRawGraph() to the plugin and check what is happening (GremlinPluginFunctionalTest) in the debugger. Let's connect next week if you can't sort it out? 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 - NOSQL for the Enterprise. http://startupbootcamp.org/ - Öresund - Innovation happens HERE. On Fri, Nov 4, 2011 at 4:16 PM, Jure Zakotnik j...@gmx.de wrote: Hi I tried the .toString() and it throws the same error. Which is strange, since in the RepresentationConverter, the string should be returned fine if no other representation is found. Could the error be somewhere else? I also forked the Gremlin plugin, but need to get familiar with it (first time usage). Actually the getRawGraph was only an example, I'm still trying to do some lucene magic to get a list of all unique properties in the graph.. Regards Jure -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/REST-api-get-list-of-all-relationship-properties-unique-tp3458852p3481516.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] REST api get list of all relationship properties (unique)
Hi Peter and Community, I played a bit with passing a groovy script to neo4j. However the response seems to be not JSON encoded, did I overlook something? I'm using 1.5M02 and did the following request (from tcpmon) http request: POST /db/data/ext/GremlinPlugin/graphdb/execute_script HTTP/1.1 Content-Type: application/json post body: {script:neo4j = g.getRawGraph()} The result seems to be not JSON encoded and different from the documentation: .. Content-Type: application/json EmbeddedGraphDatabase [...neo4j\\neo4j-community-1.5.M02\\data\\graph.db] Shouldn't this be a JSON string? Later on grails complains with an groovyx.net.http.ResponseParseException which is correct, since it's not JSON, right? Thanks, Jure -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/REST-api-get-list-of-all-relationship-properties-unique-tp3458852p3476872.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] REST api get list of all relationship properties (unique)
Jure, if the primitives in the response are not recognized (like a normal Groovy Object), then the toString() of the result is returned. If you want, you can fork and add to the representations, see https://github.com/neo4j/gremlin-plugin/blob/master/src/main/java/org/neo4j/server/plugin/gremlin/GremlinToRepresentationConverter.java - there we probably should add GraphDatabaseService as one possible return and convert it to the normal representation you see at /db/data/ . You up for it? 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 - NOSQL for the Enterprise. http://startupbootcamp.org/ - Öresund - Innovation happens HERE. On Thu, Nov 3, 2011 at 4:42 AM, Jure Zakotnik j...@gmx.de wrote: Hi Peter and Community, I played a bit with passing a groovy script to neo4j. However the response seems to be not JSON encoded, did I overlook something? I'm using 1.5M02 and did the following request (from tcpmon) http request: POST /db/data/ext/GremlinPlugin/graphdb/execute_script HTTP/1.1 Content-Type: application/json post body: {script:neo4j = g.getRawGraph()} The result seems to be not JSON encoded and different from the documentation: .. Content-Type: application/json EmbeddedGraphDatabase [...neo4j\\neo4j-community-1.5.M02\\data\\graph.db] Shouldn't this be a JSON string? Later on grails complains with an groovyx.net.http.ResponseParseException which is correct, since it's not JSON, right? Thanks, Jure -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/REST-api-get-list-of-all-relationship-properties-unique-tp3458852p3476872.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] REST api get list of all relationship properties (unique)
Shouldn't it be enough to call toString() on your results if they are not valid representations, which are for a plugin: * Primitives * Node * Relationship * Path * Iterables or Collections thereof * probably also Map but I'm not sure. please try: {script:neo4j = g.getRawGraph().toString()} Michael Am 03.11.2011 um 15:59 schrieb Peter Neubauer: Jure, if the primitives in the response are not recognized (like a normal Groovy Object), then the toString() of the result is returned. If you want, you can fork and add to the representations, see https://github.com/neo4j/gremlin-plugin/blob/master/src/main/java/org/neo4j/server/plugin/gremlin/GremlinToRepresentationConverter.java - there we probably should add GraphDatabaseService as one possible return and convert it to the normal representation you see at /db/data/ . You up for it? 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 - NOSQL for the Enterprise. http://startupbootcamp.org/- Öresund - Innovation happens HERE. On Thu, Nov 3, 2011 at 4:42 AM, Jure Zakotnik j...@gmx.de wrote: Hi Peter and Community, I played a bit with passing a groovy script to neo4j. However the response seems to be not JSON encoded, did I overlook something? I'm using 1.5M02 and did the following request (from tcpmon) http request: POST /db/data/ext/GremlinPlugin/graphdb/execute_script HTTP/1.1 Content-Type: application/json post body: {script:neo4j = g.getRawGraph()} The result seems to be not JSON encoded and different from the documentation: .. Content-Type: application/json EmbeddedGraphDatabase [...neo4j\\neo4j-community-1.5.M02\\data\\graph.db] Shouldn't this be a JSON string? Later on grails complains with an groovyx.net.http.ResponseParseException which is correct, since it's not JSON, right? Thanks, Jure -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/REST-api-get-list-of-all-relationship-properties-unique-tp3458852p3476872.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] REST api get list of all relationship properties (unique)
Or, if we are not explicitely catching and converting the representations, at the end of this switch we could hand it over to the server REST subsystem in order to convert things. I will raised https://github.com/neo4j/gremlin-plugin/issues/2 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 - NOSQL for the Enterprise. http://startupbootcamp.org/ - Öresund - Innovation happens HERE. On Thu, Nov 3, 2011 at 8:12 AM, Michael Hunger michael.hun...@neotechnology.com wrote: Shouldn't it be enough to call toString() on your results if they are not valid representations, which are for a plugin: * Primitives * Node * Relationship * Path * Iterables or Collections thereof * probably also Map but I'm not sure. please try: {script:neo4j = g.getRawGraph().toString()} Michael Am 03.11.2011 um 15:59 schrieb Peter Neubauer: Jure, if the primitives in the response are not recognized (like a normal Groovy Object), then the toString() of the result is returned. If you want, you can fork and add to the representations, see https://github.com/neo4j/gremlin-plugin/blob/master/src/main/java/org/neo4j/server/plugin/gremlin/GremlinToRepresentationConverter.java - there we probably should add GraphDatabaseService as one possible return and convert it to the normal representation you see at /db/data/ . You up for it? 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 - NOSQL for the Enterprise. http://startupbootcamp.org/ - Öresund - Innovation happens HERE. On Thu, Nov 3, 2011 at 4:42 AM, Jure Zakotnik j...@gmx.de wrote: Hi Peter and Community, I played a bit with passing a groovy script to neo4j. However the response seems to be not JSON encoded, did I overlook something? I'm using 1.5M02 and did the following request (from tcpmon) http request: POST /db/data/ext/GremlinPlugin/graphdb/execute_script HTTP/1.1 Content-Type: application/json post body: {script:neo4j = g.getRawGraph()} The result seems to be not JSON encoded and different from the documentation: .. Content-Type: application/json EmbeddedGraphDatabase [...neo4j\\neo4j-community-1.5.M02\\data\\graph.db] Shouldn't this be a JSON string? Later on grails complains with an groovyx.net.http.ResponseParseException which is correct, since it's not JSON, right? Thanks, Jure -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/REST-api-get-list-of-all-relationship-properties-unique-tp3458852p3476872.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
[Neo4j] REST api get list of all relationship properties (unique)
Dear All, I would like to extract a list of unique properties used for all relationships using the REST API. I created a relationship index and indexed all properties. When I query for * using the REST API for the lucene query, I receive lots of relationships, so it's difficult to get a unique set of properties from the query. Is there a good way to achieve this? Thanks Jure -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/REST-api-get-list-of-all-relationship-properties-unique-tp3458852p3458852.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] REST api get list of all relationship properties (unique)
Jure, if you know the Lucene query in Java, you could write a Groovy/Java script directly accessing the IndexAPI and thus do your own Lucene magic, see http://docs.neo4j.org/chunked/snapshot/gremlin-plugin.html#rest-api-send-an-arbitrary-groovy-script---lucene-sorting for an example with custom sorting in Lucene via the REST API. Does that help? 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 - NOSQL for the Enterprise. http://startupbootcamp.org/ - Öresund - Innovation happens HERE. On Thu, Oct 27, 2011 at 7:33 PM, jure j...@gmx.de wrote: Dear All, I would like to extract a list of unique properties used for all relationships using the REST API. I created a relationship index and indexed all properties. When I query for * using the REST API for the lucene query, I receive lots of relationships, so it's difficult to get a unique set of properties from the query. Is there a good way to achieve this? Thanks Jure -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/REST-api-get-list-of-all-relationship-properties-unique-tp3458852p3458852.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] REST api get list of all relationship properties (unique)
Hello Peter, many thanks for the quick reply, this will help! Regards Jure -- View this message in context: http://neo4j-community-discussions.438527.n3.nabble.com/REST-api-get-list-of-all-relationship-properties-unique-tp3458852p3458999.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