-
Notifications
You must be signed in to change notification settings - Fork 56
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
Correct datatypes for string expressions #1636
base: master
Are you sure you want to change the base?
Changes from 2 commits
47feb71
4877e8f
aefd889
b2cb8c6
96b1959
b7806b8
a83d74b
e73d1ab
0ed79df
2666b78
27fff04
7078f60
2581f4c
6d7a2b2
5948dcb
52ef1f5
f15bf94
774d52b
d4b49c0
72aaa00
25000a9
617c3b7
f631ec2
889e9dd
0c41603
1b7e1b4
344560a
67c747a
313bba4
be80b09
2adaa30
39ca3cb
7455f29
ac95531
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,26 +91,26 @@ std::optional<std::string> StringValueGetter::operator()( | |
} | ||
|
||
// ____________________________________________________________________________ | ||
std::optional<LiteralOrIri> LiteralOrIriValueGetter::operator()( | ||
Id id, const EvaluationContext* context) const { | ||
return ExportQueryExecutionTrees::idToLiteralOrIri(context->_qec.getIndex(), | ||
id, context->_localVocab); | ||
std::optional<ad_utility::triple_component::Literal> | ||
LiteralValueGetter::operator()(Id id, const EvaluationContext* context) const { | ||
return ExportQueryExecutionTrees::idToLiteral(context->_qec.getIndex(), id, | ||
context->_localVocab); | ||
} | ||
|
||
// ____________________________________________________________________________ | ||
std::optional<LiteralOrIri> | ||
LiteralOrIriValueGetterWithXsdStringFilter::operator()( | ||
std::optional<ad_utility::triple_component::Literal> | ||
LiteralValueGetterWithXsdStringFilter::operator()( | ||
Id id, const EvaluationContext* context) const { | ||
return ExportQueryExecutionTrees::idToLiteralOrIri( | ||
context->_qec.getIndex(), id, context->_localVocab, true); | ||
return ExportQueryExecutionTrees::idToLiteral(context->_qec.getIndex(), id, | ||
context->_localVocab, true); | ||
} | ||
|
||
// ____________________________________________________________________________ | ||
std::optional<LiteralOrIri> | ||
LiteralOrIriValueGetterWithXsdStringFilter::operator()( | ||
std::optional<ad_utility::triple_component::Literal> | ||
LiteralValueGetterWithXsdStringFilter::operator()( | ||
const LiteralOrIri& s, const EvaluationContext*) const { | ||
if (ExportQueryExecutionTrees::isPlainLiteralOrLiteralWithXsdString(s)) { | ||
return s; | ||
return s.getLiteral(); | ||
} | ||
AD_THROW("Input is not a plain string or xsd:string."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like a debug output. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should definitely be removed. |
||
return std::nullopt; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,29 +143,29 @@ struct StringValueGetter : Mixin<StringValueGetter> { | |
|
||
// This class can be used as the `ValueGetter` argument of Expression | ||
// templates. It produces a LiteralOrIri. | ||
struct LiteralOrIriValueGetter : Mixin<LiteralOrIriValueGetter> { | ||
using Mixin<LiteralOrIriValueGetter>::operator(); | ||
struct LiteralValueGetter : Mixin<LiteralValueGetter> { | ||
using Mixin<LiteralValueGetter>::operator(); | ||
|
||
std::optional<LiteralOrIri> operator()(ValueId, | ||
const EvaluationContext*) const; | ||
std::optional<ad_utility::triple_component::Literal> operator()( | ||
ValueId, const EvaluationContext*) const; | ||
|
||
std::optional<LiteralOrIri> operator()(const LiteralOrIri& s, | ||
const EvaluationContext*) const { | ||
return s; | ||
std::optional<ad_utility::triple_component::Literal> operator()( | ||
const LiteralOrIri& s, const EvaluationContext*) const { | ||
return s.getLiteral(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This most definitely doesn't work, you have to turn There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something you can (and probably should, as this is the core of your project) add: |
||
} | ||
}; | ||
|
||
// Same as above but only literals with 'xsd:string' datatype or no datatype are | ||
// returned. | ||
struct LiteralOrIriValueGetterWithXsdStringFilter | ||
: Mixin<LiteralOrIriValueGetterWithXsdStringFilter> { | ||
using Mixin<LiteralOrIriValueGetterWithXsdStringFilter>::operator(); | ||
struct LiteralValueGetterWithXsdStringFilter | ||
: Mixin<LiteralValueGetterWithXsdStringFilter> { | ||
using Mixin<LiteralValueGetterWithXsdStringFilter>::operator(); | ||
|
||
std::optional<LiteralOrIri> operator()(ValueId, | ||
const EvaluationContext*) const; | ||
std::optional<ad_utility::triple_component::Literal> operator()( | ||
ValueId, const EvaluationContext*) const; | ||
|
||
std::optional<LiteralOrIri> operator()(const LiteralOrIri& s, | ||
const EvaluationContext*) const; | ||
std::optional<ad_utility::triple_component::Literal> operator()( | ||
const LiteralOrIri& s, const EvaluationContext*) const; | ||
}; | ||
|
||
// Value getter for `isBlank`. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can (inside the
ExportQueryExecutionTrees
class)add a
using Literal = ad_utility::triple_component::Literal
,Then you can consistently write
Literal
in most of the places(maybe also repeat the
using
inside the.cpp
file, then it even works in the return types etc.