Page MenuHomePhabricator

Edit Form Statements using API
Closed, ResolvedPublic5 Story Points

Description

As an API user I want to be able to edit statements on Forms through wbeditentity in order to quickly add/modify/remove data.

Problem:
Currently editing of statements on Forms is not supported via wbeditentity.

Example:
see P7373

BDD

GIVEN I make a `wbeditentity` API request with the `"claims"` key set within a form's JSON
WHEN I submit the request
THEN the form's statements are modified accordingly

Acceptance criteria:

  • statements are saved persistently
  • edit summary shows up in recent changes/Lexeme history/watchlist

Open questions:
* What parts of it are already working? wbsetclaim works, wbeditentity doesn't work at all.

Technical Notes
In theory, once T201389 is solved, the only thing left to make wbeditentity work, is to add the existing ChangeOpDeserializer for Forms.

Info

Details

Related Gerrit Patches:
mediawiki/extensions/WikibaseLexeme : masterForm statement GUIDs: generate on clone
mediawiki/extensions/WikibaseLexeme : masterEnable form statement editing through wbeditentity
mediawiki/extensions/WikibaseLexeme : masterEnable form statement editing through wbeditentity
mediawiki/extensions/WikibaseLexeme : masterForm statement GUIDs: generate on clone
mediawiki/extensions/WikibaseLexeme : masterForm: do not validate at construction time
mediawiki/extensions/Wikibase : masterDo not validate a new statement's GUID
mediawiki/extensions/WikibaseLexeme : masterEditEntity: form statements not supported

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
CommunityTechBot renamed this task from 3xcaaaaaaa to Edit Form Statements using API.Jul 2 2018, 3:40 PM

What currently happens is that the statements are thrown away when creating a form via wbeditentity. For example, this lexeme was created with the following data (based on L50):

1{
2 "type": "lexeme",
3 "lemmas": {
4 "de": {
5 "language": "de",
6 "value": "Wissen"
7 }
8 },
9 "lexicalCategory": "Q92595",
10 "language": "Q348",
11 "claims": {
12 "P75607": [
13 {
14 "mainsnak": {
15 "snaktype": "value",
16 "property": "P75607",
17 "datavalue": {
18 "value": {
19 "entity-type": "lexeme",
20 "numeric-id": 51,
21 "id": "L51"
22 },
23 "type": "wikibase-entityid"
24 },
25 "datatype": "wikibase-lexeme"
26 },
27 "type": "statement",
28 "rank": "normal"
29 },
30 {
31 "mainsnak": {
32 "snaktype": "value",
33 "property": "P75607",
34 "datavalue": {
35 "value": {
36 "entity-type": "lexeme",
37 "numeric-id": 52,
38 "id": "L52"
39 },
40 "type": "wikibase-entityid"
41 },
42 "datatype": "wikibase-lexeme"
43 },
44 "type": "statement",
45 "rank": "normal"
46 }
47 ],
48 "P82": [
49 {
50 "mainsnak": {
51 "snaktype": "value",
52 "property": "P82",
53 "datavalue": {
54 "value": {
55 "entity-type": "item",
56 "numeric-id": 163015,
57 "id": "Q163015"
58 },
59 "type": "wikibase-entityid"
60 },
61 "datatype": "wikibase-item"
62 },
63 "type": "statement",
64 "rank": "normal"
65 }
66 ],
67 "P75610": [
68 {
69 "mainsnak": {
70 "snaktype": "value",
71 "property": "P75610",
72 "datavalue": {
73 "value": "foo",
74 "type": "string"
75 },
76 "datatype": "string"
77 },
78 "type": "statement",
79 "rank": "normal"
80 }
81 ]
82 },
83 "forms": [
84 {
85 "add": "",
86 "representations": {
87 "de": {
88 "language": "de",
89 "value": "Wissen"
90 }
91 },
92 "grammaticalFeatures": [
93 "Q163012",
94 "Q163014"
95 ],
96 "claims": {
97 "P75609": [
98 {
99 "mainsnak": {
100 "snaktype": "value",
101 "property": "P75609",
102 "datavalue": {
103 "value": {
104 "entity-type": "form",
105 "id": "L53-F1"
106 },
107 "type": "wikibase-entityid"
108 }
109 },
110 "type": "statement",
111 "rank": "normal"
112 }
113 ],
114 "P75608": [
115 {
116 "mainsnak": {
117 "snaktype": "value",
118 "property": "P75608",
119 "datavalue": {
120 "value": {
121 "entity-type": "form",
122 "id": "L54-F1"
123 },
124 "type": "wikibase-entityid"
125 }
126 },
127 "type": "statement",
128 "rank": "normal"
129 }
130 ]
131 }
132 },
133 {
134 "add": "",
135 "representations": {
136 "de": {
137 "language": "de",
138 "value": "Wissens"
139 }
140 },
141 "grammaticalFeatures": [
142 "Q163013",
143 "Q163014"
144 ],
145 "claims": []
146 },
147 {
148 "add": "",
149 "representations": {
150 "de": {
151 "language": "de",
152 "value": "Wissen"
153 }
154 },
155 "grammaticalFeatures": [
156 "Q163014",
157 "Q163016"
158 ],
159 "claims": []
160 },
161 {
162 "add": "",
163 "representations": {
164 "de": {
165 "language": "de",
166 "value": "Wissen"
167 }
168 },
169 "grammaticalFeatures": [
170 "Q163014",
171 "Q163017"
172 ],
173 "claims": []
174 }
175 ]
176}

The first form should have a statement, but doesn’t.

Change 449252 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] EditEntity: form statements not supported

https://gerrit.wikimedia.org/r/449252

Jakob_WMDE updated the task description. (Show Details)Aug 7 2018, 10:00 AM
Jakob_WMDE updated the task description. (Show Details)Aug 7 2018, 10:07 AM
WMDE-leszek set the point value for this task to 5.Aug 7 2018, 12:37 PM

Change 449252 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] EditEntity: form statements not supported

https://gerrit.wikimedia.org/r/449252

KaMan added a subscriber: KaMan.Aug 24 2018, 3:59 PM
Pablo-WMDE updated the task description. (Show Details)Sep 13 2018, 7:42 AM
Pablo-WMDE updated the task description. (Show Details)Sep 13 2018, 8:05 AM

Change 460917 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/WikibaseLexeme@master] Enable form statement editing through wbeditentity

https://gerrit.wikimedia.org/r/460917

Addshore moved this task from incoming to in progress on the Wikidata board.Sep 18 2018, 2:25 PM

Change 461157 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/Wikibase@master] Do not validate a new statement's GUID

https://gerrit.wikimedia.org/r/461157

Change 461630 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] Form: do not validate of construction time

https://gerrit.wikimedia.org/r/461630

Change 461157 abandoned by Jakob:
Do not validate a new statement's GUID

https://gerrit.wikimedia.org/r/461157

Change 463727 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] Form statement GUIDs: generate on clone

https://gerrit.wikimedia.org/r/463727

Change 461630 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Form: do not validate at construction time

https://gerrit.wikimedia.org/r/461630

Change 460917 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Enable form statement editing through wbeditentity

https://gerrit.wikimedia.org/r/460917

Change 463727 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Form statement GUIDs: generate on clone

https://gerrit.wikimedia.org/r/463727

Change 464015 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Jakob):
[mediawiki/extensions/WikibaseLexeme@master] Enable form statement editing through wbeditentity

https://gerrit.wikimedia.org/r/464015

Change 464515 had a related patch set uploaded (by Pablo Grass (WMDE); owner: Pablo Grass (WMDE)):
[mediawiki/extensions/WikibaseLexeme@master] Form statement GUIDs: generate on clone

https://gerrit.wikimedia.org/r/464515

Change 464015 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Enable form statement editing through wbeditentity

https://gerrit.wikimedia.org/r/464015

Change 464515 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Form statement GUIDs: generate on clone

https://gerrit.wikimedia.org/r/464515

WMDE-leszek closed this task as Resolved.Oct 15 2018, 4:24 PM

Tested a few different cases more, seems all to be working well!