Get data from NEO4j

48 views
Skip to first unread message

Andreas Dernbauer

unread,
Mar 24, 2015, 12:53:27 PM3/24/15
to d3...@googlegroups.com
Hi 

I am new to d3.js, hopefully someone can help me.

I tried since days to get data from NEO4J within the d3.js.

As far as I have learned it must be something with d3.xhr but it doesn't work

I tried the following:
var sql ='{"statements":[{"statement":"MATCH (a)-[:`srcChildOf`]->(b) RETURN a,b",   "resultDataContents":["graph"]}]}';
d3.xhr('http://localhost:7474/db/data/transaction/commit',sql,function(error,data){})

can someone help me.

Thank you regards from Vienna.

nick

unread,
Mar 25, 2015, 9:48:45 AM3/25/15
to d3...@googlegroups.com
Not sure if you found this:
http://neo4j.com/developer/guide-data-visualization/

Looks like neo4j is expecting a POST even for a query.

To do that in d3, you'd use d3.json.post
https://github.com/mbostock/d3/wiki/Requests#post

So maybe something like this:
d3.json('http://localhost:7474/db/data/transaction/commit')
 
.post(
      JSON
.stringify({

      statements
: [{
          statement
: "MATCH (a)-[:`srcChildOf`]->(b) RETURN a,b",      
          resultDataContents
: ["graph"]
       
}]

   
}),
 
function(error, data){
   
// do the thing
 
}
))

Andreas Dernbauer

unread,
Mar 25, 2015, 3:54:33 PM3/25/15
to d3...@googlegroups.com
thank you for you help but I receive error 415 
Failed to load resource: the server responded with a status of 415 (Unsupported Media Type)

nick

unread,
Mar 26, 2015, 10:04:14 AM3/26/15
to d3...@googlegroups.com
That is a bit cryptic! Looks like this is not unheard-of:
http://stackoverflow.com/questions/15954017/get-or-create-unique-node-create-ocurre-error-415-unsupported-media-type
https://groups.google.com/forum/#!topic/neo4j/Fb9El_jQw9M

Check the full body of the response and the request in your F12 browser console, and you might find something. If nothing useful comes of that, pot it here.
Reply all
Reply to author
Forward
0 new messages