So... my scruffy python code looks like this...

import urllib

def add_node_to_index(index_name, node_id, property_value,  
property_name='name' ):
        ''
        index_name = urllib.quote(index_name) #i.e "cities"
        property_value = urllib.quote(property_value) # i.e "New York"
        property_name = urllib.quote(property_name) # i.e "name"

        curl_str = '''curl -i -s -HContent-Type:application/json 
-HAccept:application/json  -X POST -d '"http://localhost:7474/db/data/node/%s";' 
http://localhost:7474/db/data/index/node/%s/%s/%s ''' % 
(str(node_id),index_name,property_name, property_value  )
        print curl_str
        response = os.popen( curl_str )
        print "Errors", response.errors
        data = response.read( )
        return data


...and when I ...

add_node_to_index("medical", node.id, node['name'])

 ... the url created is ( you are right Michael, those pesky quotes were 
killing it) ...

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

...and the output is...

HTTP/1.1 201 Created
Content-Length: 1585
Location: 
http://localhost:7474/db/data/index/node/medical/name/Hospitality_Recreation/29
Content-Encoding: UTF-8
Content-Type: application/json
Access-Control-Allow-Origin: *
Server: Jetty(6.1.25)

{
  "indexed" : 
"http://localhost:7474/db/data/index/node/medical/name/Hospitality_Recreation/29";,
  "outgoing_relationships" : 
"http://localhost:7474/db/data/node/29/relationships/out";,
  "data" : {
    "name" : "Hospitality_Recreation",
    "type" : "tag"
  },
  "traverse" : "http://localhost:7474/db/data/node/29/traverse/{returnType}";,
  "all_typed_relationships" : 
"http://localhost:7474/db/data/node/29/relationships/all/{-list|&|types}",
  "property" : "http://localhost:7474/db/data/node/29/properties/{key}";,
  "self" : "http://localhost:7474/db/data/node/29";,
  "properties" : "http://localhost:7474/db/data/node/29/properties";,
  "outgoing_typed_relationships" : 
"http://localhost:7474/db/data/node/29/relationships/out/{-list|&|types}",
  "incoming_relationships" : 
"http://localhost:7474/db/data/node/29/relationships/in";,
  "extensions" : {
    "ShortestPath" : {
      "shortestPath" : 
"http://localhost:7474/db/data/ext/ShortestPath/node/29/shortestPath";
    },
    "DepthTwo" : {
      "nodesOnDepthTwo" : 
"http://localhost:7474/db/data/ext/DepthTwo/node/29/nodesOnDepthTwo";,
      "relationshipsOnDepthTwo" : 
"http://localhost:7474/db/data/ext/DepthTwo/node/29/relationshipsOnDepthTwo";,
      "pathsOnDepthTwo" : 
"http://localhost:7474/db/data/ext/DepthTwo/node/29/pathsOnDepthTwo";
    }
  },
  "create_relationship" : "http://localhost:7474/db/data/node/29/relationships";,
  "all_relationships" : 
"http://localhost:7474/db/data/node/29/relationships/all";,
  "incoming_typed_relationships" : 
"http://localhost:7474/db/data/node/29/relationships/in/{-list|&|types}"
}

... Now to try and get data out of the index. 

Thanks



_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to