-
Notifications
You must be signed in to change notification settings - Fork 69
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 datatype and language tag for the result of SUBSTR
#1636
Correct datatype and language tag for the result of SUBSTR
#1636
Conversation
Co-authored-by: Johannes Kalmbach <[email protected]>
Co-authored-by: Johannes Kalmbach <[email protected]>
Update from original Qlever
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1636 +/- ##
========================================
Coverage 90.60% 90.61%
========================================
Files 405 405
Lines 39732 39903 +171
Branches 4488 4509 +21
========================================
+ Hits 36001 36157 +156
- Misses 2397 2405 +8
- Partials 1334 1341 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hi, You can above click at |
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.
A first round on everything but the tests.
Work on my comments, and contact me once you are done or are left with questions.
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.
Another round of reviews, this is really improving.
Make sure that the continuous integration runs through (in particular no warnings in the code + formatting etc.)
40511b3
to
7455f29
Compare
|
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.
Some additional comments.
…hub.com/DuDaAG/qlever into Correct-Datatypes-for-StringExpressions Forgot to pull before writting new code
Signed-off-by: Johannes Kalmbach <[email protected]>
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.
A pass on everything but the tests,
This looks really nice except for the one bug.
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.
I like this much better,
One and a half additional rounds or so and we can merge this.
Let me know if you have additional questions.
AD_CORRECTNESS_CHECK(iriString.ends_with('>')); | ||
iriString[0] = '"'; | ||
iriString[iriString.size() - 1] = '"'; | ||
return iriString; |
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.
The result
variable is never used.
What about taking the isiString
just as a muytable reference
(void replaceAngle(string& iriString)
)
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.
If I implement this, I get the following error message:
error: cannot bind non-const lvalue reference of type ‘std::string&’ {aka ‘std::__cxx11::basic_string&’} to an rvalue of type ‘std::remove_reference<std::__cxx11::basic_string&>::type’ {aka ‘std::__cxx11::basic_string’}
397 | std::move(word.getIri().toStringRepresentation())));
Does this mean that the I have to work with a copy either in replaceAngle
or in handleIriOrLiteral
?
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.
If an argument is a non-const lvalue-reference like std::string&
you can not assign a temporary or the result of std::move() (an rvalue reference) to this parameter. It would also be pointless, because you would mutate something in place, that is then discarded. With the reference you would have to do something like
auto str = std::move(w.Iri.toStringRepr());
replaceAngles(str);
auto Iri = Iri::fromStringRepr(std::move(str))
Whichy at second glance is ugly and doesn't really save anything here, so we just leav your original version.
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.
The mutable reference would be a better interface for the abstract interface of the class, but not for its only usage here:)
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.
Thank you very much,
This looks great now.
Signed-off-by: Johannes Kalmbach <[email protected]>
Conformance check passed ✅Test Status Changes 📊
|
|
SUBSTR
If the input string of the
SUBSTR
function has a language tag, then according to the SPARQL standard the result has to preserve this language tag. Same goes if the datatype of the string isxsd:string
. This PR implements this behavior (previously the language tag and datatype were always dropped) and implements all the infrastructure to implement this behavior also for other expressions that take and return strings.