Method and system for generating a user interface adaptable to various database management systems5550971Abstract A method and system for generating a user interface in a database management system. A semantic data model is used to describe a database in terms of data types stored in the database and functional types that describe relationships between the data types stored in the database. The system dynamically queries the data model to generate a graph of the data model itself. These queries are initiated by the system without user intervention. The user selects a node on the graph that causes the data model to be searched again to determine the name of the node selected, one or more types of relationships associated with the node selected and one or more instances of the relationships associated with the node selected. This information is used to generate a form containing a plurality of blanks. A user enters a query constraint into one or more of the blanks and the database is searched for instances of data meeting the query constraints. The data model is easily adaptable to reflect changes in the architecture of the database. The user interface reflects those changes without the need to recode or recompile the software that generates the user interface. Also because the data model is semantically the same throughout, the same functions can query the data model itself as well as the data represented by the data model. Claims What is claimed is: Description TECHNICAL FIELD
______________________________________
/*============================
class DOT {
/*============================
/*
This class is to be used for implementing
any DOT in any of the data model layers,
i.e., any DOT object in the data model is
a C++ instance of this generic class. To
instantiate a class of objects in the
data model which is an instance of another
class in the data model involves the
creation of a new instance of the DOT C++
class. Then this new C++ object is added
to a list (*instanceset) of objects
maintained by the C++ object which is
defined as the type of the new C++ object.
Therefore, each C++ object which
is defined in the data model as a class
type includes a list of all the C++
objects which are considered as instances
of the type. In this way, it is possible
to build a data model having objects that
are simultaneously both class types and
instances of other class types even
though all objects in the data model are
implemented using the same C++ class.
/*
public
/* constructor & destructor */
DOT (char *name);
.about.DOT( );
/* create an instance of the class called
nameDOT */
DOT *Instantiate(char *nameDOT);
/* create an instance of type DO for this DOT,
i.e., corresponding to some data in a
database. There is a "model level" checking:
this can be done only if the modeling layer is
2 (i.e., if this DOT is in the model layer) */
void Instantiate (DO *adataobject);
DO *Instantiate (List *attributes, List
*types, List *values);
/* tell if iddot is an instance of this DOT */
int HasInstance (DOT *iddot);
/* return all the DOTs related to this one by
a FOT*/
DOT *RelatesTo(FOT *idFOT);
DOT *RelatesTo(char *nameFOT);
/* get all the FOTs related to this DOT (using
the DOT either as domain or range, or only as
domain, or only as range). The optional
argument gives the FOT type of which the
selected FOTs must be instances */
FOTset *GetAllRelated FOTs (FOT *typeFOT =
NULL);
FOTset *GetDomainRelated FOTs (FOT *typeFOT =
NULL);
FOTset *GetRangeRelated FOTs (FOT *typeFOT =
NULL);
/* apply a function (= FOT) to this DOT, taken
as argument. This method stands for the "meta-
function" that has to be provided by the model
in order to be used as functional data-model
*/
virtual QResult *ApplyFunction(FOT *idFOT);
virtual QResult *ApplyFunction(char *nameFOT);
/* add a FOT to the fots.sub.-- from, fots.sub.-- to sets */
void AddFotFrom(FOT *fot);
void AddFotTo(FOT *fot);
/* get all the instances of this DOT */
virtual DOTset *GetInstances( );
/* get the type of this DOT */
DOT *GetType( );
char *GetName( );
DOT *GetOID(char *name, int modelayer = -
1);
private
/* name of the DOT */
char *name;
int modelayer;
/* O:meta-meta-model, 1:meta-model, 2:model,
3:data */
/* pointer on the set of instances of this DOT
*/
DOTset *instanceset;
/.about. pointer on the DOT type of this DOT */ DOT
*type;
/* lists of related FOTs */
FOTset *fots.sub.-- from;
FOTset *fots.sub.-- to;
______________________________________
The following C++ class, DO, is a subclass of the DOT class. The class DO is used for instances of objects found in the data layer of the data model. These objects are simply instances of the data model classes defined in the model layer and are not themselves data classes. Although the objects in the data layer could be created as instances of the DOT class described above, it was found to be more efficient, especially in terms of space overhead, if they were created as instances of a subclass of class DOT. In addition, instances of the type scalar are not created as instances of the type DO but are included as data members of the instance of class DO to which the scalars relate. This allows for first access to attributes of an object.
______________________________________
/*============================
class DO: private DOT {
/*============================
/*
This subclass of DOT is for instances of
objects in the data layer. The main
differences between the DO class and the
DOT class are: objects of the data layer
cannot be instantiated, (the inherited
GetInstances method must be made inaccessible);
the ApplyFunction method is
implemented differently for FOTs that
connect to SCALAR values (e.g. ATTRIBUTES).
Because instances of the SCALAR
type are not created as instances of the
type DO, the following rules apply:
1. SCALAR values are never shared
by several objects (e.g., the value of an
attribute).
2. In queries, SCALAR values are
never referred to independently. They
are always referred to as attribute
values of some complex object.
3. Scalar values are always
attached to a complex object (e.g., as an
attribute of an instance of the ENTITY
"CLIENT").
/*
public
/* constructor & destructor */
DO(char *name = NULL);
DO(List *attnames, List *attypes, List
attvalues);
.about.DO( );
/* get the type of this DO */
virtual DOT *GetType( );
/* if idFOT is of type "ATTRIBUTE"; the function
works on its private attribute data */
virtual QResult *ApplyFunction(FOT *idFOT);
virtual QResult *ApplyFunction(char *nameFOT);
/* attribute management */
int AddAttribute(char *name, char *type);
int AddAttributeVal(char *name, void *value);
char *GetAttribute(char *attname);
/* some other management methods can be added */
private
/* in addition to the data member of DOT, these
lists represent;
the names & types of attributes attached to the
DO (lists of char *);
the scalar values that are attached as attributes
to the DO.
/*
List *attributesnames;
List *attributestypes;
List *attributesvalues;
______________________________________
The following class DOTset is used to define a set of DOT instance. For example, each object found in the four layers of the data model are defined by a set of DOTs. Thus there is an instance of DOTset for the meta-meta-model layer, for the meta-model layer and for the model layer. These sets provide an additional way to search the layers of data model.
______________________________________
/*============================
class DOTset {
/*============================
/*
This is for representing sets of DOTS.
There is an instance of this class for
each modeling layer. Also, operators
that produce several DOTs return C++
instances of such sets. It is convenient
to define an iterator on such set class.
This could be inherited from iterators
defined on standard C++ List class, if
some standard library is to be used for
implementing DOTsets.
/*
public
DOTset(List *listdots = NULL);
DOTset( );
int AddDOT (DOT *dot);
int RemoveDOT (DOT *dot);
private
List *listDOTs;
______________________________________
The class QResult is used to store the results of queries on the data model itself.
______________________________________
/*============================
class QResult {
/*============================
/*
Used to represent any result set of
queries as well as of ApplyFunction
methods. The result of applying a
function (FOT) to a DOT is always repre-
sented in the form of a set of values,
which is itself implemented in the form
of a list. Each value can be: a) a
string of characters (e.g., querying
about attributes); b) a DOT (e.g.,
querying complex DOT-like entity
objects); c) both (e.g., querying about
model.sub.-- layer DOTS like "Patent").
*/
public
QResult (List *listDOT = NULL, List *liststring
= NULL);
.about.QResult( );
AddDOT(DOT *dot);
AddDOTList(List *listDOT);
AddString(char *string);
AddStringList(List *liststring);
List *GetDOTs( ) {return listDOT;}
List *GetStrings( ) {return listDOT;}
private
List *listDOT;
List *liststring;
______________________________________
The following class FOT is used to represent the relationships that exist between the various data types defined in the database model. As with the DOT class described above, all relationships in the database model are created as C++ instances of this class. However, other classes of relationships in the data model can be created that are instances of the FOT class by creating a new instance of the C++ FOT class and adding the new FOT class to a list (instanceset) of the FOT which is considered to be the class type for the new FOT instance. In this way, classes of relationships can be created in the data model that are both classes and instances of more a general FOT class in a standard object-oriented programming language.
______________________________________
/*============================
class FOT {
/*============================
/*
This class is for implementing the FOTs
in C++. Similar to the DOT class, it is
used for FOTs of the meta-meta model,
meta-model or model layers. Some methods
(GetInstances, RemoveInstances) need to
distinguish when instances are of type
ATTRIBUTE, e.g., if this FOT is the
attribute "INVENTOR.sub.-- NAME," then instances
of it are not separate objects--they are
components of the domain DO (as well as
present in the range DO for the inverse
relationship). On the other hand, if
this FOT is the association "FILES.sub.-- PAT"
between DOT "Client" and DOT "PATENT,"
then its data model instances will be C++
instances of a subclass FO.
*/
public
FOT(DOT *domaindot DOT *rangedot, char *name,
char *inverse = NULL);
FOT( );
void Instantiate(DOT *domaindot, DOT *range-
dot,
char *name=NULL, char *inverse = NULL);
DOT *GetDomainDOT( );
int IsDomainDOT(DOT *dot);
DOT *GetRangeDOT( );
int IsRangeDOT(DOT *dot);
FOTset *GetInstances( );
int RemoveInstances( );
int RemoveInstances( );
FOT *GetType( );
char *GetInverse( ); {return inversename}
char *GetName( ); {return name}
FOT *GetOID(char *name, int modelayer = -1);
int IsAttribute( );
private
char *name,
char *inversename;
int modelayer,
/* O:meta-meta-model, 1:meta-model, 2:model,
3:data */
/* pointer on the set of database model
instances of this FOT */
FOT set *instanceset;
/* pointer on the type of this FOT */
FOT *type;
/* pointer on the domain DOT */
DOT *domaindot;
/* pointer on the range DOT */
DOT *rangedot;
______________________________________
In the same way that objects in the data layer are instances of the class DO, the relationship between the DO objects are of a type FO. In addition, instances of class ATTRIBUTE are stored as data members in the instance of class DO to which it relates.
______________________________________
/*============================
class FO {
/*============================
/*
C++ instances of this class are used for
connecting C++ instances of the class DO
(i.e., complex objects in the data
layer). C++ instances of this class are
considered as data model instances of
FOTs from the model layer.
For space optimization reasons, this
class is intended to have numerous
instances since it represents the actual
data stored in the remote database. This
class does not inherit from the C++ FOT
class.
*/
public
FO(DO *domaindot, DO *rangedot);
FO( );
.about.
DO *GetDomainDO( );
DO *GetRangeDO( );
private
DO *domaindo;
DO *rangedo;
______________________________________
The following class is used in the C++ implementation to store a set of FOTs. The class is used for storing among other things the FOTs that describe the meta-meta-model, meta-model and the model layers of the data model. Each layer of the data model is described by an instance of this class in the same way as the data objects found in the meta-meta-model, meta-model and model layers of the data model are set forth in three instances of the class DOTset.
______________________________________
/*============================
class FOTset {
/*============================
/*
This is for representing sets of FOTS.
There is an instance for each modeling
layer. Also, operators that produce
several FOTs return C++ instances of such
sets.
*/
public
FOTset(List *listfots = NULL);
.about.FOTset ( );
int AddFOT(FOT *fot);
int RemoveFOT(FOT *fot);
private
/* not needed if the class inherits from a
List type */
List *listFOTs;
______________________________________
Set forth below is a complete listing required to implement a data model in the C++ programming language. As can be seen, the data model is created as a collection of sets of FOT and DOT data types that describe the contents of the layers of the data model. A data model is created by a supervisory user of the database management system who prepares a short computer program that initializes a model with data corresponding to the data stored in the remote database. If a change is made to the architecture or schema of the database, it is a simple matter to update the various DOTsets or FOTsets that define the data model in order to reflect this change in the user interface.
______________________________________
/*============================
class DataModel {
/*============================
/*
This class represents a complete data
model. Note that the data layer is not
explicitly represented. Data is only
accessible through GetInstances methods
or ApplyFunction methods.
*/
public
DataModel( );
.about.DataModel( );
DOTset *GetDOTModel( );
DOTset *GetDOTMetaModel( );
DOTset *GetDOTMetaMetaModel( );
FOTset *GetFOTModel( );
FOTset *GetFOTMetaModel( );
FOTset *GetFOTMetaMetaModel( );
private
DOTset *model.sub.-- dotlayer,
DOTset *meta.sub.-- model.sub.-- dotlayer,
DOTset *meta.sub.-- meta.sub.-- model.sub.-- dotlayer,
FOTset *model.sub.-- fotlayer,
FOTset *meta.sub.-- model.sub.-- fotlayer,
FOTset *meta.sub.-- meta.sub.-- model.sub.-- fotlayer,
______________________________________
FIG. 3 is a flow chart showing the steps performed by the present invention to create a database model corresponding to the model shown in FIG. 2. The method begins at a step 100, wherein a new instance of the DataModel class is created. At a step 102, the standard data types of the meta-meta-model layer and the meta-model layer are added. Every data model includes DOT and FOT types in the meta-meta model as well as the ENTITY, SCALAR, ASSOCIATION and ATTRIBUTE types in the meta-model layer and STRING and NUMERIC types in the model layer. The following computer code shows in greater detail how the steps 100 and 102 are actually implemented in the C++ programming language. This code is executed each time a new instance of the DataModel class is created.
______________________________________
/* ----- Constructor of the class DataModel */
DataModel::DataModel( )
/* create an empty set of DOT for the meta-
meta-model */
meta.sub.-- meta.sub.-- model.sub.-- dotlayer=new DOTset( );
/* create and add a Dot called "DOT" to meta-
meta-model */
DOT *metadot = new DOT("DOT");
meta.sub.-- meta.sub.-- model.sub.-- dotlayer.fwdarw.AddDOT(metadot);
/* create an empty set of FOTs for the meta-
meta-model */
meta.sub.-- meta.sub.-- model.sub.-- fotlayer = newFOTset( );
/* create and add the meta-meta-type "FOT" as
a recursive relationship from "DOT" to "DOT"
*/
FOT *metafot = new FOT(metadot,metadot, "FOT",
"FOT-");
meta.sub.-- meta.sub.-- model.sub.-- fotlayer.fwdarw.AddFOT(metafot);
/* initiate the meta-model layer */
/* allocate an empty DOT set to the meta-model
*/
meta.sub.-- model.sub.-- dotlayer = new DOTset( );
/* create and add a DOT "Entity" as instance
of "DOT" */
DOT *entitydot=metadot.fwdarw.Instantiate ("Entity");
meta.sub.-- model.sub.-- dotlayer.fwdarw.AddDOT(entitydot);
/* create and add a DOT "Scalar" as instance
of "DOT" */
DOT *scalardot = metadot.fwdarw.Instantiate-
("Scalar"); meta.sub.-- model.sub.-- dotlayer.fwdarw.AddDOT-
(scalardot);
/* allocate an empty FOT set to the meta-model
*/
meta.sub.-- model.sub.-- fotlayer = new FOTset( );
/* create and add a FOT "attribute" as instance
of "FOT", between Entity and Scalar */
FOT *attributefot = metafot.fwdarw.Instantiate-
(entitydot, scalardot, "attribute");
meta.sub.-- model.sub.-- fotlayer.fwdarw.AddFOT(attributefot);
/* create and add a FOT "association" as
instance of "FOT" between Entity and Entity */
FOT *associationfot = metafot.fwdarw.Instantiate (entity-
dot, entitydot, "association");
meta.sub.-- model.sub.-- fotlayer.fwdarw.AddFOT(associationfot);
/* create model layer */
/* create empty sets of DOTs and FOTs for the
model */
model.sub.-- dotlayer = new DOTset( );
model.sub.-- fotlayer = new FOTset( );
/* initialize by creating and adding standard
DOTs "String" and "Numeric" */
DOT *stringdot= scalardot.fwdarw.Instantiate-
("String");
model.sub.-- dotlayer.fwdarw.AddDOT(stringdot);
DOT *numericdot = scalardot.fwdarw.Instantiate-
("Numeric");
model.sub.-- dotlayer.fwdarw.AddDOT(numericdot);
} /* end of the creation-initialization of the
model */
______________________________________
After step 102, the model layer is populated with entities corresponding to the tables in the remote database in a step 104. For each entity to be added, a new instance of the DOT class is created and given a name. A pointer to the new DOT is added to the instanceset of the type of new DOT that is created. Then, a pointer to the new DOT is added to the model-dot-layer list of DOTs that describes the model layer of the data model. At a step 106, the model layer of the data model is populated with the relationships that exist between the various entity types added in step 104. This is accomplished by first creating a new instance of the FOT class and giving the new FOT a name. Then, the name of the domain DOT and range DOT for each new relationship is determined. Next, the name of the new FOT instance is then added to the instanceset of the type of FOT added. The name of the new FOT is then added to the fotfrom list of the domain DOT and to the fotsto list of the range DOT. Finally a pointer to the new FOT is added to the model.sub.-- fotlayer list that describes the relationships between the entities located in the model layer. After creating the model layer of the database model, the data layer must be populated. The data layer does not contain every instance of a particular data type stored in the remote database but is instead populated by the results of queries completed when the user queries the remote database. The results of a query are returned as lists to the query language processor 22 shown in FIG. 1 and stored in the local cache database 26. Once the local cache database is populated, any further searching that involves narrowing of the queries does not involve searching the remote database directly, but instead can be limited to searching the local cache database. The local cache database is populated in a step 108 by first creating an instance of a DO type for each object returned by the remote database query. The attribute names and values are stored as data members of the new DO. Then, a pointer to the new DO is added to the instanceset of the DOT in the model layer corresponding to the type of the new DO added. After the data objects have been created in the local cache database, the relationships between the objects are added in a step 110. This is accomplished by creating instances of the classes defined in the model layer of the data model. First a new instance of the FO class is created. Then a pointer to the domain and range DOT is determined from the results of the remote database query. The domaindo and rangedo data members of the new FO are created. A pointer to the new FO is added to the fotsfrom data member of the domain DO and a pointer to the new FO is added to the fotsto data member of the range DO. Once the meta-meta-model layer, the meta-model layer and the model layer of the database model have been created and populated, the present invention interrogates the model to determine how the user interface should be generated. FIG. 4 shows an example of a user interface generated by the present invention. In the preferred embodiment of the present invention, the user interface is graphical. However, the present invention could also be used to generate a text-based user interface if desired. The configuration of the user interface displayed on the video display 16 is determined by the semantic data model. In the present embodiment of the invention, the graphical user interface includes a window 150 that visually illustrates the model layer of the semantic data model by displaying each instance of the ENTITY-type objects defined in the data model as well as the instances of the ASSOCIATION type that relate one ENTITY type to another. The instances of the ATTRIBUTE types that relate the various instances of ENTITY type to the instances of SCALAR type could also be displayed on the user interface but are hidden in order to avoid cluttering the window 150 and overwhelming the user with unimportant information. Also displayed by the user interface is a window 154 that is generated when a user selects either one of the ENTITY objects with a mouse pointer or other selection device 152. Once an ENTITY object has been selected, the present invention interrogates the data model to produce the window 154. The window includes the name of the ENTITY object selected in a box 156, the FOT meta types that are connected to the object selected (if any) in boxes 158,162 and the instances of the FOT meta types in an area 160 and 164 of the window. To search the remote database, a user types query constraints in the areas 160 and 164 to locate specific instances of the ENTITY type selected. For example, to retrieve all patents filed by "U S WEST", the user types "U S WEST" to the right of the name attribute. The query processor then creates a database query in the remote database's own language to retrieve patent entries in the database that are related to a client entry having the name "U S WEST". As described above, the results of queries to the database are used to populate the data layer of the database model that is stored in the local cache database in the manner shown at steps 108 and 110 of FIG. 3. Any further searching that narrows the query criteria is performed on the local cache database. FIG. 5 is a flow chart showing the steps performed by the present invention to generate a graph of the model layer of the data model. In order to generate a corresponding graph of the model layer, the model layer must be dynamically interpreted. Consequently, internal dialogs are required to query the model layer to determine the structure of the model layer. In order to generate the graph and query the data model, a small set of low level access functions must be provided. These functions include: getting the type of a DOT object in the data model; getting all the instances of a DOT object in the data model; getting the type of a FOT object in the data model; getting all instances of a FOT object in the model; getting the domain and range of a FOT object and getting all related FOTs that extend from an object and extend to and from a FOT object in the data model. Given the description of the C++ classes used to implement the data model, the implementation of these functions is considered well within the scope of one skilled in the art of computer programming. The first step of producing the graph of a database model is to query the meta-model layer of the database model for all instances X of type DOT. A first query is issued at step 200 as follows: QI:(DOT:X)>>Y. In the database model shown in FIG. 2, step 200 returns ENTITY and SCALAR. Next, at step 202, the meta-model layer is queried for all instances of Y-type FOT that are connected to X. A second query is issued as follows: Q2:(DOT:X:.sub.--.FOT:Y)>>X,Y. Using the data model example, step 202 returns ASSOCIATION and ATTRIBUTE. In order to generate the graph, all instances of the Xs (ENTITY and SCALAR) are needed to create nodes of the graphical network and all instances of the Ys (associations and attributes) are needed in order to create the edges of the graph. A third query is generated in order to access the node/edge information from the data model, Q3:(X:X1:.sub.--.Y:A X2:)>>X1, A, X2. Here, two queries of the type Q3 are generated: one for each pair (X,Y) generated above at steps 200 and 202: Q3.sub.-- 1: (Entity:X1:.sub.-- attribute:A AX2:.sub.--)>>X1,A, X2 Q3.sub.-- 2: (Entity:X1:.sub.-- association:A X2:.sub.--)>>X1,A,X2. In other words, Q3 is a "query template" that is pre-coded and that will be instantiated depending on the values of X and Y found before for this meta-model. The query Q3.sub.-- 2 produces in turn the following triples X1,A, X2 for our example: (Client,files.sub.-- pat, Patent) (Client, in.sub.-- litig, Litigation) (Litigation, involves.sub.-- pat#, Patent). These triples are then interpreted as triples (node1, edge, node2) when displaying the graph on a display. All instances, X1, that are instances of type X are determined at step 204. Referring to FIG. 2, this step produces CLIENT, PATENT, STRING and LITIGATION. At step 206, for each Y found in step 202, all instances Y1 of type Y that are connected to the instances X1 are determined. In the example shown, step 206 produces NAME, FILES PAT, IN LITIGATION, and INVOLVES PAT#. Next, the domain and range for each Y1 object are determined at step 208. In summary, the following internal dialog is generated, pre-coded with meta-level queries or query templates: Execute Q1: (DOT:X)>>X Build a list of values: Lx, with the results for X For each instance of X in Lx, Execute Q2: (DOT:X:.sub.--.FOT:Y)>>Y Build a list of values: Lxy, with the results for that correspond to this value of X For each instance of X in Lx, For each instance of Y in Lxy for this X, Generate and Execute Q3: (x:X1:.sub.--.Y:A AX2:)>>X1,A,X2 Build a list of triples Lt with the results. After step 208, enough information is provided by the data model to generate a graph of the model layer using the objects X1 and Y1. The graph is generated whereby all the objects X1 are shown as nodes of the graph and all the objects Y1 are shown as edges between the nodes. In the preferred embodiment, some precoded filter instructions may be included to remove those instances which are of type ATTRIBUTE or SCALAR types in order to avoid generating a cluttered graph. These filters are precoded into the software that queries the database model as follows: Execute Q1: (DOT:X) & (X# Scalar)>>X Build a list of values: Lx, with the results for X For each instance of X in Lx, Execute Q2: (DOT:X:.sub.--.FOT:Y) & (Y #attribute)>>Y In fact, for the sake of more flexibility, the pre-coded queries or query templates of the internal dialogs do not explicitly appear in the program code, but are stored in a file accessible by a user interface designer. The designer can then modify this file in order to bring the required modifications to the queries of the dialog (e.g. filter out "Scalars" and "attributes"). In other words, the internal dialog as actually coded looks like the following: Execute query: Q1(X) Build a list of values: Lx, with the results for X For each instance of X in Lx, Execute query: Q2(X,Y) Build a list of values: Lxy, with the results for Y that correspond to this value of X For each instance of X in Lx, For each instance of Y in Lxy for this X, Generate and Execute query: Q3(X,Y,X1,A,X2) Build a list of triples Lt with the results, where Q1, Q2, Q3 are query names or query identifiers (QID). The file of associated modifiable queries is structure in the following way: Q1(X)=(DOT:X)>>X Q2(X,Y)=(DOT:X: .FOT:Y)>>Y Q3(X,Y,X1,A,X2)=(X:Xi:.sub.--.Y:A X2:)>>X1,A,X2, where each entry is a couple (QID, parameterized query). The link between the queries in the file and their identifier (QID) in the. program is made at run-time during an initialization phase that reads the content of the query file. In our example, this file has actually been modified in order to filter out Scalars and attributes, as follows: Q(X): (DOT:X) & (X#Scalar)>>X Q2(X,Y): (DOT:X:.sub.--.FOT:Y) &(Y# attribute)>>Y Q3(X,Y,X1,A,X2): (X:X1:.sub.--.Y:A X2:.sub.--)>>X1,A,X2. The displayed graph which corresponds to the resulting list of triples Lt will be like the one in our previous example, without the "la .sub.-- firm" attribute and without the "String" Scalar DOT. Once the graph of the database model has been displayed, the user interface waits for a user to select an object. FIG. 6 shows the steps taken by the present invention to create a form corresponding to an object selected. At step 250, the model layer of the data model is queried to determine an instance of type ENTITY corresponding to the icon a user selected. Next, at step 252, the model layer is queried to determine all the kinds of relationships Y.sub.o that concern the entity "CLIENT" For example, if the user has selected the CLIENT object, this step returns ATTRIBUTE and ASSOCIATION. At step 254, the model layer is queried to determine the name of the instances Y in each Y.sub.o related to X. Again, assuming that the user has selected the client object, these steps operate to find the CLIENT object in the data model and return NAME, FILES.sub.-- PAT and IN.sub.-- LITIGATION associated with the client object. The pre-coded internal dialog for generating a form corresponding to an icon selected by the user is as follows: Execute query: (Entity:X.Y)>>Y Build a list of values: Ly, with the results for Y For each instance of Y in Ly, Generate and Execute the query: (X:.sub.--.Y:A)>>A Build a list of values: La, with the results for A In our example, the first query, (Entity:Client.Y), will return all the kinds of relationships that concern the Entity "Client": attribute, and association. Then, for each of these kinds of relationships, we get the name of their instances for Client: (Client:.sub.--.attribute:A)>>A returns La1={name, address, phone}, and: (CLient:.sub.--.association:A)>>A returns La2={files, in.sub.-- litig}. As described above, the queries are not actually explicitly coded in the program, but in an associated file where they can be modified by the user interface designer. Only their identity, or QID (e.g., Q1, Q2, etc.) appears in the code of the program. These results are sufficient for dynamic display of a form for Client, that contains: Client: attributes name: address: phone: associations files: `in.sub.-- litig:. At step 256 the form is then displayed showing the name of the icon selected, the names of the Y.sub.o objects (ASSOCIATION and ATTRIBUTE) and the Y objects (NAME, FILES PAT and IN LITIGATION) that are instances of the Y.sub.o objects. These are displayed as shown in window 154 of FIG. 4. Once the form has been displayed, it is determined if the user has entered one or more query constraints at step 258. It is then determined if the software is operating in a "local" mode at step 262. If the system is operating in a local mode, the data to be searched have been previously stored in the local cache database. If not, the remote database is searched. Assuming the System is not operating in a local mode, the query constraints are translated into the remote database's own query language at a step 262. The remote database is then searched at a step 264 and the results are loaded into the local cache database at a step 266 as described above. If the system is operating in a local mode and the data to be searched are already located in the local cache database, the local cache database is searched for all instances of data meeting the query constraints. In either case, the search results are displayed to the user at a step 270 in any of a number of ways which will be apparent to those skilled in the art. Preferably, a scrollable window is opened allowing the user to browse the results of the search. The user interface can adapt dynamically to any database model at run-time rather than at compile-time. For instance, if a user could dynamically modify the model or even the meta-model, then in the same session it would be possible to display/update the corresponding user interface representations (e.g., a new form). This is because the user interface dynamically acquires information about the meta-model and the model through the above-described internal dialogs. In order to write the query templates that are pre-coded in the internal dialogs, only the meta-meta-model has to be initially known. The internal dialogs can then determine everything in the data model. There is an exception, however, if it is desirable to "hide" some specific types, such as "attributes" and "Scalar" in the previous example, then meta-types "Scalar" and "attribute" need to appear in the queries of the internal dialogs. The language approach to access and select meta-data gives the flexibility and the accuracy needed for accommodating any special user interface need, e.g., in our previous example, select all DOTs but not "Scalar" and Scalar instances, and not attributes for entities. Only the internal dialog needs to be changed, and such changes do not require re-compiling the user interface component. Changing the queries of the dialog requires editing the file where they are. This file is only read and the queries interpreted at run-time. In order to access meta-data as well as data, only one language is used by the user interface components. Therefore, the internal dialogs are the only interface between user interface and the model/data. This is more powerful than having two distinct languages, one for building the user interface representations (reading meta-data) and the other for the user queries (reading data). Indeed, this distinction may not hold true anymore in advanced user-interfaces: the user interface representations may depend on the data (e.g., the user interface may "decide" to customize the presentation of the data resulting from a user query, depending on the form of the data, like a "tree of icons" for a family tree), and conversely, the user may want to query the meta-model (e.g., in natural language interfaces, where the user may ask questions like "what are the attributes of an entity like Client"). The above-described features have been made possible due to the capability of the internal dialogs to query both data and models ("higher-order" language) as well as to the underlying modeling paradigm (semantic modeling with explicit meta-model). The language used for implementing the internal dialogs must satisfy some properties in order for the internal dialogs to be able to interface user interface units and data/model units. The language must provide some surrogates (variables) for the manipulation of any object, either atomic objects (like a simple number for serial.sub.-- number values) or complex objects (like a patent or a litigation). SQL is an example of query language that does not fully provide this feature, i.e., there is no variable that can represent tuples or tables. The access to data is made through functions. Functions are used to represent any relationship between data. For example, getting the name of a Client that is represented by the variable X is achieved by evaluating the function name of X (i.e. name(X)). Similarly, obtaining the Patents filed by a Client X results from the evaluation of the functional expression: files(X), where files is a functional version of the "files" relationship between Client and Patent. The functions should be able to return sets: files(X) actually may return a set of objects of the type "Patent". The functions can be composed: serial.sub.-- number(files(X)) returns the set of the serial numbers of all the patents filed by the Client X. The language must be declarative in its selection statements, that is, it should not provide control statements like those found in programming languages (e g iterative control statements "for . . . ", "while . . . ", "do. . . ", conditional statements "if . . . then" or branching statements "call . . . ", "execute . . . ", "go to . . . ", "return . . ."). In other words, it should express selection statements that specify some conditions or constraints without specifying how to execute, enforce or check them. For example, selecting Patents filed after January 90 by U S WEST should not require to specify more than the conditions (X is a Client) AND (name (X) is "U S WEST") AND (file.sub.-- date (files (X)) after 90/01/01) . Answering this query is like finding all the possible values for X that satisfy these conditions. The query for this example can be written as follows: (Client:X.name="U S WEST") & (X. files. file.sub.-- date >90/01/01)>>X. The language must have the capability of processing queries where variables are used in place of functions. For example, F(X) is a functional expression where the function is in variable F and the argument in variable X. In the same way as X may be considered as a result for queries involving such expressions, F can also be used to get function names as results. For example, the condition: (X is a Litigation) AND (F(X) ="Burlington") will select all the pairs of values (X,F) satisfying the condition. That is, in our example, all the Litigation instances that refer to "Burlington", and how they refer to "Burlington" (either as defendant.sub.-- name, or as court.sub.-- name, or as court.sub.-- location: all these attributes names are possible instances of the function variable F). In this example, the query can be coded as: (Litigation:X.F="Burlington")>>X,F. The query to get all the attributes of the entity Litigation is: (Litigation: .sub.-- attribute:A)>>A) where A is a variable for functions of the type attribute. The query language must also be able to query the meta-data as well as the data. For a full expression power, this capability should rely on two features: 1) an explicit modeling of the meta-model; and 2) higher order capability. The meta-model must use the same modeling constructs as does the schema or model (e.g. if the schema is an object-oriented model, then the meta-model should also be described using the same object-oriented constructs). This is a modeling requirement rather than a query language requirement. The idea behind a consistent meta-modeling is that queries over data are expressed using terms and functions of the schema (or model). Therefore, queries over the model itself (or schema) are likely to be expressed using terms and functions of the meta-model. Therefore, if we want to use the same language for data and meta-data querying, there should be a similar relationship between meta-model and model as between model and data (i.e., the model is considered as "data" for the meta-model, and same functional concepts are used for meta-modeling as for modeling). For example, getting all the entities associated to Client can be done by evaluating the functional expression: Entity:Client.association, where the meta-type "association" is used as a function and the entity "Client" as an object in the argument. As mentioned above, higher-order capability allows the use of variables in place of function names. This is another way to query meta-data. Meta variables (or higher-order variables) should not be restricted to function names. They should be usable at any place of an expression: (i) object types (e.g. in the expression: (X:Client.name="John"), the variable X captures the type (meta-type) of the entity "Client" (i.e., Entity in our example)), (ii) function types (e.g. in the expression: (Patent.sub.--.X:inventor.sub.-- name), the variable X captures the type of the function "inventor.sub.-- name", that is "attribute"), (iii) range of functions (they are also object types. For example, in the expression: (Client:.sub.-- address X:.sub.--, X) captures the type of the attribute address, that is "String"). In order to satisfy the requirements above, the conditional (selection) part of they query should be processed as a set of constraints. For example, query language processing uses constraint solving techniques over finite domains. A query language that observes the properties previously described requires certain features of the data model. First, the data model must provide a functional interface to all the relationships. All relationships between objects must be usable as functions. In other words, the data model must present a functional interface to the query processor. Such an interface can be represented using a unique, meta-function "f compute". f.sub.-- compute(object,function)->{set of objects or values}. f-compute applies a given function to an object and returns a set of objects or values (containing a single object or value if the function is monovalued). The expression f.sub.-- compute(object,function) is equivalent to the expression function(object). The function argument can be any semantic relationship between objects: attribute, association, inheritance, composition, etc., depending on the semantic concepts used in the data-model. The object argument can be any object at data level, but also any object type (class) (e.g. f.sub.-- compute-(Patent,attribute) returns all the attribute types of the entity Patent, i.e. {Numeric, String}), or any meta-type (e.g. f.sub.-- compute(Entity, FOT) returns all the meta-types connected to the meta-type Entity by a FOT, i.e. {Scalar}). This extension of the functional interface to the meta-model and meta-meta-model is greatly facilitated if they are also represented as functional models. The objects in argument (and in result) of functions must be uniquely identified. These identifiers (Objects IDs) are directly manipulated by the functions as arguments and results. An object-oriented model satisfies the object-identity property. For example, the semantic model described above can be implemented using an object-oriented representation system, ROCK. ROCK is a C++ library that provides OIDs in the form of C++ pointers. In other words, object identifiers (OIDs) and atomic values of type Scalar (e.g., numbers, character strings) constitute the domains and ranges of any function. The types and meta-types also should have OIDs. Second, the data model must also provide explicit representation of the meta-model using the same constructs as the model. The meta-model is represented in quite a similar way as the model, from an implementation point of view. In other words, there is the same relationship between the meta-model and the schema (or model) as between the schema and the data. That is, an element of the model (say Client entity) plays two roles: (1) it is a type for the Client instances (data level), and (2) it is itself an instance of the meta-type Entity (meta-model level). Most commercial object-oriented knowledge representation systems do not allow for a representation of an object that can be used both as a class and as an instance. For example, ROCK is in this category. With such systems, the implementation of a data model and meta-model can go around this limitation by associating two objects for each type of model and each meta-type of the meta-model: in our example, to the entity Client is actually associated a pair <instance .sub.-- view, class.sub.-- view>. When Client has to be considered as an "object" of type Entity (e.g., in the meta-level expression: Entity:Client.attribute) then the instance.sub.-- view is used and operated. When Client has to be considered as a type (e.g., type of the variable X in the expression: Client:X.name="U S WEST") then the class.sub.-- view is used. The objects of the data level contain only instance.sub.-- views, while the objects of the meta-meta-model level contain only class.sub.-- views (they are instances of nothing). For the query processor to perform efficiently (especially with regard to meta-level capabilities), the implementation of a data model must also provide the following functions in its functional interface: (f1) type.sub.-- of.sub.-- DOT (object)->object (f2) instance.sub.-- of.sub.-- DOT (object)->{set of objects} (f3) type.sub.-- of.sub.-- FOT (function)->function (f4) instance.sub.-- of.sub.-- FOT (function)->{set of functions} (f5) FOT.sub.-- from (function->object (f6) FOT.sub.-- range (function)->object These function prototypes must be defined in order to perform on any modeling layer. These modeling layers are denoted by: ML1 for data layer, ML2 for schema or model layer, ML3 for meta-model layer, ML4 for meta-meta-model layer. The fact that the modeling layers are implemented in a similar way greatly favors this multipurpose feature. The "object" arguments are represented by Objects IDs, the "function" arguments may be simply function names, or also OIDs if the function is represented itself as an object in the implementation. The functions do not need to perform on Scalar instances (i.e., numeric values or character strings). In the function f1, the term "object" may denote an object (a DOT) of any of the modeling layers ML1, ML2, ML3. It returns the type of object (in layers ML2, ML3 OR ML4). The function f2 returns all the instances of a given type. The object argument is in ML2, ML3 or ML4. The resulting objects are in ML1, ML2 or ML3. The function f3 returns the meta-function (meta-type) of a given function, e.g., type.sub.-- of.sub.-- FOT(files) returns association. The argument is a FOT in ML2 or ML3. The result is a FOT in ML3 or ML4. The function f4 returns all the functions instances of a given meta-function, e.g. {files, in.sub.-- litig, patent} is the result of instance.sub.-- of.sub.-- FOT (association). Its argument can belong to ML3 or ML4. Its results belong to ML2 or ML3. The function f5 returns the domain-DOT of a given function. For instance, FOT.sub.-- from (files) returns Client. The argument and the result belong to the same layer among ML2, ML3 or ML4. The function f6 returns the range-DOT of a given function. For instance, FOT.sub.-- range (files) returns Patent. The argument and the result belong the same layer among ML2, ML3 or ML4. The following C++ listing shows how the data model is actually queried to generate the user interface or to search the local cache database that has been populated with objects. The function "ApplyFunction" is applied to an object (either of type DOT or type DO). The function takes as its argument the name of a FOT type that is connected to the DOT or DO object. The function returns the instances of the domain and range objects connected to the DOT or DO object. For instance, CLIENT.fwdarw.ApplyFunction (ASSOCIATION) returns PATENT and LITIGATION. Similarly if the function is applied to an instance of the DO class such as U S WEST.fwdarw.ApplyFunction (FILES.sub.-- PAT) would return all the patent applications filed by U S WEST that are stored in the local cache database. The function allows the FOT objects to be used as functions to query the data model itself or the local cache database. For example, applying the FOT "IN LITIGATION" to the DO "U S WEST" returns all instances of type LITIGATION that are either in the range or the domain of the type of the U S WEST object. As can be seen from the following code, the "ApplyFunction" function works by checking to see the type of the object on which the function is applied is the domain of the FOT (idFOT) that is applied to the object. If so, the fotsfrom list of the type of object on which the FOT is applied is read to find all the FOTs that are instances of type idFOT (i.e., the type of the FOT applied to the object). The function then gets all the instances of DOTs (or DOs) that are in the range of the FOTs that are of type idFOT. For example, CLIENT.fwdarw.ApplyFunction ("ASSOCIATION") gets the type of CLIENT (i.e., ENTITY) and gets the domain of ASSOCIATION (also ENTITY). Then the function gets all the FOTs in the fotsfrom list of the CLIENT DOT (i.e., FILES.sub.-- PAT and IN.sub.-- LITIGATION and NAME). Only FILES.sub.-- PAT and IN.sub.-- LITIGATION are of type ASSOCIATION; therefore, only the ranges for these FOTs are returned (PATENT and LITIGATION). If the type of object on which the function is applied is not in the domain of the FOT, the same method is used except the fotsto list is used and all instances that are in the domain of the FOTs are returned. For example, LITIGATION.gtoreq.ApplyFunction (ASSOCIATION) returns CLIENT and PATENT. There is also shown below a separate listing for the "ApplyFunction" function when it is applied to members of the class DO. A separate routine is used because certain data objects (instances of SCALARS and ATTRIBUTES) are stored as data members of the DO and not as separate objects. As was indicated above, this was done in the present embodiment of the invention solely for performance reasons (i.e., saving memory space). Otherwise the operation of ApplyFunction for the objects of class DO is nearly the same as that described above.
______________________________________
/* -----ApplyFunction method for class DOT */
QResult *DOT::ApplyFunction(FOT *idFOT);
{
this C++ function applies a data model FOT
to a DOT belonging to its domain. The result
is a set of DOTs belonging to its range.
*/
/* initialize as empty a temporary QResult
called dotset */
/* determine if the DOT on which we apply this
function (the "DOT of interest") is instance
of the domain DOT or in the range DOT of idFOT
*/
DOT *dotype = this.fwdarw.GetType( );
if (dotype = idFOT* .fwdarw.GetDomainDOT( ) ) {
/* if the DOT of interest is domain dot: */
/* for each FOT idfot in the set of FOTs
attached to this DOT (datamember fots.sub.-- from)
dot:
if idfot is an instance of idFOT then:
take the range DOT of idfot idfot.fwdarw.Get-
RangeDOT( )
add this range DOT to the result set
dotset dotset.fwdarw.AddDOT (idfo.fwdarw.GetRangeDOT( ))
*/
}
if (dotype == idFOT.fwdarw.GetRangeDOT( )) {
if the DOT of interest is range dot: */
/* for each FOT idfot in the set of FOTs
attached to this DOT (datamemberfots.sub.-- to)do:
if idfot is an instance of idFOT then:
take the domain DOT of idfot (idfot.fwdarw.
GetDomainDOT( ))
add this domain DOT to the result set
dotset
*/
}
/* return the set of DOTs dotset to the caller */
return dotset;
/* ----- ApplyFunction method for class DO */
QResult *DO::ApplyFunction(FOT *idFOT);
{
/* this C++ function applies as data model FOT to
a DO belonging to its domain. The result is a set
of DOs belonging to its range. In the program
above: clientdo1.fwdarw.ApplyFunction("FILES.sub.-- PAT") will
return the set of DOs (patentdo1, patentdo2)
*/
*/ initialize as empty a temporary QResult called
doset */
/* determine if the DO on which we apply this
function (the "DO of interest") is instance of the
domain DOT or in the range of DOT of idFOT */
DOT *dotype = this.fwdarw.GetType( );
if (dotype == dFOT.fwdarw.GetDomainDot( )) {
/* if the DO of interest is in domain dot: */
if (idFOT.fwdarw.IsAttribute( )) {
/* idFOT is a FOT of type "ATTRIBUTE" */
/* get the ATTRIBUTE value and put it in
doset: */
char *attval = this.fwdarw.GetAttribute(idFOT.fwdarw.
GetName( ));
doset.fwdarw.AddString(attval);
}
else {
/* idFOT is an FOT of any other type */
/* for each FO idfo in the set of FOs attached
to this DO (datamember fots.sub.-- from) do:
if idfo is an instance of idFOT then:
take the range Do of idfo (idfo.fwdarw.
GetRangeDO( ))
add this range Do to the result set
doset
*/
}
}
if (dotype == idFOT.fwdarw.GetRangeDOT( )) {
/* if the DO of interest is range dot: */
/* for each FO idfo in the set of FOs attached
to this DO (datamember fots.sub.-- to) do:
if idfo is an instance of idFOT then:
take the domain DO of idfo (idfo.fwdarw.*Get
DomainDO( ) )
add this domain DO to the result set
dotset
*/
}
/* return the set of DOs dotset to the caller */
return doset;
}
______________________________________
The benefit of the data model formed according to the present invention is that the same search primitives can be used to search any layer of the semantic data model from the meta-meta-model layer to the data layer. This is because each model layer uses the same semantic constructs. Therefore, by starting at any layer in the database model, it is always possible to determine the types of the objects in the layer above it as well as the instances of the objects in the layer below it using the same primitive routines described above. Furthermore, the database model is easily adaptable to changes that may occur in the remote database. By updating the model, the software which generates the user interface can dynamically be updated to reflect the change in the remote database without having to recode the entire program which generates the user interface. As can be seen, the present invention generates a graphical user interface in a way that is not dependent upon the query language or structure of the underlying database. The present invention utilizes the semantic database model to determine at run time how the graphical user interface should be generated. Therefore, there is no need to change the software that generates the user interface to reflect a change in the underlying data. For example, if a new field were to be added to the database, this new field could be added to the semantic database model. When the database model is queried, the new field would be discovered and automatically placed in the user interface. Thus, there is no need to recode or recompile the system that generates the user interface to reflect such a change in data. Similarly, the present invention can be used on virtually any database system. The graphical user interface will appear to operate in the same way regardless of the structure of the underlying database. Therefore, there is no need to train operators to use a new query language and new user interface for each database system used. While the preferred embodiment of the invention has been illustrated and described, it will be appreciated that various. changes can be made therein without departing from the spirit and scope of the invention.
|
Same subclass Same class Consider this |
||||||||||
