hoo added a comment.

So I looked into this a bit, to evaluate what is currently done.

I was able to find the following variants of such a transitive lookup:

  1. dewiki-version: function p.isSubclass(frame)
  2. frwiki-versions (1, 2): function p.isSubclass(class, item, maxdepth)/function p.isInstance(targetclass, item, maxdepth) (definitions are the same in both modules, I suppose one is deprecated?)
  3. dewikivoyage-version: function fw.typeSearch( p31, list, limit )

While the dewikivoyage-version is only used on dewikivoyage, all the other scripts are used on several wikis.

In depth look:

dewiki-version (1)

See @thiemowmde's comment (T179155#3715222).

I checked (using mwgrep --module '["'"']maxDepth") that this is never used with a maxDepth other than 5.

frwiki-version (2)

The two modules have very similar definitions (see above). Module:Wikidata/Analyse transitive is no longer used on frwiki, but might be used on other wikis still. Given that both implement these functions in a very similar way, I don't think that needs further checking.
isSubclass checks whether a given item is a(n) (in)direct subclass of a given class by walking up the "subclass of" tree until a given maxdepth.
isInstance checks whether a given item is a(n) (in)direct instance of a given class. If the given item is no direct instance of this class, isSubclass is invoked with all the instance of values found on the item.

One notable thing here is that AFAICT the full list of parents is always materialized, if isSubclass is invoked. This is done until either the maxdepth limit, or a maxnodes limit (which is 100 in all cases I could find) are reached. In case a limit is hit, the result is quietly returned and the subclass relationship is decided based on this (possibly incomplete) data.

isSubclass is only used as part of isInstance, it has no direct usages (on any wiki). I checked this by running: mwgrep --module "\.isSubclass\([^\)]*,[^\)]*,[^\)]*\)".
isInstance is used in several places. I found usages with a maxdepth of 0, 1, 2 and 3 (checked on frwiki only).

dewikivoyage-version (3)

The function in question is used to map an entity's instance of values to a "POIType". To do this, each of the "instance of" values of an entity is taken, and then checked against the POI-types list. This is repeated with all super-classes of the "instance of" values (up to 4 levels high). This is immediately aborted when a POI-types is found. (Used in Modul:VCard; Modul:Marker, checked with mwgrep --module "typeSearch\(")


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

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

To: hoo
Cc: thiemowmde, Lydia_Pintscher, daniel, Aklapper, aude, Ricordisamoa, Liuxinyu970226, hoo, Lahi, Gq86, GoranSMilovanovic, Soteriaspace, Jayprakash12345, JakeTheDeveloper, QZanden, LawExplorer, Wikidata-bugs, TheDJ, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to