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
- Amanda Bynes, Andy Anderson, Antoine Martynciow, Antony Pyton, Ben Whishaw, Benny Benson, Cameron Bright, Channing Tatum, Charly Checker, Cody Perkins, Daniel Guitierrez, Daniël Boissevain, Dyllan Christopher, Déborah François, Female actor, Gregory Peck, Jack Black, Joe Flynn, Jos van der Donk, Julie Richalet, Keenu Reeves, Ken Watanabe, Koen van der Donk, Leonardo DiCaprio, Maarten Heijmans, Mads Mikkelsen, Nicolas Cage, Pyton, Quinn Shephard, Robert Timmins, Sacha Baron Cohen, Tyler James Williams, William Moseley, Woody Allen, and Yes-R
- 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
- Charly Checker
- 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
- Andy Anderson, Charly Checker, Leonardo DiCaprio, and Yes-R
- 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
- Charly Checker
- 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
- Amanda Bynes, Benny Benson, Björk, Cameron Bright, Channing Tatum, Charly Checker, Daniel Guitierrez, David Beckham, David Lukas Müller, Enid Blyton, Ginger Baker, Gregory Peck, Gustave Eiffel, Is12345, Jack Black, Ken Watanabe, Ludwig van Beethoven, M schnei, Michael Kastner, Nicolas Cage, Sacha Baron Cohen, Tyler James Williams, Woody Allen, Yes-R, and 최윤규
- correct output
- Benny Benson, and Charly Checker.
Return all pages that have been assigned some height:
<ask>[[Category:Actor]][[height:=+]]</ask>
- query output
- Amanda Bynes, Andy Anderson, Antony Pyton, Benny Benson, Cameron Bright, Channing Tatum, Charly Checker, Daniel Guitierrez, Gregory Peck, Jack Black, Leonardo DiCaprio, Nicolas Cage, Sacha Baron Cohen, Woody Allen, and Yes-R
- 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
- Amanda Bynes, Andy Anderson, Antony Pyton, Benny Benson, Cameron Bright, Channing Tatum, Charly Checker, Daniel Guitierrez, Gregory Peck, Jack Black, Leonardo DiCaprio, Nicolas Cage, Sacha Baron Cohen, Woody Allen, and Yes-Rwarning.png"*" is not a number.
- 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
- 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
