Table of content:
Note that each Wiki page has its own table of content about the details on that page.
Table of content:
Note that each Wiki page has its own table of content about the details on that page.
This is an old revision of the document!
Queries for conventional databases are usually expressed in a special query language, such as SQL.
Gellish does not require a special query language, because queries can be expressed in Gellish in a nearly identical way as expressing ordinary statements. In a natural language there is no big difference between the structure of sentence that expresses a question and a sentence that expresses a statement. That same principle is applied in Gellish. If you know how to express ideas in Gellish, then you only need to know the few additional rules that are explained below in order to be able to write queries for a Gellish enabled database. The response to a Gellish Query consists of Gellish expressions. This implies that Software Agents and database systems should have import and export capabilities for Gellish expressions.
There are basically two kinds of questions:
Both kinds of queries and the responses to them are discussed below.
A question about things that are unknown has as basic structure:
For example, the basic question could be: ‘which objects are classified as a pump?’
In Gellish such a question should be expressed as if it was a positive statement about an individual object, while specifying as intention 'query' (instead of 'assertion') unknown object(s) an specifying as name of the unknown a term that is unknown in the dictionary. For example, the name 'what'. The above query is expressed in Gellish English (ignoring the contextual facts) as is illustrated in Table 1:
|Intention||Name of left hand object||Name of relation type||Name of right hand object|
|query||what||is classified as a||pump|
Table 1, A simple Gellish English query
The example question asks for the object(s) that have a relation of type “is classified as a” with the concept “pump”. Instead of the term 'what' there are several other names of unknowns in ordinary language available, but any unknown name is allowed. Recommended names are: what-1, what-2, etc. to indicate an unknown object that is wanted to be identified and about which information is provided in one or more expressions. Gellish English has defined the following reserved terms:
The use of the intention 'query' or 'question' indicates that an expression should be interpreted by a computer as a question, whereas the unknown terms are free text. Note that when an unknown indicates an aspect, then not just the possible name of an aspect should be retrieved, but also its value and if applicable the unit of measure for the value.
Full Gellish expressions use unique identifiers (UID's) to identify objects. Objects that are unknowns are identified in Gellish by UIDs in the reserved range 1-99. Thus, the use of a UID in that range means that the object is unknown and is requested. The name of the unknown is then free, although for human readability the use of one or more of the above reserved terms is still recommended.
A query expressions are in fact a template for the resulting expressions, where knowns are filled-in on places of unknowns. So a search engine should find all the expressions that fit in the template. Thus, the result of a query will be a list of expressions that satisfy the query template.
If the query asks for objects that are classified by a concept that is defined in the dictionary, then the inheritance rules for the subtype-supertype hierarchy in the taxonomy imply that not only objects that are directly classified by that concept satisfy the question, but also objects that are classified by one of the subtypes of that concept. For example, the question:
- what is classified as a pressure gauge?
- what is classified as a pressure gauge or as one of its subtypes?
This means that the result of such a query is a list that includes not only things that are directly classified as pressure gauge, but also for example as a manometer, because according to the Gellish Taxonomic Dictionary a manometer is a kind of a pressure gauge. So the result of the above query could be for example:
Software that enables Gellish querying should therefore be able to automatically generate the answer as a list of things that are either classified by a concept or are classified as one of its subtypes. Furthermore, the software should indicate when objects are classified more than once.
Additional constraints are expressed in a similar way as expressing the aspects of an individual object, whereas the intention has the value 'query specification'. The names and UIDs of the unknowns should be used again where applicable to indicate that it is the same object about which an aspect is specified. For example:
|Name of left hand object||Name of relation type||Name of right hand object||UoM|
|query||What||is classified as a||pump|
|query specification||What||has as aspect||Capacity of pump|
|query specification||Capacity of pump||is classified as a||capacity (volume flow rate)|
|query specification||Capacity of pump||has on scale a value grater than||30||dm3/s|
Table 2, Example of a query with constraints
In this example the names that start with a capital character are individual unknowns. The name 'Capacity of pump' indicates the capacity of any potentially found pump and that capacity is classified and should have a value greater than 30 dm3/s. This example also illustrates that the query expresses a pattern that should be satisfied by the search engine, because we can replace the term 'what' by the name of a pump, such as P-101, and replace its capacity by 'cap of P-101'. Then the above expressions would have been a specification of information about pump P-101, apart from the statement about the quantification of the capacity.
A specification may also include a denial. This means that things are search because they have some aspect, but because they do not have such an aspect. Such a denial can be expressed in the ‘intention’ of the expression (see the paragraph on ‘Requests and Responses’ below) by extending the intention with the term 'denial', thus becoming 'query denial' and 'query specification denial'. It indicates whether the statement should be the case or not be the case for the found things.
If more than one unknown object is included in a query, then the query should make a distinction between the different unknowns. This should be done by using different names and unique identifiers (UID’s).
For example, a query about the capacities of the found pumps would be identical to the above query, except that the name of the aspect ‘capacity of pump’ should be replaced by the term ‘which aspect’. However, in addition to that the unknown aspect shall also have a UID that differs from the UID of the unknown object. So the query would become:
|Intention||UID of left hand object||Name of left hand object||UID of fact||UID of kind of relation||Name of kind of relation||UID of right hand object||Name of right hand object|
|query||1||what||101||1225||is classified as a||130206||pump|
|query specification||1||what||102||1727||has aspect||2||which aspect|
|query specification||2||which aspect||103||1225||is classified as a||550318||capacity (volume flow rate)|
Table 3, Example of a query with multiple unknowns
Such a query could result for example in the following answer:
|Intention||Name of left hand object||Name of kind of relation||Name of right hand object||Unit of measure|
|assertion||P-1||is classified as a||reciprocating pump|
|assertion||P-1||has aspect||capacity of P-1|
|assertion||capacity of P-1||is classified as a||capacity (volume flow rate)|
|assertion||capacity of P-1||has on scale a value equal to||45||dm3/s|
Some queries include constraints about different kinds of objects. For example, we may ask for pumps as well as compressors. In such a case the different unknown objects should be distinguished to enable to specify that one constraint is applicable to objects of one kind and the other constraint is applicable to objects of another kind. For example, if we ask for pumps as well as for compressors, then the result should be things that are classified either as a pump or as a compressor, and the query is not about objects that are classified both as a pump and as a compressor (such facts should not be present in a database). The distinction between the two objects can be made by giving them a different UID. The example query about pumps and compressors should therefore be expressed as follows (leaving away the other UID's):
|UID of left hand object||Name of left hand object||Name of relation type||Name of right hand object|
|1||what||is classified as a||pump|
|2||what||is classified as a||compressor|
Table 4, Example of a query about different object types
Questions sometimes have a structure that is difficult to distinguish from statements. In spoken language they are usually distinguished by the tone, the melody of the sentence. In written English, a question mark is then added. Gellish English supports such kinds of expressions by enabling the explicit expression of the ‘communication intent’ of the author of the expression. This enables to express various intentions, such as:
Such an ‘intention’ indicates whether or to what extent something is the case according to the author of the expression. In other words, it indicates the extent to which the relation expresses what is the case or it indicates the status of the process to become the case. This is called the “intention” of the proposition. So, an intention is a quality of an expression that thus can express not only that a proposition is a question, but it can also express that it is a confirmation, a probability, etc. For example, the flowing table contains a proposition with the intent to be a questions and the same proposition that is qualified as a confirmation:
|Name of left hand object||Intention||Name of relation type||Name of right hand object|
|P-1||question||is classified as a||pump|
|P-1||confirmation||is classified as a||pump|
Table 5, Examples of expressions about intentions of a proposition, without unknown objects
This means that basically the same proposition can be used for different purposes in a communication. This implies that the above two lines express two different opinions about the same fact.
The ‘author’ and the moment of creation of a proposition such as a question or an answer can be added as auxiliary facts to a Gellish English expression. A Gellish Database table has dedicated columns for that: the date of creation of a fact (a date/time) and the originator (of the latest change). As there are many ways in which a date/time can be expressed, a Gellish Database uses the standard ‘[http://support.microsoft.com/kb/q180162/ 1900 date system]’ convention to make the date/time computer interpretable. A user interface may present it in any notation.
|Name of left hand object||Intention||Name of relation type||Name of right hand object||Date of creation of fact (start of validity)||Date of latest change||Author (of latest change)||Source or reference|
|P-1||question||is classified as a||pump||20 Aug'07||20 Aug07||John Doe|
|P-1||confirmation||is classified as a||pump||20 Aug07||20 Aug}07||Andrew||my database|
Table 6, Example of a question and confirmation by an explit author at a particular date, without unknown objects
Continue with Gellish Semantic Web