2017-08-25: This step can be skipped with the current version of ConceptBase because the user interface now automatically connects to a ConceptBase server (CBserver). If it does not find a server, it tries to start it up on the fly. So, in most cases you do not need to bother with starting up a CBserver. Still, it is possible to start up a CBserver seperately and then start the user interface and connect to it.
Enter in the same command window the following command:
cbserver -port 5544 -d TutDB
You can also use the option -db instead of -d:
cbserver -port 5544 -db TutDB
In this case, ConceptBase will maintain the Telos source representation of all objects in the database directory TutDB. Your own definitions will go to the file System-oHome.sml, because that is the default database module when you log into a ConceptBase server.
An alternative to starting the ConceptBase server from the command line is
to start it from CBIva. To do so, start CBIva and the select the menu item
File / Start CBserver. A window like in figure 3 will pop up and
you need to change the following parameters:
Then press "OK" to let CBIva start a ConceptBase server with the specified parameters and connect to it.
Figure 3: Start CBserver from CBIva
2017-08-25: This step can also be skipped since CBIva auto-connects to a CBserver.
Select "Connect" from the File menu. An interaction window appears, querying the host name and the port number of the server you want to connect to. Enter the name of the host the ConceptBase server was started on and the port number specified by the -p parameter, then select "Connect". If you started the ConceptBase server on the same computer as CBIva, then use ’localhost’ as hostname.
Department in Class end
Figure 4: CBIva Telos Editor
Department in Class with attribute head: Manager end
Lloyd in Manager end Phil in Manager end Eleonore in Manager end Albert in Manager end Production in Department with head head_of_Production : Lloyd end Administration in Department with head head_of_Administration : Eleonore end Marketing in Department with head head_of_Marketing : Phil end Research in Department with head head_of_Research : Albert end Lloyd in Manager with salary LloydsSalary : 100000 end Phil in Manager with salary PhilsSalary : 120000 end Eleonore in Manager with salary EleonoresSalary : 20000 end Albert in Manager with salary AlbertsSalary : 110000 end
Michael in Employee with dept MichaelsDepartment : Production salary MichaelsSalary : 30000 end Maria in Employee with dept MariasDepartment : Administration salary MariasSalary : 10000 end Herbert in Employee with dept HerbertsDepartment : Marketing salary HerbertsSalary : 60000 end Edward in Employee with dept EdwardsDepartment : Research salary EdwardsSalary : 50000 end
Figure 5 shows the ConceptBase graph editor on object Employee. The attributes of Employee and its instances are expanded using the menu of the right mouse button clicked on Employee.
Figure 5: CB Graph Editor on object Employee
Employee with constraint salaryIC: $ forall e/Employee m/Manager x,y/Integer (e boss m) and (e salary x) and (m salary y) ==> (x <= y) $ end
QueryClass BossesAndEmployees isA Manager with computed_attribute emps : Employee; head_of : Department constraint employee_rule: $ (~head_of head this) and (~emps dept ~head_of) $ end
Figure 6 shows parts of the answer to the query BossesAndEmployees.
Figure 6: Display of answers of BossesAndEmployees
Select the option "Stop CBserver" from the "File" menu of CBIva. Afterwards, stop CBIva via the "Exit" option in the same menu. If you started the ConceptBase server with the -db option (or with source mode set to ’on’), then you find the sources of your definitions also in the directory TutDB, see file System-oHome.sml. Open this file with a text editor such as WordPad.