Package org.neo4j.graphdb

Examples of org.neo4j.graphdb.GraphDatabaseService.beginTx()


    TransactionReference tx            = transactions.get();
   
    if (tx == null) {
   
      // start new transaction
      tx = new TransactionReference(graphDb.beginTx());
     
      queues.set(new ModificationQueue());
      buffers.set(new ErrorBuffer());
      transactions.set(tx);
      currentCommand.set(this);
View Full Code Here


    this.databasePath = getNeoPath().getAbsolutePath();
  }

  private void checkIndexAndFeatureCount(String layerName) throws IOException {
    GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase(databasePath);
    try (Transaction tx = database.beginTx()) {
      SpatialDatabaseService spatial = new SpatialDatabaseService(database);
      Layer layer = spatial.getLayer(layerName);
      if (layer.getIndex().count() < 1) {
        System.out.println("Warning: index count zero: " + layer.getName());
      }
View Full Code Here

      Layer layer = spatialService.getLayer("map.osm");
      LayerIndexReader spatialIndex = layer.getIndex();
      System.out.println("Have " + spatialIndex.count() + " geometries in " + spatialIndex.getBoundingBox());

      Envelope bbox = new Envelope(12.94, 12.96, 56.04, 56.06);
            try (Transaction tx = database.beginTx()) {
                List<SpatialDatabaseRecord> results = GeoPipeline
                    .startIntersectWindowSearch(layer, bbox)
                    .toSpatialDatabaseRecordList();

                doGeometryTestsOnResults(bbox, results);
View Full Code Here

   */
  public DynamicLayerConfig(DynamicLayer parent, String name, int geometryType, String query) {
    this.parent = parent;
   
    GraphDatabaseService database = parent.getSpatialDatabase().getDatabase();
    Transaction tx = database.beginTx();
    try {
      Node node = database.createNode();
      node.setProperty(PROP_LAYER, name);
      node.setProperty(PROP_TYPE, geometryType);
      node.setProperty(PROP_QUERY, query);
View Full Code Here

    GraphDatabaseService database = new GraphDatabaseFactory().newEmbeddedDatabase(databasePath);
    try {
      // START SNIPPET: exportShapefileFromOSM
            SpatialDatabaseService spatialService = new SpatialDatabaseService(database);
            try (Transaction tx = database.beginTx()) {
          OSMLayer layer = (OSMLayer) spatialService.getLayer("map.osm");
          DynamicLayerConfig wayLayer = layer.addSimpleDynamicLayer(Constants.GTYPE_LINESTRING);
          ShapefileExporter shpExporter = new ShapefileExporter(database);
          shpExporter.exportLayer(wayLayer.getName());
                tx.success();
View Full Code Here

      Layer layer = spatialService.getLayer("map.osm");
      LayerIndexReader spatialIndex = layer.getIndex();
      System.out.println("Have " + spatialIndex.count() + " geometries in " + spatialIndex.getBoundingBox());

      Envelope bbox = new Envelope(12.94, 12.96, 56.04, 56.06);
            try (Transaction tx = database.beginTx()) {
                List<SpatialDatabaseRecord> results = GeoPipeline
                    .startIntersectWindowSearch(layer, bbox)
                    .toSpatialDatabaseRecordList();

                spatialService.createResultsLayer("results", results);
View Full Code Here

    @Test
    public void testSuppressedException() throws Exception {
        try {
        GraphDatabaseService db = new TestGraphDatabaseFactory().newImpermanentDatabase();
        try (Transaction tx = db.beginTx()) {
            Node n = db.createNode();
            try (Transaction tx2 = db.beginTx()) {
                n.setProperty("foo","bar");
                if (true) throw new Exception(MESSAGE);
                tx2.success();
View Full Code Here

    public void testSuppressedException() throws Exception {
        try {
        GraphDatabaseService db = new TestGraphDatabaseFactory().newImpermanentDatabase();
        try (Transaction tx = db.beginTx()) {
            Node n = db.createNode();
            try (Transaction tx2 = db.beginTx()) {
                n.setProperty("foo","bar");
                if (true) throw new Exception(MESSAGE);
                tx2.success();
            }
            tx.success();
View Full Code Here

    @Test
    public void testSuppressedExceptionTopLevel() throws Exception {
        try {
            GraphDatabaseService db = new TestGraphDatabaseFactory().newImpermanentDatabase();
            try (Transaction tx = db.beginTx()) {
                Node n = db.createNode();
                n.setProperty("foo", "bar");
                if (true) throw new Exception(MESSAGE);
                tx.success();
            }
View Full Code Here

      if (!toSave.remove(entry.getValue())) {
        toDelete.add(entry.getKey());
      }
    }
    GraphDatabaseService db = layer.getLayerNode().getGraphDatabase();
    Transaction tx = db.beginTx();
    try {
      for (Node node : toDelete) {
        for (Relationship rel : node.getRelationships()) {
          rel.delete();
        }
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.