• 大小: 724KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-09
  • 语言: Java
  • 标签: Neo4j  java  

资源简介

Neo4j入门的基础小程序,java实现,代码简单易懂(注意安装neo4j2.0,netBeans打开,并且导入工程中的包)带基本界面,实现excel通讯录导入和查找。暂时是最基础的版本,后期版本是美化界面并且添加了插入删除等功能的,等待稍迟些上传,本人新手,大家包涵。

资源截图

代码片段和文件信息

/**
 * Licensed to Neo Technology under one or more contributor license agreements.
 * See the NOTICE file distributed with this work for additional information
 * regarding copyright ownership. Neo Technology licenses this file to you under
 * the Apache License Version 2.0 (the “License“); you may not use this file
 * except in compliance with the License. You may obtain a copy of the License
 * at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing software
 * distributed under the License is distributed on an “AS IS“ BASIS WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package org.neo4j.examples;

import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import jxl.*;
import org.neo4j.graphdb.Direction;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.RelationshipType;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
import static org.neo4j.helpers.collection.IteratorUtil.iterator;
import org.neo4j.kernel.impl.util.FileUtils;

public class Neo4j {

    private static final String DB_PATH = “E:\\学习\\作业“;//数据库路径

//    public String greeting;
    // START SNIPPET: vars
    GraphDatabaseService graphDb;

    public GraphDatabaseService getGraphDataba() {
        return graphDb;
    }

    Relationship relationship;
    // END SNIPPET: vars

    Sheet sheet;
    NewJframe njf;

    // START SNIPPET: createReltype
    private static enum RelTypes implements RelationshipType {

        KNOWS
    }
    // END SNIPPET: createReltype
//
//    public Neo4j(Sheet sheetTemp){
//
//       
//       createDb(sheetTemp);        
////        hello.removeData();
////       shutDown();
//    }

    public void createDb(Sheet sheetTemp) {
        clearDb();
        // START SNIPPET: startDb

        sheet = sheetTemp;

        graphDb = new GraphDatabaseFactory().newembeddedDatabase(DB_PATH);
        registerShutdownHook(graphDb);
        // END SNIPPET: startDb

        // START SNIPPET: transaction
        try (Transaction tx = graphDb.beginTx()) {
            // Database operations go here
            // END SNIPPET: transaction
            // START SNIPPET: addData
            if (sheet.getRows() > 1 && sheet.getColumns() > 1) {
                Node person[] = new Node[sheet.getRows()];
                Cell cell[][] = new Cell[sheet.getRows()][sheet.getColumns()];

                for (int i = 0; i < sheet.getRows(); i++) {
                    for (int j = 0; j < sheet.getColumns(); j++) {
                        cell[i][j] = sheet.getCell(j i);
                    }
                }

                person[1] = grap

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     725735  2009-10-24 10:11  Neo4j\jxl.jar

     文件          0  2013-12-12 00:13  Neo4j\Neo4j\build\classes\.netbeans_automatic_build

     文件          0  2013-12-12 00:13  Neo4j\Neo4j\build\classes\.netbeans_update_resources

     文件        117  2013-12-12 00:13  Neo4j\Neo4j\build\classes\embeddedNeo4j.rs

     文件        744  2013-12-14 09:21  Neo4j\Neo4j\build\classes\org\neo4j\examples\CalculateShortestPath$1.class

     文件       3032  2013-12-14 09:21  Neo4j\Neo4j\build\classes\org\neo4j\examples\CypherSql$1.class

     文件        696  2013-12-14 09:21  Neo4j\Neo4j\build\classes\org\neo4j\examples\CypherSql$TestData.class

     文件        771  2013-12-14 09:21  Neo4j\Neo4j\build\classes\org\neo4j\examples\embeddedNeo4j$1.class

     文件       1173  2013-12-14 09:21  Neo4j\Neo4j\build\classes\org\neo4j\examples\embeddedNeo4j$RelTypes.class

     文件        739  2013-12-15 21:17  Neo4j\Neo4j\build\classes\org\neo4j\examples\Neo4j$1.class

     文件       1109  2013-12-15 21:17  Neo4j\Neo4j\build\classes\org\neo4j\examples\Neo4j$RelTypes.class

     文件       5090  2013-12-15 21:17  Neo4j\Neo4j\build\classes\org\neo4j\examples\Neo4j.class

     文件        812  2013-12-15 21:31  Neo4j\Neo4j\build\classes\org\neo4j\examples\NewJframe$1.class

     文件        812  2013-12-15 21:31  Neo4j\Neo4j\build\classes\org\neo4j\examples\NewJframe$2.class

     文件        768  2013-12-15 21:31  Neo4j\Neo4j\build\classes\org\neo4j\examples\NewJframe$3.class

     文件        812  2013-12-15 21:31  Neo4j\Neo4j\build\classes\org\neo4j\examples\NewJframe$4.class

     文件        812  2013-12-15 21:31  Neo4j\Neo4j\build\classes\org\neo4j\examples\NewJframe$5.class

     文件       1669  2013-12-15 21:31  Neo4j\Neo4j\build\classes\org\neo4j\examples\NewJframe$JavaReadExcel.class

     文件      11002  2013-12-15 21:31  Neo4j\Neo4j\build\classes\org\neo4j\examples\NewJframe.class

     文件       8469  2013-12-15 21:31  Neo4j\Neo4j\build\classes\org\neo4j\examples\NewJframe.form

     文件        841  2013-12-14 09:21  Neo4j\Neo4j\build\classes\org\neo4j\examples\NewMatrix$1.class

     文件       1251  2013-12-14 09:21  Neo4j\Neo4j\build\classes\org\neo4j\examples\NewMatrix$RelTypes.class

     文件       1217  2013-12-14 09:21  Neo4j\Neo4j\build\classes\org\neo4j\examples\TraversalExample$Rels.class

     文件       3600  2013-12-12 00:12  Neo4j\Neo4j\build.xml

     文件         85  2013-12-12 00:12  Neo4j\Neo4j\manifest.mf

     文件      78950  2013-12-12 00:12  Neo4j\Neo4j\nbproject\build-impl.xml

     文件        475  2013-12-12 00:12  Neo4j\Neo4j\nbproject\genfiles.properties

     文件          0  2013-12-12 00:13  Neo4j\Neo4j\nbproject\private\config.properties

     文件        283  2013-12-14 22:22  Neo4j\Neo4j\nbproject\private\private.properties

     文件        489  2013-12-15 21:40  Neo4j\Neo4j\nbproject\private\private.xml

............此处省略200个文件信息

评论

共有 条评论