Project

General

Profile

« Previous | Next » 

Revision 1a34bf3a

Added by Andreas Kohlbecker over 8 years ago

first workking implementation of the tinkerpop client for EEA_BDC

View differences:

src/main/java/org/bgbm/biovel/drf/store/Neo4jStore.java
11 11

  
12 12
import java.io.File;
13 13

  
14
import org.openrdf.repository.base.RepositoryConnectionBase;
15 14
import org.openrdf.repository.sail.SailRepository;
16 15
import org.openrdf.sail.Sail;
17 16
import org.openrdf.sail.SailException;
......
29 28
 */
30 29
public class Neo4jStore extends Store{
31 30

  
31
    private Neo4jGraph graph;
32
    private Sail sail;
33
    private SailRepository sailRepo;
32 34

  
33 35
    /**
34 36
     * @throws Exception
......
37 39
        super();
38 40
    }
39 41

  
40
    private RepositoryConnectionBase connection;
41
    private Neo4jGraph graph;
42
    private Sail sail = null;
43

  
44 42

  
45 43
    /**
46 44
     * {@inheritDoc}
......
50 48
    protected void initStoreEngine() throws Exception  {
51 49

  
52 50
        graph = new Neo4jGraph(storeLocation.toString());
53
        sail = new GraphSail(graph);
51
        sail = new GraphSail<Neo4jGraph>(graph);
54 52
        sail.initialize();
55
        logger.info("Using Neo4jGraph store at " + storeLocation.toString());
56
        logger.info("Neo4jGraph has " + sizeInfo());
53
        sailRepo = new SailRepository(sail);
54

  
55
//        logger.info("Using Neo4jGraph store at " + storeLocation.toString());
56
//        logger.info("Neo4jGraph has " + sizeInfo());
57 57
    }
58 58

  
59
    /**
60
     * {@inheritDoc}
61
     */
62
    @Override
63
    protected void stopStoreEngine() throws Exception {
64
        sailRepo.shutDown();
65
        sail.shutDown(); // should be none by the above command already
66
    }
59 67

  
60 68
    /**
61 69
     * @throws Exception
......
65 73
    protected void load(File rdfFile) throws Exception {
66 74

  
67 75
        SailLoader loader = new SailLoader(sail);
68
//            loader.setBufferSize(100000);
76
//            loader.setBufferSize(100000); // TODO optimize?
69 77
        logger.info("loading RDF/XML into Neo4jGraph store");
70 78
        loader.load(rdfFile);
71 79
        logger.info("loading RDF/XML done");
72 80
        logger.info("Neo4jGraph has " +  sizeInfo());
73 81

  
74 82
        logger.info("rdf loaded into Neo4jGraph store at " + storeLocation);
75
        connection = new SailRepository(sail).getConnection();
76 83
    }
77 84

  
78 85

  
......
91 98
    }
92 99

  
93 100

  
94
    /**
95
     * @return the connection
96
     */
97
    public RepositoryConnectionBase connection() {
98
        return connection;
99
    }
100

  
101

  
102 101
    /**
103 102
     * {@inheritDoc}
104 103
     */
......
111 110
        return graph;
112 111
    }
113 112

  
113
    /**
114
     * @return the sailRepo
115
     */
116
    public SailRepository getSailRepo() {
117
        return sailRepo;
118
    }
114 119

  
115 120

  
116 121
}

Also available in: Unified diff