Re: [Neo4j] Set property on node in Neo4j REST server
Hi Peter, For the specific case of updating a single property then: PUT node/{node_id}/property/{property_key} with an entity body like: some text or 27 would be OK I think But not until the 1.6 M01 release :-) Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Set property on node in Neo4j REST server
raised https://github.com/neo4j/community/issues/65 for further comments. Thanks! 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 Mon, Oct 17, 2011 at 8:39 AM, Peter Neubauer peter.neuba...@neotechnology.com wrote: Yes, Agreed. However, jslint not liking that warrants an issue for 1.6 me thinks? /peter Sent from my phone. On Oct 17, 2011 8:05 AM, Jim Webber j...@neotechnology.com wrote: Hi Peter, For the specific case of updating a single property then: PUT node/{node_id}/property/{property_key} with an entity body like: some text or 27 would be OK I think But not until the 1.6 M01 release :-) Jim ___ 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] Set property on node in Neo4j REST server
On Mon, Oct 17, 2011 at 8:05 AM, Jim Webber j...@neotechnology.com wrote: Hi Peter, For the specific case of updating a single property then: PUT node/{node_id}/property/{property_key} with an entity body like: some text or 27 would be OK I think But not until the 1.6 M01 release :-) But this is exactly what we do today, no? Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user -- Jacob Hansson Phone: +46 (0) 763503395 Twitter: @jakewins ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Set property on node in Neo4j REST server
Then I declare from the High Church of REST that what we do today is correct. Amen :-) Jim On 17 Oct 2011, at 15:34, Jacob Hansson wrote: On Mon, Oct 17, 2011 at 8:05 AM, Jim Webber j...@neotechnology.com wrote: Hi Peter, For the specific case of updating a single property then: PUT node/{node_id}/property/{property_key} with an entity body like: some text or 27 would be OK I think But not until the 1.6 M01 release :-) But this is exactly what we do today, no? Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user -- Jacob Hansson Phone: +46 (0) 763503395 Twitter: @jakewins ___ 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] Set property on node in Neo4j REST server
Andrew, answers inline ... On Sun, Oct 16, 2011 at 5:54 AM, andrew ton andrewt...@yahoo.com wrote: 1. Set property: the section 16.5.1 describes that the url http://localhost:7474/db/data/node/5/properties/foo and the body to be put is bar. I assume foo is the property name and bar the property value. But how is the string bar sent in the PUT request while the service accepts a JSON object (Content-type = application/json)? I have tried to put a string or a json object like {value:testing}. I got Bad request error as I anticipated. Looking at http://docs.neo4j.org/chunked/snapshot/rest-api-node-properties.html#rest-api-set-property-on-node you can set the property as just a string in the request, which is valid JSON. I have added to the test to check that after multiple property sets the old ones are still there, see https://github.com/neo4j/community/blob/master/server/src/functionaltest/java/org/neo4j/server/rest/SetNodePropertiesFunctionalTest.java#L99 This should make sure that you can set inidvidual properties. Updated the docs also, should be out in some hour. 2. Update properties: I have tried as 16.5.2 instructs and the result are: a. If I PUT a JSON object that has all existing properties with new values then all properties of the node are updated with new values. b. If I PUT a JSON object that has only one property with a new value then all properties of the node are gone except the property in the PUT with the new value. Yes, this is intended, have added a remark to the docs, see http://docs.neo4j.org/chunked/snapshot/rest-api-node-properties.html#rest-api-update-node-properties and the new wording at https://github.com/neo4j/community/blob/master/server/src/functionaltest/java/org/neo4j/server/rest/SetNodePropertiesFunctionalTest.java#L42 Does that help? What documenation URI have you been looking at (what Neo4j version are you using)? /peter Would you please explain how I can update a property and how I add new properties to a node but existing properties are still intact. Thank you very much! Cheers, From: Peter Neubauer peter.neuba...@neotechnology.com To: Neo4j user discussions user@lists.neo4j.org Sent: Friday, October 14, 2011 11:40 PM Subject: Re: [Neo4j] Set property on node in Neo4j REST server Andrew, You can either update just one property or set and override all of them, see http://docs.neo4j.org/chunked/snapshot/rest-api-node-properties.html Does that help? /peter On Friday, October 14, 2011, andrew ton andrewt...@yahoo.com wrote: Hello, According to the Neo4j REST API to set a property on a node I send a PUT request to the node's property URL e.g. http://localhost:7474/db/data/node/5/properties/{propertyname}. This api accepts a JSON object. How do I send a json object that has property name and value? The sample in the document shows the body of PUT is just a string while the property name is in the URL. Is it correct that the API should be http://localhost:7474/db/data/node/5/properties and the body has an JSONObject e.g. {propertyName:propertyValue} ? If so then what is the difference between setting property and updating property ? Thanks, ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user -- 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. ___ 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] Set property on node in Neo4j REST server
Hi Andrew, Michael Hunger wrote a plugin for the Neo4j REST server that implements this. You can get it from his github space: https://github.com/jexp/neo4j-clean-remote-db-addon Jim ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Set property on node in Neo4j REST server
Hi Jim, Thank you for your information! Andrew From: Jim Webber j...@neotechnology.com To: Neo4j user discussions user@lists.neo4j.org Sent: Sunday, October 16, 2011 12:46 PM Subject: Re: [Neo4j] Set property on node in Neo4j REST server Hi Andrew, Michael Hunger wrote a plugin for the Neo4j REST server that implements this. You can get it from his github space: https://github.com/jexp/neo4j-clean-remote-db-addon Jim ___ 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] Set property on node in Neo4j REST server
On Sun, Oct 16, 2011 at 6:06 AM, Peter Neubauer peter.neuba...@neotechnology.com wrote: Looking at http://docs.neo4j.org/chunked/snapshot/rest-api-node-properties.html#rest-api-set-property-on-node you can set the property as just a string in the request, which is valid JSON. Hey Peter, I think the confusion may have stemmed from the fact that strings by themselves are *not* actually valid JSON as far as I understand. I believe valid JSON is *technically* only objects and arrays, though many libraries, in practice, tend to support primitive values as valid JSON too. It's certainly convenient, and I prefer that, too. E.g. http://jsonlint.com/ validates {} and [] but not or 1 or true: Parse error on line 1: ^ Expecting '{', '[' Cheers, Aseem ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Set property on node in Neo4j REST server
Ok, So what would be good semantics gör updating just one property? Jim? /peter Sent from my phone. On Oct 17, 2011 6:57 AM, Aseem Kishore aseem.kish...@gmail.com wrote: On Sun, Oct 16, 2011 at 6:06 AM, Peter Neubauer peter.neuba...@neotechnology.com wrote: Looking at http://docs.neo4j.org/chunked/snapshot/rest-api-node-properties.html#rest-api-set-property-on-node you can set the property as just a string in the request, which is valid JSON. Hey Peter, I think the confusion may have stemmed from the fact that strings by themselves are *not* actually valid JSON as far as I understand. I believe valid JSON is *technically* only objects and arrays, though many libraries, in practice, tend to support primitive values as valid JSON too. It's certainly convenient, and I prefer that, too. E.g. http://jsonlint.com/ validates {} and [] but not or 1 or true: Parse error on line 1: ^ Expecting '{', '[' Cheers, Aseem ___ 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] Set property on node in Neo4j REST server
I think PUTting a value to the property's URI (which is effectively it's key within the node). Isn't that what we already do though? Jim On 17 Oct 2011, at 07:16, Peter Neubauer wrote: Ok, So what would be good semantics gör updating just one property? Jim? /peter Sent from my phone. On Oct 17, 2011 6:57 AM, Aseem Kishore aseem.kish...@gmail.com wrote: On Sun, Oct 16, 2011 at 6:06 AM, Peter Neubauer peter.neuba...@neotechnology.com wrote: Looking at http://docs.neo4j.org/chunked/snapshot/rest-api-node-properties.html#rest-api-set-property-on-node you can set the property as just a string in the request, which is valid JSON. Hey Peter, I think the confusion may have stemmed from the fact that strings by themselves are *not* actually valid JSON as far as I understand. I believe valid JSON is *technically* only objects and arrays, though many libraries, in practice, tend to support primitive values as valid JSON too. It's certainly convenient, and I prefer that, too. E.g. http://jsonlint.com/ validates {} and [] but not or 1 or true: Parse error on line 1: ^ Expecting '{', '[' Cheers, Aseem ___ 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] Set property on node in Neo4j REST server
Yes, But we send a string as the only body, not a map. If we do that, then we have duplication of the key in the uri and body. How about putting to /property which will only replace the properties in the map as opposed to /properties which replaces all properties with the map? /peter Sent from my phone. On Oct 17, 2011 7:28 AM, Jim Webber j...@neotechnology.com wrote: I think PUTting a value to the property's URI (which is effectively it's key within the node). Isn't that what we already do though? Jim On 17 Oct 2011, at 07:16, Peter Neubauer wrote: Ok, So what would be good semantics gör updating just one property? Jim? /peter Sent from my phone. On Oct 17, 2011 6:57 AM, Aseem Kishore aseem.kish...@gmail.com wrote: On Sun, Oct 16, 2011 at 6:06 AM, Peter Neubauer peter.neuba...@neotechnology.com wrote: Looking at http://docs.neo4j.org/chunked/snapshot/rest-api-node-properties.html#rest-api-set-property-on-node you can set the property as just a string in the request, which is valid JSON. Hey Peter, I think the confusion may have stemmed from the fact that strings by themselves are *not* actually valid JSON as far as I understand. I believe valid JSON is *technically* only objects and arrays, though many libraries, in practice, tend to support primitive values as valid JSON too. It's certainly convenient, and I prefer that, too. E.g. http://jsonlint.com/ validates {} and [] but not or 1 or true: Parse error on line 1: ^ Expecting '{', '[' Cheers, Aseem ___ 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] Set property on node in Neo4j REST server
Andrew, You can either update just one property or set and override all of them, see http://docs.neo4j.org/chunked/snapshot/rest-api-node-properties.html Does that help? /peter On Friday, October 14, 2011, andrew ton andrewt...@yahoo.com wrote: Hello, According to the Neo4j REST API to set a property on a node I send a PUT request to the node's property URL e.g. http://localhost:7474/db/data/node/5/properties/{propertyname}. This api accepts a JSON object. How do I send a json object that has property name and value? The sample in the document shows the body of PUT is just a string while the property name is in the URL. Is it correct that the API should be http://localhost:7474/db/data/node/5/properties and the body has an JSONObject e.g. {propertyName:propertyValue} ? If so then what is the difference between setting property and updating property ? Thanks, ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user -- 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. ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Set property on node in Neo4j REST server
Hi Peter, I did use API described by that chapter, however I still have problems. My nodes have some properties name and type. Now I want to add new properties to my nodes. 1. Set property: the section 16.5.1 describes that the url http://localhost:7474/db/data/node/5/properties/foo and the body to be put is bar. I assume foo is the property name and bar the property value. But how is the string bar sent in the PUT request while the service accepts a JSON object (Content-type = application/json)? I have tried to put a string or a json object like {value:testing}. I got Bad request error as I anticipated. 2. Update properties: I have tried as 16.5.2 instructs and the result are: a. If I PUT a JSON object that has all existing properties with new values then all properties of the node are updated with new values. b. If I PUT a JSON object that has only one property with a new value then all properties of the node are gone except the property in the PUT with the new value. Would you please explain how I can update a property and how I add new properties to a node but existing properties are still intact. Thank you very much! Cheers, From: Peter Neubauer peter.neuba...@neotechnology.com To: Neo4j user discussions user@lists.neo4j.org Sent: Friday, October 14, 2011 11:40 PM Subject: Re: [Neo4j] Set property on node in Neo4j REST server Andrew, You can either update just one property or set and override all of them, see http://docs.neo4j.org/chunked/snapshot/rest-api-node-properties.html Does that help? /peter On Friday, October 14, 2011, andrew ton andrewt...@yahoo.com wrote: Hello, According to the Neo4j REST API to set a property on a node I send a PUT request to the node's property URL e.g. http://localhost:7474/db/data/node/5/properties/{propertyname}. This api accepts a JSON object. How do I send a json object that has property name and value? The sample in the document shows the body of PUT is just a string while the property name is in the URL. Is it correct that the API should be http://localhost:7474/db/data/node/5/properties and the body has an JSONObject e.g. {propertyName:propertyValue} ? If so then what is the difference between setting property and updating property ? Thanks, ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user -- 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. ___ 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