Many properties related to an item are stored in other items and are presently very hard to access by templates using wikidata. For example:
- taxon items have property parent taxon (P171). If I have an infobox that shows genus, family or order of a given organism I need a way to move up a chain of P171s until some rank is met.
- people items have property place of death (P20) that stores most exact item related to place of death, which could be a house, street, hospital, neighborhood, etc. If I have an infobox that shows place of death of a person I usually need city or town where someone died. A query to look up a city of death of Pyotr Tchaikovsky is SELECT DISTINCT ?city { ?city ^(wdt:P20/wdt:P131*) wd:Q7315; wdt:P31/wdt:P279* wd:Q515 . }. It is very hard to access that information using Lua calls. Similar issue would be for "Country of birth" or "Country of death"
I do not have a specific proposal of how to allow access to such properties. However here are 2 ideas:
- Create infrastructure to allow read-only properties which are not directly editable but precomputed based on some SPARQL query and other properties and items. Users would see and access them in a way similar to current properties. (Inverse properties like P910/P301 can be implemented using this mechanism in the future, where one of the properties would be "read-only")
- Allow Lua to do SPARQL queries. This could be expensive
- Other ideas?
Alternative which is happening as we speak, is to write big ugly Lua codes that are hardwired queries in disguise. They need to load multiple items to show a simple info.