Skip to content
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

Graph store integration Preparations #1743

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

Qup42
Copy link
Member

@Qup42 Qup42 commented Jan 31, 2025

  • Extract parseHttpRequest and extractAccessToken into separate Class SPARQLProtocol.
  • Refactor processQueryOrUpdate (and methods below it) to take a ParsedQuery. Consolidate query preparation into parseQuery, planQuery and setupPlannedQuery.

Both these changes will make integrating the Graph Store Protocol much easier

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

Attention: Patch coverage is 49.10394% with 142 lines in your changes missing coverage. Please review.

Project coverage is 90.05%. Comparing base (f2562fe) to head (0f1ffd9).
Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
src/engine/Server.cpp 0.69% 142 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1743      +/-   ##
==========================================
+ Coverage   89.95%   90.05%   +0.10%     
==========================================
  Files         395      396       +1     
  Lines       37651    37910     +259     
  Branches     4234     4261      +27     
==========================================
+ Hits        33869    34141     +272     
+ Misses       2487     2476      -11     
+ Partials     1295     1293       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@joka921 joka921 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An initial round of reviews,
I find this already much cleaner.

src/engine/Server.h Outdated Show resolved Hide resolved
src/engine/Server.h Outdated Show resolved Hide resolved
src/engine/Server.cpp Outdated Show resolved Hide resolved
src/engine/Server.cpp Outdated Show resolved Hide resolved
src/engine/Server.cpp Outdated Show resolved Hide resolved
src/engine/Server.cpp Outdated Show resolved Hide resolved

if (!plannedQuery.parsedQuery_.hasUpdateClause()) {
if (!plannedUpdate.parsedQuery_.hasUpdateClause()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this check with the well-defined error message be performed earlier (e.g. right after the parsing, and in a single function for the query and update? This could also then be moved into the SPARQLProtocol file.
Then we can here get away with a simple AD_CORRECTNESS_CHECK

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the check into the visit function. This could get even cleaner if we'd separate the parsing functions for and have separate types for parsed Queries/Updates.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll wait until the very end with moving the function, to keep the review more manageable.

src/engine/Server.cpp Outdated Show resolved Hide resolved
#include "util/http/UrlParser.h"
#include "util/http/beast.h"

class SPARQLProtocol {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll have a look at this file another time, but I assume, that there is not much change other than moving the functionality out of the Server.cpp file into this file, is that right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of now there's no change here at all, yes. Some small changes will happen in the follow-up PR.

Copy link
Member

@joka921 joka921 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much better,
Please address my further comments.
I hope we can make serious progress here soon.

src/engine/Server.cpp Outdated Show resolved Hide resolved
src/engine/Server.cpp Outdated Show resolved Hide resolved
src/engine/Server.cpp Outdated Show resolved Hide resolved
src/engine/Server.cpp Outdated Show resolved Hide resolved
Comment on lines +1002 to +1003
// TODO: the storing of the PlannedQuery outside the try-catch block in case
// of an error has been broken for some time
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate which case exactly is broken here? Then we can decide if that is an easy or a hard problem to fix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When all the query execution was in this function, it was possible to access the planned query when doing the exception handling. This was used to add the planned query to the error response for debugging. The planned query is not available here and not all places were exceptions could be thrown have access to the planned query.

@sparql-conformance
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants