Big Data

From TechWiki

What is big data, data science?

Contents

Neo4j Graph Database

Import CSV

Agents

LOAD CSV WITH HEADERS FROM "file:///home/jbg/work2/SIMPOL/code/databases/test/147agents.csv" AS csvLine
CREATE (a:Agent { id: toInt(csvLine.id), name: csvLine.Label, nace: toInt(csvLine.nace), 
country: csvLine.country, operatingRevenue: toInt(csvLine.operatingRevenue), control: 
toFloat(csvLine.control) });

Relations:

USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///home/jbg/work2/SIMPOL/code/databases/test/147network.csv" AS csvLine
MATCH (a:Agent { id: toInt(csvLine.Source)}),(b:Agent { id: toInt(csvLine.Target)})
CREATE (a)-[:OWNS { weight: csvLine.weight }]->(b);

Export


Shell-tools:

export-graphml -o out.graphml

Can be imported into Gephi, but only yields rudimentry graph (no info)

Shell:

Neo4J Webadmin and Browser

Issues:

Bugfix

Cannot start server

Failed to start Neo4j with an older data store version. To enable automatic upgrade, please set configuration parameter "allow_store_upgrade=true"

Simply add allow_store_upgrade=true to your neo4j.properties file, and start the database again. http://stackoverflow.com/questions/21418107/neo4j-2-0-java-failed-to-start-neo4j-with-an-older-data-store-version

Neo4J browser: Node with id - > Neo.ClientError.Statement.EntityNotFound

Memory Leaks

"Transaction data is kept in memory until committed so all your created nodes and relationships will just sit in memory awaiting a commit and that's why you eventually get OOM."

       if ( i > 0 && i % 10000 == 0 ) {
           tx.success();
           tx.finish();
           tx = graphDb.beginTx();
       }

http://stackoverflow.com/questions/11103436/java-neo4j-out-of-memory

Links

Server vs Embedded

Java

Eclipse

Python

Resources

Embedded Java

Batch Inserter

See Big_Data#Git

Always perform batch insertion in a single thread (or use synchronization to make only one thread at a time access the batch inserter) and invoke shutdown when finished.

Install

Dependencies:

Run

From base dir, with csv files

 mvn clean compile exec:java -Dexec.mainClass="org.neo4j.batchimport.Importer" -Dexec.args="/home/jbg/sw/neo4j-community-2.1.3/data/graph.db nodes.csv rels.csv"

Comma-delimited to tab-delimited:

sed 's/\,/\t/g' file >outfile

Example:

mvn clean compile exec:java -Dexec.mainClass="org.neo4j.batchimport.Importer" -Dexec.args="/home/jbg/sw/neo4j-community-2.1.3/data/graph.db /home/jbg/work2/SIMPOL/code/databases/test/147nodes.csv /home/jbg/work2/SIMPOL/code/databases/test/147rels.csv"

Nodes:

id      Label   nace    country operatingRevenue        control
1       BARCLAYS PLC    6512    GB      42481646        4.0495401294
2       AXA     6712    FR      94955880        2.2751084221
3       STATE STREET CORPORATION        6713    US      6327000 1.8073643012

Rels:

Start   End     Type    Property
105     111     owns    100
5       25      owns    80

Links

Cypher

Count

START n=node(*) 
RETURN count(n) 

START r=relationship(*)
RETURN count(r)

Eg

CREATE (n:JNODE { name : 'one'})

MATCH (n:JNODE)
WHERE n.name = "one"
CREATE (m:JNODE { name:'two' })
CREATE (n)-[:FOLLOWS { link : 'follows'}]->(m);
start n=node(*)
match n-[r]-m
return n, r, m;

Degree info

start n=node(*)
match n-[r]-m
return n, count(r) as degree
order by degree desc;

Delete:

MATCH (n)
OPTIONAL MATCH (n)-[r]-()
DELETE n,r
START n=node(*)
OPTIONAL MATCH (n)-[r]-() 
DELETE n, r
match n
WHERE n.`BOWTIE`='OCC'
with n
match n-[r]-()
delete r,n
match n
WHERE NOT (HAS (n.name)) //find all nodes with no name property
with n
match n-[r]-() //find all nodes connected to that node
delete r,n //delete its relations and then the node itself
MATCH (a:Person),(m:Movie) OPTIONAL MATCH (a)-[r1]-(), (m)-[r2]-() DELETE a,r1,m,r2

Links: To find nodes connected by exactly 3 relationships:

MATCH (n)-[r*3]->(m) RETURN n, r, m;

To find nodes connected by a number of relationships in the range [2..5]:

MATCH (n)-[r*2..5]->(m) RETURN n, r, m;

To find nodes connected by up to 5 relationships (the lower bound of 1 avoids the case where there there is no relationship, i.e., n is the same as m):

MATCH (n)-[r*1..5]->(m) RETURN n, r, m;

To find nodes connected by at least 2 relationships:

MATCH (n)-[r*2..]->(m) RETURN n, r, m;

http://stackoverflow.com/questions/23204062/neo4j-query-nodes-where-any-pair-of-nodes-are-connected-by-a-certain-number-of

Petra:

match (n:_Graph {name:"Greenpeace"}) 
optional match n-[]-m 
optional match n-[:w3_sameAs*]-o 
optional match o-[]-(p) 
return *

On And On

MATCH (n) RETURN n
start n = node:myindex('name:*WI*') return n
match (n:TNC) match n<-[r]-() where n.name="BLACKROCK INC" return n,r
match (n:TNC) match n<-[r]-() where n.name="BLACKROCK INC" return n,sum(r.weight)
match (n:TNC) where n.bowtie="scc" return ID(n) limit 1
match (n)-[r]-()
with n, sum(case when endnode(r) = n then 1 else 0 end) as indegree
return id(n),n.NAME as nodename, indegree
order by indegree asc
match (n)-[r]-()
with n, sum(case when endnode(r) = n then 1 else 0 end) as indegree where indegree=0
return id(n),n.NAME, n.BOWTIE, indegree
match ()-[r]-(n)
with n, sum(case when startnode(r) = n then 1 else 0 end) as outdegree where outdegree=0
return id(n),n.NAME, n.BOWTIE, outdegree
START n=node(137),m=node(92) 
MATCH p=n-[r*1..]-m 
WITH count(p) AS totalPaths,n,m 
WHERE totalPaths>1 
RETURN n,m,totalPaths 
LIMIT 2
START n=node(137),m=node(92) 
MATCH p=n-[r*1..]-m 
RETURN n,m,count(p)
START n=node(92) 
MATCH p=n-[]-m
WHERE m.BOWTIE='SCC'
RETURN n,m 
START n=node(*)
WHERE n.BOWTIE='IN'
MATCH p=n-[]-m
WHERE m.BOWTIE='IN'
RETURN n,m
match (n) with n.`Total_assets_(last_year)_th_USD_Last_avail__yr` as ta where ta>0 return sum(ta)
MATCH (n) WITH n.NAME as name, n.`Total_assets_th_USD_Last_avail__yr` as ta WHERE ta>0 RETURN name, ta ORDER BY ta desc
MATCH (n) WITH n.`Total_assets_th_USD_Last_avail__yr` as ta WHERE ta>0 RETURN sum(ta)
MATCH (n) WHERE has(n.`COUNTRY`) RETURN DISTINCT "" as element, n.`COUNTRY` , count(n) as cnt ORDER BY cnt desc
START n=node(*)
MATCH (n)-[r]->()
WITH n, count(r) as c
RETURN n.`NAME`, c
ORDER BY c DESC
START n=node(*)
MATCH (n)<-[r]-()
WITH n, count(r) as c
WHERE c=172
RETURN n.`NAME`
MATCH (n) WHERE has(n.`BOWTIE`) RETURN n.`BOWTIE`="SCC" , sum(n.`CONTROL`) as cnt ORDER BY cnt desc
MATCH (n) WHERE 
has(n.`CONTROL`) AND n.`CONTROL`>0 
AND has(n.`VALUE`) AND n.`VALUE`>0
AND has(n.`Total_assets_th_USD_Last_avail__yr`) AND n.`Total_assets_th_USD_Last_avail__yr`>0
AND has(n.`P/L_for_period_[=Net_income]_th_USD_Last_avail__yr`) AND n.`P/L_for_period_[=Net_income]_th_USD_Last_avail__yr`>0
AND has(n.`P/L_before_tax_th_USD_Last_avail__yr`) AND n.`P/L_before_tax_th_USD_Last_avail__yr`>0
AND has(n.`ROE_using_P/L_before_tax___Last_avail__yr`) AND n.`ROE_using_P/L_before_tax___Last_avail__yr`>0
AND has(n.`COUNTRY`)
RETURN n.`CONTROL` as c ,
n.`VALUE` as v,
n.`Total_assets_th_USD_Last_avail__yr` as tota,
n.`P/L_for_period_[=Net_income]_th_USD_Last_avail__yr` as netinc,
n.`P/L_before_tax_th_USD_Last_avail__yr` as plbtax,
n.`ROE_using_P/L_before_tax___Last_avail__yr` as roe,
n.`COUNTRY` as ctry
LIMIT 10
MATCH (n) WHERE 
n.`P/L_for_period_[=Net_income]_th_USD_Last_avail__yr`="Credit needed"
SET n.`P/L_for_period_[=Net_income]_th_USD_Last_avail__yr`=0
RETURN count(n)
MATCH (n) WHERE
has(n.`CONTROL`) AND n.`CONTROL`>0
AND has(n.`VALUE`) AND n.`VALUE`>0
AND has(n.`Total_assets_th_USD_Last_avail__yr`) AND n.`Total_assets_th_USD_Last_avail__yr`>0
AND has(n.`P/L_for_period_[=Net_income]_th_USD_Last_avail__yr`)
AND has(n.`P/L_before_tax_th_USD_Last_avail__yr`)
AND has(n.`ROE_using_P/L_before_tax___Last_avail__yr`)
AND has(n.`COUNTRY`)
RETURN n.`CONTROL` as c,
n.`VALUE` as v,
n.`Total_assets_th_USD_Last_avail__yr` as tota,
n.`P/L_for_period_[=Net_income]_th_USD_Last_avail__yr` as netinc,
n.`P/L_before_tax_th_USD_Last_avail__yr` as plbtax,
n.`ROE_using_P/L_before_tax___Last_avail__yr` as roe,
n.`COUNTRY` as ctry
match (n) WHERE n.`COUNTRY`='US' AND  n.`BOWTIE`='SCC' return n.`NAME`, n.`NACE`, n.`CONTROL` order by n.`CONTROL` desc limit 100
start n=node(*) match n-[r]-m return n.`NAME`, n.`CONTROL`, count(r) as degree order by degree desc limit 200;
match (n) WHERE  n.`BOWTIE`='SCC' return n.`NAME`, n.`NACE`, n.`VALUE`, n.`CONTROL` order by n.`CONTROL` desc limit 200

This was really painful to figure out: take a subset of nodes, count how often nodes with a certain property are present (e.g., country) and---here lies the crux--- express this as percentage:

MATCH (n) WHERE n.`BOWTIE`='SCC'
WITH COUNT(n) as tot
MATCH (n) WHERE n.`BOWTIE`='SCC'
WITH  tot, n.`COUNTRY` as Country, COUNT(n.`COUNTRY`) as num
RETURN Country, num*100.0/tot as Perc order by Perc desc
MATCH (n)
WITH sum(n.`CONTROL`) as totc
MATCH (n)
WITH totc, sum(n.`VALUE`) as totv
MATCH (n) WHERE n.`BOWTIE`='SCC'
WITH  totv, totc, n.`NAME` as Name, n.`NACE` as NACE, n.`CONTROL` as ctrl, n.`VALUE` as val
RETURN Name, NACE, ctrl*100.0/totc as GIIPerc, val*100.0/totv as OpRevPerc order by GIIPerc desc
MATCH (n)
WITH sum(n.`CONTROL`) as totc
MATCH (n)
WITH totc, sum(n.`VALUE`) as totv
MATCH (n)
WITH  totv, totc, n.`NAME` as NameInSCC, n.`BOWTIE` as Bowtie, n.`NACE` as NACE, n.`CONTROL` as ctrl, n.`VALUE` as val 
RETURN NameInSCC, Bowtie, NACE, ctrl*100.0/totc as GIIPerc, val*100.0/totv as OpRevPerc order by GIIPerc desc limit 10;
MATCH (n)
WITH sum(n.`CONTROL`) as totc
MATCH (n)
WITH totc, sum(n.`VALUE`) as totv
MATCH (n) WHERE n.`BOWTIE`='SCC'
WITH  totv, totc, sum(n.`CONTROL`) as ctrl, sum(n.`VALUE`) as val
RETURN ctrl*100.0/totc as SCCGIIPerc, val*100.0/totv as SCCOpRevPerc
MATCH (n) WHERE n.`BOWTIE`='SCC'
MATCH (m) WHERE m.`BOWTIE`='SCC'
MATCH (n)-[r]-m
RETURN count(r) as SCCRels
match (n)-[r]-()
with n, sum(case when endnode(r) = n then 1 else 0 end) as indegree
match ()-[r]-(n)
with indegree, n, sum(case when startnode(r) = n then 1 else 0 end) as outdegree 
return n.NAME, n.BOWTIE, indegree, outdegree order by outdegree desc limit 10;
match (n)-[r]-()
MATCH (n) WHERE n.`BOWTIE`='SCC'
with n, sum(case when endnode(r) = n then 1 else 0 end) as kin
match ()-[r]-(n)
MATCH (n) WHERE n.`BOWTIE`='SCC'
with kin, n, sum(case when startnode(r) = n then 1 else 0 end) as kout
return n.`NAME` as name, n.`CONTROL` as ii, n.`VALUE` as v, n.`Total_assets_th_USD_XXXX` as tota,
n.`P_L_for_period___Net_income__th_USD_XXXX` as netinc, n.`P_L_before_tax_th_USD_XXXX` as plbtax,
n.`ROE_using_P_L_before_tax___XXXX` as roe, n.`Number_of_employees_XXXX` as emp,
n.`COUNTRY` as ctry, kin, kout;
match n<-[r]-m
with n, sum(r.`WEIGHT_MERGED`) as win
where win>1.0
return count(win);

match n<-[r]-m
return n.`NAME` as name, sum(r.`WEIGHT_MERGED`) as win
order by win desc limit 10;
match n<-[r]-m
with n, r
where n.`NAME`='BARCLAYS PLC'
return r.`WEIGHT_MERGED` as win 
order by win desc limit 10;
match n<-[r]-m
with n, sum(r.`WEIGHT_MERGED`) as wintot
with n, (CASE WHEN wintot > 1 THEN 1 ELSE wintot END) as nwintot
return (1- nwintot) order by nwintot asc limit 10;
match n<-[r]-m
with n, sum(r.`WEIGHT_MERGED`) as wintot
with n, (CASE WHEN wintot > 1 THEN 1 ELSE wintot END) as nwintot
with sum((1- nwintot)*n.`VALUE`) as lossval, sum(n.`VALUE`) as val
return 100.0*lossval/val;
match o-[s*2]->m-[r]->n
where o.`BOWTIE`='TT' and m.`BOWTIE`='TT' and n.`BOWTIE`='OUT'
return count(distinct o);
match i-[r*1]->o
where o.`BOWTIE`='OUT' and i.`BOWTIE`='IN'
return  count(distinct i);
MATCH (n)
WITH n, n.`CONTROL` as c ORDER BY c DESC LIMIT 480 
WHERE n.`BOWTIE`='SCC'
RETURN sum(c)/178090379652*100;

Histo

MATCH (n) WHERE has(n.`TYPE`) RETURN DISTINCT n.`TYPE` as type, count(n.`TYPE`) order by type asc;

Return a set of ordered links from a set of ordered nodes:

MATCH (n) WHERE HAS(n.II_VAL)
WITH n ORDER BY n.II_VAL DESC LIMIT 10
MATCH (n)-[r]->(m) WHERE HAS(m.VALUE)
WITH n, n.II_VAL as ii, r, m, m.VALUE*r.WEIGHT_MERGED as iidir ORDER BY iidir DESC
RETURN n.NAME, ii, COLLECT([r.WEIGHT_MERGED, m.VALUE, iidir, m.NAME])[0..2] order BY ii DESC;
MATCH (n) WHERE HAS(n.II_VAL)
WITH n ORDER BY n.II_VAL DESC LIMIT 120
MATCH (n)-[r]->(m) WHERE HAS(m.VALUE) and HAS(m.II_VAL)
WITH n, n.II_VAL as ii, r, m, 1000*m.VALUE*r.WEIGHT_MERGED as dirVal, m.II_VAL*r.WEIGHT_MERGED as dirII ORDER BY (dirII+dirVal) DESC
RETURN n.NAME, ii, COLLECT([r.WEIGHT_MERGED, 1000*m.VALUE, m.II_VAL, dirVal, dirII, m.NAME])[0..10] order BY ii DESC;

Top II and small kout:

MATCH (n) WHERE n.II_VAL > 100000000000
WITH n ORDER BY n.II_VAL DESC
MATCH (n)-[r]->() 
WITH n, count(r) as outdegree where outdegree > 1
RETURN n.NAME, n.II_VAL, outdegree order by outdegree asc limit 100;

Dir pf:

MATCH n-[r]->m
WITH n, m, n.II_VAL as ii, m.VALUE * r.WEIGHT_MERGED * 1000 as diro
RETURN n.NAME, ii, sum(diro) as dirpf, count(m) as cnt ORDER by dirpf DESC;

Tendrils:

MATCH (n)-[r]->(m) WHERE n.`BOWTIE`="IN" and m.`BOWTIE`="TT" SET m.`TT`="IT1" return count(m);
MATCH (m)-[r]->(n) WHERE n.`BOWTIE`="OUT" and m.`BOWTIE`="TT" SET m.`TT`="T1O" return count(m);

Cont:

MATCH (n)-[r]->(m) WHERE n.`TT`="IT1" and not(has(m.`TT`)) SET m.`TT`="IT2" return count(m);
MATCH (m)-[r]->(n) WHERE n.`TT`="T1O" and not(has(n.`TT`)) SET m.`TT`="T2O" return count(m);

Tubes:

MATCH p =(k)-[*1..500]->(m)
WHERE has(k.`TT`) and has(m.`TT`)
WITH EXTRACT(l in FILTER(n IN nodes(p) WHERE not(has(n.`TT`))) | l) as tubes
RETURN length(tubes) as tubes;

Tubes & Tendrils -- working version:

// Start
MATCH (n) REMOVE n.`TT` RETURN count(n);
// Anchor
// I->T
MATCH (n)-[r]->(m) WHERE n.`BOWTIE`="IN" and m.`BOWTIE`="TT" SET n.`TT`="INANCH" return count(m) as inAnchors;
// T->O
MATCH (m)-[r]->(n) WHERE n.`BOWTIE`="OUT" and m.`BOWTIE`="TT" SET n.`TT`="OUTANCH" return count(m) as outAnchors;
// IN: leaves
MATCH (n)
WHERE n.`BOWTIE`="TT" and NOT (n)-[]->()
SET n.`TT`="INLEAVES"
RETURN count(n) as rootsOut;
// OUT: roots
MATCH (n)
WHERE n.`BOWTIE`="TT" and NOT ()-[]->(n)
SET n.`TT`="OUTROOTS"
RETURN count(n) as leavesIn;
// IN-Tendrils
MATCH p =(k)-[*1..500]->(m)
WHERE k.`TT`="INANCH" and m.`TT`="INLEAVES"
WITH FILTER(n IN nodes(p) WHERE n.`BOWTIE`="TT" and not(has(n.`TT`))) as tubes
FOREACH(x in tubes | SET x.`TT`="INT")
RETURN count(tubes) as intend;
// OUT-Tendrils
MATCH p =(m)-[*1..500]->(k)
WHERE k.`TT`="OUTANCH" and m.`TT`="OUTROOTS"
WITH FILTER(n IN nodes(p) WHERE n.`BOWTIE`="TT" and not(has(n.`TT`))) as tubes
FOREACH(x in tubes | SET x.`TT`="OUTT")
RETURN count(tubes) as outtend;
// Tubes
MATCH p =(k)-[]->(x)-[*1..500]->(y)-[]->(m)
WHERE k.`TT`="INANCH" and m.`TT`="OUTANCH" and x.`BOWTIE`="TT" and y.`BOWTIE`="TT"
WITH FILTER(n IN nodes(p) WHERE n.`BOWTIE`="TT" and not(has(n.`TT`))) as tubes
FOREACH(x in tubes | SET x.`TT`="TUBES")
RETURN length(tubes);
// Count
MATCH (n) where n.`TT`="TUBES" return count(n);
MATCH (n) where n.`TT`="INLEAVES" and n.`TT`="INT" return count(n);
MATCH (n) where n.`TT`="OUTROOTS" and n.`TT`="OUTT" return count(n);
MATCH (n) where n.`BOWTIE`="TT" return count(n);

Performance and Tuning

Neo4j

Setting up JVM:

java -Dfile.encoding=UTF-8 -Dfile.encoding=UTF-8 -Xmx8G -Xms8G -Xverify:none -XX:+HeapDumpOnOutOfMemoryError -server -d64 -XX:+UseConcMarkSweepGC -jar my.jar

Tweaking Neo4j from Java:

gdbs = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(cfg.dbPath).
  ...
  setConfig(GraphDatabaseSettings.cache_type, "none").
  setConfig(GraphDatabaseSettings.use_memory_mapped_buffers, "true").
  setConfig(GraphDatabaseSettings.nodestore_mapped_memory_size, "4G").
  setConfig(GraphDatabaseSettings.relationshipstore_mapped_memory_size, "12G").
  setConfig(GraphDatabaseSettings.strings_mapped_memory_size, "1G").
  setConfig(GraphDatabaseSettings.arrays_mapped_memory_size, "0G").
  newGraphDatabase();

Tweaking Neo4j server:

conf/neo4j-server.properties
conf/neo4j.properties

Java

If possible, use sets not arrays! These are costly operations on arrays:

.remove(...);
.contains(...);
.indexOf(...);

Example:

ArrayList<Integer> tt = new ArrayList<Integer>();
ArrayList<Integer> occ = new ArrayList<Integer>();
ArrayList<Integer> del = (ArrayList<Integer>) occ.clone();
for (int i : del) {
   if (tt.contains(i)) {
       occ.remove(occ.indexOf(i));
   }
}

takes nearly 55 hours with an aray size of 13'944'444!!!

Same functionality with sets:

HashSet<Integer> tt = new HashSet<Integer>();
HashSet<Integer> occ = new HashSet<Integer>();
Integer[] del = occ.toArray(new Integer[occ.size()]);
for (int i : del) {
   if (tt.contains(i)) {
       occ.remove(i);
   }
}

runs under one second!!!

MySQL

See MySQL#Tuning.

Misc

Gephi

  • neo4j plugin

Problems importing Neo4J DB

Neoclipse

Git

Links:

Performance

neo4j.properties

   neostore.nodestore.db.mapped_memory=4G
   neostore.relationshipstore.db.mapped_memory=12G
   neostore.relationshipgroupstore.db.mapped_memory=4G
   neostore.propertystore.db.mapped_memory=4G
   neostore.propertystore.db.strings.mapped_memory=4G
   neostore.propertystore.db.arrays.mapped_memory=0M
   allow_store_upgrade=true
   #keep_logical_logs=7 days
   node_auto_indexing=true

neo4j-wrapper.conf

wrapper.java.additional=-XX:+HeapDumpOnOutOfMemoryError
wrapper.java.additional=-server
wrapper.java.additional=-d64
wrapper.java.initmemory=12000
wrapper.java.maxmemory=28000


Indexing

Cypher

CREATE INDEX ON :TNC(name)
CREATE INDEX ON :Firm(name)
CREATE INDEX ON :`Firm`(`name`)
:schema

In the neo4-j-shell

schema -ls

Embedded Java

Update

Set:

GraphDatabaseService gdbs = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(cfg.dbPath).

setConfig(GraphDatabaseSettings.node_keys_indexable, "prop1, prop2). setConfig(GraphDatabaseSettings.node_auto_indexing, "true"). newGraphDatabase();

Retrieve:

Node hit = autoNodeIndex.get("prop1", "prop1_val").getSingle();
Node hit2 = autoNodeIndex.get("prop2", "prop2_val").getSingle();
IndexHits<Node> hits = autoNodeIndex.get("prop2", "prop3_val"); // null


This didn't work:

IndexDefinition indexDefinition;
Transaction tx = gdbs.beginTx();

try{
Schema schema = gdbs.schema();
indexDefinition = schema.indexFor(DynamicLabel.label("Firm")).on("name").create();
tx.success();
}
finally {
tx.close();
System.out.println("Trx1 close");
}
tx = gdbs.beginTx();
try {
System.out.println("Index pop start");
Schema schema = gdbs.schema();
schema.awaitIndexOnline( indexDefinition, 10, TimeUnit.SECONDS );
// No index for label Firm on property name
// Cypher
// CREATE INDEX ON :Firm(name)
tx.success();
}
finally {
tx.close();
System.out.println("Trx2 close");
}

Either "Expected index to come online within a reasonable time." (schema.awaitIndexOnline) or "org.neo4j.graphdb.NotFoundException: No index for label Firm on property name".

Links