You are here

Tutorial 6. Build you own query using the Query Builder


SHAARE possesses a sophisticated integrated query builder that can produce queries that span many different sources of information. The query builder allows the both the modification of existing template queries and the creation of entirely new queries from scratch.
The easiest way to learn how to use the query builder is to pick an existing template query and click the edit template button on the right side of every query. 
This will show the query builder interface (shown below) and you can see how this the query was created. In the case of screen shot below, the gene table starting point is shown. To see an attribute (data field) in the results click the "show" button next to the attribute. Attributes from other linked tables can be shown by expanding the connections below by clicking "+". A description is available for many of the attributes and is viewable by moving the mouse cursor over the "i" at the end of the attribute name. 
To narrow the results of a query you can constrain attributes by clicking the "constrain" button next to "show". This allows the query to be restricted to include only a particular value or just whether the field has any value or not. Some attributes (with a yellow background in the box) will search for compliant terms as you type. Once the constraint has been selected click the "Add to query" button. 
You can also use a list as a constraint. To do this click the "constrain" button next to the title of the the table (e.g. Gene) and then click the check box next to "OR" and select a compatible list from the drop down box.  
More than one constrain can be added to a query. The "Constraint logic" section allows constraints to be used in an "and" or "or" context. In the example below, the gene query has been restricted to Human Protein Atlas - High expression AND must be Cardiovascular OR Blood immune system.
To change the order of the attributes in the results, the boxes in the "Columns to Display" section can be dragged and dropped to create the desired order. To sort the results table by the values of a particular attribute click the purple "sort" button. Buttons are also available within the boxes to remove an attribute from the results or change the description of the table header for that attribute. 
The newly created query can be saved to My Account where it can be run again or modified further (tutorial 9). Once a query has been created it can be run using the "Show results" button.
Instead of altering existing queries it is also possible to build a query from scratch. Go to the 'QueryBuilder' tab on the main menu bar and then select a data type to begin building using the interface. Query builder starting points can also be found on the data category pages (tutorial 6).
It is also possible to export and import queries in XML. This can be an easy way to share queries between users. An export XML button can be found at the bottom of every template query on the right hand side. To import an XML query select 'Import query from XML' on the 'QueryBuilder' page. Then simply copy and paste the XML into the box and click submit.