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

Add ActionIfExists.MERGE_REFS_OR_APPEND #619

Merged
merged 2 commits into from
Jan 7, 2024
Merged

Conversation

LeMyst
Copy link
Owner

@LeMyst LeMyst commented Sep 7, 2023

Close #607

@LeMyst LeMyst force-pushed the merge-ref-or-append branch 2 times, most recently from 771e42a to 2453483 Compare September 7, 2023 22:34
@LeMyst
Copy link
Owner Author

LeMyst commented Sep 11, 2023

DRAFT...

I'm trying to improve the ActionIfExists enum by using Enum.Flag

Like, you want REPLACE if exist or APPEND otherwise:
action_if_exists= ActionIfExists.REPLACE | ActionIfExists.APPEND

You want to just APPEND new claim to existing property:
action_if_exists= ActionIfExists.APPEND

Same if you just want to REPLACE existing value without doing nothing more:
action_if_exists= ActionIfExists.REPLACE

If you use the word ActionIfExists.KEEP, this do nothing if the property already have claim.

If you want to merge references, you can use the ActionIfExists.MERGE_REFS, in addition with the APPEND and REPLACE
action_if_exists= ActionIfExists.APPEND | ActionIfExists.MERGE_REFS

@dpriskorn
Copy link
Contributor

Very nice work. I just tested it, see dpriskorn/WikidataEurLexScraper#2, and I'm happy :)
LGTM

@LeMyst LeMyst force-pushed the merge-ref-or-append branch from 2453483 to d9fce5f Compare January 7, 2024 09:49
@LeMyst LeMyst merged commit 928f602 into master Jan 7, 2024
8 checks passed
@LeMyst LeMyst deleted the merge-ref-or-append branch January 7, 2024 13:23
@dpriskorn
Copy link
Contributor

Hooray!

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.

ActionIfExistis --> APPEND or ADD REFERENCE
3 participants