matej_suchanek added a comment.

  It's clear now the question is not //whether// but //how//.
  
  The major problem is the backwards compatibility. @Lokal_Profil proposes 
splitting `pywikibot.Claim` since
  
  > pywikibot.Claim here is a mixture of Claim (value +Qualifiers) and 
Statement (Claim+References).
  
  and refers to my citation of documentation in T76615#3464801 
<https://phabricator.wikimedia.org/T76615#3464801>. However, it isn't accurate:
  
  - per https://www.mediawiki.org/wiki/Wikibase/DataModel/JSON: 
//(Historically, there was a distinction between Claims, which had only a main 
snak and qualifiers, and Statements, which also had references. Traces of this 
distinction may still be found in the serialization or in outdated 
documentation.)//
  - even the official PHP implementation 
<https://github.com/wmde/WikibaseDataModel/blob/master/src/Statement/Statement.php>
 mixes qualifiers and references in a single class (called Statement)
  - 
https://www.mediawiki.org/wiki/Wikibase/DataModel#Overview_of_the_data_model 
does not type the word //claim// in bold unlike **Statement[s]** (ie. "claim" 
is not a real part of the model)
  - SPARQL endpoint (RDF export) doesn't distinguish this either
  
  So I believe this splitting would be conter-productive.
  
  Another incompatibility of class API is the change from 
`pywikibot.Claim(repo, 'P123', isQualifier=True)` to `pywikibot.Qualifier(repo, 
'P123')` or similar. There are three possibilities:
  
  1. renaming `Claim` to `Statement` and making `pywikibot.Claim` a deprecated 
factory function
  2. same as 1 but `Claim` is not deprecated for calls with neither 
`isQualifier` nor `isReference` and eventually becomes an alias of `Statement`
  3. implementing `Claim.__new__` (will return `Qualifier` for 
`isQualifier=True` and `Reference` for `isReference=True`, otherwise just 
`Claim`)
  
  The problem with the first two is that the class `Claim` also holds public 
instance methods (most notably `Claim.fromJSON`). I've never implemented 
Python's `__new__` metamethods but I hope it works the way I mean.

TASK DETAIL
  https://phabricator.wikimedia.org/T186200

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: matej_suchanek
Cc: SilentSpike, David_Haskiya_WMSE, Phaebz, Dvorapa, Lokal_Profil, Aklapper, 
matej_suchanek, pywikibot-bugs-list, Zkhalido, Viztor, Wenyi, Tbscho, MayS, 
Framawiki, Mdupont, JJMC89, Altostratus, Avicennasis, mys_721tx, jayvdb, 
Ricordisamoa, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to