Examples of ExecutionResult


Examples of org.neo4j.cypher.javacompat.ExecutionResult

   * @param columnValues the values in {@link org.hibernate.ogm.model.key.spi.EntityKey#getColumnValues()}
   * @return the corresponding node
   */
  public Node findEntity(ExecutionEngine executionEngine, Object[] columnValues) {
    Map<String, Object> params = params( columnValues );
    ExecutionResult result = executionEngine.execute( findEntityQuery, params );
    return singleResult( result );
  }
View Full Code Here

Examples of org.neo4j.cypher.javacompat.ExecutionResult

   * @param columnValues the values in {@link org.hibernate.ogm.model.key.spi.EntityKey#getColumnValues()}
   * @return the corresponding node
   */
  public Node findOrCreateEntity(ExecutionEngine executionEngine, Object[] columnValues) {
    Map<String, Object> params = params( columnValues );
    ExecutionResult result = executionEngine.execute( findOrCreateEntityQuery, params );
    return singleResult( result );
  }
View Full Code Here

Examples of org.neo4j.cypher.javacompat.ExecutionResult

   *
   * @param executionEngine the {@link ExecutionEngine} used to run the query
   * @return
   */
  public ResourceIterator<Node> findEntities(ExecutionEngine executionEngine) {
    ExecutionResult result = executionEngine.execute( findEntitiesQuery );
    return result.columnAs( "n" );
  }
View Full Code Here

Examples of org.neo4j.cypher.javacompat.ExecutionResult

   * @param idSourceKey the {@link IdSourceKey} identifying the sequence
   * @return the node representing the sequence
   */
  private Node getSequence(IdSourceKey idSourceKey) {
    String updateSequenceQuery = getQuery( idSourceKey );
    ExecutionResult result = engine.execute( updateSequenceQuery, singletonMap( SEQUENCE_NAME_QUERY_PARAM, (Object) sequenceName( idSourceKey ) ) );
    ResourceIterator<Node> column = result.columnAs( "n" );
    Node node = null;
    if ( column.hasNext() ) {
      node = column.next();
    }
    column.close();
View Full Code Here

Examples of org.neo4j.cypher.javacompat.ExecutionResult

  protected ExecutionResult executeCypherQuery(String query, Map<String, Object> parameters) throws Exception {
    SessionFactoryImplementor sessionFactory = (SessionFactoryImplementor) ( (OgmEntityManagerFactory) getFactory() ).getSessionFactory();
    Neo4jDatastoreProvider provider = (Neo4jDatastoreProvider) sessionFactory.getServiceRegistry().getService( DatastoreProvider.class );
    ExecutionEngine engine = new ExecutionEngine( provider.getDataBase() );
    ExecutionResult result = engine.execute( query, parameters );
    return result;
  }
View Full Code Here

Examples of org.neo4j.cypher.javacompat.ExecutionResult

  private static final String ROOT_FOLDER = buildDirectory() + File.separator + "NEO4J";

  @Override
  public long getNumberOfEntities(SessionFactory sessionFactory) {
    ExecutionEngine engine = new ExecutionEngine( getProvider( sessionFactory ).getDataBase() );
    ExecutionResult result = engine.execute( ENTITY_COUNT_QUERY );
    ResourceIterator<Map<String, Object>> iterator = result.iterator();
    if ( iterator.hasNext() ) {
      Map<String, Object> next = iterator.next();
      return ( (Long) next.get( "COUNT(n)" ) ).longValue();
    }
    return 0;
View Full Code Here

Examples of org.neo4j.cypher.javacompat.ExecutionResult

  @Override
  public long getNumberOfAssociations(SessionFactory sessionFactory) {
    String query = "MATCH (n) - [r] -> () RETURN COUNT(DISTINCT type(r))";
    ExecutionEngine engine = new ExecutionEngine( getProvider( sessionFactory ).getDataBase() );
    ExecutionResult result = engine.execute( query.toString() );
    ResourceIterator<Long> columnAs = result.columnAs( "COUNT(DISTINCT type(r))" );
    Long next = columnAs.next();
    columnAs.close();
    return next.longValue();
  }
View Full Code Here

Examples of org.neo4j.cypher.javacompat.ExecutionResult

        long time=System.currentTimeMillis();
        Transaction tx = gdb.beginTx();
        javax.transaction.Transaction resumeTx;
        try {
            resumeTx = suspendTx(query);
            ExecutionResult result = canProfile ? executionEngine.profile(query,params) : executionEngine.execute(query,params);
            final Collection<Map<String, Object>> data = IteratorUtil.asCollection(result);
            time = System.currentTimeMillis() - time;
            resumeTransaction(resumeTx);
            CypherResult cypherResult = new CypherResult(result.columns(), data, result.getQueryStatistics(), time, canProfile ? result.executionPlanDescription() : null, prettify(query));
            tx.success();
            return cypherResult;
        } finally {
            tx.close();
            awaitIndexOnline(query);
View Full Code Here

Examples of org.neo4j.cypher.javacompat.ExecutionResult

    StringBuilder query = new StringBuilder( "MATCH" );
    appendNodePattern( entityKey, parameters, query, ENTITY );
    query.append( " - " );
    query.append( relationshipCypher( associationKey, rowKey, parameters, entityKey.getColumnNames().length ) );
    query.append( " -> () RETURN r" );
    ExecutionResult result = engine.execute( query.toString(), parameters );
    ResourceIterator<Relationship> column = result.columnAs( "r" );
    Relationship relationship = null;
    if ( column.hasNext() ) {
      relationship = column.next();
    }
    column.close();
View Full Code Here

Examples of org.neo4j.cypher.javacompat.ExecutionResult

  public Node findNode(Key key, NodeLabel label) {
    Map<String, Object> parameters = new HashMap<String, Object>( key.getColumnNames().length );
    StringBuilder query = new StringBuilder( "MATCH" );
    appendNodePattern( key, parameters, query, label );
    query.append( " RETURN n" );
    ExecutionResult result = engine.execute( query.toString(), parameters );
    ResourceIterator<Node> column = result.columnAs( "n" );
    Node node = null;
    if ( column.hasNext() ) {
      node = column.next();
    }
    column.close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.