Skip to content

Commit

Permalink
eclipse-rdf4jGH-2864 benchmarks use nativestore to simulate more real…
Browse files Browse the repository at this point in the history
…istic usage, also some code cleanup while we were at it

Signed-off-by: Håvard Ottestad <[email protected]>
  • Loading branch information
hmottestad committed Feb 27, 2021
1 parent 86159c4 commit ac29711
Show file tree
Hide file tree
Showing 61 changed files with 1,141 additions and 893 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11016,6 +11016,11 @@ private Token jj_consume_token(int kind) throws ParseException {
}

static private final class LookaheadSuccess extends java.lang.Error {

@Override
public synchronized Throwable fillInStackTrace() {
return null;
}
}

final private LookaheadSuccess jj_ls = new LookaheadSuccess();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public SourceConstraintComponent getConstraintComponent() {
public PlanNode generateTransactionalValidationPlan(ConnectionsGroup connectionsGroup, boolean logValidationPlans,
PlanNodeProvider overrideTargetNode, Scope scope) {

if (minCount <= 0) {
return new EmptyNode();
}

PlanNode target = getTargetChain()
.getEffectiveTarget("_target", scope, connectionsGroup.getRdfsSubClassOfReasoner())
.getPlanNode(connectionsGroup, scope, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.apache.jena.update.UpdateAction;
import org.eclipse.rdf4j.IsolationLevel;
import org.eclipse.rdf4j.IsolationLevels;
import org.eclipse.rdf4j.model.BNode;
import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.model.Resource;
import org.eclipse.rdf4j.model.Statement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,34 @@
package org.eclipse.rdf4j.sail.shacl;

import static org.junit.Assert.assertEquals;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
import org.eclipse.rdf4j.model.vocabulary.DCAT;
import org.eclipse.rdf4j.model.vocabulary.RDFS;
import org.eclipse.rdf4j.sail.SailConnection;
import org.eclipse.rdf4j.sail.memory.MemoryStore;
import org.eclipse.rdf4j.sail.shacl.mock.MockConsumePlanNode;
import org.eclipse.rdf4j.sail.shacl.mock.MockInputPlanNode;
import org.junit.Test;

public class BulkedExternalInnerJoinTest {
/*
* @Test public void gapInResultsFromQueryTest() {
*
*
* SimpleValueFactory vf = SimpleValueFactory.getInstance(); IRI a = vf.createIRI("http://a"); IRI b =
* vf.createIRI("http://b"); IRI c = vf.createIRI("http://c"); IRI d = vf.createIRI("http://d");
*
*
* PlanNode left = new MockInputPlanNode( Arrays.asList(new Tuple(Collections.singletonList(a)), new
* Tuple(Collections.singletonList(b)), new Tuple(Collections.singletonList(c)), new
* Tuple(Collections.singletonList(d))));
*
*
* MemoryStore sailRepository = new MemoryStore(); sailRepository.init();
*
*
* try (SailConnection connection = sailRepository.getConnection()) { connection.begin(); connection.addStatement(b,
* DCAT.ACCESS_URL, RDFS.RESOURCE); connection.addStatement(d, DCAT.ACCESS_URL, RDFS.SUBPROPERTYOF);
* connection.commit(); } try (SailConnection connection = sailRepository.getConnection()) {
*
*
* BulkedExternalInnerJoin bulkedExternalInnerJoin = new BulkedExternalInnerJoin(left, connection,
* "?a <http://www.w3.org/ns/dcat#accessURL> ?c. ", false, null, "?a", "?c");
*
*
* List<Tuple> tuples = new MockConsumePlanNode(bulkedExternalInnerJoin).asList();
*
*
* tuples.forEach(System.out::println);
*
*
* assertEquals("[http://b, http://www.w3.org/2000/01/rdf-schema#Resource]",
* Arrays.toString(tuples.get(0).getLine().toArray()));
* assertEquals("[http://d, http://www.w3.org/2000/01/rdf-schema#subPropertyOf]",
* Arrays.toString(tuples.get(1).getLine().toArray()));
*
*
* } }
*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public void test() throws IOException {
.execute();
connection.commit();
}

shaclRepository.shutDown();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertTrue;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public static void afterClass() {
@Test
public void testDashIsDisabledByDefault() throws Exception {

SailRepository shaclRepository = Utils.getInitializedShaclRepository("test-cases/class/allSubjects/shacl.ttl",
false);
SailRepository shaclRepository = Utils.getInitializedShaclRepository("test-cases/class/allSubjects/shacl.ttl"
);

try (SailRepositoryConnection connection = shaclRepository.getConnection()) {
connection.begin();
Expand All @@ -49,8 +49,8 @@ public void testDashIsDisabledByDefault() throws Exception {
@Test(expected = ShaclSailValidationException.class)
public void testThatDashCanBeEnabled() throws Throwable {

SailRepository shaclRepository = Utils.getInitializedShaclRepository("test-cases/class/allSubjects/shacl.ttl",
false);
SailRepository shaclRepository = Utils.getInitializedShaclRepository("test-cases/class/allSubjects/shacl.ttl"
);
((ShaclSail) shaclRepository.getSail()).setDashDataShapes(true);

try (SailRepositoryConnection connection = shaclRepository.getConnection()) {
Expand All @@ -69,7 +69,7 @@ public void testThatDashCanBeEnabled() throws Throwable {
public void testTargetShapeIsDisabledByDefault() throws Exception {

SailRepository shaclRepository = Utils
.getInitializedShaclRepository("test-cases/class/simpleTargetShape/shacl.ttl", false);
.getInitializedShaclRepository("test-cases/class/simpleTargetShape/shacl.ttl");

try (SailRepositoryConnection connection = shaclRepository.getConnection()) {
connection.begin();
Expand All @@ -85,7 +85,7 @@ public void testTargetShapeIsDisabledByDefault() throws Exception {
public void testThatTargetShapesCanBeEnabled() throws Throwable {

SailRepository shaclRepository = Utils
.getInitializedShaclRepository("test-cases/class/simpleTargetShape/shacl.ttl", false);
.getInitializedShaclRepository("test-cases/class/simpleTargetShape/shacl.ttl");

((ShaclSail) shaclRepository.getSail()).setDashDataShapes(true);
((ShaclSail) shaclRepository.getSail()).setEclipseRdf4jShaclExtensions(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

import static junit.framework.TestCase.assertTrue;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.eclipse.rdf4j.sail.nativerdf.NativeStore;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;

public class MultithreadedNativeStoreTest extends MultithreadedTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

package org.eclipse.rdf4j.sail.shacl;

import static junit.framework.TestCase.assertEquals;
import static org.assertj.core.api.Assertions.assertThat;

import org.eclipse.rdf4j.model.ValueFactory;
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public void testAutomaticRollback2() throws IOException {

@Test
public void testAutomaticRollbackRepository() throws IOException {
SailRepository shaclSail = Utils.getInitializedShaclRepository("shacl.ttl", false);
SailRepository shaclSail = Utils.getInitializedShaclRepository("shacl.ttl");

boolean exception = false;
BNode bNode = SimpleValueFactory.getInstance().createBNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class SerializableTest {
@Test
public void testMaxCountSnapshot() throws IOException, InterruptedException {
for (int i = 0; i < 10; i++) {
SailRepository repo = Utils.getInitializedShaclRepository("shaclMax.ttl", false);
SailRepository repo = Utils.getInitializedShaclRepository("shaclMax.ttl");

Sail sail = repo.getSail();
// ((ShaclSail) sail).setGlobalLogValidationExecution(true);
Expand All @@ -61,7 +61,7 @@ public void testMaxCountSnapshot() throws IOException, InterruptedException {
@Test
public void testMaxCountSerializable() throws IOException, InterruptedException {

SailRepository repo = Utils.getInitializedShaclRepository("shaclMax.ttl", false);
SailRepository repo = Utils.getInitializedShaclRepository("shaclMax.ttl");

multithreadedMaxCountViolation(IsolationLevels.SERIALIZABLE, repo);

Expand All @@ -82,7 +82,7 @@ public void testMaxCountSerializable() throws IOException, InterruptedException
@Test
public void testMaxCount2Serializable() throws IOException, InterruptedException {

SailRepository repo = Utils.getInitializedShaclRepository("shaclMax.ttl", false);
SailRepository repo = Utils.getInitializedShaclRepository("shaclMax.ttl");

multithreadedMaxCount2Violation(IsolationLevels.SERIALIZABLE, repo);

Expand All @@ -103,7 +103,7 @@ public void testMaxCount2Serializable() throws IOException, InterruptedException
@Test
public void testMaxCount2Snapshot() throws IOException, InterruptedException {

SailRepository repo = Utils.getInitializedShaclRepository("shaclMax.ttl", false);
SailRepository repo = Utils.getInitializedShaclRepository("shaclMax.ttl");

multithreadedMaxCount2Violation(IsolationLevels.SNAPSHOT, repo);

Expand All @@ -125,7 +125,7 @@ public void testMaxCount2Snapshot() throws IOException, InterruptedException {
public void serializableParallelValidation() throws Throwable {

SailRepository repo = Utils
.getInitializedShaclRepository("test-cases/complex/targetShapeAndQualifiedShape/shacl.ttl", false);
.getInitializedShaclRepository("test-cases/complex/targetShapeAndQualifiedShape/shacl.ttl");

ShaclSail sail = (ShaclSail) repo.getSail();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static void afterClass() {
@Test
public void a() throws Exception {

SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.ttl", false);
SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.ttl");

try (SailRepositoryConnection connection = shaclRepository.getConnection()) {

Expand Down Expand Up @@ -81,7 +81,7 @@ public void a() throws Exception {

@Test
public void b() throws Exception {
SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.ttl", false);
SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.ttl");

try (SailRepositoryConnection connection = shaclRepository.getConnection()) {

Expand Down Expand Up @@ -110,7 +110,7 @@ public void b() throws Exception {

@Test(expected = RepositoryException.class)
public void maxCount() throws Exception {
SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclMax.ttl", false);
SailRepository shaclRepository = Utils.getInitializedShaclRepository("shaclMax.ttl");

try (SailRepositoryConnection connection = shaclRepository.getConnection()) {

Expand Down Expand Up @@ -145,7 +145,7 @@ public void maxCount() throws Exception {
@Test
public void minCount() throws Exception {

SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.ttl", false);
SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.ttl");

try (SailRepositoryConnection connection = shaclRepository.getConnection()) {

Expand All @@ -172,7 +172,7 @@ public void minCount() throws Exception {
@Test
public void leftOuterJoin() throws Exception {

SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.ttl", false);
SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacl.ttl");

try (SailRepositoryConnection connection = shaclRepository.getConnection()) {

Expand Down Expand Up @@ -209,7 +209,7 @@ public void leftOuterJoin() throws Exception {
@Test(expected = RepositoryException.class)
public void testShapeWithoutTargetClassRemove() throws Exception {

SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacleNoTargetClass.ttl", true);
SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacleNoTargetClass.ttl");

try (SailRepositoryConnection connection = shaclRepository.getConnection()) {

Expand All @@ -230,7 +230,7 @@ public void testShapeWithoutTargetClassRemove() throws Exception {
@Test(expected = RepositoryException.class)
public void testShapeWithoutTargetClassAdd() throws Exception {

SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacleNoTargetClass.ttl", true);
SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacleNoTargetClass.ttl");

try (SailRepositoryConnection connection = shaclRepository.getConnection()) {

Expand All @@ -250,7 +250,7 @@ public void testShapeWithoutTargetClassAdd() throws Exception {
@Test
public void testShapeWithoutTargetClassValid() throws Exception {

SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacleNoTargetClass.ttl", true);
SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacleNoTargetClass.ttl");

((ShaclSail) shaclRepository.getSail()).setUndefinedTargetValidatesAllSubjects(true);

Expand Down Expand Up @@ -280,7 +280,7 @@ public void testShapeWithoutTargetClassValid() throws Exception {
@Test(expected = ShaclSailValidationException.class)
public void testUndefinedTargetClassValidatesAllSubjects() throws Throwable {

SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacleNoTargetClass.ttl", true);
SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacleNoTargetClass.ttl");

try (SailRepositoryConnection connection = shaclRepository.getConnection()) {

Expand Down Expand Up @@ -335,7 +335,7 @@ public void testUndefinedTargetClassValidatesAllSubjects() throws Throwable {
@Test(expected = ShaclSailValidationException.class)
public void testUndefinedTargetClassValidatesAllSubjects2() throws Throwable {

SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacleNoTargetClass.ttl", true);
SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacleNoTargetClass.ttl");

try (SailRepositoryConnection connection = shaclRepository.getConnection()) {

Expand Down Expand Up @@ -386,7 +386,7 @@ public void testUndefinedTargetClassValidatesAllSubjects2() throws Throwable {
@Test
public void testUndefinedTargetClassValidatesAllSubjects3() throws Throwable {

SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacleNoTargetClass.ttl", false);
SailRepository shaclRepository = Utils.getInitializedShaclRepository("shacleNoTargetClass.ttl");

try (SailRepositoryConnection connection = shaclRepository.getConnection()) {

Expand Down
Loading

0 comments on commit ac29711

Please sign in to comment.