View Source

h2. Overview

Both *Structure* and *Patterns* look for entities in the knowledge base. However, while *Patterns* provides a set of frequently used queries where the search criteria are already pre-defined for you, *Structure* offers greater flexibility and very comprehensive query definition options. In broad terms, *Structure* can be used for two kinds of search tasks:

* To look for entities through their names, part of their names, or entity type (i.e. entity look-up).
* To create patterns by choosing entity types, names and relations between them. If you want to make your search even more specific, you can use additional entity characteristics.

The *Structure* screen provides three fields where you define your query: *Lookup for patterns where*, *Attribute restrictions*, and *Interested in*.

h2. Lookup for patterns where

The *Lookup for patterns where* field builds the frame of your query pattern. A custom pattern can be represented as:

The entity X is in RELATION with an entity Y, which can be also in another RELATION with another entity Z. Additional restrictions can be specified over X, Y and Z to further narrow the search. This way, each custom pattern is defined by the RELATIONS between the selected entity types and the restrictions over their names.

h3. Query patterns for entity X

By default the *Lookup for patterns where* field is set only for the entity X. It consists of three boxes with drop down lists and an optional search box.

h5. "X is a" box

In the *X, is a* box you specify the entity X by selecting the entity type you are interested in. Here the default is set to "Entity" - the most general ontology class.

If you click the drop down list, you see the taxonomy tree representing the ontology. To make your query pattern more specific, just select one of the classes or subclasses of the ontology, for example "Organization".

!_Images for reuse^Structure_Xis.png|border=1!

h5. "which name" box

In the *which name* box you further restrict your query by specifying the name of the entity you have selected. This is also a drop down list box and the default is set to: "is unknown".

!_Images for reuse^Structure_which_name.png|border=1!

If you choose this value, the results will contain either all entities for the type organizations or all documents containing entities for organizations.

However, if you have even some partial information about the name of the entity, you can select one of the comparison operators from the drop down list:

* _is exactly_ (case-sensitive) - if you know the exact name of the entity, including exact upper- / lowercase spelling
* _equals ignore case -_ if you know the name of the entity but you are not sure about upper- / lowercase spelling
* _starts with / ends with_ - if you know the first/last name (or letters) of the entity
* _contains_ - if you know only some part of the name
* _is < (before) / is > (after)_ - if you have a time interval

h5. Empty search box

When you select a comparison operator an empty search box opens and you can type the name of the entity there.

!_Images for reuse^task.png!
*Find specific companies, for example all companies that have Apple in their name.*

!_Images for reuse^to_do.png!
Select "Organization" as your entity type and _contains_ as your comparison operator and type "Apple" in the search box.

!_Images for reuse^Structure_empty_search_box.png|border=1!

(/) When you type the name of the selected entity, you need to enter only strings of letters, numbers, spaces, underscores, and any value specifier ("*"). Otherwise you get an error message.

!_Images for reuse^Structure_which_name2.png|border=1!

If you are only interested in the entity X, you can continue defining your query in the *Attribute restrictions* field. However, if your task requires more complex information, you can further restrict the query by adding other entity types and their relations.

h3. Further restricting the query pattern

h5. "and X….Y" box

To further restrict the entity pattern, go to the *and X….Y* box and from the drop down list select the type of relation between the entity X and another entity Y, applicable to your query.

This opens another section in the *Lookup for patterns where* field. It provides a new set of options for restricting the entity Y like the ones described for the entity X. Here, you specify the name of the entity Y and whether you are interested in its relation to a third entity.

(/) Alternatively, you can specify the relation of the entity X to the third entity Z by selecting the entity X from the drop down list.

When the last section in the *Lookup for patterns where* field becomes available, you can specify the name of the entity Z in the same way as described for the entity X. This finalizes the frame of your custom query pattern.

!_Images for reuse^task.png!
*Find all People in the knowledge base that have a Position in specific companies, for example companies with Apple in their name.*

!_Images for reuse^to_do.png!
Enter all restrictions as shown in the following custom query pattern:

* *X, is a* Person, *which name* is unknown.
* *and X* hasPosition *Y*.
* *Y, is* *a* Job Position *which name* is unknown.
* *and Y* withinOrganization *Z*.
* *Z, is a* Organization *which name* contains "Apple".
* *Interested In:* X, Y, and Z.
* *Search for* Entities.

h2. Attribute restrict where

If there are any attributes available for the entities, you can narrow your custom pattern further in the *Attribute restrict where* field.

The section for each entity consists of two boxes with drop down lists and an optional search box. The first drop down list contains the attribute options available in the ontology. The second one consists of the comparison operator and by default is also set to "is unknown". When you choose another operator, an empty search box becomes available and you can type restrictions on the entity name there.

!_Images for reuse^Structure_attribute_restrictions.png|border=1!

For example, you may be interested in job positions held before 2009 in organizations which name contains "Apple" and where the number of employees is more than 100.

h2. Interested in

In the *Interested in* field you identify which of the entities in your custom query pattern, should be included in the results. You do this by selecting an option from the drop down list.

In the case of the query pattern "Find all People in the knowledge base that have a Position in companies with Apple in their name", you can retrieve all:

* people (entity X)
* people and job positions (entities X and Y)
* people and organizations (entities X and Z)
* people, job positions and organizations (entities X, Y, and Z)

h2. Search for

In the *Search for* field you choose whether to look for entities in the knowledge base or for the set of documents where entities matching your query pattern occur. This field works in the same way in both the *Structure* and the *Patterns* search paradigms.

* To get the set of all documents matching your custom query, click !_Images for reuse^Documents_button.png! . Results are presented with some metadata and snippets in [*Document Query Result*|Document Query Result#_Document Query Result].
* To get the set of all entities matching your custom query, click !_Images for reuse^Entities_button.png! . Results are presented with hyperlinks to their entity description in [*Entity Query Result*|Entity Query Result#_Entity Query Result].
* To further customize your query by entering more restrictions directly in SeRQL or SPARQL, click !_Images for reuse^TryFreeQuery_button.png! .