Difference between revisions of "Ask"

From its-wiki.no
Jump to: navigation, search
Line 48: Line 48:
 
{{#show: Berlin | ?population }}  
 
{{#show: Berlin | ?population }}  
 
</nowiki></pre>
 
</nowiki></pre>
 +
== Tips and Tricks ==
 +
Recommendation from [[Neill Mitchell|Neill]]: I always hide the raw page name as much as possible and use aliases so
 +
queries return more user friendly links.
 +
<nowiki> {{#set:Page Link=[[{{FULLPAGENAME}}|{{{Page Title|}}}]]}} </nowiki>where Page Title
 +
is usually a field in the form. Sometimes I prepend with a section ID
 +
<nowiki>{{#set:Page Link=[[{{FULLPAGENAME}}|{{{Section ID|}}}-{{{Page Title|}}}]]}} </nowiki>
  
 +
Then in the queries I return Page Link and use mainlabel=- to suppress the
 +
raw page name field.
 +
<nowiki>
 +
{{#ask:
 +
|?Page Link
 +
..
 +
..
 +
|mainlabel=-
 +
}}
 +
</nowiki>
 
== Example ==
 
== Example ==
 
ongoing projects, based on  <nowiki> [[Category:Project]] [[Due_date::> {{#expr:{{#time: Y|now}}}}]]  </nowiki>
 
ongoing projects, based on  <nowiki> [[Category:Project]] [[Due_date::> {{#expr:{{#time: Y|now}}}}]]  </nowiki>

Revision as of 12:06, 10 July 2015

Explanation of Semantic MediaWiki ask function

see also Test-Ask for invers properties

help page

http://semantic-mediawiki.org/wiki/Help:Selecting_pages, including " ::>, ::! "

output to vcard

Warning: exports all users on this wiki ... further results

for errors, see Josef_Noll

Example

 {{#ask:[[Category::User]]
 |?=search for users#
 |?User
 |?Date
 |?Title
 |format=broadtable
 |limit=5
 |offset=1
 |link=all
 |sort=User count
 |order=descending
 |headers=plain
 |mainlabel=search for users
 |intro=results
 |outro=done
 |searchlabel=… further results
 |default=no results found
 |class=sortable wikitable smwtable
 }}

<!--- ask with OR connection, as used in Template:User --->
{{#ask: [[Supervisor::{{SUBJECTPAGENAME}}]] OR [[Lecturer::{{SUBJECTPAGENAME}}]] OR 
[[User::{{SUBJECTPAGENAME}}]] OR [[{{SUBJECTPAGENAME}}]]

ommit main label: | mainlabel=- |

{{#show: Berlin | ?population }} 

Tips and Tricks

Recommendation from Neill: I always hide the raw page name as much as possible and use aliases so queries return more user friendly links. {{#set:Page Link=[[{{FULLPAGENAME}}|{{{Page Title|}}}]]}} where Page Title is usually a field in the form. Sometimes I prepend with a section ID {{#set:Page Link=[[{{FULLPAGENAME}}|{{{Section ID|}}}-{{{Page Title|}}}]]}}

Then in the queries I return Page Link and use mainlabel=- to suppress the raw page name field. {{#ask: |?Page Link .. .. |mainlabel=- }}

Example

ongoing projects, based on [[Category:Project]] [[Due_date::> {{#expr:{{#time: Y|now}}}}]]

  • CURRENTYEAR is 2024, CURRENTTIME is 14:01, LOCALTIME is 14:01
  • date: 25 Februar 2016 or "now": 10 Jun 2024
  • see all time examples in: Help:Extension:ParserFunctions

recent pages


pages from 2013


recent pages in slideshow

Note: format=slideshow is supported in this version, and shown in:

recent pages, random

[[modification date::+]] shows only pages that exist (not deleted ones)

  1. Roman Vitenberg
  2. Joakim Egseth Solberg
  3. Mone Eli Sæland.jpg
  4. Asgeir Brevik
  5. Agreement Bernard Lutete Josef Noll.jpg
  6. ... further results

The part "{{{ns}}}" of the query was not understood. Results might not be as expected.

Variables