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

Support triple patterns with zero variables #1395

Merged
merged 16 commits into from
Aug 3, 2024

Conversation

joka921
Copy link
Member

@joka921 joka921 commented Jul 11, 2024

So far, triple patterns in a query had to contain at least one variable. But the SPARQL 1.1 standard also supports triple patterns with no variables, like in SELECT * WHERE { wd:Q42 wdt:P31 wd:Q5 ... }. The semantics is that if the triple exists in the dataset, the triple pattern acts as the neutral element (that is, as if it weren't there), and if it does not exist in the dataset, it acts as the zero element (that is, the result of the whole graph pattern will be empty). This is now implemented, here is an example query: https://qlever.cs.uni-freiburg.de/wikidata/TkjahB . In particular, this fixes #835.

As part of this fix, the code is refactored and simplified significantly, in particular:

  1. The ScanSpecification class, which so far was used only in the index classes, now has a sibling ScanSpecificationAsTripleComponent, which is now also used in the class for the IndexScan operation.

  2. Remove significant amounts of redundant code from the time, when index scans with one variable were executed (and cached) at query planning time. Remove the associated special case (used in testing), of an index scan without query execution context.

Let's feed this to the tools, and then implement the missing unit tests.
Copy link

codecov bot commented Jul 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.67%. Comparing base (3a6a791) to head (a705799).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1395      +/-   ##
==========================================
+ Coverage   89.64%   89.67%   +0.02%     
==========================================
  Files         343      345       +2     
  Lines       29948    29942       -6     
  Branches     3314     3305       -9     
==========================================
+ Hits        26848    26851       +3     
+ Misses       1957     1949       -8     
+ Partials     1143     1142       -1     

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

@hannahbast hannahbast changed the title Support triples with three variables. Support triples without any variable Aug 1, 2024
# Conflicts:
#	src/engine/CMakeLists.txt
Copy link
Member

@hannahbast hannahbast left a comment

Choose a reason for hiding this comment

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

Thorough 1-1 with Johannes, various smaller changes as discussed

Copy link
Member

@hannahbast hannahbast left a comment

Choose a reason for hiding this comment

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

Second round, a very minor change left.

Copy link
Member

@hannahbast hannahbast left a comment

Choose a reason for hiding this comment

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

Awesome!

Copy link
Member

@hannahbast hannahbast left a comment

Choose a reason for hiding this comment

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

Indeed!

@hannahbast hannahbast changed the title Support triples without any variable Support triples with zero variables Aug 3, 2024
@hannahbast hannahbast changed the title Support triples with zero variables Support triple patterns with zero variables Aug 3, 2024
@hannahbast hannahbast merged commit 0b9d26f into ad-freiburg:master Aug 3, 2024
17 checks passed
Copy link

sonarcloud bot commented Aug 3, 2024

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.

Exception: Triples should have at least one variable.
2 participants