.collect(Collectors.toList()));
// Iterate through the inputs
for (String input: inputs)
{
Transaction tx = db.beginTx();
// Get data node
Long dataNodeId = nodeManager.getOrCreateNode(dataNodeManager, input, db).getId();
nodeManager.setNodeProperty(dataNodeId, "label", labels.toArray(new String[labels.size()]), db);
Map<Long, Integer> patternMatchers = PatternMatcher.match(GraphManager.ROOT_TEMPLATE, input, db, graphManager);
tx.success();
tx.close();
tx = db.beginTx();
for (Long nodeId : patternMatchers.keySet()) {
// Get property
Integer matchCount = (Integer) nodeManager.getNodeProperty(nodeId, "matches", db);
if (matchCount == null) {
matchCount = 0;
nodeManager.setNodeProperty(nodeId, "matches", matchCount, db);
}
// Set property
nodeManager.setNodeProperty(nodeId, "matches", matchCount + patternMatchers.get(nodeId), db);
// Get or create data relationship
dataRelationshipManager.getOrCreateNode(nodeId, dataNodeId, db);
for (Long labelId : labelNodeIds) {
// Get or create class relationship
classRelationshipCache.getOrCreateRelationship(nodeId, labelId, db, graphManager);
}
// Check if the match count has exceeded the threshold
matchCount = (Integer) nodeManager.getNodeProperty(nodeId, "matches", db);
Integer threshold = (Integer) nodeManager.getNodeProperty(nodeId, "threshold", db);
if (matchCount > threshold) {
// Set match count to 0
nodeManager.setNodeProperty(nodeId, "matches", 0, db);
// Increase threshold
nodeManager.setNodeProperty(nodeId, "threshold", (threshold / GraphManager.MIN_THRESHOLD) + (threshold), db);
// Populate a map of matched patterns
Map<Integer, Map<String, PatternCount>> matchDictionary = new HashMap<>();
populatePatternMap(db, nodeId, matchDictionary);
// Generate nodes for every wildcard
generateChildPatterns(db, nodeManager.getNodeAsMap(nodeId, db), matchDictionary, graphManager);
}
}
tx.success();
tx.close();
}
}