PrF UG queries create query

From Protege Wiki
Jump to: navigation, search

Creating a Single Query


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

The Queries tab allows you to query your project and locate all instances that match the criteria you specify. You can create a simple query, or combine multiple criteria to restrict or expand your results.

You can create a simple query based on a class, a slot, or both. When you specify a slot, you also specify the criteria for matching the slot:

  • A query based solely on a class will find all instances of the selected class and all of its subclasses.

  • A query based solely on a slot will find all instances whose value at the slot match the criteria you specify.

  • A query based on a class and a slot will find all instances of the class that match the criteria at the selected slot.

Note: Sometimes the query buttons or query entry bar will not display correctly. You can refresh the query entry by clicking on another tab and then returning to the Query tab.

The directions below show how to select a class first, then a slot. You can also select the slot first and then the class; this is useful if you remember the slot name, but are not certain of the classes that it is attached to. To do this, select the slot as in Steps 3 and 4, then select the class as in Steps 1 and 2. In this case, the Select Classes dialog box will show only those classes that have the selected slot.

To create a query:

  1. To specify a class, click the Select Class (all_object.add) button above the Class entry bar. (If you wish to create a query based solely on a slot, start at Step 3.)

    Class entry bar
  2. Select the class you want from the Select Classes dialog box, then click OK. (If you wish to create a query solely on that class, you are now ready to run it.)

    Select Classes dialog, "Employee" selected
  3. Click OK.

    Class entry bar
  4. To specify a slot, click the Select Slot (all_object.add) button, above the Slot entry bar.

    Slot entry bar, empty
  5. Select a slot from the Select Slot dialog box. If you selected a class, only slots attached to that class will be shown. If no class is selected, all slots are available.

    Select Slot dialog, "date_hired" selected
  6. Click OK. The slot will be filled in and the criteria menu immediately to the right will be displayed.

    Slot entry bar, filled
  7. Make a selection from the pull-down criteria menu. This menu becomes active after you select a slot; the choices are based on the slot's Value Type.

    pull-down criteria menu
  8. Enter a value for comparison at the entry bar to the right. The entry method for this value depends on the slot value type.

    • For Boolean value type, select whether the slot value is true or false.

    • For Class value type, click the Select Class (all_object.add) button and select a class from the dialog. The query will find all instances where the slot value contains (or does not contain) the selected class.

    • For Float or Integer value type, enter the number to which you want to compare the slot value.

    • For Instance value type, click the Select Instance (all_object.add) or Select Query (queries_query) button and select a value from the dialog box.

    • For Symbol value type, the possible values are displayed as a drop-down list. Select a symbol from this list.

      Note: Sometimes the query buttons or query entry bar will not display correctly. You can refresh the query entry by clicking on another tab and then returning to the Query tab.

To run the query, click the Find button:

Find button

To save the query in the Query Library, give it a name and click the Add Query to Library (queries_query.library.add) button.