Last active
August 29, 2015 14:17
-
-
Save klaeufer/5c9dbd6cc60e4f76cde5 to your computer and use it in GitHub Desktop.
Initial neo4j explorations in Scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// libraryDependencies += "org.neo4j" % "neo4j" % "2.2.0-RC01" | |
// libraryDependencies += "com.jsuereth" %% "scala-arm" % "1.4" | |
import org.neo4j.graphdb._ | |
import org.neo4j.graphdb.factory._ | |
import resource._ | |
import scala.collection.JavaConversions._ // for using ResourceIterator in a for comprehension | |
val graphDb = new GraphDatabaseFactory().newEmbeddedDatabase("db1") | |
for (tx <- managed(graphDb.beginTx())) { | |
val n = graphDb.createNode(DynamicLabel.label("node")) | |
n.setProperty("was", "sup") | |
tx.success() | |
} | |
for (tx <- managed(graphDb.beginTx()); | |
node <- graphDb.findNodesByLabelAndProperty(DynamicLabel.label("node"), "was", "sup")) { | |
println(node) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment