/** * Create a new RDF store using the provided Blueprints graph. Additionally, create edge indices * for the provided triple patterns (potentially speeding up certain queries, while increasing * storage overhead). * * @param graph the storage layer. If the provided graph implements TransactionalGraph and is in * manual transaction mode, then this Sail will also be transactional. Any vertices and edges * in the graph should have been previously created with GraphSail. * @param indexedPatterns a comma-delimited list of triple patterns for index-based statement * matching. Only p,c are required, while the default patterns are p,c,pc. */ public GraphSail(final T graph, final String indexedPatterns) { // if (graph instanceof TransactionalGraph) // ((TransactionalGraph) graph).setTransactionMode(TransactionalGraph.Mode.AUTOMATIC); // printGraphInfo(graph); store.sail = this; store.graph = graph; createIndices(graph); store.manualTransactions = store.graph instanceof TransactionalGraph; // && 0 == ((TransactionalGraph) store.graph).getMaxBufferSize(); store.namespaces = store.getReferenceVertex(); if (null == store.namespaces) { if (store.manualTransactions) { ((TransactionalGraph) graph).startTransaction(); } try { // FIXME: with FAKE_VERTEX_IDS, an extra "namespace" called "value" is present. Perhaps // namespaces // should be given individual nodes, rather than being encapsulated in properties of the // namespaces node. store.namespaces = store.addVertex(NAMESPACES_VERTEX_ID); } finally { if (store.manualTransactions) { ((TransactionalGraph) graph).stopTransaction(TransactionalGraph.Conclusion.SUCCESS); } } } store.matchers[0] = new TrivialMatcher(graph); parseTripleIndices(indexedPatterns); assignUnassignedTriplePatterns(); }