User:M.mendel/Wikibase

What is a Wikibase?
A wikibase is an object-oriented database implemented on top of the wiki using wiki template code to acess it.

Once the decision was made to remove the Skillbox calls from the skill articles and store them separately, in effect a database was created. Only no-one saw it that way, so it doesn't work as well as it could.

Each skill article in Template: namespace is a database entry. Its article name is its identifier and single key; and the fields it calls Skill Box with are its attributes - the data, if you will.

Even now, there are two ways to retrieve this data:

Technique 1: Parse the Template Source
We can grab the content of the template with msgnw: and parse it using #pos:, #replace: or #explode:, e.g.  {#explode: |=|1}}  will retrieve the value  of the field Profession from the skill Abaddon's Chosen. It does that by determining the position of the field within the template with #pos:, discarding everything before it with #sub: and cutting out first the bit between the pipes and then the piece after the = with #explode:. The value of this field should be Monster: it is . Cost: Pre-expand include size: 1027/2097152 bytes, Post-expand include size: 1228/2097152 bytes, Template argument size: 0/2097152 bytes.

Technique 2: Use a "Get Field" Template
We can call the skill directly, using a custom skill box that only returns the needed field: should be Monster: it is . Pre-expand include size: 417/2097152 bytes, Post-expand include size: 32/2097152 bytes, Template argument size: 21/2097152 bytes. Clearly, as of now, method 2 is superior: it is more readable and uses less system resources. The drawback is that for each field that is to be returned, a custom "Skill box Get field" template has to be created.

It is certainly difficult to redesign the present skill system; with over 500 skills such a move requires considerable planning and effort, and it may not be worth it. However, if the beastinfo or other database-like information structures should move to a more data-base like system, and of course for the Guild Wars 2 wiki the following improvements should be considered.

Suggestion 1: Dollar format
If the above methode 1 is to be used (parsing the template itself with string functions), then it would help if the data was more parseable. The above skill, now stored as could be stored as $name$Abaddon's Chosen $type$Enchantment Spell $profession$Monster $campaign$Nightfall $activation$¾ $recharge$90 $description$Target cannot lose Health for 10 seconds. $concise_description$(10 seconds.) Target cannot lose Health. or similar. The advantage is that msgnw: need not be used to access the data.

It is still possible to fill fields with the data and call a template with that, as User:M.mendel/Templates/merge_PvPvE demonstrates. It takes as first parameter a template to call, and as a second parameter a skill dataset in the above $format$. This can be generated from the present skill data by calling. It invokes the Skill box data template that checks for all fields that could possibly occur in a skill object and wraps them in $. (I made this to extract data from a PvP skill and its PvE counterpart and feed both to my dual skill box.)

Suggestion 2: Template call-through
The beginning of Abaddon's Chosen is {{Skill box {{{1|}}} Therefore, it can only ever call a Skill box. If it began {{ {{{1|Skill box}}} | {{{2|}}} | {{{3|}}} | {{{4|}}} then it would be much more flexible. The call {{Template|Abbadon's Chosen}} works the same in both versions, and a call that is presently {{Abaddon's Chosen|qr}} would be converted to {{Abaddon's Chosen|Skill box qr}}. The gain in flexibility is that it would be possible to have Abbadon's Chosen call any other template - even in User: space - and pass along three unnamed parameters as well.

What's more, a Template:Get can be written that retrieves any parameter: {{{ {{{1}}} }}} is enough to do so. Observe: {{ Get | campaign | | | | nocats = yes | name = Abaddon's Chosen | campaign = Nightfall | profession = Monster }} gives {{:User:M.mendel/Templates/Get | campaign | | | | nocats = yes | name = Abaddon's Chosen | campaign = Nightfall | profession = Monster }} Neat, huh? This means that we don't need a template for every single field we want to access, thanks to the pass-through parameters.

It is also easy to call templates that work on the fields in the template, for example to compute a score for a skill or to autocategorize it. The possibilities are endless.