Welcome to the Virtual Education Wiki ~ Open Education Wiki
Help:Unions of results
Unions (OR) of result
This page is copied from https://www.semantic-mediawiki.org/wiki/Help:Unions_of_results
Disjunctions are OR-conditions that admit several alternative conditions on query results. A disjunction requires that at least one (but maybe more than one) of the possible alternatives is satisfied (logical OR).
Semantic MediaWiki has two ways of writing disjunctions in queries:
- The operator
OR
is used for taking the union of two queries. - The operator
||
is used for disjunctions in property values, page names and category names.
For example, a query that describes pages of actors in [[Category:Musical actor]]
or [[Category:Theatre actor]]
, or in both of them, can be written as:
[[Category:Musical actor]] OR [[Category:Theatre actor]]
or more concisely,
[[Category:Musical actor||Theatre actor]]
Similarly, a query that describes all pages of people born in Boston or New York can be written using one of these operators:
[[Born in::Boston]] OR [[Born in::New York]]
or again more concisely,
[[Born in::Boston||New York]]
Note that ||
does not always offer an alternative to OR
. For example,
[[Born in::Boston]] OR [[Category:Actor]]
cannot be expressed with ||
.
OR operates on the query, not on a single element of the query. Thus in the following query, which is intended to list actors born in Boston or in New York, the category name needs to be repeated:
[[Category:Actor]] [[Born in::Boston]] OR [[Category:Actor]] [[Born in::New York]]
To combine multiple queries, you can also use https://www.semantic-mediawiki.org/wiki/Extension:Semantic_Compound_Queries