From 9eea579a23545462f78624c86d3f7e1431580d89 Mon Sep 17 00:00:00 2001 From: qaate47 Date: Fri, 16 Feb 2024 15:15:11 +0100 Subject: [PATCH] [skip ci] wip 2 --- .../store/EndpointStoreConnection.java | 24 ++++++++++++++++++- ...tMultIndexSPARQL11QueryComplianceTest.java | 7 +++--- ...MultIndexSPARQL11UpdateComplianceTest.java | 3 +++ .../EndpointSPARQL11QueryComplianceTest.java | 6 ++++- .../EndpointSPARQL11UpdateComplianceTest.java | 3 +++ 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/qendpoint-store/src/main/java/com/the_qa_company/qendpoint/store/EndpointStoreConnection.java b/qendpoint-store/src/main/java/com/the_qa_company/qendpoint/store/EndpointStoreConnection.java index 4724fb76..0995891f 100644 --- a/qendpoint-store/src/main/java/com/the_qa_company/qendpoint/store/EndpointStoreConnection.java +++ b/qendpoint-store/src/main/java/com/the_qa_company/qendpoint/store/EndpointStoreConnection.java @@ -517,6 +517,28 @@ private boolean tripleExistInHDT(TripleID tripleID) { } private void assignBitMapDeletes(TripleID tripleID, Resource subj, IRI pred, Value obj) throws SailException { + if (tripleID.isEmpty()) { + // clear + for (TripleComponentOrder order : endpoint.getValidOrders()) { + IteratorTripleID iter = endpoint.getHdt().getTriples().search(tripleID, order.mask); + + while (iter.hasNext()) { + iter.next(); + long index = iter.getLastTriplePosition(); + + assert iter.isLastTriplePositionBoundToOrder(); + TripleComponentOrder sorder = iter.getOrder(); + + if (!this.endpoint.getDeleteBitMap(sorder).access(index)) { + this.endpoint.getDeleteBitMap(sorder).set(index, true); + if (this.endpoint.isMerging()) { + this.endpoint.getTempDeleteBitMap(sorder).set(index, true); + } + } + } + } + return; + } if (tripleID.getSubject() != -1 && tripleID.getPredicate() != -1 && tripleID.getObject() != -1) { for (TripleComponentOrder order : endpoint.getValidOrders()) { @@ -534,7 +556,7 @@ private void assignBitMapDeletes(TripleID tripleID, Resource subj, IRI pred, Val if (this.endpoint.isMerging()) { this.endpoint.getTempDeleteBitMap(sorder).set(index, true); } - if (order == TripleComponentOrder.SPO && subj != null && pred != null && obj != null) { + if (order == TripleComponentOrder.SPO) { notifyStatementRemoved(this.endpoint.getValueFactory().createStatement(subj, pred, obj)); } } diff --git a/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointMultIndexSPARQL11QueryComplianceTest.java b/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointMultIndexSPARQL11QueryComplianceTest.java index b91facd1..29a6905c 100644 --- a/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointMultIndexSPARQL11QueryComplianceTest.java +++ b/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointMultIndexSPARQL11QueryComplianceTest.java @@ -13,13 +13,9 @@ import org.eclipse.rdf4j.query.Dataset; import org.eclipse.rdf4j.repository.Repository; import org.eclipse.rdf4j.repository.sail.SailRepository; -import org.eclipse.rdf4j.sail.SailException; import org.eclipse.rdf4j.testsuite.query.parser.sparql.manifest.SPARQL11QueryComplianceTest; -import org.junit.Assert; -import org.junit.Rule; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.io.TempDir; -import org.junit.rules.TemporaryFolder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -125,6 +121,9 @@ public HDT loadIndex() throws IOException { } }; // endpoint.setThreshold(2); + if (EndpointSPARQL11QueryComplianceTest.PRINT) { + return Utility.convertToDumpRepository(new SailRepository(Utility.convertToDumpSail(endpoint))); + } return new SailRepository(endpoint); } diff --git a/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointMultIndexSPARQL11UpdateComplianceTest.java b/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointMultIndexSPARQL11UpdateComplianceTest.java index 9fdb3e9c..f5f03522 100644 --- a/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointMultIndexSPARQL11UpdateComplianceTest.java +++ b/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointMultIndexSPARQL11UpdateComplianceTest.java @@ -85,6 +85,9 @@ public HDT loadIndex() throws IOException { }; // endpoint.setThreshold(2); + if (EndpointSPARQL11QueryComplianceTest.PRINT) { + return Utility.convertToDumpRepository(new SailRepository(Utility.convertToDumpSail(endpoint))); + } return new SailRepository(endpoint); // return new DatasetRepository(new SailRepository(new // NativeStore(tempDir.newFolder(), "spoc"))); diff --git a/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointSPARQL11QueryComplianceTest.java b/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointSPARQL11QueryComplianceTest.java index 5ab3c291..35193121 100644 --- a/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointSPARQL11QueryComplianceTest.java +++ b/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointSPARQL11QueryComplianceTest.java @@ -30,6 +30,7 @@ * @author Ali Haidar */ public class EndpointSPARQL11QueryComplianceTest extends SPARQL11QueryComplianceTest { + public static boolean PRINT = true; private static final Logger logger = LoggerFactory.getLogger(EndpointSPARQL11QueryComplianceTest.class); public EndpointSPARQL11QueryComplianceTest() { @@ -95,7 +96,10 @@ protected Repository newRepository() throws Exception { endpoint = new EndpointStore(hdtStore.toAbsolutePath() + "/", EndpointStoreTest.HDT_INDEX_NAME, spec, nativeStore.toAbsolutePath() + "/", true); // endpoint.setThreshold(2); - return Utility.convertToDumpRepository(new SailRepository(Utility.convertToDumpSail(endpoint))); + if (EndpointSPARQL11QueryComplianceTest.PRINT) { + return Utility.convertToDumpRepository(new SailRepository(Utility.convertToDumpSail(endpoint))); + } + return new SailRepository(endpoint); } HDT hdt; diff --git a/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointSPARQL11UpdateComplianceTest.java b/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointSPARQL11UpdateComplianceTest.java index cd97de58..09d90f94 100644 --- a/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointSPARQL11UpdateComplianceTest.java +++ b/qendpoint-store/src/test/java/com/the_qa_company/qendpoint/store/EndpointSPARQL11UpdateComplianceTest.java @@ -67,6 +67,9 @@ protected Repository newRepository() throws Exception { spec, nativeStore.toAbsolutePath() + "/", true); // endpoint.setThreshold(2); + if (EndpointSPARQL11QueryComplianceTest.PRINT) { + return Utility.convertToDumpRepository(new SailRepository(Utility.convertToDumpSail(endpoint))); + } return new SailRepository(endpoint); // return new DatasetRepository(new SailRepository(new // NativeStore(tempDir.newFolder(), "spoc")));