Skip to content

Instantly share code, notes, and snippets.

@jexp
Last active August 29, 2015 14:08
Show Gist options
  • Save jexp/5a183c3501869ee63d30 to your computer and use it in GitHub Desktop.
Save jexp/5a183c3501869ee63d30 to your computer and use it in GitHub Desktop.
groovy script to debug string value of node property (Usage groovy debug_property.groovy /path/to/neo/data/graph.db)
@Grab('org.neo4j:neo4j:2.1.5')
import org.neo4j.graphdb.factory.*
import org.neo4j.graphdb.*
import org.neo4j.*
import org.neo4j.cypher.javacompat.*
db = new GraphDatabaseFactory().newEmbeddedDatabase(args[0])
cypher = new ExecutionEngine(db)
query = "match (n:material) where n.id = 'lsF3BxzFdn0kj' return n"
tx = db.beginTx()
try {
result = cypher.execute(query,[:])
for (row in result) {
node = row["n"]
print(node.getId() + " ")
desc = node.getProperty("description")
print(desc ==~ /(?i).*mosaic.*/)
print(" ")
for (i=0;i<desc.length();i++) {
print(desc[i]+"("+Integer.toHexString((int)desc.charAt(i))+") ")
}
println()
}
tx.success()
} finally {
tx.close()
}
db.shutdown()
206 true I(49) n(6e) t(74) r(72) o(6f) d(64) u(75) c(63) i(69) n(6e) g(67) (20) o(6f) u(75) r(72) (20) n(6e) e(65) w(77) (20) R(52) i(69) p(70) (20) C(43) u(75) r(72) l(6c) (20) l(6c) i(69) n(6e) e(65) a(61) r(72) (20) g(67) l(6c) a(61) s(73) s(73) (20) m(6d) o(6f) s(73) a(61) i(69) c(63) (20) t(74) i(69) l(6c) e(65) s(73) .(2e) (20) T(54) h(68) i(69) s(73) (20) C(43) a(61) r(72) i(69) b(62) b(62) e(65) a(61) n(6e) (20) c(63) o(6f) l(6c) o(6f) r(72) (20) c(63) o(6f) m(6d) b(62) i(69) n(6e) a(61) t(74) i(69) o(6f) n(6e) (20) o(6f) f(66) (20) g(67) r(72) e(65) e(65) n(6e) s(73) (20) a(61) n(6e) d(64) (20) b(62) l(6c) u(75) e(65) s(73) (20) b(62) r(72) i(69) n(6e) g(67) s(73) (20) a(61) (20) w(77) a(61) r(72) m(6d) (20) i(69) n(6e) v(76) i(69) t(74) i(69) n(6e) g(67) (20) f(66) e(65) e(65) l(6c) i(69) n(6e) g(67) (20) t(74) o(6f) (20) a(61) (20) k(6b) i(69) t(74) c(63) h(68) e(65) n(6e) (20) b(62) a(61) c(63) k(6b) s(73) p(70) l(6c) a(61) s(73) h(68) (20) o(6f) r(72) (20) b(62) a(61) t(74) h(68) r(72) o(6f) o(6f) m(6d) .(2e) (20) T(54) h(68) e(65) (20) c(63) o(6f) l(6c) o(6f) r(72) s(73) (20) w(77) o(6f) r(72) k(6b) (20) v(76) e(65) r(72) y(79) (20) w(77) e(65) l(6c) l(6c) (20) w(77) i(69) t(74) h(68) (20) w(77) h(68) i(69) t(74) e(65) (20) c(63) a(61) b(62) i(69) n(6e) e(65) t(74) r(72) y(79) (20) o(6f) r(72) (20) l(6c) a(61) r(72) g(67) e(65) r(72) (20) t(74) i(69) l(6c) e(65) s(73) .(2e) (20) W(57) e(65) (20) a(61) l(6c) s(73) o(6f) (20) c(63) a(61) r(72) r(72) y(79) (20) t(74) h(68) i(69) s(73) (20) p(70) r(72) o(6f) d(64) u(75) c(63) t(74) (20) i(69) n(6e) (20) a(61) (20) s(73) m(6d) a(61) l(6c) l(6c) (20) s(73) u(75) b(62) w(77) a(61) y(79) (20) m(6d) o(6f) s(73) a(61) i(69) c(63) (20) t(74) o(6f) (20) g(67) i(69) v(76) e(65) (20) y(79) o(6f) u(75) (20) s(73) o(6f) m(6d) e(65) (20) o(6f) p(70) t(74) i(69) o(6f) n(6e) s(73) !(21) (20) S(53) O(4f) L(4c) D(44) (20) O(4f) U(55) T(54) :(3a) (20) B(42) a(61) c(63) k(6b) (20) i(69) n(6e) (20) s(73) t(74) o(6f) c(63) k(6b) (20) e(65) n(6e) d(64) (20) o(6f) f(66) (20) A(41) u(75) g(67) u(75) s(73) t(74) .(2e) (20) C(43) a(61) l(6c) l(6c) (20) u(75) s(73) (20) t(74) o(6f) (20) p(70) r(72) e(65) -(2d) o(6f) r(72) d(64) e(65) r(72) (20) a(61) n(6e) d(64) (20) s(73) a(61) v(76) e(65) (20) 1(31) 0(30) %(25) !(21)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment