Package org.neo4j.graphdb

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


        {
            Transaction tx = database.beginTx();

            try
            {
                Node rickard = database.createNode();
                rickard.setProperty( "name", "Rickard" );

                Node niclas = database.createNode();
                niclas.setProperty( "name", "Niclas" );
View Full Code Here


            try
            {
                Node rickard = database.createNode();
                rickard.setProperty( "name", "Rickard" );

                Node niclas = database.createNode();
                niclas.setProperty( "name", "Niclas" );

                rickard.createRelationshipTo( niclas, TestRelationships.KNOWS );

                tx.success();
View Full Code Here

  }

  private Node makeOSMWay(Geometry geometry, Node geomNode, int gtype) {
    wayId++;
    GraphDatabaseService db = geomNode.getGraphDatabase();
    Node way = db.createNode();
    // TODO: Generate a valid osm id
    way.setProperty(OSMId.WAY.toString(), wayId);
    way.setProperty("timestamp", getTimestamp());
    // TODO: Add other common properties, like changeset, uid, user,
    // version, name
View Full Code Here

    // are not indexed
    geomNode.setProperty(PROP_TYPE, gtype);
    Node prev = null;
    for (Coordinate coord : geometry.getCoordinates()) {
      Node node = makeOSMNode(coord, db);
      Node proxyNode = db.createNode();
      proxyNode.createRelationshipTo(node, OSMRelation.NODE);
      if (prev == null) {
        way.createRelationshipTo(proxyNode, OSMRelation.FIRST_NODE);
      } else {
        prev.createRelationshipTo(proxyNode, OSMRelation.NEXT);
View Full Code Here

  @Nonnull
  protected String serialize( @Nonnull Serializer<T, Node, Node> serializer, @Nonnull T objectToSerialize ) throws IOException {
    GraphDatabaseService db = neo4jRule.createDb();

    try ( Transaction tx = db.beginTx() ) {
      Node rootNode = db.createNode();
      serializer.serialize( objectToSerialize, rootNode );

      tx.success();
    }
View Full Code Here

      // intentionally create raw Neo4j transaction and create nodes in there
      try (Transaction tx = graphDb.beginTx()) {

        for (int i=0; i<100; i++) {

          final Node test = graphDb.createNode();

          // set ID and type so that the rebuild index command identifies it as a Structr node.
          test.setProperty("type", "Group");
          test.setProperty("id", UUID.randomUUID().toString().replace("-", ""));
        }
View Full Code Here

      // intentionally create raw Neo4j transaction and create nodes in there
      try (Transaction tx = graphDb.beginTx()) {

        for (int i=0; i<100; i++) {

          final Node test = graphDb.createNode();

          // set ID and type so that the rebuild index command identifies it as a Structr node.
          test.setProperty("type", "TestOne");
          test.setProperty("id", UUID.randomUUID().toString().replace("-", ""));
        }
View Full Code Here

      Class nodeType             = typeObject != null ? SchemaHelper.getEntityClassForRawType(typeObject.toString()) : StructrApp.getConfiguration().getFactoryDefinition().getGenericNodeType();
      NodeFactory<T> nodeFactory = new NodeFactory<>(securityContext);
      boolean isCreation         = true;

      // Create node with type
      node = (T) nodeFactory.instantiateWithType(graphDb.createNode(), nodeType, isCreation);
      if(node != null) {
       
        TransactionCommand.nodeCreated(node);

        // set type
View Full Code Here

    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);
      parent.getLayerNode().createRelationshipTo(node, SpatialRelationshipTypes.LAYER_CONFIG);
      tx.success();
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

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.