-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added quite some unit tests, the next pass will be for the comments.
Signed-off-by: Johannes Kalmbach <[email protected]>
- Loading branch information
Showing
13 changed files
with
144 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2024, University of Freiburg | ||
// Chair of Algorithms and Data Structures | ||
// Author: Johannes Kalmbach <[email protected]> | ||
|
||
#include "DatasetClauses.h" | ||
|
||
// _____________________________________________________________________________ | ||
parsedQuery::DatasetClauses parsedQuery::DatasetClauses::fromClauses( | ||
const std::vector<DatasetClause>& clauses) { | ||
DatasetClauses result; | ||
for (auto& [dataset, isNamed] : clauses) { | ||
auto& graphs = isNamed ? result.namedGraphs_ : result.defaultGraphs_; | ||
if (!graphs.has_value()) { | ||
graphs.emplace(); | ||
} | ||
graphs.value().insert(dataset); | ||
} | ||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2024, University of Freiburg | ||
// Chair of Algorithms and Data Structures | ||
// Author: Johannes Kalmbach <[email protected]> | ||
|
||
#pragma once | ||
#include <vector> | ||
|
||
#include "index/ScanSpecification.h" | ||
#include "parser/sparqlParser/DatasetClause.h" | ||
|
||
namespace parsedQuery { | ||
// A struct for the FROM and FROM NAMED clauses; | ||
struct DatasetClauses { | ||
// FROM clauses. | ||
ScanSpecificationAsTripleComponent::Graphs defaultGraphs_{}; | ||
// FROM NAMED clauses. | ||
ScanSpecificationAsTripleComponent::Graphs namedGraphs_{}; | ||
|
||
static DatasetClauses fromClauses(const std::vector<DatasetClause>& clauses); | ||
|
||
bool operator==(const DatasetClauses& other) const = default; | ||
}; | ||
} // namespace parsedQuery |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Copyright 2015 - 2024, University of Freiburg | ||
// Chair of Algorithms and Data Structures | ||
// Authors: Björn Buchhold <[email protected]> [2015 - 2017] | ||
// Johannes Kalmbach <kalmbachqcs.uni-freiburg.de> [2018 - 2024] | ||
// Johannes Kalmbach <kalmbach@cs.uni-freiburg.de> [2018 - 2024] | ||
|
||
#include <gtest/gtest.h> | ||
|
||
|
@@ -2151,10 +2151,18 @@ TEST(QueryPlanner, WarningsOnUnboundVariables) { | |
|
||
// ___________________________________________________________________________ | ||
TEST(QueryPlanner, Describe) { | ||
// TODO<joka921> Properly match the describe clause. | ||
// Note: We deliberately don't test the contents of the actual DESCRIBE | ||
// clause, because they have been extensively tested already in | ||
// `SparqlAntlrParserTest.cpp` where we have access to proper matchers for | ||
// them. | ||
h::expect("DESCRIBE <x>", h::Describe(::testing::_, h::NeutralElement())); | ||
h::expect("DESCRIBE ?x", h::Describe(::testing::_, h::NeutralElement())); | ||
h::expect( | ||
"Describe ?y { ?y <p> <o>}", | ||
h::Describe(::testing::_, h::IndexScanFromStrings("?y", "<p>", "<o>"))); | ||
h::expect( | ||
"Describe ?y FROM <g> { ?y <p> <o>}", | ||
h::Describe(::testing::_, h::IndexScanFromStrings( | ||
"?y", "<p>", "<o>", {}, | ||
ad_utility::HashSet<std::string>{"<g>"}))); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters