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 WikibaseIntegrator #152

Merged
merged 355 commits into from
Jul 14, 2022
Merged

⚡Rewrite WikibaseIntegrator #152

merged 355 commits into from
Jul 14, 2022

Conversation

LeMyst
Copy link
Owner

@LeMyst LeMyst commented May 12, 2021

Will break compatibility 🤷

TODO

  • Rewrite the FastRunContainer
  • Rewrite BaseDataType and Datatypes
  • Re-add the __select_item() who search item in SPARQL DB (replaced by FastRunContainer.get_item())

Rewrite FastRunContainer

  1. Get data for entity
  2. If needed, get data for labels, descriptions and aliases
  3. Compare fastrun data from item data
  4. Return a boolean if write is required or not, stop on first write required

@LeMyst LeMyst marked this pull request as draft May 12, 2021 17:13
@LeMyst LeMyst changed the title Rewrite WikibaseIntegrator ⚡Rewrite WikibaseIntegrator May 12, 2021
@kwisatz
Copy link

kwisatz commented Aug 11, 2021

@LeMyst could you please briefly state what the motivation for the rewrite is?

@LeMyst
Copy link
Owner Author

LeMyst commented Aug 11, 2021

@LeMyst could you please briefly state what the motivation for the rewrite is?

Hello @kwisatz , thank you for your interest in my project.
The main goal of this rewrite is to make WBI easier to maintain and use.

My main issue with the current code is the difficulty to add new functions to the current core, like Lexeme or MediaInfo (#174). Adding the lexeme to the library were the starting point of this rewrite.
This rewrite brings functions that are closer to what Wikibase API offers. (In terms of parameters and property)

I'm not happy with the current code of the rewrite, there is a lot of questions that need to be answered, like default config values, partial update or the fastrun rewrite_write() function.

I'll continue to update and accept PR to ranch v0.11 even after the release of v.12+ (if the rewrite is merged).

I hope to have answered your question.

Best Regards,

Myst~

@dpriskorn
Copy link
Contributor

Is this in a working alpha state now, so I can test it out? :)

@LeMyst
Copy link
Owner Author

LeMyst commented Aug 21, 2021

Is this in a working alpha state now, so I can test it out? :)

The code is working on the git repository but I've currently a blocking issue with the code on my computer (and to much changes to easily find the issue).
I want to release a "0.12.0.dev0" on pip.

@LeMyst
Copy link
Owner Author

LeMyst commented Aug 21, 2021

I broke v0.12
Last good commit is 8539d19

@LeMyst LeMyst linked an issue Aug 22, 2021 that may be closed by this pull request
2 tasks
@dpriskorn
Copy link
Contributor

I'll hold off a little then.
I really love the clear separation you have done and heavy use of hierarchical classes.
It makes it much easier to overview the code.

@LeMyst LeMyst added enhancement New feature or request v0.12.x labels Aug 28, 2021
@LeMyst LeMyst linked an issue Aug 29, 2021 that may be closed by this pull request
@LeMyst LeMyst self-assigned this Aug 29, 2021
matches = pattern.match(entity_id)

if not matches:
raise ValueError("Invalid item ID ({}), format must be 'Q[0-9]+'".format(entity_id))
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice that you state the value it hiccuped on :)

Copy link
Owner Author

Choose a reason for hiding this comment

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

The user can now use 42, '42' and 'Q42' as item id.

LeMyst and others added 27 commits June 15, 2022 10:35
Co-Authored-By: Peter Grond <1938132+pgrond@users.noreply.github.com>
Co-Authored-By: Dennis Priskorn <dennis@priskorn.se>
Co-Authored-By: Dennis Priskorn <dennis@priskorn.se>
Fix #343

Co-Authored-By: Dennis Priskorn <dennis@priskorn.se>
* Replace `APPEND` by `APPEND_OR_REPLACE`
* Replace `REPLACE` by `REPLACE_ALL`

Co-Authored-By: Peter Grond <1938132+pgrond@users.noreply.github.com>
Add folder to .gitignore
* Reintroduce getting the conflicting entity id and the language and test everything.
wbi_exceptions.py:
MWApiError: New attributes code, info, messages, messages_names.
get_conflicting_entity_id(), get_language(): New methods.
test_wbi_exceptions.py: Add TestCase class TestWbiExceptions and move the existing functions into it.
TestWbiExceptions:
test_modification_failed(), test_failed_save(): Add 2 assertions for the new properties.
test_modification_failed_no_dict(), test_modification_failed_no_message(), test_modification_failed_no_parameters(): New tests

* Handle DataValueCorrupt which are missing info key and other information.
wbi_exceptions.py: MWApiError:
get_conflicting_entity_id(), get_language(): Add logic to raise new exception if the information is missing.
DataValueCorrupt: New exception.

* wbi_exceptions.py: MWApiError:
get_conflicting_entity_id(), get_language(): Raise IndexError with the whole error dict.

* wbi_exceptions.py: MWApiError:
get_language(): Raise NonExistentEntityError if not found.

* Optimize properties to return list instead of str

Optimize get_conflicting_entity_id and get_language from wbi_exceptions to return a List of str or None

* Update wbi_exceptions.py

Remove unused attribute

* Update wikibaseintegrator/wbi_exceptions.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Replace "return None" to empty List

* Unused Exception

Removed for the time being.

* Use plural form

Co-Authored-By: Christian Clauss <cclauss@me.com>

Co-authored-by: Myst <1592048+LeMyst@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
@LeMyst LeMyst merged commit 92c9680 into master Jul 14, 2022
@dpriskorn
Copy link
Contributor

Woohoo 🎉 Congratulations!

@LeMyst
Copy link
Owner Author

LeMyst commented Jul 14, 2022

Woohoo 🎉 Congratulations!

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v0.12.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rewrite WikibaseIntegrator Add full support for Lexeme
3 participants