Java Code Examples for org.eclipse.rdf4j.sail.memory.MemoryStore#initialize()
The following examples show how to use
org.eclipse.rdf4j.sail.memory.MemoryStore#initialize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemoryBenchmark.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Benchmark public long size() { MemoryStore memoryStore = new MemoryStore(); memoryStore.initialize(); try (NotifyingSailConnection connection = memoryStore.getConnection()) { connection.begin(IsolationLevels.valueOf(isolationLevel)); statementList.forEach( st -> connection.addStatement(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext())); connection.commit(); return connection.size(); } }
Example 2
Source File: MemoryBenchmark.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Benchmark public long singleTransactionGetFirstStatement() { MemoryStore memoryStore = new MemoryStore(); memoryStore.initialize(); try (NotifyingSailConnection connection = memoryStore.getConnection()) { connection.begin(IsolationLevels.valueOf(isolationLevel)); statementList.forEach( st -> connection.addStatement(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext())); long count = 0; for (int i = 0; i < 10; i++) { try (CloseableIteration<? extends Statement, SailException> statements = connection.getStatements(null, null, null, false)) { count += statements.next().toString().length(); } } connection.commit(); return count; } }
Example 3
Source File: MemoryBenchmark.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Benchmark public void load() { MemoryStore memoryStore = new MemoryStore(); memoryStore.initialize(); try (NotifyingSailConnection connection = memoryStore.getConnection()) { connection.begin(IsolationLevels.valueOf(isolationLevel)); statementList.forEach( st -> connection.addStatement(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext())); connection.commit(); } }
Example 4
Source File: MemoryBenchmark.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Benchmark public long duplicatesAndNewStatementsGetFirst() { MemoryStore memoryStore = new MemoryStore(); memoryStore.initialize(); try (NotifyingSailConnection connection = memoryStore.getConnection()) { connection.begin(IsolationLevels.valueOf(isolationLevel)); statementList.forEach( st -> connection.addStatement(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext())); connection.commit(); connection.begin(IsolationLevels.valueOf(isolationLevel)); statementList.forEach( st -> connection.addStatement(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext())); ValueFactory vf = memoryStore.getValueFactory(); connection.addStatement(vf.createBNode(), RDFS.LABEL, vf.createLiteral("label")); long counter = 0; for (int i = 0; i < 10; i++) { try (CloseableIteration<? extends Statement, SailException> statements = connection.getStatements(null, null, null, false)) { counter += statements.next().toString().length(); } } connection.commit(); return counter; } }
Example 5
Source File: MemoryBenchmark.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Benchmark public long duplicatesAndNewStatementsIteratorMatchesNothing() { MemoryStore memoryStore = new MemoryStore(); memoryStore.initialize(); try (NotifyingSailConnection connection = memoryStore.getConnection()) { connection.begin(IsolationLevels.valueOf(isolationLevel)); statementList.forEach( st -> connection.addStatement(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext())); connection.commit(); connection.begin(IsolationLevels.valueOf(isolationLevel)); statementList.forEach( st -> connection.addStatement(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext())); ValueFactory vf = memoryStore.getValueFactory(); connection.addStatement(vf.createBNode(), RDFS.LABEL, vf.createLiteral("label")); long count = 0; for (int i = 0; i < 10; i++) { try (Stream<? extends Statement> stream = connection.getStatements(vf.createBNode(), null, null, false) .stream()) { count += stream.count(); } } connection.commit(); return count; } }
Example 6
Source File: SailModelNamespacesTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected Model getModelImplementation() { sail = new MemoryStore(); try { sail.initialize(); conn = sail.getConnection(); conn.begin(); return new SailModel(conn, false); } catch (SailException e) { throw new ModelException(e); } }
Example 7
Source File: MemoryBenchmark.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 3 votes |
@Benchmark public long duplicates() { MemoryStore memoryStore = new MemoryStore(); memoryStore.initialize(); try (NotifyingSailConnection connection = memoryStore.getConnection()) { connection.begin(IsolationLevels.valueOf(isolationLevel)); statementList.forEach( st -> connection.addStatement(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext())); connection.commit(); connection.begin(IsolationLevels.valueOf(isolationLevel)); statementList.forEach( st -> connection.addStatement(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext())); long count = 0; for (int i = 0; i < 10; i++) { count += getCount(connection); } connection.commit(); return count; } }
Example 8
Source File: MemoryBenchmark.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 3 votes |
@Benchmark public long duplicatesFlush() { MemoryStore memoryStore = new MemoryStore(); memoryStore.initialize(); try (NotifyingSailConnection connection = memoryStore.getConnection()) { connection.begin(IsolationLevels.valueOf(isolationLevel)); statementList.forEach( st -> connection.addStatement(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext())); connection.commit(); connection.begin(IsolationLevels.valueOf(isolationLevel)); statementList.forEach( st -> connection.addStatement(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext())); connection.flush(); long count = 0; for (int i = 0; i < 10; i++) { count += getCount(connection); } connection.commit(); return count; } }
Example 9
Source File: MemoryBenchmark.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 3 votes |
@Benchmark public long duplicatesAndNewStatements() { MemoryStore memoryStore = new MemoryStore(); memoryStore.initialize(); try (NotifyingSailConnection connection = memoryStore.getConnection()) { connection.begin(IsolationLevels.valueOf(isolationLevel)); statementList.forEach( st -> connection.addStatement(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext())); connection.commit(); connection.begin(IsolationLevels.valueOf(isolationLevel)); statementList.forEach( st -> connection.addStatement(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext())); ValueFactory vf = memoryStore.getValueFactory(); connection.addStatement(vf.createBNode(), RDFS.LABEL, vf.createLiteral("label")); long count = 0; for (int i = 0; i < 10; i++) { count += getCount(connection); } connection.commit(); return count; } }