User Tools

Site Tools


querying_a_gellish_english_database

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
querying_a_gellish_english_database [2020/03/11 13:01]
andries
querying_a_gellish_english_database [2020/03/11 14:06]
andries
Line 3: Line 3:
  
 Queries for conventional databases are usually expressed in a special query language, such as SQL. \\ 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 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 replace knowns by unknowns ​according to the few additional rules that are explained below in order to be able to write queries for [[:​gellish_databases|Gellish enabled databases]]. The response to a Gellish Query consists of Gellish expressions as well, although ​selfwithstanding ​. This implies that Software Agents and database systems ​should ​have not only import and export capabilities for ordinary Gellish expressions,​ but also for Gellish queries.+Gellish does not require a special query language, because queries can be expressed in Gellish in the same way as expressing ordinary statements. In natural ​languages ​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 replace knowns by unknowns ​and comply with the few additional rules that are explained below in order to be able to write queries for [[:​gellish_databases|Gellish enabled databases]]. The response to a Gellish Query consists of Gellish expressions as well, although ​of course such responses can be displayed in any form in user interfaces. This implies that Software Agents and database systems ​might have not only import and export capabilities for ordinary Gellish expressions,​ but also for Gellish queries.
  
 There are basically two kinds of questions: There are basically two kinds of questions:
Line 12: Line 12:
 ====== 2. Questions about unknown objects ====== ====== 2. Questions about unknown objects ======
 A question about things that are unknown has as basic structure: A question about things that are unknown has as basic structure:
-  * the basic question: which object(s) have a relation of a particular type with another ​object? +  * the base question: which object(s) have a relation of a particular type with a known other object? 
-  * a specification of additional constraints ​that specify values for characteristics ​for the object(s) that are the result of the basic question+  * a specification of additional constraints for the unknown objects or for their characteristics.  
-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'​) and specifying as name of the unknown ​one of the reserved ​names for unknowns such as '​who'​ or '​what'​ or a term that starts with a question mark, such as '?-1'. The above query is expressed in Gellish English (ignoring ​the contextual facts) as is illustrated in Table 1, together with another example: ​\\+==== 2.1 Base questions ==== 
 +Examples of base questions in natural English are: ‘which objects are classified as a pump?​’ ​or 'who is general manager of Ford?'\\ 
 +In Gellish such questions are expressed as if they were positive ​statements ​about individual ​objects, while specifying as intention '​query'​ (instead of '​assertion'​) and specifying as names of the unknowns terms that starts with a question mark, such as '?​-person',​ or that starts with one of the reserved ​terms for unknowns such as '​who'​ or '​what'​ or 'which', optionally followed by any string. The above example queries are expressed in Gellish English (ignoring ​optional ​contextual facts) as is illustrated in Table 1\\
 ^Intention^Name of left hand object^Name of relation type^Name of right hand object^ ^Intention^Name of left hand object^Name of relation type^Name of right hand object^
 |query| ​ what |  is classified as a |  pump | |query| ​ what |  is classified as a |  pump |
-|query| ​ who|  is manager of |  Ford | +|query| ​ who|  is general ​manager of |  Ford | 
-//Table 1, Simple queries in Gellish English// \\ +//Table 1, Simple queries in Gellish English// ​ \\  
-The first example question asks for the object(s) that have a relation of type “is classified as a” with the concept “pump”. Because of the taxomic ​nature of Gellish this query should also trigger software to search for subtypes of '​pump'​. Thus, for example, it should also find things that are classified as a '​centrifugal pump' (which is defined as a subtype of '​pump'​. ​Instead ​of the term '​what'​ there are several other names of unknowns in ordinary language available, but any name that starts with question mark 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: + 
-  * what +The example question ​on the first line asks for the object(s) that have a relation of type “is classified as a” with the concept “pump”. Because of the taxonomic ​nature of Gellish this query should also trigger software to search for subtypes of '​pump'​. Thus, for example, it should also find things that are classified as a '​centrifugal pump' (which is defined as a subtype of '​pump'​)\\  
-  * who +The name of an unknown may consist of multiple terms. The first term of a multi term name of an unknown ​might be followed by the name of a kind, which should ​be interpreted by software ​as requirement ​for the kind that classifies the searched ​individual ​thing(s). For example the query: 'which pump is part of Unit-100'​ specifies two requirements in one expression, because it asks for individual things that are classified as a pump and that are parts of Unit-100.
-  * which ... +
-  * where +
-  * when +
-Note that the three dots may denote ​a kind that can be interpreted by software ​are requirements ​for the kind that classifies the searched thing(s).+
  
-The use of the intention '​query'​ or '​question'​ indicates that an expression should be interpreted by a computer as a question. Note that Gellish ​incudes ​the following rule: when an unknown ​indicates ​an aspect, then the software should not only retrieve the possible aspect(s) name(s), but also their values and if applicable the units of measures for the values. \\  +The use of the intention '​query'​ or '​question'​ indicates that an expression should be interpreted by a computer as a question. ​If a query is expressed in a Gellish expression format file, then the file header may include '​category=query',​ which specifies that the file contains one or more queries. Then the specification of the intention in a separate table column may be omitted, because the software should append that automatically.\\  
-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, possibly preceded by a prefix and a colon, such as '​unkn:'​. Thus, the use of a UID in that range means that the object is unknown and is requested. +Note that Gellish ​includes ​the following rule: when an unknown ​appears to be an aspect, then the software should not only retrieve the possible aspect(s) name(s), but also their values and if applicable ​it should also retrieve ​the units of measures for the values. \\  
-==== 2.Querying results and inheritance ==== +Gellish ​queries may specify ​unique identifiers (UIDs) to identify ​the known and also the unknown ​objects. The use of UIDs for known objects eliminate possible misinterpretations because of the use of homonyms (different objects with the same name). Objects that are unknowns ​should be identified in Gellish by UIDs in the reserved range 1-99, possibly preceded by a prefix and a colon, such as '​unkn:'​. Thus, the use of a UID in that range means that the object is unknown and is requested. 
-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. \\+==== 2.Querying results and inheritance ==== 
 +Query expressions are in fact a template for the resulting expressions,​ where knowns are filled-in on places of unknowns. ​Thus, a search engine should find all the expressions that fit in the template ​and 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: \\ 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? \\
Line 42: Line 41:
  
 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. 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.
-==== 2.Specification of additional constraints ====+==== 2.Specification of additional constraints ====
 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: \\ 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^ ^^Name of left hand object^Name of relation type^Name of right hand object^UoM^
Line 49: Line 48:
 | query specification |  Capacity of pump |  is classified as a |  capacity (volume flow rate) |  | 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| | query specification |  Capacity of pump |  has on scale a value grater than |  30 |  dm3/s|
-//Table 2, Example of a query with constraints//​+//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. ​ 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. 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.
-=== 2.2.1 Denials ===+=== 2.3.1 Denials ===
 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. 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.
-=== 2.2.2 Multiple unknowns ===+=== 2.3.2 Multiple unknowns ===
 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).\\ 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).\\
   * Note: Application software may hide the UID’s for users by adopting the convention to allow a dash and a sequence number to distinguish different objects and to translate that to a UID and a standard term.   * Note: Application software may hide the UID’s for users by adopting the convention to allow a dash and a sequence number to distinguish different objects and to translate that to a UID and a standard term.
Line 72: Line 71:
 |assertion|capacity of P-1 |has on scale a value equal to |45 |dm3/s| |assertion|capacity of P-1 |has on scale a value equal to |45 |dm3/s|
  
-=== 2.2.3 Constraints about different kinds of objects ===+=== 2.3.3 Constraints about different kinds of objects ===
 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. An example query about pumps and compressors should therefore be expressed as follows (leaving away the other UIDs): \\ 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. An example query about pumps and compressors should therefore be expressed as follows (leaving away the other UIDs): \\
 ^Intention^UID of left hand object^Name of left hand object^Name of relation type^Name of right hand object^ ^Intention^UID of left hand object^Name of left hand object^Name of relation type^Name of right hand object^
querying_a_gellish_english_database.txt · Last modified: 2020/03/11 14:06 by andries