Difference between revisions of "PrF UG queries chain queries"

From Protege Wiki
Jump to: navigation, search
(Automated import of articles)
 
Line 4: Line 4:
 
{{PrF_UG_TOC_queries}}<div id='prf_ug'>
 
{{PrF_UG_TOC_queries}}<div id='prf_ug'>
  
Queries saved in the Query Library can be used as matching values for slots of type Instance.
+
Queries saved in the Query Library can be used as matching values
When you do this,
+
for slots of type Instance.
the resulting query looks for instances where the slot value is a search result for the specified query.
+
When you do this, the resulting query looks for instances
 +
where the slot value is a search result for the specified query.
  
Often,
+
Often, when you need to create a query of this type,
when you need to create a query of this type,
+
you will look at a class that has a slot of type Instance
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.
+
and want to know which of those instances have a certain property.
 
When you create the combined query,
 
When you create the combined query,
 
you need to create the query for the property first,
 
you need to create the query for the property first,
 
and then create the query for the class.
 
and then create the query for the class.
  
For example,
+
For example, the query "Articles whose Authors are highly paid"
the query "Articles whose Authors are highly paid" looks for instances of the Class <b>Article</b> whose value at the slot <i>author</i> is also a valid result of the query "People with salary greater than 100,000".
+
looks for instances of the Class <b>Article</b> whose value at the slot <i>author</i>
 +
is also a valid result of the query "People with salary greater than 100,000".
  
<div>[[Image:PrF_UG_queries_people_highly_paid.png|queries_people_highly_paid]]</div>
+
<div>[[Image:PrF_UG_queries_people_highly_paid.png|
 +
      queries_people_highly_paid]]</div>
  
 
<b><i>Query:
 
<b><i>Query:
 
People with salary greater than 100,000</i></b>
 
People with salary greater than 100,000</i></b>
  
<div>[[Image:PrF_UG_queries_articles_whose_authors.png|queries_articles_whose_authors]]</div>
+
<div>[[Image:PrF_UG_queries_articles_whose_authors.png|
 +
      queries_articles_whose_authors]]</div>
  
 
<b>Query using "<i>People with salary greater than 100,000"</i></b>
 
<b>Query using "<i>People with salary greater than 100,000"</i></b>
Line 47: Line 51:
 
    
 
    
 
     <li><p>
 
     <li><p>
       empty (in this case,
+
       empty (in this case, you must select a class)
      you must select a class)
 
 
       </p>
 
       </p>
 
   </ul>
 
   </ul>
Line 54: Line 57:
 
   <li><p>
 
   <li><p>
 
     For the final chained query to be meaningful,
 
     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.
+
     Query A (the query that will be used inside the other query)
     If Query A has a slot,
+
    must have results that intersect the possible inputs for Query B.
    the domain for the slot should intersect the Allowed Classes for the slot of type Instance in Query B.
+
     If Query A has a slot, the domain for the slot
     If Query A does not have a slot,
+
    should intersect the Allowed Classes for the slot of type Instance in Query B.
    the subclasses of the class in Query should intersect the subclasses of 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.
 
     </p>
 
     </p>
 
</ul>
 
</ul>
Line 66: Line 71:
 
<ol class='a'>
 
<ol class='a'>
 
   <li><p>
 
   <li><p>
     [[PrF_UG_queries_create_query|Create]]
+
     [[PrF_UG_queries_create_query|Create]] an initial query.
    an initial query.
 
 
     </p>
 
     </p>
  
 
   <li><p>
 
   <li><p>
     [[PrF_UG_queries_saving_query|Save]]
+
     [[PrF_UG_queries_saving_query|Save]] this query
     this query in the
+
     in the [[PrF_UG_queries_query_library|Query Library]].
    [[PrF_UG_queries_query_library|Query Library]].
 
 
     </p>
 
     </p>
  
Line 90: Line 93:
 
   <li><p>
 
   <li><p>
 
     Click the <b>Add Query</b>
 
     Click the <b>Add Query</b>
     [[Image:PrF_UG_queries_query.gif|queries_query]]
+
     [[Image:PrF_UG_queries_query.gif|queries_query]] button.
    button.
 
  
 
     </p>
 
     </p>
     <p> <b>Note:</b> You may have some trouble getting this to display.
+
     <p> <b>Note:</b>
     If you do,
+
    You may have some trouble getting this to display.
    try switching to another tab and then returning to the Queries Tab.
+
     If you do, try switching to another tab and then returning to the Queries Tab.
     If that doesn't work,
+
     If that doesn't work, try retrieving the "Articles whose authors are highly paid" query
    try retrieving the "Articles whose authors are highly paid" query from the Query Library,
+
    from the Query Library, then clearing it and recreating your query.
    then clearing it and recreating your query.
 
 
     You may still have to switch to another tab after you have entered your slot,
 
     You may still have to switch to another tab after you have entered your slot,
 
     but this should work.
 
     but this should work.
Line 106: Line 107:
 
   <li><p>
 
   <li><p>
 
     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|queries_pick_query]]</div>
 
 
     </p>
 
     </p>
 +
    <div>[[Image:PrF_UG_queries_pick_query.png|queries_pick_query]]</div>
  
 
   <li><p>
 
   <li><p>
Line 115: Line 115:
 
</ol>
 
</ol>
  
You can also
+
You can also [[PrF_UG_queries_create_complex_query|combine]] chained queries
[[PrF_UG_queries_create_complex_query|combine]]
+
with other queries.
chained queries with other queries.
 
  
 
</div>
 
</div>

Revision as of 14:44, October 16, 2008

Chaining Multiple Queries


Protege-Frames User's Guide
Queries
The Queries Tab
The Query Editor
The Search Results Pane
The Query Library Pane
Creating a Single Query
Combining Multiple Queries
Chaining Multiple Queries
Running a Query
Saving a Query
Retrieving a Query
Clearing a Query
Exporting Query Results
Glossary, Editing Help

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".

queries_people_highly_paid

Query: People with salary greater than 100,000

queries_articles_whose_authors

Query using "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

  1. Create an initial query.

  2. Save this query in the Query Library.

  3. Clear the current query.

  4. Select the Class and/or Slot you want for the second query.

  5. Select contains or does not contain from the menu.

  6. Click the Add Query queries_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.

  7. A Pick Query dialog displays the saved queries.

    queries_pick_query
  8. Select the query you want and click okay.

You can also combine chained queries with other queries.