Help:Selection
From semanticweb.org
This is old documentation, see Help:Semantic search -- Skierpage 10:17, 13 March 2008 (CET)
This description applies to the old SMW version 0.7 The behavior is somewhat different in SMW 1.0, which ontoworld.org is running.
Contents |
[edit] Introduction
The ask function selects pages and presents info about them. Between the tags <ask> and </ask> a list of items is put, partly for selection, partly for specifying info to be displayed. The two types of items can be mixed. This page deals with the selection.
Parameters can be entered in the opening <ask> tag. There is one concerning the selection of pages:
- <ask limit=..>
specifies the maximum number of pages selected. It will be capped by 500 anyway.
[edit] Intersection
The selection is the intersection of the sets defined by the selection items. To avoid ambiguity, of adjacent items at least one is put in double square brackets.
A selection item may involve a union of sets, but only in the cases specified below.
[edit] Direct conditions on pages
Two types of sets can be specified:
1. A specific page, e.g.
- <ask>[[Berlin]]</ask> gives Berlin
- <ask>[[Talk:Berlin]]</ask> gives "Berlin" although the page Talk:Berlin exists.
Note that the namespace prefixes are not displayed, see the hover box or status bar of the browser, or follow the links.
The full name of a category page denotes the set of pages in the category, while with a colon in front it denotes the category page.
2. A namespace prefix with the colon, followed by "+" indicates the namespace, e.g.
- <ask>[[Help:+]]</ask> gives Annotation, Annotation (SMW0.7), Annotation naming guideline, Ask, Attribute, Attribute name, Backlinks, Browsing and searching, Category, Chains of relations and attributes, Computation, Contents, Custom units, Data import with a script, Edit summary, Editing, Factbox, Import vocabulary, Inline queries, Installation, Namespace, Ontology import, OntologyImport, Preferences, RDF export, Relation, Relation name, Reuse, SPARQL endpoint, SearchTriple, Searching, Selection, Semantic Web, Semantic search, Semantic templates, Semantics, Service links, Sorting, Suggestions, Template, Templates in SMW, and Type
- <ask limit=5>[[:+]]</ask> gives 'n Beetje Verliefd, (animated), (testing 2), (testing), and * … further results.
- <ask limit=5>[[:Category:+]]</ask> (note the colon in front again) gives the category pages: !Main, !Main-c, 1683 establishments, 2D dihedral isometry group of order 10, and 2D figure … further results, i.e., the categories, including empty ones, but excluding those which have not been created as a page.
For any collection of these sets, we can take the union with "||". E.g.:
<ask>[[Berlin||Help:+]]</ask>
gives
Annotation, Annotation (SMW0.7), Annotation naming guideline, Ask, Attribute, Attribute name, Backlinks, Berlin, Browsing and searching, Category, Chains of relations and attributes, Computation, Contents, Custom units, Data import with a script, Edit summary, Editing, Factbox, Import vocabulary, Inline queries, Installation, Namespace, Ontology import, OntologyImport, Preferences, RDF export, Relation, Relation name, Reuse, SPARQL endpoint, SearchTriple, Searching, Selection, Semantic Web, Semantic search, Semantic templates, Semantics, Service links, Sorting, Suggestions, Template, Templates in SMW, and Type
[edit] Pages in categories
<ask>[[:+||:Category:+]][[Category:Country in European Union]]</ask>
gives all pages directly or indirectly (through a sub-, subsub-, etc. category) in Category:Country in European Union (including the subcategories themselves):
Belgium, Country in Eurozone, Cyprus, Estonia, Greece, Latvia, Lithuania, Luxembourg, Poland, Republic of Ireland, Romania, Slovakia, Slovenia, and Sweden
<ask>[[Category:Country in European Union]]</ask>
gives the same without the subcategories themselves:
Belgium, Country in Eurozone, Cyprus, Estonia, Greece, Latvia, Lithuania, Luxembourg, Poland, Republic of Ireland, Romania, Slovakia, Slovenia, and Sweden
<ask>[[:Category:+]][[Category:Country in European Union]]</ask>
gives just the sub-, subsub-, etc. categories:
<ask>[[Category:Country in European Union||Continent]]</ask>
gives all pages directly or indirectly (through a sub-, subsub-, etc. category) in Category:Continent or Category:Country in European Union:
Africa, Antarctica, Asia, Belgium, Country in Eurozone, Cyprus, Estonia, Europe, Greece, Latvia, Lithuania, Luxembourg, North America, Poland, Republic of Ireland, Romania, Slovakia, Slovenia, South America, and Sweden
A query cannot produce just the pages and subcategories which are directly in a category.
[edit] Conditions with relations
relation::set gives the set of pages with the given relation to any page in the given set ("+" for the set of all pages):
- <ask>[[parent of::Seth]]</ask> gives
- <ask>[[parent of::Template:Seth]]</ask> gives (the template prefix is ignored)
- <ask limit=5>[[parent of::+]]</ask> gives George Herbert Walker Bush, Hillary Clinton, and Willem van de Sande Bakhuyzen.
- <ask limit=5>[[parent of::Help:+]]</ask> gives (the help prefix is ignored)
For other given sets the nested tags <q> and </q> are needed (restricted to one level):
- <ask limit=5>[[parent of::<q>[[Category:Actor]]</q>]]</ask> gives .
- <ask limit=5>[[parent of::<q>[[:+]]</q>]]</ask> gives George Herbert Walker Bush, Hillary Clinton, and Willem van de Sande Bakhuyzen (parents of people with existing pages).
Compare the last example with:
- <ask limit=5>[[parent of::<q>[[+]]</q>]]</ask> gives (all parents, the same as without q-tags).
Within the q-tags we can use any set that does not require inner tags itself, e.g. one involving a relation again:
- <ask limit=5>[[parent of::<q>[[parent of::+]]</q>]]</ask> gives (parents of parents).
[edit] Conditions with attributes
We can check for being defined (:=+), for equality (:=), also for multiple values, and for being less or equal (:=<) and greater or equal (:=>):
- <ask>[[start date:=+]]</ask> gives 9/11, AAAI2007, AAAI2008, AIMS2007, AIMS2007 SBPM Tutorial, AKT-SWS2004, ALPSWS2006, ALPSWS2007, ALPSWS2008, AOW2006, AST2006, ASWC2006, ASWC2008, AWESOME2007, AWIC2007, AWeSOMe'07, Attack on Pearl Harbor, BIS2007, BODC, BOEMIE2006, Biochromatography & Nanobiotechnologies 2007, C-SHALS, CAPS2007, CEC/EEE2006, CEDAR 2008, CH-SW 2007, CHI 2005, CHI 2006, CHI 2007, CHI 2008, CISIS-2007, CLA2006, CODS'2007, COMPSAC 2007, COMPSAC 2008, CPSW2007, CS-TIW2008, CSWS2008, CentiarePrize2007, Change of president of the United States from Bill Clinton to George W. Bush, CoKM2007, Collaborative Web Tagging 2006, DEXA2007, DILS06, DIMEA 2008, DIST 2008, DL2007, DL2008, Data Collection 2006, and Date range … further results
- <ask>[[start date:=2006-10-05]]</ask> gives AST2006, and ICWI2006
- <ask>[[start date:=2006-10-05||2006-12-04]]</ask> gives AOW2006, AST2006, ICWI2006, SMAP2006, and SemWS2006
- <ask>[[start date:=>2007-01-06]]</ask> gives AAAI2007, AAAI2008, AIMS2007, AIMS2007 SBPM Tutorial, ALPSWS2007, ALPSWS2008, ASWC2008, AWESOME2007, AWIC2007, AWeSOMe'07, BIS2007, BODC, Biochromatography & Nanobiotechnologies 2007, C-SHALS, CAPS2007, CEDAR 2008, CH-SW 2007, CHI 2007, CHI 2008, CISIS-2007, CODS'2007, COMPSAC 2007, COMPSAC 2008, CPSW2007, CS-TIW2008, CSWS2008, CentiarePrize2007, CoKM2007, DEXA2007, DIMEA 2008, DIST 2008, DL2007, DL2008, ECAI2008, ECIR2007, ECOWS 2007, EON 2007, ERC, ESAS 2008, ESOE2007, ESTC 2007, ESTC2007 SBPM Tutorial, ESWC2007, ESWC2007 SBPM Tutorial, ESWC2008, ETAS2007, EXPOAGRO 2007, European Summer Time 2007, FAInt-07, and FEWS … further results
- <ask>[[nr. of screens:=14]]</ask> gives
- <ask>[[nr. of screens:=>13]]</ask> gives
When needed, automatic unit conversion is applied for the purpose of the test.
If a datatype has no natural linear ordering, inequalities are based on alphabetical order of the normalized datavalues as they are used in the RDF export.
In all cases the result is limited to pages for which the attribute value is defined. However, if the query contains an invalid comparison value, the result is like putting "+", i.e. it gives all these pages:
- <ask>[[nr. of screens:=a]]</ask> gives
- <ask>[[start date:=>2007]]</ask> gives ALPSWS2008, ASWC2008, CSWS2008, DIMEA 2008, DIST 2008, HLIE08, I-SEEK09, ICCS2009, ICDEM 2009, ICFCA2009, ICWIS09, IEEE-ICSC 2007, IMC-SSW, INSEMTIVE2008, ISWC2008, JELIA2008, KR 2008, LEB 08, LPAR 2008, NEPOMUK Summer School, OM-2008, OWLED 2008, OnAV09, OntoContent 2008, PICKME2008, PKM2009, RR2008, Reasoning Web 2008, SAAKM2008, SAECSIS-2009, SDoW2008, SSW2009, SUM 2008, Semantic Rhine Oct 2008, TWOMDE 2008, WI’08, WM 2009, and WikiSym 2008
All categories | properties | types
Advice on Annotation | Ask | Attribute name | Browsing and searching | Category | Chains of relations and attributes | Custom units | Namespace | Relation name | Selection | SearchTriple | Sorting | Templates in SMW
