diff --git a/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/dictionary/Dictionary.java b/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/dictionary/Dictionary.java index 17fcb6e7..1d4ce246 100644 --- a/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/dictionary/Dictionary.java +++ b/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/dictionary/Dictionary.java @@ -134,6 +134,14 @@ default boolean supportsLanguageOfId() { return false; } + /** + * @return if the dictionary is an MSD. if so, {@link #getObjects()} can't + * be used and the {@link #getAllObjects()} method should be used. + */ + default boolean isMultiSectionDictionary() { + return false; + } + /** * Returns whether the dictionary supports graphs * diff --git a/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/dictionary/impl/MultipleBaseDictionary.java b/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/dictionary/impl/MultipleBaseDictionary.java index f392f4a8..b40bc126 100644 --- a/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/dictionary/impl/MultipleBaseDictionary.java +++ b/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/dictionary/impl/MultipleBaseDictionary.java @@ -375,6 +375,11 @@ public void reset() { } } + @Override + public boolean isMultiSectionDictionary() { + return true; + } + @Override public OptimizedExtractor createOptimizedMapExtractor() { return new MultDictionaryPFCOptimizedExtractor(this); diff --git a/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/dictionary/impl/MultipleLangBaseDictionary.java b/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/dictionary/impl/MultipleLangBaseDictionary.java index ded6c74e..25853366 100644 --- a/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/dictionary/impl/MultipleLangBaseDictionary.java +++ b/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/dictionary/impl/MultipleLangBaseDictionary.java @@ -528,6 +528,11 @@ public OptimizedExtractor createOptimizedMapExtractor() { return new MultipleSectionDictionaryLangPFCOptimizedExtractor(this); } + @Override + public boolean isMultiSectionDictionary() { + return true; + } + public int getObjectsSectionCount() { return objectIdLocationsSec.length; } diff --git a/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/tools/HDTVerify.java b/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/tools/HDTVerify.java index f080ba8d..7d648148 100644 --- a/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/tools/HDTVerify.java +++ b/qendpoint-core/src/main/java/com/the_qa_company/qendpoint/core/tools/HDTVerify.java @@ -4,7 +4,6 @@ import com.beust.jcommander.Parameter; import com.beust.jcommander.internal.Lists; import com.the_qa_company.qendpoint.core.dictionary.DictionarySection; -import com.the_qa_company.qendpoint.core.dictionary.impl.MultipleBaseDictionary; import com.the_qa_company.qendpoint.core.exceptions.NotFoundException; import com.the_qa_company.qendpoint.core.hdt.HDT; import com.the_qa_company.qendpoint.core.hdt.HDTManager; @@ -237,7 +236,7 @@ public void exec() throws Throwable { try (HDT hdt = hdtl) { boolean error; long count = 0; - if (hdt.getDictionary() instanceof MultipleBaseDictionary) { + if (hdt.getDictionary().isMultiSectionDictionary()) { colorTool.log("Checking subject entries"); error = checkDictionarySectionOrder(binary, unicode, colorTool, "subject", hdt.getDictionary().getSubjects(), console); @@ -279,6 +278,12 @@ public void exec() throws Throwable { hdt.getDictionary().getShared(), console); count += hdt.getDictionary().getShared().getNumberOfElements(); } + if (hdt.getDictionary().supportGraphs()) { + colorTool.log("Checking graph entries"); + error |= checkDictionarySectionOrder(binary, unicode, colorTool, "graph", + hdt.getDictionary().getGraphs(), console); + count += hdt.getDictionary().getGraphs().getNumberOfElements(); + } if (error) { colorTool.error("This HDT isn't valid", true); diff --git a/qendpoint-store/src/main/java/com/the_qa_company/qendpoint/compiler/SparqlRepository.java b/qendpoint-store/src/main/java/com/the_qa_company/qendpoint/compiler/SparqlRepository.java index 2819c09c..3b839e84 100644 --- a/qendpoint-store/src/main/java/com/the_qa_company/qendpoint/compiler/SparqlRepository.java +++ b/qendpoint-store/src/main/java/com/the_qa_company/qendpoint/compiler/SparqlRepository.java @@ -11,16 +11,10 @@ import com.the_qa_company.qendpoint.utils.sail.SourceSailConnectionWrapper; import jakarta.json.Json; import jakarta.json.stream.JsonGenerator; -import org.eclipse.rdf4j.model.Literal; import org.eclipse.rdf4j.model.Namespace; import org.eclipse.rdf4j.model.Statement; -import org.eclipse.rdf4j.model.ValueFactory; -import org.eclipse.rdf4j.model.base.CoreDatatype; -import org.eclipse.rdf4j.model.impl.SimpleValueFactory; import org.eclipse.rdf4j.model.util.Values; import org.eclipse.rdf4j.query.*; -import org.eclipse.rdf4j.query.algebra.Var; -import org.eclipse.rdf4j.query.algebra.helpers.AbstractQueryModelVisitor; import org.eclipse.rdf4j.query.explanation.Explanation; import org.eclipse.rdf4j.query.explanation.GenericPlanNode; import org.eclipse.rdf4j.query.parser.*; @@ -104,9 +98,6 @@ public CompiledSailOptions getOptions() { /** * reindex all the lucene sails of this repository - * - * @throws Exception any exception returned by - * {@link org.eclipse.rdf4j.sail.lucene.LuceneSail#reindex()} */ public void reindexLuceneSails() { compiledSail.reindexLuceneSails(); @@ -762,15 +753,17 @@ public void executeUpdate(String sparqlQuery, int timeout, OutputStream out) { executeUpdate(sparqlQuery, timeout, out, null); } + /** * execute a sparql update query * - * @param sparqlQuery the query - * @param timeout query timeout - * @param out the output stream, can be null + * @param sparqlQuery the query + * @param timeout query timeout + * @param out the output stream, can be null * @param customConnection custom connection to use */ - public void executeUpdate(String sparqlQuery, int timeout, OutputStream out, RepositoryConnection customConnection) { + public void executeUpdate(String sparqlQuery, int timeout, OutputStream out, + RepositoryConnection customConnection) { // logger.info("Running update query:"+sparqlQuery); sparqlQuery = applyPrefixes(sparqlQuery); sparqlQuery = Pattern.compile("MINUS \\{(?s).*?}\\n {2}}").matcher(sparqlQuery).replaceAll("");