Package org.neo4j.rest.graphdb.query

Examples of org.neo4j.rest.graphdb.query.RestCypherQueryEngine


    public void initFromUrl(Neo4jService service, URL url, final String query) {
        if (!service.doesOwnDatabase()) return;
        final String urlString = url.toString().replaceAll("/cypher/?$", "");
        final RestAPI restApi = new RestAPIFacade(urlString);
        final QueryResult<Map<String,Object>> cypherResult = new RestCypherQueryEngine(restApi).query(query, null);
        final SubGraph graph = new SubGraph();
        for (Map<String, Object> row : cypherResult) {
            for (Object value : row.values()) {
                addResultValue(graph, value);
            }
View Full Code Here


        this(new RestAPIFacade(uri));
    }

    public RestGraphStorage(RestAPI restAPI) {
        this.restAPI = restAPI;
        cypher = new RestCypherQueryEngine(restAPI);
        index = restAPI.index().forNodes("graphs");
    }
View Full Code Here

    }

    @Override
    public <QL> ResultIterator<Map<String, Object>> execute(QL expression, Map<String, Object> parameters) {
        RestAPI restAPI = getGraphDatabaseService().getRestAPI();
        RestCypherQueryEngine restCypherQueryEngine = new RestCypherQueryEngine(restAPI);
        QueryResult<Map<String, Object>> queryResult = restCypherQueryEngine.query(getCypher(expression), parameters);
        final Iterator<Map<String, Object>> iterator = queryResult.iterator();
        return new ResultIterator() {

            @Override
            public boolean hasNext() {
View Full Code Here

    }

    @Override
    public <QL> ResultIterator<Map<String, Object>> executeQuery(QL expression, Map<String, Object> parameters) {
        RestAPI restAPI = getGraphDatabaseService().getRestAPI();
        RestCypherQueryEngine restCypherQueryEngine = new RestCypherQueryEngine(restAPI);
        QueryResult<Map<String, Object>> queryResult = restCypherQueryEngine.query(getCypher(expression), parameters);
        final Iterator<Map<String, Object>> iterator = queryResult.iterator();
        return new ResultIterator<Map<String, Object>>() {

            @Override
            public boolean hasNext() {
View Full Code Here

        @Override
        public ResultIterator<Map<String, Object>> execute(String expression, Map<String, Object> parameters) {
            Map<String, Object> effectiveParameters = translateParameters(parameters);
            RestAPI restAPI = getGraphDatabaseService().getRestAPI();
            RestCypherQueryEngine restCypherQueryEngine = new RestCypherQueryEngine(restAPI);
            QueryResult<Map<String, Object>> queryResult = restCypherQueryEngine.query(expression, effectiveParameters);

            final Iterator<Map<String, Object>> iterator = queryResult.iterator();
            return new ResultIterator<Map<String, Object>>() {

                @Override
View Full Code Here

    @Override
    public <QL> ResultIterator<Map<String, Object>> executeQuery(QL expression, Map<String, Object> parameters) {
        Map<String, Object> effectiveParameters = translateParameters(parameters);
        RestAPI restAPI = getGraphDatabaseService().getRestAPI();
        RestCypherQueryEngine restCypherQueryEngine = new RestCypherQueryEngine(restAPI);
        QueryResult<Map<String, Object>> queryResult = restCypherQueryEngine.query(getCypher(expression), effectiveParameters);

        final Iterator<Map<String, Object>> iterator = queryResult.iterator();
        return new ResultIterator<Map<String, Object>>() {

            @Override
View Full Code Here

    private final RestCypherQueryEngine restCypherQueryEngine;
    private ResultConverter resultConverter;

    public SpringRestCypherQueryEngine(RestAPI restAPI, ResultConverter resultConverter) {
        this.resultConverter = resultConverter;
        this.restCypherQueryEngine = new RestCypherQueryEngine(restAPI, new SpringResultConverter(resultConverter));
    }
View Full Code Here

public class SimpleTransactionTest extends RestTestBase {

    @Test
    public void testQueryWithinTransaction() throws Exception {
        GraphDatabaseService db = getRestGraphDb();
        RestCypherQueryEngine cypher = new RestCypherQueryEngine(((RestAPIProvider)db).getRestAPI());
        Transaction tx = db.beginTx();
        QueryResult<Map<String,Object>> result = cypher.query("CREATE (person1 { personId: {id}, started: {started} }) return person1",
                map("id", 1, "started", System.currentTimeMillis()));
        try {
            result.to(Node.class).singleOrNull();
        } catch(IllegalStateException ise) { assertEquals(true, ise.getMessage().contains("finish the transaction")); }
        tx.success();
View Full Code Here

    @Before
    public void init() throws Exception {
        embeddedMatrixdata = new MatrixDataGraph(getGraphDatabase(),nodeId()).createNodespace();
        restMatrixData = new MatrixDataGraph(getRestGraphDb(),nodeId());
        this.restAPI = ((RestAPIProvider)getRestGraphDb()).getRestAPI();
        queryEngine = new RestCypherQueryEngine(restAPI);     
    }
View Full Code Here

    private final RestCypherQueryEngine cypherQueryEngine;


    public RestGraphDatabase( RestAPI api){
      this.restAPI = api;
        cypherQueryEngine = new RestCypherQueryEngine(restAPI);
    }
View Full Code Here

TOP

Related Classes of org.neo4j.rest.graphdb.query.RestCypherQueryEngine

Copyright © 2018 www.massapicom. 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.