use of com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph in project sunbird-rc-core by Sunbird-RC.
the class Neo4jGraphProvider method createUniqueIndex.
@Override
public void createUniqueIndex(Graph graph, String label, List<String> propertyNames) {
Neo4JGraph neo4jGraph = (Neo4JGraph) graph;
if (propertyNames.size() > 0) {
for (String propertyName : propertyNames) {
Objects.requireNonNull(label, "label cannot be null");
Objects.requireNonNull(propertyName, "propertyName cannot be null");
neo4jGraph.execute(new Statement("CREATE CONSTRAINT ON (n:" + label + ") ASSERT n." + propertyName + " IS UNIQUE"));
logger.info("Neo4jGraph unique index created for " + label);
}
} else {
logger.info("Could not create unique index for empty properties");
}
}
use of com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph in project sunbird-rc-core by Sunbird-RC.
the class Neo4jGraphProvider method createCompositeIndex.
@Override
public void createCompositeIndex(Graph graph, String label, List<String> propertyNames) {
Neo4JGraph neo4jGraph = (Neo4JGraph) graph;
if (propertyNames.size() > 0) {
StringBuilder properties = new StringBuilder(String.join(",", propertyNames));
logger.info("composite key properties values " + properties);
Objects.requireNonNull(label, "label cannot be null");
Objects.requireNonNull(properties, "properties cannot be null");
neo4jGraph.execute(new Statement("CREATE INDEX ON :`" + label + "`(" + properties + ")"));
} else {
logger.info("Could not create composite index for empty properties");
}
}
use of com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph in project sunbird-rc-core by Sunbird-RC.
the class Neo4jGraphProvider method getGraph.
private Neo4JGraph getGraph() {
Neo4JGraph neo4jGraph;
Neo4JElementIdProvider<?> idProvider = neo4jIdProvider;
neo4jGraph = new Neo4JGraph(driver, idProvider, idProvider);
logger.debug("Getting a new graph unit of work");
return neo4jGraph;
}
use of com.steelbridgelabs.oss.neo4j.structure.Neo4JGraph in project sunbird-rc-core by Sunbird-RC.
the class Neo4jGraphProvider method createIndex.
@Override
public void createIndex(Graph graph, String label, List<String> propertyNames) {
Neo4JGraph neo4jGraph = (Neo4JGraph) graph;
if (propertyNames.size() > 0) {
for (String propertyName : propertyNames) {
neo4jGraph.createIndex(label, propertyName);
logger.info("Neo4jGraph index created for " + label);
}
} else {
logger.info("Could not create single index for empty properties");
}
}
Aggregations