You are not logged in.

jbExplorer

Trainee

  • "jbExplorer" started this thread

Posts: 111

Date of registration: Mar 18th 2013

  • Send private message

1

Saturday, October 18th 2014, 6:34pm

Using Neo4j with Jabaco

This will get you started, but is not the only way to work with the Neo4j api:



'// Download the Neo4j jars, from
'// http://neo4j.com/download/other-releases/

'// and
'// http://download.java.net/maven/2/javax/t…/jta-1.0.1B.jar


'// Include these in the Jabaco References/Classpath
'// jta-1.0.1B.jar
'// lucene-core-3.6.2.jar
'// neo4j-kernel-2.1.5.jar
'// neo4j-lucene-index-2.1.5.jar
'// neo4j-primitive-collections-2.1.5.jar

Import java#io#File
Import java#io#IOException
Import java#util.*

Import org#neo4j#graphdb#Direction
Import org#neo4j#graphdb#GraphDatabaseService
Import org#neo4j#graphdb#Node
Import org#neo4j#graphdb#Relationship
Import org#neo4j#graphdb#RelationshipType
Import org#neo4j#graphdb#Transaction
Import org#neo4j#graphdb#factory#GraphDatabaseFactory
Import org#neo4j#kernel#impl#util#FileUtils



Public Sub main(ByJava args() As String)

Dim myArgs() As String

Dim s_dbPath As String = ""

Dim rel As Relationship

Dim KNOWS As DynamicRelationshipType

Dim gdf_GraphDatabase As GraphDatabaseService
Dim nd_First As org#neo4j#graphdb#Node
Dim nd_Second As org#neo4j#graphdb#Node

Dim tx As org#neo4j#graphdb#Transaction

myArgs = args


On Error Goto ErrHandler


KNOWS = DynamicRelationshipType.withName( "KNOWS" )

s_dbPath = "c:\Personal_Programming\Jabaco\Neo4J\db\FirstNeo4j.db"
gdf_GraphDatabase = New GraphDatabaseFactory().newEmbeddedDatabase( s_dbPath )
tx = gdf_GraphDatabase.beginTx

nd_First = gdf_GraphDatabase.createNode()
nd_First.setProperty( "message", "What the..., " )

nd_Second = gdf_GraphDatabase.createNode()
nd_Second.setProperty( "message", "World..." )


rel = nd_First.createRelationshipTo( nd_Second, KNOWS )

rel.setProperty( "message", "Important link between What The, and World" )

Debug().Print( nd_First.getProperty( "message" ) )
Debug().Print( nd_Second.getProperty( "message" ) )
Debug().Print( rel.getProperty( "message" ) )



gdf_GraphDatabase.shutdown

tx.success


'// Not sure why this generates an error.
'// tx.close



Exit Sub

ErrHandler:
JabacoErrorManager( "Main() : " & Err.getClass.getName, "what the...?", Err.getMessage )


End Sub

Rate this thread
WoltLab Burning Board