PageRenderTime 55ms CodeModel.GetById 24ms app.highlight 1ms RepoModel.GetById 29ms app.codeStats 0ms

/src/test_cfc.cfm

http://github.com/bpanulla/cf_neo4j
ColdFusion | 31 lines | 23 code | 8 blank | 0 comment | 0 complexity | 10cd076172824b0061f2428bbbb0ea7e MD5 | raw file
 1<cfset neo4jHelper = CreateObject("component", "org.fraught.neo4j.neo4j").initialize("/tmp/neo4jtest/var/graphdb") />
 2
 3<cftry>
 4	<cfset tx = neo4jHelper.beginTx() />
 5	
 6	<cfscript>
 7		firstNode = neo4jHelper.createNode();
 8		secondNode = neo4jHelper.createNode();
 9		relationship = firstNode.createRelationshipTo( secondNode, neo4jHelper.getRelationship("KNOWS") );
10		 
11		firstNode.setProperty( "message", "Hello, " );
12		secondNode.setProperty( "message", "world!" );
13		relationship.setProperty( "message", "brave Neo4j " );
14
15		WriteOutput( firstNode.getProperty( "message" ) );
16		WriteOutput( relationship.getProperty( "message" ) );
17		WriteOutput( secondNode.getProperty( "message" ) );
18
19		tx.success();
20	</cfscript>
21	
22
23	<cfset tx.finish() />
24	<cfcatch type="any">
25		<cfset neo4jHelper.shutdown() />
26		<cfdump var="#cfcatch#">
27	</cfcatch>
28</cftry>
29
30<cfset neo4jHelper.shutdown() />
31Done.