Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for FROM and GRAPH with fixed IRI #1445

Merged
merged 99 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 97 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
3deee1d
Still adding + 1 to all kinds of column indices.
joka921 May 2, 2024
7be34a7
Add the GraphID.
joka921 May 3, 2024
3600030
Refactoring and fixing E2E tests.
joka921 May 3, 2024
0b1a846
Some sonarcloudd stuff.
joka921 May 3, 2024
3c8ca4f
Merge branch 'refs/heads/add-graph-column' into nquad-parser
joka921 May 6, 2024
ca98e05
A first draft of an NQuad parser
joka921 May 6, 2024
bc31aea
Integrated the parser into the IndexBuilder.
joka921 May 6, 2024
658dc3e
Starting with this and that.
joka921 May 6, 2024
5a845b1
We don't need this for now,
joka921 May 6, 2024
e374b92
We have to fix some complex lambdas, but otherwise this could be easy.
joka921 May 6, 2024
b8e872b
A lot of stuff is missing, but the IN seems to work for simple cases..
joka921 May 8, 2024
be5528f
also integrate the NOT IN expression.
joka921 May 13, 2024
c99feee
TODO<joka921>
joka921 May 13, 2024
a31bb2a
Correct cache keys, correct behavior in HAVING clauses, and
joka921 May 13, 2024
4cccaac
Merging in the IN expression.
joka921 May 15, 2024
b79623b
Merge branch 'refs/heads/in-and-not-in' into use-named-graph
joka921 May 15, 2024
7c4a573
We have written our first FROM expression....
joka921 May 15, 2024
14d9414
Merged in the current master.
joka921 Jul 31, 2024
55d53a3
Merge branch 'master' into add-graph-column
joka921 Aug 16, 2024
74aeea4
Fix the merge bugs.
joka921 Aug 16, 2024
271b844
Fix bugs in tests and add the graph column to this and that.
joka921 Aug 16, 2024
8ac1c20
Merge this in... I think something is off here...
joka921 Aug 16, 2024
f4c78a7
Merge branch 'add-graph-column' into nquad-parser
joka921 Aug 16, 2024
c97793f
Include the NQuad Parser...
joka921 Aug 16, 2024
f0fc258
Merged everything, now
joka921 Aug 16, 2024
106dedb
Clang format.
joka921 Aug 16, 2024
d178b10
Fix some bugs...
joka921 Aug 16, 2024
046d72b
Fix some bugs...
joka921 Aug 16, 2024
2860ad3
Fix several bugs...
joka921 Aug 16, 2024
e7a0198
Merge branch 'add-graph-column' into nquad-parser
joka921 Aug 16, 2024
608d04f
Merge branch 'nquad-parser' into use-named-graph
joka921 Aug 16, 2024
14369e1
add Graph clauses...
joka921 Aug 16, 2024
86a7648
Fix several bugs.
joka921 Aug 16, 2024
d3fafde
Some logging.
joka921 Aug 16, 2024
a685db9
Another thing.
joka921 Aug 16, 2024
bd5bc36
Change a log.
joka921 Aug 16, 2024
eba78bc
Noch eine Chance.
joka921 Aug 16, 2024
09f21b5
Fix another bug...
joka921 Aug 16, 2024
a415305
Call the new file format `nq` and not `nquad`
Aug 20, 2024
b9229cb
At least the changes to the pattern creator survived...
joka921 Aug 26, 2024
7ea1913
Merge branch 'master' into special-ids-to-normal-ids
joka921 Aug 27, 2024
d608856
Merge branch 'master' into special-ids-to-normal-ids
joka921 Aug 27, 2024
ee8e0ad
Add the special IDs to the ordinary vocabulary.
joka921 Aug 27, 2024
b79ac1f
Compiling,
joka921 Aug 27, 2024
1b1adc8
This seems to work.
joka921 Aug 27, 2024
b32530e
A small improvement.
joka921 Aug 27, 2024
9601522
Merge branch 'special-ids-to-normal-ids' into use-named-graph
joka921 Aug 27, 2024
2469cf2
Merge in, still hacky.
joka921 Aug 27, 2024
0356a45
Add various comments and cleanups.
joka921 Aug 28, 2024
d1e85ee
Add various comments and cleanups.
joka921 Aug 29, 2024
f15c234
A round of reviews.
joka921 Aug 29, 2024
efeef68
A round of reviews.
joka921 Aug 29, 2024
f389bf7
Clang format.
joka921 Aug 29, 2024
48d6ca8
Merge branch 'special-ids-to-normal-ids' into use-named-graph
joka921 Aug 29, 2024
74766d3
Merge branch 'master' into use-named-graph
joka921 Aug 30, 2024
6c8d2e6
Merge branch 'master' into use-named-graph
joka921 Sep 5, 2024
b2b05f0
Including the graph filter into the IndexScan and Block metadata...
joka921 Sep 5, 2024
994dc9f
Merge branch 'named-graph-metadata' into use-named-graph
joka921 Sep 5, 2024
5303b23
A fix.
joka921 Sep 5, 2024
e9b76f0
Found out why the unit tests fail.
joka921 Sep 5, 2024
f3a38de
Better named graphs.
joka921 Sep 5, 2024
eae5a6d
Merge branch 'master' into use-named-graph
joka921 Sep 5, 2024
5d440f6
Merge remote-tracking branch 'origin/master' into use-named-graph
Sep 7, 2024
f38219f
Clang format
Sep 7, 2024
336f73a
Filter also by the graph.
joka921 Sep 10, 2024
6e9193f
Merge remote-tracking branch 'origin/use-named-graph' into use-named-…
joka921 Sep 10, 2024
af329f1
Try to add more metadata.
joka921 Sep 11, 2024
ef5743c
Fix some warnings for now, a lot of tests are still missing.
joka921 Sep 19, 2024
5433c67
Merge branch 'master' into use-named-graph
joka921 Sep 20, 2024
2a2e6b7
Rebased and fixed an assertion.
joka921 Sep 20, 2024
9569b75
Add some tests.
joka921 Sep 24, 2024
a45668c
Added some more tests,
joka921 Sep 24, 2024
3de269a
Add several tests.
joka921 Sep 24, 2024
649d223
Merge branch 'master' into named-graph-metadata
joka921 Sep 24, 2024
be5b474
Updated everything.
joka921 Sep 24, 2024
80ef7c8
Refactor and use the new info.
joka921 Sep 24, 2024
4082661
A round of reviews.
joka921 Sep 24, 2024
daa4bcf
Resolve conflict
Sep 24, 2024
1817a00
More small things...
joka921 Sep 24, 2024
2fd691b
Merge remote-tracking branch 'origin/named-graph-metadata' into named…
joka921 Sep 24, 2024
8e97463
Revised a few comments
Sep 24, 2024
f486109
Make the tests work again.
joka921 Sep 24, 2024
e76eb40
Merge remote-tracking branch 'origin/named-graph-metadata' into named…
joka921 Sep 24, 2024
76e8aa3
Fix everything from a review.
joka921 Sep 25, 2024
f5b4f8d
Merge branch 'named-graph-metadata' into use-named-graph
joka921 Sep 25, 2024
808ee41
Some initial tests for the query planner.
joka921 Sep 25, 2024
2d48441
Fixes
joka921 Sep 25, 2024
62e0e7d
Fix the compiler warning.
joka921 Sep 25, 2024
ea6bfa4
A round of reviews.
joka921 Sep 25, 2024
c540e64
last reviews.
joka921 Sep 25, 2024
54d3a66
Merge branch 'named-graph-metadata' into use-named-graph
joka921 Sep 25, 2024
0009143
A thorough round of reviews.
joka921 Sep 25, 2024
dc51cf8
Merge branch 'master' into use-named-graph
joka921 Sep 25, 2024
70e9b96
Fix the unit test compilation from refactoring.
joka921 Sep 26, 2024
02e3d6b
Add unit tests, and while doing so, fix some bugs in the query planner.
joka921 Sep 26, 2024
1091c5f
Also add tests for the Sparql parser.
joka921 Sep 26, 2024
fdf4716
Fix linkage for codecov.
joka921 Sep 26, 2024
109585b
Merge branch 'master' into use-named-graph
joka921 Sep 26, 2024
0394bba
Small further review changes.
joka921 Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/engine/CountAvailablePredicates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ ProtoResult CountAvailablePredicates::computeResult(
if (!indexScan) {
return false;
}
if (!indexScan->getSubject().isVariable() ||
!indexScan->getObject().isVariable()) {
if (!indexScan->subject().isVariable() ||
!indexScan->object().isVariable()) {
return false;
}

return indexScan->getPredicate() == HAS_PATTERN_PREDICATE;
return indexScan->predicate() == HAS_PATTERN_PREDICATE;
}();

if (isPatternTrickForAllEntities) {
Expand Down
19 changes: 11 additions & 8 deletions src/engine/GroupBy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,8 @@ std::optional<IdTable> GroupBy::computeGroupByForSingleIndexScan() const {
return std::nullopt;
}

if (indexScan->getResultWidth() <= 1 || !_groupByVariables.empty()) {
if (indexScan->getResultWidth() <= 1 ||
indexScan->graphsToFilter().has_value() || !_groupByVariables.empty()) {
return std::nullopt;
}

Expand Down Expand Up @@ -624,7 +625,8 @@ std::optional<IdTable> GroupBy::computeGroupByObjectWithCount() const {
// The child must be an `IndexScan` with exactly two variables.
auto indexScan =
std::dynamic_pointer_cast<IndexScan>(_subtree->getRootOperation());
if (!indexScan || indexScan->numVariables() != 2) {
if (!indexScan || indexScan->graphsToFilter().has_value() ||
indexScan->numVariables() != 2) {
return std::nullopt;
}
const auto& permutedTriple = indexScan->getPermutedTriple();
Expand Down Expand Up @@ -741,22 +743,23 @@ std::optional<Permutation::Enum> GroupBy::getPermutationForThreeVariableTriple(
auto indexScan =
std::dynamic_pointer_cast<const IndexScan>(tree.getRootOperation());

if (!indexScan || indexScan->getResultWidth() != 3) {
if (!indexScan || indexScan->graphsToFilter().has_value() ||
indexScan->getResultWidth() != 3) {
return std::nullopt;
}
{
auto v = variableThatMustBeContained;
if (v != indexScan->getSubject() && v != indexScan->getPredicate() &&
v != indexScan->getObject()) {
if (v != indexScan->subject() && v != indexScan->predicate() &&
v != indexScan->object()) {
return std::nullopt;
}
}

if (variableByWhichToSort == indexScan->getSubject()) {
if (variableByWhichToSort == indexScan->subject()) {
return Permutation::SPO;
} else if (variableByWhichToSort == indexScan->getPredicate()) {
} else if (variableByWhichToSort == indexScan->predicate()) {
return Permutation::POS;
} else if (variableByWhichToSort == indexScan->getObject()) {
} else if (variableByWhichToSort == indexScan->object()) {
return Permutation::OSP;
} else {
return std::nullopt;
Expand Down
12 changes: 11 additions & 1 deletion src/engine/IndexScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ string IndexScan::getCacheKeyImpl() const {
os << " Additional Columns: ";
os << absl::StrJoin(additionalColumns(), " ");
}
if (graphsToFilter_.has_value()) {
// The graphs are stored as a hash set, but we need a deterministic order.
std::vector<std::string> graphIdVec;
std::ranges::transform(graphsToFilter_.value(),
std::back_inserter(graphIdVec),
&TripleComponent::toRdfLiteral);
std::ranges::sort(graphIdVec);
os << "\nFiltered by Graphs:";
os << absl::StrJoin(graphIdVec, " ");
}
return std::move(os).str();
}

Expand Down Expand Up @@ -151,7 +161,7 @@ ProtoResult IndexScan::computeResult(bool requestLaziness) {
using enum Permutation::Enum;
idTable.setNumColumns(numVariables_);
const auto& index = _executionContext->getIndex();
if (numVariables_ < 3) {
if (numVariables_ < 3 || !additionalColumns().empty()) {
idTable = index.scan(getScanSpecification(), permutation_,
additionalColumns(), cancellationHandle_, getLimit());
} else {
Expand Down
7 changes: 4 additions & 3 deletions src/engine/IndexScan.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ class IndexScan final : public Operation {

~IndexScan() override = default;

const TripleComponent& getPredicate() const { return predicate_; }
const TripleComponent& getSubject() const { return subject_; }
const TripleComponent& getObject() const { return object_; }
const TripleComponent& predicate() const { return predicate_; }
const TripleComponent& subject() const { return subject_; }
const TripleComponent& object() const { return object_; }
const auto& graphsToFilter() const { return graphsToFilter_; }

const std::vector<ColumnIndex>& additionalColumns() const {
return additionalColumns_;
Expand Down
7 changes: 7 additions & 0 deletions src/engine/Join.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,13 @@
rti.addDetail("num-blocks-read", metadata.numBlocksRead_);
rti.addDetail("num-blocks-all", metadata.numBlocksAll_);
rti.addDetail("num-elements-read", metadata.numElementsRead_);
if (metadata.numBlocksSkippedBecauseOfGraph_ > 0) {
rti.addDetail("num-blocks-skipped-graph",
metadata.numBlocksSkippedBecauseOfGraph_);

Check warning on line 570 in src/engine/Join.cpp

View check run for this annotation

Codecov / codecov/patch

src/engine/Join.cpp#L569-L570

Added lines #L569 - L570 were not covered by tests
}
if (metadata.numBlocksPostprocessed_ > 0) {
rti.addDetail("num-blocks-postprocessed", metadata.numBlocksPostprocessed_);

Check warning on line 573 in src/engine/Join.cpp

View check run for this annotation

Codecov / codecov/patch

src/engine/Join.cpp#L573

Added line #L573 was not covered by tests
}
}
} // namespace

Expand Down
74 changes: 58 additions & 16 deletions src/engine/QueryPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include "engine/TransitivePathBase.h"
#include "engine/Union.h"
#include "engine/Values.h"
#include "engine/sparqlExpressions/LiteralExpression.h"
#include "engine/sparqlExpressions/RelationalExpressions.h"
#include "parser/Alias.h"
#include "parser/SparqlParserHelpers.h"

Expand Down Expand Up @@ -78,11 +80,26 @@ QueryPlanner::QueryPlanner(QueryExecutionContext* qec,

// _____________________________________________________________________________
std::vector<QueryPlanner::SubtreePlan> QueryPlanner::createExecutionTrees(
ParsedQuery& pq) {
ParsedQuery& pq, bool isSubquery) {
// Store the dataset clause (FROM and FROM NAMED clauses), s.t. we have access
// to them down the callstack. Subqueries can't have their own dataset clause,
// but inherit it from the parent query.
auto datasetClauseIsEmpty = [](const auto& datasetClause) {
return !datasetClause.defaultGraphs_.has_value() &&
!datasetClause.namedGraphs_.has_value();
};
if (!isSubquery) {
AD_CORRECTNESS_CHECK(datasetClauseIsEmpty(activeDatasetClauses_));
activeDatasetClauses_ = pq.datasetClauses_;
} else {
AD_CORRECTNESS_CHECK(datasetClauseIsEmpty(pq.datasetClauses_));
}

// Look for ql:has-predicate to determine if the pattern trick should be used.
// If the pattern trick is used, the ql:has-predicate triple will be removed
// from the list of where clause triples. Otherwise, the ql:has-predicate
// triple will be handled using a `HasPredicateScan`.

using checkUsePatternTrick::PatternTrickTuple;
const auto patternTrickTuple =
_enablePatternTrick ? checkUsePatternTrick::checkUsePatternTrick(&pq)
Expand Down Expand Up @@ -166,13 +183,22 @@ std::vector<QueryPlanner::SubtreePlan> QueryPlanner::createExecutionTrees(
}

checkCancellation();

const auto& fromNamed = pq.datasetClauses_.namedGraphs_;
if (fromNamed.has_value()) {
AD_CORRECTNESS_CHECK(!fromNamed.value().empty());
throw std::runtime_error(
"FROM NAMED clauses are not yet supported by QLever");
}

return lastRow;
}

// _____________________________________________________________________
QueryExecutionTree QueryPlanner::createExecutionTree(ParsedQuery& pq) {
QueryExecutionTree QueryPlanner::createExecutionTree(ParsedQuery& pq,
bool isSubquery) {
try {
auto lastRow = createExecutionTrees(pq);
auto lastRow = createExecutionTrees(pq, isSubquery);
auto minInd = findCheapestExecutionTree(lastRow);
LOG(DEBUG) << "Done creating execution plan.\n";
return *lastRow[minInd]._qet;
Expand Down Expand Up @@ -662,6 +688,7 @@ auto QueryPlanner::seedWithScansAndText(
}
idShift++;
}

for (size_t i = 0; i < tg._nodeMap.size(); ++i) {
const TripleGraph::Node& node = *tg._nodeMap.find(i)->second;

Expand Down Expand Up @@ -696,18 +723,18 @@ auto QueryPlanner::seedWithScansAndText(
continue;
}

auto addIndexScan = [this, pushPlan, node](
Permutation::Enum permutation,
std::optional<SparqlTripleSimple> triple =
std::nullopt) {
if (!triple.has_value()) {
pushPlan(makeSubtreePlan<IndexScan>(_qec, permutation,
node.triple_.getSimple()));
} else {
pushPlan(makeSubtreePlan<IndexScan>(_qec, permutation,
std::move(triple.value())));
}
};
auto addIndexScan =
[this, pushPlan, node,
&relevantGraphs = activeDatasetClauses_.defaultGraphs_](
Permutation::Enum permutation,
std::optional<SparqlTripleSimple> triple = std::nullopt) {
if (!triple.has_value()) {
triple = node.triple_.getSimple();
}

pushPlan(makeSubtreePlan<IndexScan>(
_qec, permutation, std::move(triple.value()), relevantGraphs));
};

auto addFilter = [&filters = result.filters_](SparqlFilter filter) {
filters.push_back(std::move(filter));
Expand Down Expand Up @@ -2014,13 +2041,28 @@ void QueryPlanner::GraphPatternPlanner::graphPatternOperationVisitor(Arg& arg) {
using SubtreePlan = QueryPlanner::SubtreePlan;
if constexpr (std::is_same_v<T, p::Optional> ||
std::is_same_v<T, p::GroupGraphPattern>) {
// If this is a `GRAPH <graph> {...}` clause, then we have to overwrite the
// default graphs while planning this clause, and reset them when leaving
// the clause.
std::optional<ParsedQuery::DatasetClauses> datasetBackup;
if constexpr (std::is_same_v<T, p::GroupGraphPattern>) {
if (arg._graphIri.has_value()) {
datasetBackup = planner_.activeDatasetClauses_;
planner_.activeDatasetClauses_.defaultGraphs_.emplace(
{arg._graphIri.value()});
}
}

auto candidates = planner_.optimize(&arg._child);
if constexpr (std::is_same_v<T, p::Optional>) {
for (auto& c : candidates) {
c.type = SubtreePlan::OPTIONAL;
}
}
visitGroupOptionalOrMinus(std::move(candidates));
if (datasetBackup.has_value()) {
planner_.activeDatasetClauses_ = std::move(datasetBackup.value());
}
} else if constexpr (std::is_same_v<T, p::Union>) {
visitUnion(arg);
} else if constexpr (std::is_same_v<T, p::Subquery>) {
Expand Down Expand Up @@ -2173,7 +2215,7 @@ void QueryPlanner::GraphPatternPlanner::visitSubquery(

// For a subquery, make sure that one optimal result for each ordering
// of the result (by a single column) is contained.
auto candidatesForSubquery = planner_.createExecutionTrees(subquery);
auto candidatesForSubquery = planner_.createExecutionTrees(subquery, true);
// Make sure that variables that are not selected by the subquery are
// not visible.
auto setSelectedVariables = [&](SubtreePlan& plan) {
Expand Down
8 changes: 6 additions & 2 deletions src/engine/QueryPlanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ class QueryPlanner {
template <typename T>
using vector = std::vector<T>;

ParsedQuery::DatasetClauses activeDatasetClauses_;

public:
explicit QueryPlanner(QueryExecutionContext* qec,
CancellationHandle cancellationHandle);

// Create the best execution tree for the given query according to the
// optimization algorithm and cost estimates of the QueryPlanner.
QueryExecutionTree createExecutionTree(ParsedQuery& pq);
QueryExecutionTree createExecutionTree(ParsedQuery& pq,
bool isSubquery = false);

class TripleGraph {
public:
Expand Down Expand Up @@ -211,7 +214,8 @@ class QueryPlanner {
// result. This is relevant for subqueries, which are currently optimized
// independently of the rest of the query, but where it depends on the rest
// of the query, which ordering of the result is best.
[[nodiscard]] std::vector<SubtreePlan> createExecutionTrees(ParsedQuery& pq);
[[nodiscard]] std::vector<SubtreePlan> createExecutionTrees(
ParsedQuery& pq, bool isSubquery = false);

private:
QueryExecutionContext* _qec;
Expand Down
7 changes: 4 additions & 3 deletions src/engine/Result.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,10 @@ void Result::checkDefinedness(const VariableToColumnMap& varColMap) {
if (isFullyMaterialized()) {
AD_EXPENSIVE_CHECK(performCheck(varColMap, std::get<IdTable>(data_)));
} else {
auto generator = [](cppcoro::generator<IdTable> original,
VariableToColumnMap varColMap,
auto performCheck) -> cppcoro::generator<IdTable> {
auto generator =
[](cppcoro::generator<IdTable> original,
[[maybe_unused]] VariableToColumnMap varColMap,
[[maybe_unused]] auto performCheck) -> cppcoro::generator<IdTable> {
for (IdTable& idTable : original) {
// No need to check subsequent idTables assuming the datatypes
// don't change mid result.
Expand Down
2 changes: 1 addition & 1 deletion src/engine/TransitivePathBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ std::string TransitivePathBase::getDescriptor() const {
auto scanOperation =
std::dynamic_pointer_cast<IndexScan>(subtree_->getRootOperation());
if (scanOperation != nullptr) {
os << " " << scanOperation->getPredicate() << " ";
os << " " << scanOperation->predicate() << " ";
} else {
// Escaped the question marks to avoid a warning about ignored trigraphs.
os << R"( <???> )";
Expand Down
4 changes: 3 additions & 1 deletion src/engine/sparqlExpressions/LiteralExpression.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ class LiteralExpression : public SparqlExpression {
if (auto ptr = cachedResult_.load(std::memory_order_relaxed)) {
return *ptr;
}
auto id = context->_qec.getIndex().getId(s);
TripleComponent tc{s};
std::optional<Id> id = tc.toValueId(context->_qec.getIndex().getVocab());
// auto id = context->_qec.getIndex().getId(s);
IdOrLiteralOrIri result =
id.has_value()
? IdOrLiteralOrIri{id.value()}
Expand Down
16 changes: 0 additions & 16 deletions src/index/Index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,6 @@ std::string_view Index::indexToString(WordVocabIndex id) const {
return pimpl_->indexToString(id);
}

// ____________________________________________________________________________
std::optional<Id> Index::getId(
const ad_utility::triple_component::LiteralOrIri& element) const {
return pimpl_->getId(element);
}
// ____________________________________________________________________________
std::optional<Id> Index::getId(
const ad_utility::triple_component::Iri& element) const {
return pimpl_->getId(element);
}
// ____________________________________________________________________________
std::optional<Id> Index::getId(
const ad_utility::triple_component::Literal& element) const {
return pimpl_->getId(element);
}

// ____________________________________________________________________________
Index::Vocab::PrefixRanges Index::prefixRanges(std::string_view prefix) const {
return pimpl_->prefixRanges(prefix);
Expand Down
7 changes: 0 additions & 7 deletions src/index/Index.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,6 @@ class Index {
std::string indexToString(VocabIndex id) const;
std::string_view indexToString(WordVocabIndex id) const;

std::optional<Id> getId(
const ad_utility::triple_component::LiteralOrIri& element) const;
std::optional<Id> getId(
const ad_utility::triple_component::Literal& element) const;
std::optional<Id> getId(
const ad_utility::triple_component::Iri& element) const;

[[nodiscard]] Vocab::PrefixRanges prefixRanges(std::string_view prefix) const;

[[nodiscard]] const CompactVectorOfStrings<Id>& getPatterns() const;
Expand Down
29 changes: 0 additions & 29 deletions src/index/IndexImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1353,35 +1353,6 @@ std::string_view IndexImpl::indexToString(WordVocabIndex id) const {
return textVocab_[id];
}

// ___________________________________________________________________________
std::optional<Id> IndexImpl::getIdImpl(const auto& element) const {
VocabIndex vocabIndex;
auto success =
getVocab().getId(element.toStringRepresentation(), &vocabIndex);
if (!success) {
return std::nullopt;
}
return Id::makeFromVocabIndex(vocabIndex);
}

// ___________________________________________________________________________
std::optional<Id> IndexImpl::getId(
const ad_utility::triple_component::LiteralOrIri& element) const {
return getIdImpl(element);
}

// ___________________________________________________________________________
std::optional<Id> IndexImpl::getId(
const ad_utility::triple_component::Literal& element) const {
return getIdImpl(element);
}

// ___________________________________________________________________________
std::optional<Id> IndexImpl::getId(
const ad_utility::triple_component::Iri& element) const {
return getIdImpl(element);
}

// ___________________________________________________________________________
Index::Vocab::PrefixRanges IndexImpl::prefixRanges(
std::string_view prefix) const {
Expand Down
Loading
Loading