-
Notifications
You must be signed in to change notification settings - Fork 8
OrientDB
-
Create an instance of OrientDB and an instance of the Analytics Toolkit from TAP Services >Marketplace. See Creating a service instance.
-
Bind your Analytics Toolkit instance with your OrientDB instance. See Binding Services to learn how to bind two instances.
-
Use Jupyter notebook to export data from the Analytics Toolkit to OrientDB. See Creating a Jupyter Notebook.
The export to OrientDB API creates an OrientDB database with the specified name and exports the Analytics Toolkit graph to the database. The API returns summary statistics for the exported data.
graph.export_to_orientdb(“DatabaseName”)
Importedgraph = ta.Graph(ta.OrientDBGraph(“DatabaseName”)
inspect the imported graph data
Importedgraph.vertices['input'].inspect()
importedgraph.vertices['input'].inspect()
importedgraph.edges['input'].inspect()
Example: Export data from the Analytics Toolkit in Parquet graph format to OrientDB database and import it back as a new Parquet graph
import trustedanalytics as ta
ta.connect(“atk_credentials_file”)
schema = [('viewer', str), ('profile', ta.int32), ('movie', str), ('rating', ta.int32)]
data1 = [['fred',0,'Croods',5],
['fred',0,'Jurassic Park',5],
['fred',0,'2001',2],
['fred',0,'Ice Age',4],
['wilma',0,'Jurassic Park',3],
['wilma',0,'2001',5],
['wilma',0,'Ice Age',4],
['pebbles',1,'Croods',4],
['pebbles',1,'Land Before Time',3],
['pebbles',1,'Ice Age',5]]
data2 = [['betty',0,'Croods',5],
['betty',0,'Jurassic Park',3],
['betty',0,'Land Before Time',4],
['betty',0,'Ice Age',3],
['barney',0,'Croods',5],
['barney',0,'Jurassic Park',5],
['barney',0,'Land Before Time',3],
['barney',0,'Ice Age',5],
['bamm bamm',1,'Croods',5],
['bamm bamm',1,'Land Before Time',3]]
frame = ta.Frame(ta.UploadRows(data1, schema))
frame2 = ta.Frame(ta.UploadRows(data2, schema))
graph = ta.Graph()
graph.define_vertex_type('viewer')
graph.define_vertex_type('film')
graph.define_edge_type('rating', 'viewer', 'film')
graph.vertices['viewer'].add_vertices(frame, 'viewer', ['profile'])
graph.vertices['film'].add_vertices(frame, 'movie')
graph.edges['rating'].add_edges(frame, 'viewer', 'movie', ['rating'])
graph.vertices['viewer'].inspect()
graph.vertices['film'].inspect()
graph.edges['rating'].inspect()
graph.export_to_orientdb(“DatabaseName”)
Importedgraph = ta.Graph(ta.OrientDBGraph(“DatabaseName”)
inspect the imported graph data
Importedgraph.vertices['viewer'].inspect()
importedgraph.vertices['film'].inspect()
importedgraph.edges['rating'].inspect()
-
Setup your environment to run Cloud Foundry commands (CF) on your machine: Install the CloudFoundry CLI package from https://github.com/cloudfoundry/cli/releases. On RedHat/CentOS, however, run these commands instead:
‘wget --content-disposition https://cli.run.pivotal.io/stable?release=redhat64’
This downloads the pre-packaged RPM to your local machine.
Now run the command to install this package:
‘sudo yum install <path to the cf_cli RPM>’
To test your ‘cf-cli’ installation, run the ‘cf’ command and verify that the usage message is displayed.
- Deploy the OrientDB-dashboard application on TAP
Create a new directory in your Linux machine.
Download the zip file of OrientDB-dashboard repository from https://github.com/trustedanalytics/orientdb-dashboard in the created directory
Unzip it and delete the original zip file or move it to another location.
Edit the manifest file, changing the “orientdb-dashboard” application name to the name of your previously created instance of the OrientDB service.
Push your app with the code from your branch.
‘cf push -f <PATH_TO_MANIFEST_FILE>’
- To access your OrientDB-dashboard application:
From the TAP console, navigate to Applications and search for an application name “orientdb-dashboard”.
Click on the URL in your application row to access the OrientDB studio webpage.
- From the OrientDB studio webpage, select the database name from the drop-down menu, as shown below.
- Enter the user credentials. The default username is “admin” and password is “admin”, or the root user name and password are predefined in the database configuration file. (You can change user credentials once you open the database.)
From the OrientDB studio page, open the database with default credentials and select >Security from the top-level menu. You can then select the default users roles or modify them. New users and roles can be added.
More information for OrientDB studio can be found at http://orientdb.com/docs/2.0/orientdb-studio.wiki/Home-page.html