Skip to content

Commit

Permalink
use reportError
Browse files Browse the repository at this point in the history
  • Loading branch information
ullingerc committed Nov 22, 2024
1 parent 6fe436b commit cbf7612
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions src/parser/sparqlParser/SparqlQleverVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -833,15 +833,16 @@ GraphPatternOperation Visitor::visitPathQuery(

GraphPatternOperation Visitor::visitSpatialQuery(
Parser::ServiceGraphPatternContext* ctx) {
auto parseSpatialQuery = [](parsedQuery::SpatialQuery& spatialQuery,
const parsedQuery::GraphPatternOperation& op) {
auto parseSpatialQuery = [ctx](parsedQuery::SpatialQuery& spatialQuery,
const parsedQuery::GraphPatternOperation& op) {
if (std::holds_alternative<parsedQuery::BasicGraphPattern>(op)) {
spatialQuery.addBasicPattern(
std::get<parsedQuery::BasicGraphPattern>(op));
} else if (std::holds_alternative<parsedQuery::GroupGraphPattern>(op)) {
spatialQuery.addGraph(op);
} else {
throw parsedQuery::SpatialSearchException(
reportError(
ctx,
"Unsupported element in spatialQuery."
"spatialQuery may only consist of triples for configuration"
"And a { group graph pattern } specifying the right join table.");
Expand Down Expand Up @@ -2173,24 +2174,28 @@ ExpressionPtr Visitor::visit([[maybe_unused]] Parser::BuiltInCallContext* ctx) {
using namespace sparqlExpression;
// Create the expression using the matching factory function from
// `NaryExpression.h`.
auto createUnary = [&argList]<typename Function>(Function function)
requires std::is_invocable_r_v<ExpressionPtr, Function, ExpressionPtr> {
auto createUnary =
[&argList]<typename Function>(Function function)
requires std::is_invocable_r_v<ExpressionPtr, Function, ExpressionPtr>
{
AD_CORRECTNESS_CHECK(argList.size() == 1, argList.size());
return function(std::move(argList[0]));
};
auto createBinary = [&argList]<typename Function>(Function function)
requires std::is_invocable_r_v<ExpressionPtr, Function, ExpressionPtr,
ExpressionPtr> {
AD_CORRECTNESS_CHECK(argList.size() == 2);
return function(std::move(argList[0]), std::move(argList[1]));
};
auto createTernary = [&argList]<typename Function>(Function function)
requires std::is_invocable_r_v<ExpressionPtr, Function, ExpressionPtr,
ExpressionPtr, ExpressionPtr> {
AD_CORRECTNESS_CHECK(argList.size() == 3);
return function(std::move(argList[0]), std::move(argList[1]),
std::move(argList[2]));
};
auto createBinary =
[&argList]<typename Function>(Function function)
requires std::is_invocable_r_v<ExpressionPtr, Function, ExpressionPtr,
ExpressionPtr> {
AD_CORRECTNESS_CHECK(argList.size() == 2);
return function(std::move(argList[0]), std::move(argList[1]));
};
auto createTernary =
[&argList]<typename Function>(Function function)
requires std::is_invocable_r_v<ExpressionPtr, Function, ExpressionPtr,
ExpressionPtr, ExpressionPtr> {
AD_CORRECTNESS_CHECK(argList.size() == 3);
return function(std::move(argList[0]), std::move(argList[1]),
std::move(argList[2]));
};
if (functionName == "str") {
return createUnary(&makeStrExpression);
} else if (functionName == "iri" || functionName == "uri") {
Expand Down

0 comments on commit cbf7612

Please sign in to comment.