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

Own classes for both Literal and Iri #1301

Merged
merged 33 commits into from
Mar 22, 2024

Conversation

joka921
Copy link
Member

@joka921 joka921 commented Mar 11, 2024

So far, literals and IRIs were stored as a std::string (in a normalized way, that is, without escaping) and the distinction between literals and IRIs was made via the first character (" or <). The code to deal with datatypes (the stuff after ^^) and language tags (e.g., @en) was also ad-hoc using low-level string operations. Now there are proper classes Literal and Iri, which internally still store their data as normalized strings starting with " or < (just like before), but they are now two different types and each with a proper interface. This continues work started with #1186.

The new classes are used in the TripleComponent class, which is used by the Turtle and SPARQL parsers. As a consequence, a lot of code is affected by this change. The new classes are not yet used by LocalVocab and ExportQueryExecutionTrees.

Copy link

codecov bot commented Mar 11, 2024

Codecov Report

Attention: Patch coverage is 95.77922% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 88.10%. Comparing base (bb9959a) to head (07eb4f9).

Files Patch % Lines
src/parser/TurtleParser.cpp 91.07% 4 Missing and 1 partial ⚠️
src/parser/Literal.cpp 94.33% 2 Missing and 1 partial ⚠️
src/engine/sparqlExpressions/LiteralExpression.h 85.71% 1 Missing and 1 partial ⚠️
src/index/IndexImpl.cpp 96.29% 0 Missing and 1 partial ⚠️
src/parser/TripleComponent.h 92.85% 0 Missing and 1 partial ⚠️
src/parser/sparqlParser/SparqlQleverVisitor.cpp 94.11% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1301      +/-   ##
==========================================
- Coverage   88.24%   88.10%   -0.15%     
==========================================
  Files         310      313       +3     
  Lines       28432    28503      +71     
  Branches     3148     3155       +7     
==========================================
+ Hits        25091    25112      +21     
- Misses       2188     2235      +47     
- Partials     1153     1156       +3     

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

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.

First pass in 1-1 with Johannes over everything except the tests

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 regardin the last two commits and all the tests, looks great, just some minor changes left

@hannahbast hannahbast marked this pull request as ready for review March 21, 2024 18:40
@hannahbast hannahbast changed the title Use the strong LiteralOrIri type as part of the TripleComponent class. Own classes for Literal and Iri Mar 21, 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.

Almost done, we still need to get rid of the g++13 warning (dangling ...)

@hannahbast hannahbast changed the title Own classes for Literal and Iri Own classes for both Literal and Iri Mar 21, 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.

This is ready to be merged now, thanks a lot for the effort!

@hannahbast hannahbast merged commit 7ad3f58 into ad-freiburg:master Mar 22, 2024
17 of 18 checks passed
Copy link

Quality Gate Passed Quality Gate passed

Issues
12 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@joka921 joka921 deleted the UseLiteralOrIri branch March 22, 2024 07:51
hannahbast pushed a commit that referenced this pull request Mar 23, 2024
Since #1301, triples were the subject is an explicit blank node (for example `_:x <is-a> <blankNode>.`) could no longer be parsed. This commit fixes this bug and adds a unit test for this case.
hannahbast pushed a commit that referenced this pull request May 3, 2024
#1301 introduced a bug where basic graph patterns like `wdt:Q183 ?p ?o` (fixed subject or object with a language tag, variable predicate) throw an exception. This is now fixed again.
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