Single page constraints

From semantic-mediawiki.org
Jump to: navigation, search

This section describes how to directly select some pages, or pages from a given namespace.

Giving that the page title is known (possibly including a namespace prefix), as list separated by ||, the QueryEngine will match pages with those names. An example is the query

[[Brazil||France||User:John Doe]]

which has three results (at least if the pages exist). Note that the result does not display any namespace prefixes; see the hover box or status bar of the browser, or follow the links to determine the namespace. Restricting the set based on an attribute value one could ask, e.g., «Who of Bill Murray, Dan Aykroyd, Harold Ramis and Ernie Hudson is taller than 6ft?». But direct selection of articles is most useful if further properties of those articles are asked for, e.g. to simply print the height of Bill Murray.

To select a category in this way, a : must be put before the category name. This avoids confusing [[Category:Actor]] (return all actors) and [[:Category:Actor]] (return the category «Actor»).

Starting with Semantic MediaWiki 2.4.0 it is possible to use the like "~" and not like "!~" comparators to describe single pages.1 An example is the following query

[[~John*]]

which would return all pages starting with "John" like, e. g. "John Doe", "John Lackland", etc. See <sandbox.semantic-mediawiki.org> for a live example.

References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:1246