Package org.neo4j.cypher

Examples of org.neo4j.cypher.ExecutionEngine


        System.out.println(">>>> Attaching Procedure " + childProcedureId + " to Procedure " + parentProcedureId);
        Transaction tx = graphDb.beginTx();

        try {
            CypherParser parser = new CypherParser();
            ExecutionEngine engine = new ExecutionEngine(this.graphDb);
            Query query = parser.parse("start n=(procedures, 'procedureId:" + parentProcedureId + "')  return n");
            ExecutionResult result = engine.execute(query);
            Iterator<Node> n_column = result.columnAs("n");
            Node parentProcedure = n_column.next();

            query = parser.parse("start n=(procedures, 'procedureId:" + childProcedureId + "')  return n");
            result = engine.execute(query);
            n_column = result.columnAs("n");
            Node childProcedure = n_column.next();

            parentProcedure.createRelationshipTo(childProcedure, EmergencyRelationshipType.SUB);
View Full Code Here


    public void attachServiceChannel(String emergencyId, String channelId) {
        Transaction tx = graphDb.beginTx();

        try {
            CypherParser parser = new CypherParser();
            ExecutionEngine engine = new ExecutionEngine(this.graphDb);
            Query query = parser.parse("start n=(emergencies, 'emergencyId:" + emergencyId + "')  return n");
            ExecutionResult result = engine.execute(query);
            Iterator<Node> n_column = result.columnAs("n");
            Node emergency = n_column.next();

            query = parser.parse("start n=(channels, 'channelId:" + channelId + "')  return n");
            result = engine.execute(query);
            n_column = result.columnAs("n");
            Node channel = n_column.next();

            emergency.createRelationshipTo(channel, EmergencyRelationshipType.CONSUME);
View Full Code Here

    public void detachVehicle(String vehicleId) {
        Transaction tx = graphDb.beginTx();

        try {
            CypherParser parser = new CypherParser();
            ExecutionEngine engine = new ExecutionEngine(this.graphDb);
            Query query = parser.parse("start n=(vehicles, 'vehicleId:" + vehicleId + "')  return n");
            ExecutionResult result = engine.execute(query);
            Iterator<Node> n_column = result.columnAs("n");
            Node vehicle = n_column.next();
            //Removing the node from the index
            this.vehiclesIndex.remove(vehicle);
            for (Relationship rel : vehicle.getRelationships()) {
View Full Code Here

    public void detachProcedure(String procedureId) {
        Transaction tx = graphDb.beginTx();

        try {
            CypherParser parser = new CypherParser();
            ExecutionEngine engine = new ExecutionEngine(this.graphDb);
            Query query = parser.parse("start n=(procedures, 'procedureId:" + procedureId + "')  return n");
            ExecutionResult result = engine.execute(query);
            Iterator<Node> n_column = result.columnAs("n");
            Node procedure = n_column.next();
            //Removing the node from the index
            this.proceduresIndex.remove(procedure);
            for (Relationship rel : procedure.getRelationships()) {
View Full Code Here

    public void detachEmergency(String emergencyId) {
        Transaction tx = graphDb.beginTx();

        try {
            CypherParser parser = new CypherParser();
            ExecutionEngine engine = new ExecutionEngine(this.graphDb);
            Query query = parser.parse("start n=(emergencies, 'emergencyId:" + emergencyId + "')  return n");
            ExecutionResult result = engine.execute(query);
            Iterator<Node> n_column = result.columnAs("n");
            Node emergency = n_column.next();
            //Removing the node from the index
            this.emergenciesIndex.remove(emergency);
            for (Relationship rel : emergency.getRelationships()) {
View Full Code Here

    public void detachServiceChannel(String serviceChannelId) {
        Transaction tx = graphDb.beginTx();

        try {
            CypherParser parser = new CypherParser();
            ExecutionEngine engine = new ExecutionEngine(this.graphDb);
            Query query = parser.parse("start n=(channels, 'channelId:" + serviceChannelId + "')  return n");
            ExecutionResult result = engine.execute(query);
            Iterator<Node> n_column = result.columnAs("n");
            Node channel = n_column.next();
            //Removing the node from the index
            this.channelsIndex.remove(channel);
            for (Relationship rel : channel.getRelationships()) {
View Full Code Here

    public void detachPatient(String patientId) {
        Transaction tx = graphDb.beginTx();

        try {
            CypherParser parser = new CypherParser();
            ExecutionEngine engine = new ExecutionEngine(this.graphDb);
            Query query = parser.parse("start n=(patients, 'patientId:" + patientId + "')  return n");
            ExecutionResult result = engine.execute(query);
            Iterator<Node> n_column = result.columnAs("n");
            Node patient = n_column.next();
            //Removing the node from the index
            this.channelsIndex.remove(patient);
            for (Relationship rel : patient.getRelationships()) {
View Full Code Here

    public void detachEmergencyEntityBuilding(String entityBuildingId) {
        Transaction tx = graphDb.beginTx();

        try {
            CypherParser parser = new CypherParser();
            ExecutionEngine engine = new ExecutionEngine(this.graphDb);
            Query query = parser.parse("start n=(buildings, 'buildingId:" + entityBuildingId + "')  return n");
            ExecutionResult result = engine.execute(query);
            Iterator<Node> n_column = result.columnAs("n");
            Node building = n_column.next();
            //Removing the node from the index
            this.buildingsIndex.remove(building);
            for (Relationship rel : building.getRelationships()) {
View Full Code Here

        this.wayMerger = new WayMerger();
    }

    public void optimize() {

        ExecutionEngine engine = new ExecutionEngine(graphDb, StringLogger.DEV_NULL);
        ExecutionResult result = engine.execute("START n=relationship:ways('WAY_ID: *') RETURN distinct n.WAY_ID");
        while (result.hasNext()) {

            Map<String, Object> objectMap = result.next();
            Option<Object> option = objectMap.get("n.WAY_ID");
            Long wayId = (Long) option.get();
View Full Code Here

  }
 
  private int coAuthorCypher(int numQueries){
    int qCnt = 0;
    int resCnt = 0;
    ExecutionEngine engine = new ExecutionEngine( graphDB );
    for (Node author:graphDB.getAllNodes()){
      if (!author.hasProperty("name"))continue;
      if (++qCnt>numQueries)break;
     
      Map<String, Object> params = new HashMap<String, Object>();
      params.put( "node", author );
      //ExecutionResult result = engine.execute( "start n=node({node}) return n.name", params );
     
      String query = "START author=node({node}) MATCH author-[:"+DBRelationshipTypes.WRITTEN_BY.name()+"]-()-[:"+DBRelationshipTypes.WRITTEN_BY.name()+"]- coAuthor RETURN coAuthor";
      ExecutionResult result = engine.execute( query, params);
      scala.collection.Iterator<Node> it = result.columnAs("coAuthor");
      while (it.hasNext()){
        Node coAuthor = it.next();
        resCnt++;
      }
View Full Code Here

TOP

Related Classes of org.neo4j.cypher.ExecutionEngine

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.