SearchAProcess
From Process Wiki
Search with (comprehensive) query
Example - needs to be rewritten to more specific example
This example is taken from the SMW+ User forums.
[edit] The task
This article will give a step by step example for creating a query with the Query Interface (QI). The example query used in this case is as follows:
- “Give me the number of inhabitants for every European Union capital”
[edit] Ask for pages in a category
First of all, we have to define what we look for and according to this choose a category. Of course, this choice always depends on the content and structure of the wiki. In this example, we will say that capitals are in the category “city”. The first step therefore is that we ask for this category. In every input field of the QI you can use auto completion in order to find appropriate inputs.
After clicking “Add”, the category will appear in the query tree.
[edit] Ask for pages with a certain property
For every capital, we want to have the number of inhabitants, which is a property. The next step therefore is to add this property to the query.
[edit] Show the values of a property in the results
As we would like to have the number of inhabitants printed out in the result table, we have to check “Show in result table”. Please be reminded that only properties in the main part of the query can be printed. Properties of subqueries can not be printed, therefore this checkbox will not appear. As value we enter “*” for all values, meaning that we are asking for pages with any number of inhabitants, but this field can as well stay empty which would have the same effect. If we wanted only those pages which have a value for the 'number of inhabitants', we would check the 'Value must be set' checkbox. Since this is not the case (i.e. we want to show all countries in the European Union, whether or not they have a value for the number of inhabitants), we will leave the box unchecked.
[edit] Creating subqueries
As stated in our query, we want only those cities that are capitals of countries which belong to the European Union. The word “which” is always a hint on a subquery. Therefore we have to create a subquery here.
To add a subquery, simple check the “Insert subquery” box next to the input field. Subqueries are only possible with properties that refer to another wiki page. If a property has for example Integer or Date as a type, subqueries are not possible.
Now, the subquery can be edited. This happens by clicking “Subquery 1” in the tree view. You will then see a new empty tree which represents the contents of the subquery. This subquery will search for all Countries that are part of the European Union. Therefore, we will have to add the category “Country” and the property “is part of” with the value “European Union”.
By clicking on “Main” on top of the treeview, you can navigate back to the main part of the query.
[edit] Layout parameters - Changing the way in which the results are being displayed
Before finishing the query, some layout parameters will be set, in the 'Query Layout Manager' box.
- As a format , we choose table.
- The main label is the heading of the first table column. We will call this one city.
- Finally, we want our results sorted by the number of inhabitants in an descending order.
[edit] Preview the query
By clicking on “Preview results”, the results of the current query can be checked. In this case, there are only two cities in the database which are Berlin and Rome.[edit] Using the query (inserting it into a wiki article)
The query is now finished and can be either copied to the clipboard and pasted in a wiki article, or you can view the query by clicking on the 'Show full query' button at the bottom, and manually copy the query and paste it into a wiki article.








