So, you have two options. You can change it to return type(r), or you can tell the transactional endpoint you want a more verbose output.
http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html#rest-api-execute-statements-in-an-open-transaction-in-rest-format-for-the-return 1) https://gist.github.com/wfreeman/8017978 2) https://gist.github.com/wfreeman/8017992 Wes On Wed, Dec 18, 2013 at 12:41 AM, Alan Robertson <[email protected]> wrote: > The query in the script below produces the following output: > > {"results":[{"columns":["one","rel","two"],"data":[{"row":[{"domain":"metadata","nodetype":"CMAclass","name":"HbRing"},{},{"domain":"metadata","nodetype":"CMAclass","name":"CMAclass"}]}]}],"errors":[]} > > What I noticed is that the relationship shows up as {}. Do I need to > change the query to get the relationship type? [See the script below > for the query] > > In any case, below is a script which does a passable job of seeing if > Neo4j is operational (and not dead, comatose, or laying on the ground > twitching)... I'm going to write an OCF resource agent using it - so I > can monitor neo4j "properly". And I could also make it highly-available > using Pacemaker... > > It can use either wget or curl to talk to Neo4j. > > # > # Simple script to monitor Neo4j for basic operation > # > # Potential inputs to this script are: > # ipport: IP-port combination of the neo4j REST server > # cypher: Cypher query string > # regex: Regular expression to match server output against > # grepflags: flags to give grep > ipport='127.0.0.1:7474' > ipport='[::ffff:127.0.0.1]:7474' > cypher="START one=node(*) RETURN one LIMIT 1" > # Need at least one node and one relationship for this one to succeed... > cypher="START one=node(*) MATCH one-[rel]->two RETURN one, rel, two LIMIT > 1" > regex='^{ *"results" *: *\[.*\] *, *"errors" *: *\[ *\] *}$' > grepflags="" > # > # Other variables in the script > # queryjson: JSON-encapsulated version of cypher query > # committrans: url suffix for committing transactions in one go > # URL: URL to give to Neo4j REST service > # header: Extra header information to give REST service (i.e., > Content-type) > queryjson="{\"statements\" : [ { \"statement\" : \"$cypher\" } ] }" > committrans='db/data/transaction/commit' > URL=http://${ipport}/${committrans} > header='Content-type: application/json' > use_wget=1 > > runquery() { > if > [ "$use_wget" -eq 1 ] > then > wget -q --header="${header}" --post-data="$queryjson" > --output-document=- $URL > else > curl -s -g --header "${header}" --data "$queryjson" --output > - $URL > fi > } > monitor() { > runquery | grep ${grepflags} "${regex}" >/dev/null > } > runquery > monitor > rc=$? > echo $rc > exit $rc > > > > -- > Alan Robertson <[email protected]> - @OSSAlanR > > "Openness is the foundation and preservative of friendship... Let me > claim from you at all times your undisguised opinions." - William > Wilberforce > > -- > You received this message because you are subscribed to the Google Groups > "Neo4j" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
