-
Notifications
You must be signed in to change notification settings - Fork 37
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 prefixes #530
Changes from 2 commits
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 |
---|---|---|
|
@@ -1172,7 +1172,7 @@ class SparqlQleverVisitor : public SparqlAutomaticVisitor { | |
SparqlAutomaticParser::PnameLnContext* ctx) override { | ||
string text = ctx->getText(); | ||
auto pos = text.find(':'); | ||
auto pnameNS = text.substr(0, pos + 1); | ||
auto pnameNS = text.substr(0, pos); | ||
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. Was this a bug already before or is this specific for the CONSTRUCT clause? 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. I wouldn't consider it a bug, but rather an implementation specific oddity. |
||
auto pnLocal = text.substr(pos + 1); | ||
if (!_prefixMap.contains(pnameNS)) { | ||
// TODO<joka921> : proper name | ||
|
@@ -1189,7 +1189,8 @@ class SparqlQleverVisitor : public SparqlAutomaticVisitor { | |
|
||
antlrcpp::Any visitPnameNs( | ||
SparqlAutomaticParser::PnameNsContext* ctx) override { | ||
auto prefix = ctx->getText(); | ||
auto text = ctx->getText(); | ||
auto prefix = text.substr(0, text.length() - 1); | ||
Comment on lines
+1194
to
+1195
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. Same question as before. |
||
if (!_prefixMap.contains(prefix)) { | ||
// TODO<joka921> : proper name | ||
throw SparqlParseException{ | ||
|
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.
Are the prefixes now parsed twice (for the CONSTRUCT clause and the WHERE clause)? I am asking because prefixes did work already for the WHERE clause.
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.
They are not, the weirdness comes from the parser-duality that currently exists within the codebase.
Basically the existing parser (the non-antlr) version currently parses all the prefixes, but the parsing of the construct clause is done using antlr (which requires the parsed prefixes being passed here), which then delegates back to the original parser to parse the where clause