Page MenuHomePhabricator

PropertyPage object doesn't support access to or modification of a property's claims
Closed, ResolvedPublic

Description

Use case: I want to find properties that have an 'inverse of' statement and then create reverse relations for object-items. This is so the item of an author can automatically get a list of author of works, if works have the item listed as author.

(This is for my institution's wikibase instance.)

pywikibot's PropertyPage object does not have a claims property like the ItemPage has, though properties can have claims as well. Even calling the toJSON method does not return any info about claims for a property.

Details

Related Changes in Gerrit:

Event Timeline

despens raised the priority of this task from to Needs Triage.
despens updated the task description. (Show Details)
despens added a project: Pywikibot.
despens subscribed.
Restricted Application added subscribers: Aklapper, Unknown Object (MLST). · View Herald TranscriptMar 13 2015, 8:49 PM

Change 219244 had a related patch set uploaded (by John Vandenberg):
Add support for adding/removing statements in PropertyPage

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

So, property claims can have references/sources.

That means that the only ItemPage-specific data is sitelinks. They dont appears to be valid for properties. But perhaps we should check if the Wikibase team intend to add sitelinks/badges to Properties?

So, property claims can have references/sources.

That means that the only ItemPage-specific data is sitelinks. They dont appears to be valid for properties. But perhaps we should check if the Wikibase team intend to add sitelinks/badges to Properties?

Maybe we should split attributes and methods into WikibasePageWithLabels, WikibasePageWithSitelinks, WikibasePageWithClaims, etc., then make ItemPage and PropertyPage subclass them accordingly.

So, property claims can have references/sources.

That means that the only ItemPage-specific data is sitelinks. They dont appears to be valid for properties. But perhaps we should check if the Wikibase team intend to add sitelinks/badges to Properties?

Maybe we should split attributes and methods into WikibasePageWithLabels, WikibasePageWithSitelinks, WikibasePageWithClaims, etc., then make ItemPage and PropertyPage subclass them accordingly.

WikibasePageWithLabels doesnt seem to be different from WikibasePage. In the data model, it appears that all entities implement labels, aliases and descriptions.
https://github.com/wmde/WikibaseDataModel/blob/master/src/Entity/Entity.php
However I can see some value in separating the implementation of 'labels, aliases and descriptions' from the entity.

..WithClaims maps to the data models StatementListHolder, and ..WithSitelinks maps to the data model SiteLinkList, so there is a sound basis to create separate classes for each of those.

A much cheaper approach is for WikibasePage to provide (perhaps limited) support for whatever keys appear in the JSON, and subclasses provide any special properties that are needed. WikibasePage.editEntity probably already does support writing for 'Property' entities; we just need to add more flexibility to other parts of WikibasePage. That will buy us some time so a better model can be created in T102741, where Page concepts are not mixed up in the data model.

Ricordisamoa renamed this task from PropertyPage object doesn't support acess to or modification of a property's claims to PropertyPage object doesn't support access to or modification of a property's claims.Jul 1 2015, 2:47 AM
Ricordisamoa assigned this task to Ladsgroup.
Ricordisamoa triaged this task as High priority.

Change 219244 had a related patch set uploaded (by Ladsgroup):
Add support for statements in PropertyPage

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

Change 219244 merged by jenkins-bot:
Add support for statements in PropertyPage

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

addClaim and removeClaims methods are still missing from PropertyPage.

Ricordisamoa lowered the priority of this task from High to Medium.Jul 15 2015, 8:06 AM

addClaim and removeClaims methods are still missing from PropertyPage.

The problem has been resolved. If you wish to add extra ways to modify the items, propose a patch.

addClaim and removeClaims methods are still missing from PropertyPage.

The problem has been resolved. If you wish to add extra ways to modify the items, propose a patch.

Err, half-resolved. Of course PropertyPage should now support all of ItemPage's methods dealing with claims.

We talked about this in gerrit and we agreed on not moving addClaim and removeClaims. Even though I'm not a big fan of this approach (T107712) but since we have T113131 already. I think it's safe to close this task.

addClaim and removeClaims are *NOT* deprecated.