Package org.neo4j.rest.graphdb

Examples of org.neo4j.rest.graphdb.RestAPI


                    throw new RuntimeException("Invalid Neo4j-Server-URL " + restUrl);
                }
            }

            if (!restUrl.contains("/db/data")) restUrl += "/db/data";
            final RestAPI api = new RestAPIFacade(restUrl, login, password);
            storage = new RestGraphStorage(api);
            log("Graph Storage " + restUrl + " login " + login + " " + password + " " + storage);
        }
        } catch(Exception e) {
            LOG.error("Error creating graph storage",e);
View Full Code Here


    }

    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

        throw new CdoException("Transactions are not supported for this datastore.");
    }

    @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() {
View Full Code Here

        return transaction;
    }

    @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>>() {
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>>() {
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>>() {
View Full Code Here

        this(new RestAPIImpl( uri, user, password ));
    }

    @Override
    public Node createNode(Map<String, Object> props, Collection<String> labels) {
        RestAPI restAPI = super.getRestAPI();
        return restAPI.createNode(props,labels);
    }
View Full Code Here

        this(new RestAPIImpl( uri, user, password ));
    }

    @Override
    public Node createNode(Map<String, Object> props, Collection<String> labels) {
        RestAPI restAPI = super.getRestAPI();
        return restAPI.createNode(props,labels);
    }
View Full Code Here

    public static final String URI = "http://localhost:7470";

    @Test
    public void testParseZeroLength() throws Exception {
        String uri = "http://localhost:7470";
        RestAPI restApi = new RestAPIImpl(uri);
        Map<String,Object> node = MapUtil.map("data", Collections.EMPTY_MAP, "self", uri + "/db/data/node/0");
        Map<String, Object> pathData = MapUtil.map("start", node, "nodes",Collections.singletonList(node),"length", 0, "relationships", Collections.EMPTY_LIST, "end", node);
        System.out.println("pathData = " + pathData);
        Path path = RestPathParser.parse(pathData, restApi);
        assertEquals(0,path.length());
View Full Code Here

        assertEquals(0,path.startNode().getId());
        assertEquals(0,path.endNode().getId());
    }
    @Test
    public void testParsePath() throws Exception {
        RestAPI restApi = new RestAPIImpl(URI);
        Map<String,Object> node = node(0);
        Map<String,Object> node2 = node(1);
        Map<String,Object> relationship = relationship(1,0,1);
        Map<String, Object> pathData = MapUtil.map("start", node, "nodes", Arrays.asList(node, node2),"length", 1, "relationships", Collections.singletonList(relationship), "end", node2);
        System.out.println("pathData = " + pathData);
View Full Code Here

TOP

Related Classes of org.neo4j.rest.graphdb.RestAPI

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.