Graphics Reference
In-Depth Information
Tip
Titan is documented and made available for download on GitHub at
https://github.com/thinkaurelius/titan/wiki .
Creating and Populating a Graph Database
Theoriginalsourcedatausedinthisexamplewasformattedforeasyreading
by humans rather than computers, so the authors have done the
time-consuming parsing for you and exported the result in GraphML
format. Before proceeding, download the compressed data file from this
book's companion website and extract it for importing into Titan. It's a large
data set, so expect that it will take more time to download than other files in
thisbook.Ifyouhaven't already doneso,youwillalsoneedtodownload and
install Titan. The examples in this chapter were used with version 0.4.4.
Once you have the data, you are ready to create the database. The first step
inmakinganewTitandatabaseistoconfigureitsstorage.Totakeadvantage
of advanced text search on select properties, it is also important to configure
an index for Lucene or Elastic Search. Create a productdb.properties
file with content similar to the following, altering the two directory paths as
appropriate. You will use this to initially create the database and to reopen
it each time after.
storage.backend= local
storage.directory= storage
storage.index.search.backend= lucene
storage.index.search.directory= storage/lucene
The next step is to define schemas for the data. In Titan this is simply
a matter of defining any properties of nodes and links that will be used,
indicating which should be indexed for fast lookup. The quickest way to do
this is to use a script. Create the following makeproductdb.groovy file,
entering the first line listed to open the database. File paths in the script
shouldbemodifiedtoreflectactuallocations.Relative pathswilltypicallybe
evaluated relative to the Titan bin directory.
graph = TitanFactory.open( 'productdb.properties' )
Search WWH ::




Custom Search