The config element

The config element is always root element in a .cphrase file. Its DTD-based definition is:

<!ELEMENT config (table|view|report|cascade|db_state)*>
<!ATTLIST config
          id CDATA #REQUIRED
          db CDATA #REQUIRED
          language CDATA #IMPLIED
          description CDATA #IMPLIED>
        

•  id is the identifier of the configuration. The folder and .cphrase and .py files associated with this configuration will all use this identifier.

•  db specifies how to connect to the underlying database. In stand-alone mode the actual database may not be built yet. If so, then launching NLIs will result in an error message reminding the administrator to build an SQLite database. The specific format of the db attribute is a text string that always starts with either postgresql:, mysql: or sqlite: followed by a connection string. In the case of SQLite, the connection string is simply the name of the database file. For example, db="sqlite:personal.db" specifies the local SQLite database.

To help, we have two databases running on a remote server that you should be able to connect to via the following database connection strings.

 mysql:user=readonly,password=db123,database=world,host=44.202.44.37,port=3306
 postgresql:dbname=northwind host=44.202.44.37 user=readonly password=db123 port=5432

Unfortunately these connection strings may not contain domain names in place of IP addresses. Note that if you are uncomfortable having the password as clear text in the connection string, you may access it as an environmental variable. Thus the following would work:

mysql:user=readonly,password=$WORLD_PW,database=world,host=100.26.31.103,port=3306
postgresql:dbname=northwind host=100.26.31.103 user=readonly password=$NW_PW port=5432
The recommended way to set these would be add the following to the begining of /root/start-cp.sh

export WORLD_PW=db123
export NW_PW=db123

Now that you have confirmed that you can access these databases, to connect to your own database, you must have a user account with a password on the remote database. You must also ensure that your database server allows for remote connections from your running server. Assuming this is achieved, configurations for remote databases require a connection string like the two example above to be supplied. These connection strings can be fairly complex, but they always start with the database engine (either postgresql or mysql) followed by a psycopg2 or pymysql compatible connection string.

•  language is an optional comma separated list of languages with the first language being the dominant one. Its default value is language="english". Since C-Phrase currently only supports Swedish and English, this could in its most complex form be language="swedish,english" which would mean that both English and Swedish would be covered, but paraphrases and messages would be in Swedish.

Within the config element, sub-elements represent tables, views, reports and then string processing directives in cascade. Finally the configuration might also contain a list of tuples within a db_state element that represent a database state.