FANDOM


Semantic MediaWiki is an excellent tool for creating retrievable data across every page. This project page aims to standardise the usage of SMW.

Declaring attributes

Most properties should be defined in infoboxes or other templates. In the few cases where this needs to be done inline, use {{Set}}.

Fetching data

All attribute requests should be done via wrapper templates. These will be watched by an abuse filter that warns and prevents editors from changing dynamic data.

Property pages

  • To discuss:
    1. Uniformity via template? e.g. {{Property|Name=|type=|desc=}}
    2. Limits

Listing data

  • To discuss:
    1. Where to hold data? Project or calculator? Or repurpose "Charm" to "Data"????

All dynamic lists, tables, etc. that function with SMW should be hosted in the <X> namespace.

Cheatsheet

Defining attributes

Code Display Function
[[foo::bar]] bar Defines the property "foo" as bar and creates a link to bar
[[foo::bar|baz]] baz Defines the property "foo" as bar and creates a link to bar on the text "baz"
[[foo::bar| ]] Defines the property "foo" as bar and creates no text
[[foo::baz::bar]] foo::baz::bar Defines both the property "foo" and the property "baz" as bar and creates a link to bar

Links can have an alternate text or be hidden like above.

{{#set:foo=bar|...}} Defines the property "foo" as bar and displays nothing. Multiple properties can be defined this way.

Note: Use {{set}} if defining properties in the content namespaces.

Retrieving attributes with #ask

Code Display Function
[[Category:Foo]] Example Finds all pages that are in category "foo"
?foo Example Shows the property "foo" of all results
limit=X Example Confines the displayed results to limit X
offset=X Example Begins the search at an offset of X
[[foo::bar]] Example Finds all pages that contain a property of "foo" that is equal to "bar"
[[foo::!bar]] Example Finds all pages that contain a property of "foo" that is not equal to "bar"
[[foo::>X]] Example Finds all pages that contain a property of "foo" that is greater than or equal to X
[[foo::>>X]] Example Finds all pages that contain a property of "foo" that is greater than X
[[foo::<X]] Example Finds all pages that contain a property of "foo" that is less than or equal to X
[[foo::<<X]] Example Finds all pages that contain a property of "foo" that is less than X
[[foo::bar||baz]]

[[foo::bar]] OR [[foo::baz]]

Example Finds all pages that contain a property of "foo" that is "bar" or "baz"

Retrieving attributes with #show

Code Display Function
{{#show:Bar|?foo}}

Note: Use {{get|Bar|foo}}

Example Shows the property "foo" of page Bar

See also