use of org.neo4j.cypher.javacompat.internal.GraphDatabaseCypherService in project neo4j by neo4j.
the class CommunityCypherEngineProvider method createEngine.
@Override
protected QueryExecutionEngine createEngine(Dependencies deps, GraphDatabaseAPI graphAPI) {
GraphDatabaseCypherService queryService = new GraphDatabaseCypherService(graphAPI);
deps.satisfyDependency(queryService);
DependencyResolver resolver = graphAPI.getDependencyResolver();
LogService logService = resolver.resolveDependency(LogService.class);
KernelAPI kernelAPI = resolver.resolveDependency(KernelAPI.class);
Monitors monitors = resolver.resolveDependency(Monitors.class);
LogProvider logProvider = logService.getInternalLogProvider();
CommunityCompatibilityFactory compatibilityFactory = new CommunityCompatibilityFactory(queryService, kernelAPI, monitors, logProvider);
deps.satisfyDependencies(compatibilityFactory);
return new ExecutionEngine(queryService, logProvider, compatibilityFactory);
}
use of org.neo4j.cypher.javacompat.internal.GraphDatabaseCypherService in project neo4j by neo4j.
the class ExecutionEngineTests method shouldConvertListsAndMapsWhenPassingFromScalaToJava.
@Test
public void shouldConvertListsAndMapsWhenPassingFromScalaToJava() throws Exception {
GraphDatabaseQueryService graph = new GraphDatabaseCypherService(this.database.getGraphDatabaseAPI());
KernelAPI kernelAPI = graph.getDependencyResolver().resolveDependency(KernelAPI.class);
Monitors monitors = graph.getDependencyResolver().resolveDependency(Monitors.class);
NullLogProvider nullLogProvider = NullLogProvider.getInstance();
CommunityCompatibilityFactory compatibilityFactory = new CommunityCompatibilityFactory(graph, kernelAPI, monitors, nullLogProvider);
ExecutionEngine executionEngine = new ExecutionEngine(graph, nullLogProvider, compatibilityFactory);
Result result;
try (InternalTransaction tx = graph.beginTransaction(KernelTransaction.Type.implicit, SecurityContext.AUTH_DISABLED)) {
String query = "RETURN { key : 'Value' , collectionKey: [{ inner: 'Map1' }, { inner: 'Map2' }]}";
TransactionalContext tc = createTransactionContext(graph, tx, query);
result = executionEngine.executeQuery(query, NO_PARAMS, tc);
tx.success();
}
Map firstRowValue = (Map) result.next().values().iterator().next();
assertThat(firstRowValue.get("key"), is("Value"));
List theList = (List) firstRowValue.get("collectionKey");
assertThat(((Map) theList.get(0)).get("inner"), is("Map1"));
assertThat(((Map) theList.get(1)).get("inner"), is("Map2"));
}
use of org.neo4j.cypher.javacompat.internal.GraphDatabaseCypherService in project neo4j by neo4j.
the class EnterpriseCypherEngineProvider method createEngine.
@Override
protected QueryExecutionEngine createEngine(Dependencies deps, GraphDatabaseAPI graphAPI) {
GraphDatabaseCypherService queryService = new GraphDatabaseCypherService(graphAPI);
deps.satisfyDependency(queryService);
DependencyResolver resolver = graphAPI.getDependencyResolver();
LogService logService = resolver.resolveDependency(LogService.class);
KernelAPI kernelAPI = resolver.resolveDependency(KernelAPI.class);
Monitors monitors = resolver.resolveDependency(Monitors.class);
LogProvider logProvider = logService.getInternalLogProvider();
CommunityCompatibilityFactory inner = new CommunityCompatibilityFactory(queryService, kernelAPI, monitors, logProvider);
EnterpriseCompatibilityFactory compatibilityFactory = new EnterpriseCompatibilityFactory(inner, queryService, kernelAPI, monitors, logProvider);
deps.satisfyDependency(compatibilityFactory);
return new ExecutionEngine(queryService, logProvider, compatibilityFactory);
}
Aggregations