Semantic MediaWiki/markup/ask

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
Semantic MediaWiki "#ask" syntax

Syntax

Operators

  • «::» : "equals"
  • «::>» : "greater than"

Dates

By default, the filter condition «<property name>::<date value>» means «WHERE <property name> equals <date value>». Note that even if <date value> has no time, it will not find pages where <property value> is set to a full timestamp in which the time is not 00:00.

In order to match any timestamp from the same day (00:00 - 23:59)... researching this; there are several possible avenues...

(I ended up semi-kluging a solution by using «#time» (see below) to normalize the timestamp, in the data-saving template, and using that normalized value to set the SMW property.)

What doesn't work

Note: it may be incorrect that this doesn't work. I realized later I might have been accidentally hiding the results; follow-up is needed.

  • «[[<property name>::<date of wanted day>]] [[<property name>::<date of next day>]]», i.e. "between 00:00 this morning and 00:00 next morning". This ignores pages where <date value> doesn't have a time-stamp (despite the claim of «::>» actually meaning «»).

Related

  • {{#time:Y/m/d|<date/time string>}} will normalize all recognized date-time formats into a YYYY/MM/DD string (time omitted).
  • {{#dateformat:<date string>|Y/m/d}} renders a date in the the same format, but only works if <date string> is (already) just a date, no time.

Official Documentation

Operators

Note that there does not seem to be any documentation specifically about available comparison operators. The «::>» and «::<» operators are mentioned in passing in a couple of places:

  • smw:Help:Calendar format - «Don't worry that the comparison operators are «<» and «>» instead of «<=» and «>=»; the return values of the parser functions are set so that this will not be an issue.» This doesn't clarify whether this is true in general or only within the Calendar context.
  • smw:Help:$smwgQStrictComparators - by default, «::>» and «::<» are treated as «» and «»