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

Rewrite local vocab entries and blank nodes for DeltaTriples #1580

Merged
merged 9 commits into from
Oct 25, 2024

Conversation

joka921
Copy link
Member

@joka921 joka921 commented Oct 24, 2024

Each DeltaTriples object has exactly one local vocab and one blank node manager. When inserted triples contain local vocab IDs or blank node IDs, these are rewritten for that local vocab and blank node manager. Different local vocab entries referring to the same string are rewritten to the same new local vocab ID. Similarly, different occurrences of the same blank node are rewritten to the same new blank node ID. The rewriting also ensures that local vocab entries or blank nodes that were created merely during the evaluation of the WHERE clause of an insert operation, but do not end up in one of the resulting triples, do not become part of the local vocab or blank nodes of the DeltaTriples object.

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.04%. Comparing base (2ccfb50) to head (f44ee5a).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1580   +/-   ##
=======================================
  Coverage   89.04%   89.04%           
=======================================
  Files         368      368           
  Lines       33972    34018   +46     
  Branches     3839     3846    +7     
=======================================
+ Hits        30249    30293   +44     
- Misses       2471     2472    +1     
- Partials     1252     1253    +1     

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

Signed-off-by: Johannes Kalmbach <[email protected]>
Signed-off-by: Johannes Kalmbach <[email protected]>
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.

1-1 with Johannes, this looks great.

I will revise the comments and test it, then let's see

@hannahbast hannahbast changed the title Correctly handle the local vocab in the DeltaTriples Rewrite local vocab entries and blank nodes for DeltaTriples Oct 24, 2024
@sparql-conformance
Copy link

Copy link

sonarcloud bot commented Oct 24, 2024

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.

Looks great now from my side

@Qup42
Copy link
Member

Qup42 commented Oct 25, 2024

To evaluate the triple set for an update it is sufficient to calculate this in the ID space. I also stumbled upon this problem. I have one question about the behaviour of the PR:

  • Triples with IDs from a LocalVocab can be inserted into DeltaTriples. The DeltaTriples then takes care of transferring the LocalVocab IDs to its LocalVocab. The only thing the caller has to take of is ensure that the LocalVocab lives long enough. Is that correct?
  • If the result is fully materialized the LocalVocab lives as long as the Result. How long are the LocalVocabs valid for Results that are not fully materialized?

@hannahbast hannahbast merged commit f9bac20 into ad-freiburg:master Oct 25, 2024
22 checks passed
@hannahbast
Copy link
Member

hannahbast commented Oct 25, 2024

@Qup42 The idea is to potentially maintain multiple DeltaTripels objects, rereferenced via shared pointers. Whenever new delta triples come in, a copy of the most recent object is created and the triples are added to that object. Each query uses the most recent DeltaTriples object at the time of the query. A DeltaTripels object lives as long as it is referenced by at least one query that is still running (or a cache entry in case we still have those, but no sure about that). A DeltaTriples object is deleted when it is no longer referenced (typical shared pointer semantics). The most recent DeltaTriples object is never deleted.

Does this answer your questions?

@Qup42
Copy link
Member

Qup42 commented Oct 25, 2024

That does clear up the bigger picture of this PR. Johannes and I cleared up the questions in private. The two aspects are relevant to my next PR.

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.

3 participants