Help:Selection

From semanticweb.org

Jump to: navigation, search

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.

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:

Country in Eurozone

<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):

For other given sets the nested tags <q> and </q> are needed (restricted to one level):

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 (:=>):

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:



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


Personal tools