wiki:query_builder_doc

Query Builder tool

You can find the Query Builder tool online at

https://ismi-dev.mpiwg-berlin.mpg.de/static-ismi/ng2-query-builder/index.html

Currently the tool can select objects

  • by type
  • by ID
  • by the value of an attribute containing a string
  • by the value of an attribute containing a string ignoring diacritical marks
  • by the value of an attribute being between two numbers
  • by their relation

These queries can be combined together and the resulting list of objects can be displayed as a table.

Example query

In this simple example we will find all witnesses of titles by Nasir al-Din al-Tusi.

Start

The tool starts with an option to select the first query step:

For the first step you can select one of two query types in the select box:

  • "object type is" to select all objects of a type e.g. PERSON or WITNESS
  • "object ID is" to select one object with a certain ISMI_ID e.g. 47316 for Tusi

Show all persons

If we select "object type is" in the first select box we get a second select box with all the possible object types like ALIAS, CODEX, COLLECTION and more.

In the second box we select "PERSON" which automatically runs a query to select all PERSON objects:

Under "Query result" we see that we have selected 2217 PERSON objects.

Because this are a lot of objects the system will not show all of the objects automatically. If you really want to see all 2217 objects you can click on the "show results" button but your browser may crash or take a while to display so many objects in a table.

Select persons by name

Now we want to narrow down the list of persons to only those that have "tusi" in their name.

For this we click on the "add step" button.

This gives us a second row of query steps with a query type select box.

In the first select box we select "Attribute (contains normalized)" to do a search that ignores diacritical marks in arabic transliterations.

Then we get a second select box with the names of all attributes we can search in and a text field for the text we want to search for.

Here we select the attribute "name_translit" in the second select box and type "tusi" in the text field and click on the "Submit" button.

This runs the query to narrow down the list of all persons to only those that have "tusi" in their transliterated name field:

Under "Query result" we see that now only 11 PERSON objects are selected.

Since this are not too many objects the selected persons are displayed automatically in a table below.

Above the table you can change how many results are shown on the page at a time ("Show XX results per page") and you can change which attributes of the object will be shown as columns of the table ("Columns: XX").

You can browse through the pages of the table by clicking on the "Next" and "Previous" buttons or by selecting one of the numbered pages in the pager element directly above the table.

In the table we find the row containing Abū Jaʿfar Naṣīr al-Dīn Muḥammad ibn Muḥammad ibn al-Ḥasan al-Ṭūsī and we note that the corresponding ismi_id is 47316.

Select one person by ID

Now we click "add step" again to add another step to select only Nasir al-Din al-Tusi to find only his works.

In the first select box we select "Object ID is" and we enter "47316" in the input field.

This runs the query to narrow down the list of persons to the one person with the ID 47316:

Under "Query result" we see that now only 1 PERSON object is selected.

Select texts written by a person

Now we click "add step" again to add another step to select all texts written by Tusi.

In the first select box we select "Relation type is".

In the second select box we get a list of all relations of the Tusi object in the database like "roles of person" or "works of".

When we select "works of" in the second select box the system runs the query to find all texts that were created by Tusi:

Under "Query result" we see that now 94 TEXT objects are selected.

Select one text by ID

Browsing through the titles we note Tusis "Ṭaḥrīr al-Majisṭī" with the ismi_id 99451. We want to find the witnesses of this title.

Now we click "add step" again to add another step to select only this title.

In the first select box we select "Object ID is" and we enter "99451" in the input field.

This runs the query to narrow down the list of texts to the one with the ID 99451.

Under "Query result" we see that now only 1 TEXT object is selected.

Select witnesses of texts

Now we click "add step" again to add another step to select the witnesses of the text.

In the first select box we select "Relation type is" again and in the second select box we select "witnesses to title".

This runs the query to find all witnesses that are exemplars of the previously selected text:

Under "Query result" we see that now 3 WITNESS objects are selected.

Relations with "funny" names

You will note that some relation types show up in the list prefixed with "<-". These are the reverse relations. These are needed because the relations are directed and you have to select the direction of the relation.

The "normal" relation is read from the last selected object, in this case a PERSON to the next possible objects. To find the birthplace of the PERSON you would select "was_born_in" and you would get the relation PERSON-[was_born_in]->PLACE going from a PERSON to a PLACE.

To get the texts written by Tusi we needed the relation TEXT-[was_created_by]->PERSON which goes from a TEXT to a PERSON. But in our case we want to start at the PERSON not the TEXT so we have to select the reverse relation "<- was_created_by".

Last modified 6 years ago Last modified on Feb 15, 2016, 11:07:00 AM

Attachments (7)

Download all attachments as: .zip