-
Notifications
You must be signed in to change notification settings - Fork 19
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
Introduce StatementGroup #507
base: master
Are you sure you want to change the base?
Conversation
I'm not seeing the value in indexing the things in the group by rank. We do not currently need that or benefit from having it, so YAGNI. That the UI will use some kind of grouping is not all that relevant here. Especially if you consider that there is a layer between the UI and the PHP: the DataModel serialization. |
The issue is that we will encounter the same indexing issue we currently have with Also, this indexing makes it easier to find the best statements of a StatementGroup etc. I think it is logical and intuitive to do such indexing because we have lots of relevant usecases for it. |
How about first doing the refactoring that introduces The need for the rank stuff is not clear to me. Which does not mean it is not there. It does mean that before I can +2 this, I need to look into that more. So if the part without the rank stuff is done first, we can already move forwards with that. |
class StatementGroup implements PropertyIdProvider { | ||
|
||
/** | ||
* @var Statement[][] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most IDEs don't understand type hints with [][]
. I prefer array[]
.
This draft is incomplete. Currently there is no way to access the statements. I think having such methods in the proposal is crucial to understand it's practical impact. In general, I wonder what the benefit over |
@thiemowmde let's talk about this when I'm at the office next week, ok? I just had this idea but didn't complete it because of time but still wanted to upload the things I started. It's basically a step to fix https://phabricator.wikimedia.org/T99243 |
Sure. My comment was more a note to myself and to let others know what I think. Not meant to be a voting of any kind. |
7333df7
to
a672975
Compare
a672975
to
1559058
Compare
Possible follow-ups:
|
I disagree with "the default representation" proposal. This is more a Wikidata specific UI thing and should not be enforced on all implementations that use statements. However, I think this is a welcome addition. Please try to add the proposed StatementGroupList to this or a dependent patch, otherwise this class alone is not really helpful. |
@Benestar do you have any interest in continuing this? I did a quick review of the code and noticed how That does not leave much in @thiemowmde do you remember why you went with creating a StatementListChanger instead of the approach that was already started here? |
This patch here is incomplete. The one essential thing the proposed StatementGroup class does is checking if the statements all have the same property. But this alone is not enough. Further guarantees are needed, e.g. an Item should not contain two groups with the same property. Where is this going to be implemented? In the Item class? In the existing StatementList? In a new StatementGroupList? How would a migration path for any of this look like? Phase out StatementList? If not, where will the new class be used, and how often? How often will flat lists be converted into groups, and back, and how will this affect performance in a real-live production scenario? I checked the code that interacts with StatementLists multiple times over the years, and only very few places work with statements that are grouped by property. Grouping is not always done by property. Sometimes it's done by rank, for example. Most code does not care, and would become unnecessary complex if it could not get a flat list of statements any more, or needs to convert objects first. What I wrote in #507 (comment) as well as wmde/WikibaseDataModelServices#157 still holds. |
I suggest to leave Item as it is. No need for us to deal with migration or the problems you just mentioned. StatementGroup stuff would just be used by code that deals with groups, meaning we just need to be able to go from StatementList to StatementGroup stuff and back, which is easy to do. |
Per #479 (comment)
Missing testsThe reasons for this are that in the UI we already group all Statements by PropertyId and will also group them by rank in future. To support clean indexing, we have to replicate this structure in the DataModel as well.