Re: [Neo4j] Installing the python bindings ( I think )

2011-02-10 Thread Tom Smith

On 9 Feb 2011, at 21:25, Michael Hunger wrote:

 and this is supported by the REST API, see:
 http://components.neo4j.org/neo4j-server/milestone/rest.html#Add_to_index
 
 Hope that helps

It nearly does. In the above example, adding something to an index via curl is 
documented as...

curl -HContent-Type:application/json -X POST -d 
'http://localhost:7474/db/data/node/123;' 
http://localhost:7474/db/data/index/node/my_nodes/foo/bar

... it's not clear what my_nodes is. Is that the index name? As in 
graphdb.index(cities)?

And secondly, does each index entry need a key of foo with a value of bar? 
As in   {'name': 'New York'}?

thanks

Tom














___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Installing the python bindings ( I think )

2011-02-10 Thread Michael Hunger
Tom,

sorry for the confusion.
my_nodes is the index name (you can several index-names per type (node, 
relationship) the default names are nodes and relationships

so for your example it would look like:

 curl -Haccept:application/json -HContent-Type:application/json -X POST -d 
 'http://localhost:7474/db/data/node/123;' 
 http://localhost:7474/db/data/index/node/nodes/name/New%20York

Sorry, I thought someone updated the wiki, we had the discussion before. Will 
do it now.

Michael

Am 10.02.2011 um 13:06 schrieb Tom Smith:

 
 On 9 Feb 2011, at 21:25, Michael Hunger wrote:
 
 and this is supported by the REST API, see:
 http://components.neo4j.org/neo4j-server/milestone/rest.html#Add_to_index
 
 Hope that helps
 
 It nearly does. In the above example, adding something to an index via curl 
 is documented as...
 
 curl -HContent-Type:application/json -X POST -d 
 'http://localhost:7474/db/data/node/123;' 
 http://localhost:7474/db/data/index/node/my_nodes/foo/bar
 
 ... it's not clear what my_nodes is. Is that the index name? As in 
 graphdb.index(cities)?
 
 And secondly, does each index entry need a key of foo with a value of 
 bar? As in   {'name': 'New York'}?
 
 thanks
 
 Tom
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 ___
 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] Installing the python bindings ( I think )

2011-02-10 Thread Tom Smith

On 10 Feb 2011, at 12:11, Michael Hunger wrote:

 so for your example it would look like:
 
 curl -Haccept:application/json -HContent-Type:application/json -X POST -d 
 'http://localhost:7474/db/data/node/123;'http://localhost:7474/db/data/index/node/nodes/name/New%20York
 
 Sorry, I thought someone updated the wiki, we had the discussion before. Will 
 do it now.

Cheers.. but wouldn't it be...

curl -Haccept:application/json -HContent-Type:application/json -X POST -d 
'http://localhost:7474/db/data/node/123;'http://localhost:7474/db/data/index/node/cities/name/New%20York

... if my index name was cities?

I'm slightly unsure why I'd have to specify /name/ too... something that in the 
python api I don't do to add an item I would just...

cities[ New York ] = new_york_node

I don't mind giving an index value a name but just want to be sure I'm doing 
it right...

thanks again

Tom














___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Installing the python bindings ( I think )

2011-02-10 Thread Michael Hunger
Yes, you're right, didn't read that piece of code [ graphdb.index(cities) ]

it is graphDb.index().forNodes(cities).add/get

you add the name field to the index as otherwise there wouldn't be a 
distinction where New York appears (e.g. you have a name field and a 
destination that both can contain New York but you just want to get(name, 
New York and not those
containing it in the destination field. That's the way the Neo4j index API 
was designed. You also need the property names if you want to do querying as 
you have to be able to address the individual properties when comparing them to 
your search values.

Michael

Am 10.02.2011 um 13:28 schrieb Tom Smith:

 
 On 10 Feb 2011, at 12:11, Michael Hunger wrote:
 
 so for your example it would look like:
 
 curl -Haccept:application/json -HContent-Type:application/json -X POST -d 
 'http://localhost:7474/db/data/node/123;'http://localhost:7474/db/data/index/node/nodes/name/New%20York
 
 Sorry, I thought someone updated the wiki, we had the discussion before. 
 Will do it now.
 
 Cheers.. but wouldn't it be...
 
 curl -Haccept:application/json -HContent-Type:application/json -X POST -d 
 'http://localhost:7474/db/data/node/123;'http://localhost:7474/db/data/index/node/cities/name/New%20York
 
 ... if my index name was cities?
 
 I'm slightly unsure why I'd have to specify /name/ too... something that in 
 the python api I don't do to add an item I would just...
 
 cities[ New York ] = new_york_node
 
 I don't mind giving an index value a name but just want to be sure I'm 
 doing it right...
 
 thanks again
 
 Tom
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 ___
 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] Installing the python bindings ( I think )

2011-02-10 Thread Tom Smith
So... my curl string for ...

Adding node id 29 to an index called medical with an index property name of 
name with a value of Hospitality_Recreation

...looks like  this ...

curl -i -s -HAccept:application/json  -HContent-Type:application/json -X POST 
-d http://localhost:7474/db/data/node/29; 
http://localhost:7474/db/data/index/node/medical/name/Hospitality_Recreation; 

... which can't quite be right. I'm getting...

Unexpected character ('h' (code 104)): expected a valid value (number, String, 
array, object, 'true', 'false' or 'null')\n at [Source: 
java.io.StringReader@f0754b8; line: 1, column: 2]






___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Installing the python bindings ( I think )

2011-02-10 Thread Michael Hunger
Yes because your post data has to be a valid JSON string

so you have to write
-d 'http://localhost:7474/db/data/node/29;'

wrap the double quotes in single quotes, otherwise json just gets http://...29 
which it can't parse as a string.

the h that it complains about is from http :)

Cheers

Michael
Am 10.02.2011 um 14:55 schrieb Tom Smith:

 So... my curl string for ...
 
 Adding node id 29 to an index called medical with an index property name of 
 name with a value of Hospitality_Recreation
 
 ...looks like  this ...
 
 curl -i -s -HAccept:application/json  -HContent-Type:application/json -X POST 
 -d http://localhost:7474/db/data/node/29; 
 http://localhost:7474/db/data/index/node/medical/name/Hospitality_Recreation;
  
 
 ... which can't quite be right. I'm getting...
 
 Unexpected character ('h' (code 104)): expected a valid value (number, 
 String, array, object, 'true', 'false' or 'null')\n at [Source: 
 java.io.StringReader@f0754b8; line: 1, column: 2]
 
 
 
 
 
 
 ___
 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] Installing the python bindings ( I think )

2011-02-09 Thread Tom Smith
Hello,

I'm in a pickle. I KNOW I had neo4j working fine on my computer, but not it 
complains ...

ImportError: No applicable backend found.

... I suspect that I *may* have tidied up my site-packages folder but I'm not 
sure why it has stopped. I'm now both unable to install JPype (although I think 
it IS already installed) ...

src/native/common/jp_array.cpp:98: error: ‘jvalue’ does not name a type
src/native/common/jp_array.cpp: In member function ‘virtual JCharString 
JPArray::toString()’:
src/native/common/jp_array.cpp:107: error: ‘jchar’ was not declared in this 
scope
src/native/common/jp_array.cpp:107: error: expected `;' before ‘res’
src/native/common/jp_array.cpp:108: error: ‘res’ was not declared in this scope
error: command '/usr/bin/gcc-4.2' failed with exit status 1


...and unable to install the python bindings ( on MacOS X)... they error, but I 
think they are installed OK.

I tried using the REST server (which is great) but it doesn't support 
graphdb.index(whatever) yet.

When will the next release of the REST server (with indexing) or the python 
binding?

Thanks

Tom Smith













___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Installing the python bindings ( I think )

2011-02-09 Thread Javier de la Rosa
On Wed, Feb 9, 2011 at 10:31, Tom Smith tom.sm...@york.ac.uk wrote:
 I tried using the REST server (which is great) but it doesn't support 
 graphdb.index(whatever) yet.

I hope neo4j-rest-client in Python support indexing and plugins before
the end of february.



-- 
Javier de la Rosa
http://versae.es
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Installing the python bindings ( I think )

2011-02-09 Thread Peter Neubauer
What I think is the core of the index REST story is that we need to
add the query part of things to it, not just the exact matching
(index.get() and index.query()). You can do that easily writing a
server plugin, I will try to do it during my next lab day, but the
basics go like http://docs.neo4j.org/chunked/snapshot/server-plugins.html

Would that help?

/peter

On Wed, Feb 9, 2011 at 10:25 PM, Michael Hunger
michael.hun...@neotechnology.com wrote:
 Tom,

 What do you mean with graphdb.index(whatever)

 the (new) indexing API that is available since 1.2 has the syntax
 graphDb.index().forNodes(indexName).add(node,key,value) for adding to the 
 index and
 IndexHitsNode hits = graphDb.index().forNodes(indexName).get(key,value)

 and this is supported by the REST API, see:
 http://components.neo4j.org/neo4j-server/milestone/rest.html#Add_to_index

 Hope that helps

 Michael


 Am 09.02.2011 um 16:31 schrieb Tom Smith:

 Hello,

 I tried using the REST server (which is great) but it doesn't support 
 graphdb.index(whatever) yet.

 When will the next release of the REST server (with indexing) or the python 
 binding?

 Thanks

 Tom Smith

 ___
 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