On 22.05.2012 17:12, Bryan Burgers wrote:
What I didn't see in the proposal was a way to get
data multiple levels deep.
Will this be possible?
Not directly. Wikibase/Wikidata doesn't provide nested items. Only item references.
Use case:
Q100 is data about an association football game. Maybe Q100 has
team1-score="3",
team2-score="2", referenced by {{{data.team1-score}}} and
{{{data.team2-score}}}
respectively (or whatever modifications have been made already due to previous
discussion). Great.
ok
Q100 also might have links to the teams: team1=[Q200],
team2=[Q201]. Q200 has
the name of the team: name="Melchester Rovers". Can we get the name of the
team?
{{{data.team1.name <http://data.team1.name>}}}? Some other syntax? Not available?
Not like this. Either, the teams get passed into the templates as separate
items, e.g. as data_team_1 and data_team_2. But that would require the called to
specify the teams explicitly, even though they are already in the item Q100
about the match.
It could be made nicer if the template is allowed to load additional items into
its scope on its own accord, as I discussed in my reply to Nikola earlier:
{{#load-data:{{{data.team1}}}}}
Note that I don't really like the idea, but if we need it to cover real world
use cases, then we can easily do this, I think.
The only difficulty here is to decide what exactly {{{data.team1}}} should
return in case {{{data.team1}}} is an item reference. In the present use case,
it would need to return the item id, while when used "normally" in wikitext, it
would be nice if it would return a wiki link to the corresponding local wiki
page (if that exists). We may then need to somehow indicate that in this
context, we want the actual id, perhaps like this:
{{#load-data:{{{data.team1#id}}}}}
This is not very pretty, though. Maybe it would be cleaner to use something like
this:
{{#load-data:{{#data-value:data.team1|form=raw}}}}
-- daniel
--
Daniel Kinzler, Softwarearchitekt
Wikimedia Deutschland e.V. | Eisenacher Straße 2 | 10777 Berlin
http://wikimedia.de | Tel. (030) 219 158 260
Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e.V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg
unter der Nummer 23855 B. Als gemeinnützig anerkannt durch das Finanzamt
für Körperschaften I Berlin, Steuernummer 27/681/51985.