Difference between revisions of "Using"

From Fiamma
Jump to navigationJump to search
Line 15: Line 15:
  
 
=== Searching ===
 
=== Searching ===
 +
 +
==== Page names ====
 +
 +
<pre>
 +
[[Brazil||France||User:John Doe]]
 +
[[~John*]]
 +
</pre>
 +
 +
==== Based on values ====
 +
 
The search page for structured queries is [[Special:Ask]]. More here: https://www.semantic-mediawiki.org/wiki/Help:Semantic_search
 
The search page for structured queries is [[Special:Ask]]. More here: https://www.semantic-mediawiki.org/wiki/Help:Semantic_search
 
Selecting pages: https://www.semantic-mediawiki.org/wiki/Help:Selecting_pages
 
Selecting pages: https://www.semantic-mediawiki.org/wiki/Help:Selecting_pages
Line 23: Line 33:
 
[[height::180cm]]
 
[[height::180cm]]
 
</pre>
 
</pre>
 +
 +
==== Logic ====
 +
 +
A space is AND.
 +
* <nowiki>||</nowiki> is for disjuncting inside a query (values, property names)
 +
* <nowiki> OR </nowiki> is for parts of a query.
 +
 +
For example:
 +
<code><nowiki>[[Category:Musical actor]] OR [[Category:Theatre actor]]</nowiki></code>
 +
==
 +
<code><nowiki>[[Category:Musical actor||Theatre actor]]</nowiki></code>
  
 
==== Wildcards ====
 
==== Wildcards ====
Line 44: Line 65:
 
==== Like, not like ====
 
==== Like, not like ====
 
In a like condition, one uses '<code>*</code>' wildcards to match any sequence of characters and '<code>?</code>' to match any single character. For example, one could ask <code><nowiki>[[Address::~*Park Place*]]</nowiki></code> to select addresses containing the string "Park Place", or <code><nowiki>[[Honorific::~M?.]]</nowiki></code> to select both "Mr." and "Ms.".
 
In a like condition, one uses '<code>*</code>' wildcards to match any sequence of characters and '<code>?</code>' to match any single character. For example, one could ask <code><nowiki>[[Address::~*Park Place*]]</nowiki></code> to select addresses containing the string "Park Place", or <code><nowiki>[[Honorific::~M?.]]</nowiki></code> to select both "Mr." and "Ms.".
 +
 +
==== Subqueries ====
 +
 +
<pre>[[Category:Actor]] [[born in::<q>[[Category:City]] [[located in::Italy]]</q>]]</pre>

Revision as of 16:45, 8 December 2016

Making content available to search

https://www.semantic-mediawiki.org/wiki/Help:In-text_annotation details In text annotations, things like

[[Is capital of::Germany]]

If I want to do it quietly, it'll be thus:

{{#set:
 Has population=3,396,990
 |Has country=Germany
}}

Searching

Page names

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

Based on values

The search page for structured queries is Special:Ask. More here: https://www.semantic-mediawiki.org/wiki/Help:Semantic_search Selecting pages: https://www.semantic-mediawiki.org/wiki/Help:Selecting_pages

[[Category:Actor]] 
[[born in::Boston]] 
[[height::180cm]]

Logic

A space is AND.

* || is for disjuncting inside a query (values, property names)
*  OR  is for parts of a query.

For example: [[Category:Musical actor]] OR [[Category:Theatre actor]] == [[Category:Musical actor||Theatre actor]]

Wildcards

[[born in::+]]

returns all pages that have any value for the property «born in».

Comparators

Placed after :: in property conditions.

  • >> and <<: "greater than" and "less than"
  • > and <: "greater than or equal" and "less than or equal" by default, but "greater than" and "less than" if $smwStrictComparators = true;
  • and : "greater than or equal" and "less than or equal"
  • !: "not" ("unequal")
  • ~: «like» comparison for strings
  • !~: «not like» comparison for strings

Like, not like

In a like condition, one uses '*' wildcards to match any sequence of characters and '?' to match any single character. For example, one could ask [[Address::~*Park Place*]] to select addresses containing the string "Park Place", or [[Honorific::~M?.]] to select both "Mr." and "Ms.".

Subqueries

[[Category:Actor]] [[born in::<q>[[Category:City]] [[located in::Italy]]</q>]]