User:Dr ishmael/SMW test plan

From Guild Wars 2 Wiki
Jump to navigationJump to search

This page aims to document a test plan for the Semantic MediaWiki (SMW) extension, as requested by User:Stephane Lo Presti to assist the ArenaNet tech team. I am placing it on the wiki for ease of access to all parties, and to allow any interested GW2W users to provide additional input.

Properties[edit]

Primary article: smw:Help:Properties and types

The most basic feature of SMW is the ability to store data on a page in properties. Each property has a type that defines the kind of data stored in that property.

  • Properties are annotated in the format [[<property name>::<value>]], with the resulting display of <value> on the page.
  • Annotations can be piped the same way as internal wiki links, e.g. [[Located in::Germany|Deutschland]] will display Deutschland while storing the value Germany.
  • Silent annotations (i.e. with no displayed output) can be achieved by using the #set parser function. This function takes input parameters in the form of <property>=<value>, e.g. {{#set: Located in = Germany | population = 1,234,567 }}.
  • A property is defined by a page in the Property: namespace. This page should denote the property's type and document the property's usage within the wiki. This page will also display a list of all pages that use this property, along with the values set on those pages (similar to category pages automatically listing all pages in the category).

General test procedure for properties:

  1. Create properties of various supported datatypes.
  2. Create a page or pages containing annotations that store appropriate values in these properties.
  3. The page-value pairs should be displayed on each property's page.
  4. Edit a page to change the value stored in a property.
  5. Check that the value updated correctly on the property's page.

Enumerations[edit]

Primary article: smw:Help:Special property Allows value

Properties can be limited to only accept certain input values by using the special property Allows value on the property's definition page. For example, traits in GW2 can be one of two types and can be in one of three tiers. To annotate those facts, we would use a pair of enumerated properties:

Property
Has trait type
[[Allows value::Major]]
[[Allows value::Minor]]
Property
Has trait tier
[[Allows value::Adept]]
[[Allows value::Master]]
[[Allows value::Grandmaster]]

This will cause a warning to be displayed when a user attempts to enter an unrecognized value for these properties, and SMW will not store the value. Instead, the special property Has improper value for will be set for that page, linking to the property.

Test procedure:

  1. Create an empty article at Property:Has improper value for (this is to make it easier to access the page without going through a redlink).
  2. On a property's definition page, set one or more Allows value annotations.
  3. On an article, annotate this property with values from the allowed list. These should be stored as normal.
  4. Attempt to store a non-allowed value in this property.
  5. The value should not be stored and not displayed on the property's page.
  6. The page should be listed on Property:Has improper value for.

Displaying information[edit]

Primary article: smw:Help:Selecting pages
Primary article: smw:Help:Inline queries

Data stored in properties can be queried and displayed on other pages by using the #ask and #show parser functions. The data can also be queried through a form interface on Special:Ask.

#show[edit]

The #show function is the simpler of the two, as it simply displays the value of a single property from a single page. This example would display the value of the population property from the "Berlin" page.

{{#show: Berlin | ?population }}

Test procedure for #show:

  1. Use the #show parser function to display the value of a property from a page created for the properties testing above.

#ask[edit]

The #ask function is more complex. It takes multiple input criteria in order to select a list of pages, then displays the values of the requested properties from those pages in a specified format. The selection criteria can reference both categories and properties and can use most common comparison operators. This example would display the population and area of cities in Germany in a (default) table format:

{{#ask: [[Category:City]] [[located in::Germany]] 
| ?population 
| ?area#km² = Size in km²
}}

Test procedure for #ask:

  1. Create a set of related pages that all store data in a few common properties.
    • In the context of this wiki, a useful and fairly simple set to use would be the trait pages for a profession, e.g. [[:Category:Warrior traits]]. Using Special:Export with the "Include templates" option checked will let you copy all the relevant content to your test wiki quickly, except for images and CSS.
  2. Modify Template:Trait infobox with automatic annotations; code provided below.
  3. Create pages for the properties being used so they will parse as the proper datatypes.
  4. On the pages for the trait lines (Strength, Arms, Defense, Tactics, Discipline) add the following annotation: [[For profession::Warrior]]
  5. Create a page to run various #ask queries on this set of pages.
    • The property chain [[In trait line::For profession::Warrior]] is the base criteria to include all 75 trait pages in the query. (Using [[Category:Warrior traits]] would also include the 5 trait line pages.)

See below for testing specific #Output formats.

Properties used
Property Type
Has canonical name String
In trait line Page
For profession Page
Has trait tier String
Has trait type String
Has trait number Number
Is historical Boolean

Special pages[edit]

Primary article: smw:Help:Browsing interfaces

Special:Ask[edit]

This special page is a form-based interface to the #ask function. The selection criteria go in the left box, and the list of properties to display goes in the right, with additional options configurable in the controls below. Editors can use this page to create and fine-tune queries for use on wiki articles (via the "Show embed code" link near the submit button) or simply to run ad-hoc queries.

Example of a Special:Ask query on GuildWiki. This query lists all rare crafting materials that were collected by Nicholas the Traveler in Factions campaign locations, sorted by date.

Test procedure will be similar to that for ##ask. Having query options set up as form inputs will probably make it easier to test them thoroughly using this interface.

Special:Browse[edit]

This special page provides a view of the semantic data stored in articles on the wiki. Entering an article name will display the semantic data for that article, showing both the properties defined on that page (outgoing properties) as well as properties on other articles that have that page as the value (incoming properties).

  • Properties of type page will show an "eye" icon next to each value that links to the Special:Browse output for the linked page.
  • All other property types will show magnifying glass icon next to each value that links to the Special:SearchByProperty output for that property/category and value.
    • Categories will erroneously show this icon, but unless you have a property with the same name as the category, SearchByProperty will not be able to display any output.

Example Special:Browse page on GuildWiki.

Test procedure:

  1. Enter the name of an article with semantic data.
    • Continuing to use the warrior trait pages from above, you could start with a trait like Deep Cuts
  2. Click on eye icons to browse data for other pages.
    • Deep Cuts should have the value Arms for the property In trait line, so clicking the icon there will show the semantic data for the Arms article.
    • From there, you should see all 15 Arms traits listed as linking to that page.
  3. Click on magnifying glass icons to search property values.
    • For any trait, you could search on their value for Has trait tier or Has trait type to get a list of all other e.g. Major or Adept traits.
  4. Edit the article you are browsing data for and change the value of a property, or add/remove properties, to verify these changes are reflected on Special:Browse.
    • For the traits, this is accomplished through changing the inputs to the infobox template, since all annotations are performed by the template.

Special:SearchByProperty[edit]

This special page provides a means of searching the wiki's semantic data to final pages that have a certain value for a property.

Example of Special:SearchByProperty at GuildWiki, showing all pages for items collected by Nick that he requested 3 of the item.

Test procedure:

  1. Select a property and value in use by your set of test pages.
    • Example: Has trait number and 7.
  2. Enter them in the search form and verify that the results include all pages with that value.
    • Assuming the set of 75 warrior trait pages, searching for Has trait number and 7 should return 5 results, the number VII traits from each trait line.

Special:Properties[edit]

This page lists all properties that are in use on the wiki, along with their type and a count of how many pages on the wiki use that property. A property can be in use without having a definition page in the Property: namespace.

Test procedure:

  1. Implicitly create a new property by annotating a value for it on an article. Verify that it appears on Special:Properties.
  2. Check that they property types on Special:Properties match the types defined on each property's definition page.
  3. Check that the usage counts match the actual usage.
    • For the warrior traits data, the Has trait tier/type/number properties should each be used 75 times, once on each of the 75 trait pages. For profession should be used 5 times, on the 5 trait line pages.

Special:WantedProperties[edit]

This page lists any properties used in the wiki that do not have a definition page in the Property: namespace.

Test procedure:

  1. Implicitly create a new property by annotating a value for it on an article. Verify that it appears on Special:WantedProperties.
  2. Create a definition page for the property and verify that it no longer appears on Special:WantedProperties.

Special:UnusedProperties[edit]

This page lists any properties defined in the Property: namespace that are not used by any articles in the wiki.

Test procedure:

  1. Create a new property by creating a definition page for it. Verify that it appears on Special:UnusedProperties.
  2. Add an annotation for the property to an article and verify that it no longer appears on Special:UnusedProperties.


Output formats[edit]

Primary article: smw:Help:Result formats


Types[edit]

Most data types won't be used much, if at all, on this wiki. (We should never need the telephone number or temperature types, for example.)

Page[edit]

Primary article: smw:Help:Type Page

Page properties expect their input values to be names of articles in the wiki. This will be the most used type by far.

GW2W examples:

  • Is in trait line for traits.
  • Is for race for racial skills.
  • Has skill type for skills.
  • Requires ingredient for recipes.
  • Preceded by/Followed by for personal story chapters and events.
  • Is part of meta event for events.

When a page property is output by a query, the values are automatically interpreted as article titles and formatted as internal wiki-links. If there is no page with that title, the link will be a standard MediaWiki "red link." This can be suppressed for the entire query output by supplying the option | link = none or for properties printouts only (retaining links in the main result column) with | link = subject. This is especially useful when using a #show query to obtain a specific value, then using that value as part of the criteria for an #ask query.

String / Text[edit]

Primary article: smw:Help:Type String
Primary article: smw:Help:Type Text

String and text properties can store any arbitrary sequence of characters. The difference is that string values are limited to a length of 255 and can be queried by value, where text values have no length limit but cannot be queried by value. Both types can contain wiki and HTML markup.

GW2W examples:

  • Has canonical name (string) for any page with a disambiguation suffix, to store the actual name of the game asset. (e.g. Impale (warrior sword skill) would have [[Has canonical name::Impale]])
  • Has game description (text) for skills, traits, and items, to store the prose description of the asset.

When a string or text property is output by a query, the raw stored value is inserted into the wikitext output by SMW, and any wiki-code or HTML code contained in the value is fully parsed by the MediaWiki engine.

Boolean[edit]

Primary article: smw:Help:Type Boolean

Boolean properties store a binary value. Several equivalent input formats are recognized: true/false, 1/0, yes/no, t/f, and y/n.

GW2W examples:

  • Is historical to indicate whether a page documents historical game content.
  • Can break stun on skills to document the "Breaks stun" skill fact.

When a boolean property is output by a query, the values are displayed as true or false by default. These strings can be changed by modifiers in the query. The following will instead display success or failure as the values:

{{#ask: [[Category:Project]]
| ?successful#success,failure
}}

Number[edit]

Primary article: smw:Help:Type Number

Number properties only accept input values consisting of the digits 0-9 with optional thousand separators and a decimal point. The punctuation is dependent on the wiki's configured language, which would be English here, resulting in the comma , for thousands and the period . for the decimal point.

GW2W examples:

  • Requires discipline level on recipes and crafting materials.
  • Has recharge time, Has initiative cost, Has skill point cost on skills.
  • Has recommended level for personal story chapters, events, areas, etc.

When a number property is output by a query, thousand separators are automatically inserted. This behavior can be suppressed by appending a # to the property name in the query:

{{#show: Berlin | ?population# }}

Subobjects[edit]

Primary article: smw:Help:Adding subobjects


Configuration[edit]

Primary article: smw:Help:Configuration

Factbox[edit]

The factbox is a table shown at the bottom of an article page that list all semantic data recorded in that article. By default, factboxes are hidden when viewing articles and are shown when editing articles if the article has semantic data. This behavior is configured through the variables $smwgShowFactbox and $smwgShowFactboxEdit, respectively.

Possible values:

  • SMW_FACTBOX_HIDDEN - always hide factboxes (default for $smwgShowFactbox)
  • SMW_FACTBOX_NONEMPTY - show factbox if the article has semantic data (default for $smwgShowFactboxEdit)
  • SMW_FACTBOX_SPECIAL - show factbox if special properties are set (I'm not certainwhat this means)
  • SMW_FACTBOX_SHOWN - always show factboxes (noted as being buggy and not recommended)