Inline Query Examples
From semanticweb.org
On this page there are a number of inline queries corresponding to the examples shown in Help:Inline queries. For each example, there is a "query output" dynamically generated by running the query and a "correct output" which is a static version of the results of the query. If the results are the same for all queries then inline queries are working correctly.
- Note
- For the examples below to work, this page uses Category:Actor, Attribute:Height, Relation:born in and articles: Andy Anderson, Benny Benson, Charly Checker. Additional results may appear if these pages are changed or annotations are used elsewhere on the site.
Contents |
[edit] Page Selection
Give all pages directly or indirectly (through a sub-, subsub-, etc. category) in a category:
<ask>[[Category:Actor]]</ask>
- query output
- <ask> no longer supported. See SMW documentation on how to do inline queries now.
- correct output
- Andy Anderson, Benny Benson, and Charly Checker
Give all pages annotated as being about someone born in Boston:
<ask>[[born in::Boston]]</ask>
- query output
- <ask> no longer supported. See SMW documentation on how to do inline queries now.
- correct output
- Benny Benson, and Charly Checker.
Give all pages annotated as being about someone having a height of 180cm:
<ask>[[height:=180cm]]</ask>
- query output
- <ask> no longer supported. See SMW documentation on how to do inline queries now.
- correct output
- Andy Anderson, and Charly Checker.
Everybody who is an actor and was born in Boston and is 180cm in tall:
<ask>[[Category:Actor]] [[born in::Boston]] [[height:=180cm]]</ask>
- query output
- <ask> no longer supported. See SMW documentation on how to do inline queries now.
- correct output
- Charly Checker.
[edit] Wildcards and Disjunctions
Return all pages that have annotations for the relation "born in":
<ask>[[born in::+]]</ask>
- query output
- <ask> no longer supported. See SMW documentation on how to do inline queries now.
- correct output
- Benny Benson, and Charly Checker.
Return all pages that have been assigned some height:
<ask>[[Category:Actor]][[height:=+]]</ask>
- query output
- <ask> no longer supported. See SMW documentation on how to do inline queries now.
- correct output
- Andy Anderson, and Charly Checker.
Disjunctions...
[edit] Conditions with attributes
[edit] Direct conditions on pages
[edit] Data to be displayed
Show the height (if any) of the selected pages
<ask>[[Category:Actor]][[height:=*]]</ask>
- query output
- <ask> no longer supported. See SMW documentation on how to do inline queries now.
- correct output
- (coming soon)
Show all pages that have a "born in" relation to the result page:
<ask>[[Category:Actor]][[born in::*]]</ask>
- query output
- <ask> no longer supported. See SMW documentation on how to do inline queries now.
- correct output
Show all categories that the result page has directly been stated to be in
<ask>[[Category:*]]</ask>
- query output
- (too many categories to display)
- correct output
