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

Make statements always have valid ids #447

Closed
Tpt opened this issue Oct 3, 2019 · 3 comments
Closed

Make statements always have valid ids #447

Tpt opened this issue Oct 3, 2019 · 3 comments

Comments

@Tpt
Copy link
Collaborator

Tpt commented Oct 3, 2019

Currently Statements are allowed to use the "" statement id to tag the statement as new. Then, when editing, the wikibaseapi module is generating a new valid id and, if a conversion to RDF happens, the RDF converter should do the same.

It might make sense to make the Statement constructors to generate a new valid id if no id is provided.

@wetneb Do you think it make sense? Would it create problems on the API wrapper side to distinguish new statements from edited ones?

Related issue: #166

@Tpt Tpt changed the title Makes statement always have valid ids Make statements always have valid ids Oct 3, 2019
@wetneb
Copy link
Member

wetneb commented Oct 3, 2019

There are a few things to watch out for I think. Here are two (not pretending this is exhaustive):

  • If you allocate a new id in the Statement constructor, then you need to call a random number generator there, so the same generator call will not generate equal statements. This breaks the determinism of the data model implementation which might have unforeseen consequences at various places in the code. It is also harder to mock this random generation in tests.

  • Yes, as you point out, there could be issues with not being able to reproduce the semantics of the current empty ID field to represent new statements.

But perhaps none of these are actually blocking and the change is doable. I'll keep thinking about it.

@robertvazan
Copy link
Collaborator

@Tpt Can this be closed with conclusion that there are valid use cases for empty statement ID?

@Tpt
Copy link
Collaborator Author

Tpt commented Aug 25, 2021

Yes, indeed.

@Tpt Tpt closed this as completed Aug 25, 2021
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

No branches or pull requests

3 participants