Working with X-Queries

The following topics are covered below.


Specifying an X-Query

When you specify a query in the X-Query window, you must always provide server, database, collection and query expression.

Start of instruction setTo specify an X-Query

  1. In the Server text box, specify the name of the server on which you want to execute your query.

  2. In the Database text box, specify the name of a database of the above server in which you want to execute your query.

  3. In the Collection text box, specify the name of a collection in the above database in which you want to execute your query.

  4. In the query area below the above text boxes, specify the query expression using Tamino's X-Query language. See X-Query User Guide and X-Query Reference Guide in the Tamino XML Server documentation for detailed information.

    The sorting sequence specified with the instance descriptor is not applied in the X-Query window. In the X-Query window, you can specify your own sorting sequence in the query expression (for example, with the sortby clause).

    You can now execute the query as described below. See Executing an X-Query.

Creating a New X-Query

When you create a new query, any information in the query area is deleted.

Note:
The result of the previous query is not overwritten until you execute the new query.

Start of instruction setTo create a new X-Query

  1. From the File menu, choose New.

    Or:
    Press CTRL+N.

    Or:
    Choose the following toolbar button:

    New

    A dialog box appears asking whether you want to save the currently displayed query.

  2. Choose either the Yes or No button.

    When you choose the Yes button and the current query has not yet been saved in a file, the Save As dialog box appears. See Saving an X-Query below.

    The query area is now empty.

  3. Specify a query expression and execute the query.

Executing an X-Query

When you have specified a query and want to display the result, you have to execute the query.

You can search for both XML instances and non-XML instances. Two different types of query are available for these two types of instances and they are executed using different commands (see below).

Depending on the type of query different information is shown in the navigation tree:

  • XML Query
    The ino:id is shown for fragments and non-XML instances. For XML instances, the ino:id and/or instance descriptor is shown.

  • Non-XML Query
    The ino:docname is shown for XML and non-XML instances. When ino:docname is not available for an XML instance, the ino:id is shown.

The result contents are shown in different ways, depending on the type of query:

  XML Query Non-XML Query
XML Instance or Fragment The XML code with ino:id is shown in plain view and tree view. The XML code without ino:id is shown in plain view.
Non-XML Instance The attributes ino:id and ino:docname are shown in plain view and tree view. The content of a non-XML instance is shown.

For a list of all non-XML formats that can be displayed with the Tamino X-Plorer, see the description of the main application window's Content pane.

When you execute a query for a database which has not yet been connected, the Connect dialog box appears and you have to specify all required logon information. See Connecting to a Tamino Database.

Each new query that is executed overwrites the previous result pack. If you want to save your result pack, see Saving the Current Result Pack.

Note:
The result of a query may provide both XML and non-XML instances.

Start of instruction setTo execute an XML query

  • From the File menu, choose Execute XML Query.

    Or:
    Or press CTRL+Q.

    Or:
    Choose the following toolbar button:

    Execute XML

    The result is now shown on the Result pane.

Start of instruction setTo execute a non-XML query

  • From the File menu, choose Execute Non-XML Query.

    Or:
    Or press CTRL+E.

    Or:
    Choose the following toolbar button:

    Execute non-XML

    The result is now shown on the Result pane.

Note:
A portion of X-Query code can be executed by selecting the portion and pressing the Execute button or pressing Ctrl+Q.

Saving an X-Query

You can save a query in a file in your file system.

As long as a query has not yet been saved, the name "NewQuery" is shown in the title bar of the X-Query window. When you save this query for the first time, the Save As dialog box appears in which you have to specify the name of the file in which the query is to be saved in your file system.

Start of instruction setTo save an X-Query under a new name

  1. From the File menu, choose Save As.

    The Save As dialog box appears. File name and extension are automatically provided.

  2. Optionally: specify another file name and extension.

  3. Select the path in which you want to save the file.

  4. Choose the Save button.

Start of instruction setTo save a named X-Query

  • From the File menu, choose Save.

    Or:
    Or press CTRL+S.

    Or:
    Choose the following toolbar button:

    Save

    The existing query in your file system is updated.

Opening a Saved X-Query

You can open a query which you have previously saved in your file system.

Start of instruction setTo open a saved X-Query

  1. From the File menu, choose Open.

    Or:
    Press CTRL+O.

    Or:
    Choose the following toolbar button:

    Open

    A dialog box appears asking whether you want to save the currently displayed query.

  2. Choose either the Yes or No button.

    When you choose the Yes button and the current query has not yet been saved in a file, the Save As dialog box appears. See Saving an X- Query above.

    The Open dialog box appears.

  3. Select the file containing the desired query.

  4. Choose the Open button.

    The previously saved query is now shown in the X-Query window.

Selecting Text

In order to cut, copy or delete text, you have to select it. To do so, use the standard techniques for the platform on which you are currently working.

You can also select all text at once (see below). In this case, the selection depends on the area which has previously been selected in the query window.

You can select text in the following areas:

  • in the query area (including the text boxes for server, database, and collection),

  • in the result contents of the Result pane (plain view only).

Start of instruction setTo select all text

  1. Select the required area in the query window.

  2. From the Edit menu, choose Select All.

    Or:
    Press CTRL+A.

Cutting, Copying and Pasting Text

You can cut, copy and paste any text in the query area. You can also copy from the result contents of the Result pane (plain view only).

This feature uses the Windows clipboard which may also contain information from another application. Thus, it is also possible to copy an entire query from or to another source.

Start of instruction setTo cut the selection and transfer it to the clipboard

  • From the Edit menu, choose Cut.

    Or:
    Press CTRL+X.

    Or:
    Choose the following toolbar button:

    Cut

    The selection is deleted at its original position and is copied to the clipboard.

Start of instruction setTo copy the selection to the clipboard

  • From the Edit menu, choose Copy.

    Or:
    Press CTRL+C.

    Or:
    Choose the following toolbar button:

    Copy

    The selection remains at its original position and is copied to the clipboard.

Start of instruction setTo paste the content of the clipboard

  1. Place the insertion point at the position at which you want to paste the cut or copied information.

  2. From the Edit menu, choose Paste.

    Or:
    Press CTRL+V.

    Or:
    Choose the following toolbar button:

    Paste

    The previously cut or copied text is inserted at the insertion point.

Deleting Text

You can delete any text in the query area.

Start of instruction setTo delete the selection

  • From the Edit menu, choose Clear.

    Or:
    Press DEL.

    The selection is deleted immediately. You are not asked to confirm the deletion.