If have reached this chapter you should now have DEX correctly installed in your computer and be ready to work in your development framework.
You have previously been introduced to DEX APIs and you should have chosen the language with which you feel most familiar. Here we will explain the complete construction of the HelloDEX application, including the construction of the database plus your first queries. For each step in the development we will show an example using all the available DEX programming languages; just focus on your chosen language.
Let's say Hello to DEX!
The first step is the creation of a directory for this project and the new sample application in your development environment. We will come later in the compile and run chapter with certain modifications in the project in order to be able to run DEX.
As part of the setup, you could create a text file with the name "dex.cfg" (or any other name, if you explicitly load it) in the same folder where the executable file will be. This configuration file will establish the default DEX settings. This is not a required task, because you can modify these settings directly in the source code using the
DexConfig class methods.
These are the most common settings that you may want to set in this file:
dex.license : This option is used to set your commercial license key. By default you do not need to provide a license key.
dex.io.cache.maxsize : Sets the maximum size for the cache (all pools) in megabytes. By default DEX uses all the available memory, leaving enough memory for other needs. If you are running several memory consuming applications at the same time you must consider adjusting this parameter.
dex.log.file : Changes the log file path. The default value is
dex.log.level : The level of detail provided by the log file can be modified with this option. Valid values are:
Debug. The default level is
Info. For HelloDEX you will not need to change this level.
dex.cfg file could, for instance, look like this one:
dex.license=Your-license-key dex.io.cache.maxsize=2048 dex.log.file=HelloDex.log
Your-license-key is the alphanumeric key provided by Sparsity Technologies when you acquire a license, the cache assigned for DEX is 2GB and the log file name is changed for
Following this guide we will construct HelloDEX step by step, if you want to go faster, once you are done with the set up you can download the complete application, copy it in your sample application and jump to the compile and run chapter. However we recommend following the guide for a complete understanding of each of the steps of creating a graph database and querying it.
Let's now finish the set up by moving from the directories to your development framework and start coding. Before starting to create your database you should first include references to DEX: this is mandatory.
#include "gdb/Dex.h" #include "gdb/Database.h" #include "gdb/Session.h" #include "gdb/Graph.h" #include "gdb/Objects.h" #include "gdb/ObjectsIterator.h"