wiki:query_builder_doc

Version 9 (modified by casties, 8 years ago) (diff)

--

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

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 objects 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 "is_alias_name_of" or "was_born_in".

You will note that all relation types show up in the list a second time 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 need 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".

When we select "<- was_created_by" 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 witnesses of texts

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

We want to use the relation WITNESS-[is_exemplar_of]->TEXT but we have to use the reverse relation because we are starting from the TEXT.

In the first select box we select "Relation type is" again and in the second select box we select "<- is_exemplar_of".

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

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

Since there are more than 1000 results the result table is hidden at first. If you want to browse all the results click on the "show results" button.

Attachments (7)

Download all attachments as: .zip