Difference between revisions of "Using"

From Fiamma
Jump to navigationJump to search
(Created page with "=== Making content available to search === https://www.semantic-mediawiki.org/wiki/Help:In-text_annotation details '''In text annotations''', things like <pre> Is capital o...")
 
 
(33 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
=== General ===
 +
'''Categories''' are named in plural where it's possible (think "Blogs", not "Blog"), '''tags''' are in singular.
 +
 +
Important pages:
 +
* [[Special:SearchByProperty|Search by property]];
 +
* [[Special:Ask]]
 +
 +
=== Style ===
 +
I will add spaces when setting a category, to make it easier to select:
 +
<pre>
 +
[[Category: Meta]]
 +
</pre>
 +
Use bold for key words / concepts, cursive for emphasis.
 +
 
=== Making content available to search ===
 
=== Making content available to search ===
  
 +
Two main properties are [[Property:L]] the link (if there's one of them) and [[Property:T]] -- the title; SMW seems to capitalize them by default. <ref>It seems that SMW capitalizes them by default</ref>
 +
 +
The [[Template:B]]asic helps to use it all swiftly:
 +
<pre>
 +
{{B|l|t|[c=5]|[r=5]|[o=true]}}
 +
</pre>
 +
Where '''c''' is the ''complexity'' of a page, from 1 to 10, '''t''' is the page title as stated in the link, '''r''' is rating, 1 to 10 too, o is whether it's an one link page. Last two parameters are optional.
 +
 +
<br>
 +
<s>//todo: write a small plugin to automate at least partly all this.</s> Done!
 +
 +
Other examples:
 
https://www.semantic-mediawiki.org/wiki/Help:In-text_annotation details '''In text annotations''', things like
 
https://www.semantic-mediawiki.org/wiki/Help:In-text_annotation details '''In text annotations''', things like
 
<pre>
 
<pre>
Line 15: Line 41:
  
 
=== Searching ===
 
=== Searching ===
The search page for structured queries is [[Special:Ask]].
 
  
 +
http://www.pchr8.net/f/index.php/Special:SearchByProperty/R/7 is [[Special:SearchByProperty|Search by property]], a pretty nice and useful interface.
 +
The search page for structured queries is [[Special:Ask]]. More here: https://www.semantic-mediawiki.org/wiki/Help:Semantic_search
 +
 +
<nowiki>[[:+]]</nowiki> limits to main namespace. (No "Property:*" pages).
 +
==== Page names ====
 +
 +
<pre>
 +
[[Brazil||France||User:John Doe]]
 +
[[~John*]]
 +
</pre>
 +
 +
==== Based on values ====
 +
 +
Selecting pages: https://www.semantic-mediawiki.org/wiki/Help:Selecting_pages
 +
 +
<pre>
 +
[[Category:Actor]]
 +
[[born in::Boston]]
 +
[[height::180cm]]
 +
</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 ====
 +
<pre>
 +
[[born in::+]]
 +
</pre> 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 <tt>[[Help:$smwStrictComparators|$smwStrictComparators]] = true;</tt>
 +
* '''≥''' 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 '<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>
 +
 +
----
 +
* https://www.mediawiki.org/wiki/Help:Formatting/
 +
* https://www.mediawiki.org/wiki/Help:Templates#Default_values
 +
* [[Keywords_In_Semantic_Mediawiki]]
 +
 +
===  Additionally ===
 +
For URIs which contain "=", which doesn't play nice with templating, <nowiki>{{=}}</nowiki> can be used.
 +
 +
==== Inline queries====
 +
 +
An example can be seen in [http://www.pchr8.net/f/index.php/Learning_French#Animes_dubbed_in_French animes dubbed in French], where via an inline query all pages in categories French and Anime are shown.
 +
 +
==== References / Footnotes ====
 +
 +
I add <nowiki><ref>My reference</ref></nowiki> and it will add it by default at the end.
  
 +
==== Footnotes ====
 +
<references />
  
[[Category:Meta]]
+
[[Category: Meta]]
 +
[[Category: Reference]]
 +
[[Category: Personal knowledge management]]
 +
[[Category: Good]]

Latest revision as of 21:05, 25 March 2020

General

Categories are named in plural where it's possible (think "Blogs", not "Blog"), tags are in singular.

Important pages:

Style

I will add spaces when setting a category, to make it easier to select:

[[Category: Meta]]

Use bold for key words / concepts, cursive for emphasis.

Making content available to search

Two main properties are Property:L the link (if there's one of them) and Property:T -- the title; SMW seems to capitalize them by default. [1]

The Template:Basic helps to use it all swiftly:

{{B|l|t|[c=5]|[r=5]|[o=true]}}

Where c is the complexity of a page, from 1 to 10, t is the page title as stated in the link, r is rating, 1 to 10 too, o is whether it's an one link page. Last two parameters are optional.


//todo: write a small plugin to automate at least partly all this. Done!

Other examples: 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

http://www.pchr8.net/f/index.php/Special:SearchByProperty/R/7 is Search by property, a pretty nice and useful interface. The search page for structured queries is Special:Ask. More here: https://www.semantic-mediawiki.org/wiki/Help:Semantic_search

[[:+]] limits to main namespace. (No "Property:*" pages).

Page names

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

Based on values

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>]]

Additionally

For URIs which contain "=", which doesn't play nice with templating, {{=}} can be used.

Inline queries

An example can be seen in animes dubbed in French, where via an inline query all pages in categories French and Anime are shown.

References / Footnotes

I add <ref>My reference</ref> and it will add it by default at the end.

Footnotes

  1. It seems that SMW capitalizes them by default