Difference between revisions of "PrF UG queries chain queries"
(4 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
== Chaining Multiple Queries == | == Chaining Multiple Queries == | ||
− | {{PrF_UG_TOC_queries}}<div id='prf_ug'> | + | <noinclude>{{PrF_UG_TOC_queries}}<div id='prf_ug'></noinclude> |
Queries saved in the Query Library can be used as matching values | Queries saved in the Query Library can be used as matching values | ||
Line 20: | Line 20: | ||
is also a valid result of the query "People with salary greater than 100,000". | is also a valid result of the query "People with salary greater than 100,000". | ||
− | <div>[[Image:PrF_UG_queries_people_highly_paid.png| | + | <div>[[Image:PrF_UG_queries_people_highly_paid.png|frame|none| |
− | + | People with salary greater than 100,000]]</div> | |
− | |||
− | |||
− | <div>[[Image:PrF_UG_queries_articles_whose_authors.png| | + | <div>[[Image:PrF_UG_queries_articles_whose_authors.png|thumb|none|600px| |
− | + | Articles whose Authors are highly paid]]</div> | |
− | |||
− | |||
You do not have to use a slot in either query. | You do not have to use a slot in either query. | ||
Line 93: | Line 89: | ||
<li><p> | <li><p> | ||
Click the <b>Add Query</b> | Click the <b>Add Query</b> | ||
− | [[Image:PrF_UG_queries_query.gif|queries_query]] button. | + | ([[Image:PrF_UG_queries_query.gif|queries_query]]) button. |
</p> | </p> | ||
<p> | <p> | ||
<b>Note:</b> | <b>Note:</b> | ||
You may have some trouble getting this to display. | You may have some trouble getting this to display. | ||
− | If you do, try switching to another tab and then returning to the Queries | + | If you do, try switching to another tab and then returning to the Queries tab. |
If that doesn't work, try retrieving the "Articles whose authors are highly paid" query | If that doesn't work, try retrieving the "Articles whose authors are highly paid" query | ||
from the Query Library, then clearing it and recreating your query. | from the Query Library, then clearing it and recreating your query. | ||
Line 108: | Line 104: | ||
A <b>Pick Query</b> dialog displays the saved queries. | A <b>Pick Query</b> dialog displays the saved queries. | ||
</p> | </p> | ||
− | <div>[[Image:PrF_UG_queries_pick_query.png| | + | <div>[[Image:PrF_UG_queries_pick_query.png|frame|none| |
+ | Pick Query dialog]]</div> | ||
<li><p> | <li><p> | ||
− | Select the query you want and click | + | Select the query you want and click OK. |
</p> | </p> | ||
</ol> | </ol> | ||
Line 118: | Line 115: | ||
with other queries. | with other queries. | ||
− | </div> | + | |
+ | <noinclude></div></noinclude> |
Latest revision as of 17:39, November 13, 2008
Chaining Multiple Queries
Queries saved in the Query Library can be used as matching values for slots of type Instance. When you do this, the resulting query looks for instances where the slot value is a search result for the specified query.
Often, when you need to create a query of this type, you will look at a class that has a slot of type Instance and want to know which of those instances have a certain property. When you create the combined query, you need to create the query for the property first, and then create the query for the class.
For example, the query "Articles whose Authors are highly paid" looks for instances of the Class Article whose value at the slot author is also a valid result of the query "People with salary greater than 100,000".
You do not have to use a slot in either query. If you just use a class, you will find all instances of that class and its subclasses.
To create a query of this type, you need to make sure the two queries satisfy the following:
The slot value for Query B, the query that contains another query, must be one of the following:
a slot of type Instance
empty (in this case, you must select a class)
For the final chained query to be meaningful, Query A (the query that will be used inside the other query) must have results that intersect the possible inputs for Query B. If Query A has a slot, the domain for the slot should intersect the Allowed Classes for the slot of type Instance in Query B. If Query A does not have a slot, the subclasses of the class in Query should intersect the subclasses of the Allowed Classes for the slot of type Instance in Query B.
To create a query of this type
Create an initial query.
Save this query in the Query Library.
Clear the current query.
Select the Class and/or Slot you want for the second query.
Select contains or does not contain from the menu.
Click the Add Query () button.
Note: You may have some trouble getting this to display. If you do, try switching to another tab and then returning to the Queries tab. If that doesn't work, try retrieving the "Articles whose authors are highly paid" query from the Query Library, then clearing it and recreating your query. You may still have to switch to another tab after you have entered your slot, but this should work.
A Pick Query dialog displays the saved queries.
Select the query you want and click OK.
You can also combine chained queries with other queries.