| hoo added a comment. |
Given what I saw, I suggest the following interfaces:
- mw.wikibase.isInHierarchy( fromId, toId, propertyId ) -> bool or nil (returns nil in case the maximum recursion depth or some other limit was exhausted)
Say we want to find out whether "Kreuzberg" (Q308928) is a "administrative territorial entity" (Q56061). For this, we fetch the "instance of" value from "Kreuzberg" (Q308928) which is " locality of Berlin" (Q35034452). With that we can mw.wikibase.isInHierarchy( 'Q35034452', 'Q56061', 'P279' ) -> true. This function could optionally allow restricting/ changing the access/ recursion limits further via additional (optional) parameters.
- mw.wikibase.getClosestInHierarchy( fromId, toIds, propertyId ) -> string or false or nil (returns false if no entity from toIds could be found; nil in case the maximum recursion depth or some other limit was exhausted)
Finds the closest entity from toIds that is linked to fromId via a propertyId chain. With the example above: mw.wikibase.isInHierarchy( 'Q35034452', {'Q56061', 'Q12345'}, 'P279' ) -> 'Q56061'.
Both of these would need to be at least marked as expensive, if not also specifically restricted further (like the number of entities a single user can access). Also we need to find sane default limits… for that we probably better start low so that we can increase the numbers later on.
TASK DETAIL
EMAIL PREFERENCES
To: hoo
Cc: Lucas_Werkmeister_WMDE, thiemowmde, Lydia_Pintscher, daniel, Aklapper, aude, Ricordisamoa, Liuxinyu970226, hoo, Lahi, Gq86, GoranSMilovanovic, lisong, QZanden, LawExplorer, Wikidata-bugs, Mbch331
Cc: Lucas_Werkmeister_WMDE, thiemowmde, Lydia_Pintscher, daniel, Aklapper, aude, Ricordisamoa, Liuxinyu970226, hoo, Lahi, Gq86, GoranSMilovanovic, lisong, QZanden, LawExplorer, Wikidata-bugs, Mbch331
_______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
