@@ -0,0 +1,2669 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0ACreated on Mon Oct 26 17:55:52 2020%0A%0A@author: rish-r%0A%22%22%22%0A%0Afrom arango import ArangoClient, ArangoServerError, DocumentInsertError%0A%0Adb_name = 'SODI_TEST'%0Auser = 'root'%0Apassword = 'Cro$$refkg'%0A%0A%0Adef intialize_database(db_name, user, password):%0A    %22%22%22%0A    Parameters%0A    ----------%0A    db_name : str%0A        Name of the ArangoDB instance.%0A    user : str%0A        Username.%0A    password : str%0A        Password.%0A%0A    Returns%0A    -------%0A    None.%0A    %22%22%22%0A    # Initialize the client for ArangoDB.%0A    client = ArangoClient(hosts='http://localhost:8529')%0A%0A    # Connect to %22_system%22 database as root user.%0A    sys_db = client.db('_system', username=user, password=password)%0A%0A    # Create a new database named %22test%22.%0A    sys_db.create_database(db_name)%0A%0A    # Connect to %22test%22 database as root user.%0A    db = client.db(db_name, username=user, password=password)%0A%0A    # Create a new collection named %22Person%22.%0A    Person = db.create_collection('Person')%0A%0A    # Create a new collection named %22Works%22.%0A    Works = db.create_collection('Works')%0A%0A    # Add a hash index to the collection.%0A    Person.add_hash_index(fields=%5B'URI'%5D, unique=True)%0A%0A    # Add a hash index to the collection.%0A    Works.add_hash_index(fields=%5B'URI'%5D, unique=True)%0A%0A    # Add a hash index to the collection.%0A    Works.add_hash_index(fields=%5B'DOI'%5D, unique=True)%0A%0A    # Create a new graph named %22Publications%22.%0A    graph = db.create_graph('Publications')%0A%0A    # Create vertex collections for the graph.%0A    Person = graph.create_vertex_collection('Person')%0A%0A    # Create vertex collections for the graph.%0A    Works = graph.create_vertex_collection('Works')%0A%0A    # Create an edge definition for works to works.%0A    References = graph.create_edge_definition(%0A        edge_collection='References',%0A        from_vertex_collections=%5B'Works'%5D,%0A        to_vertex_collections=%5B'Works'%5D%0A    )%0A%0A    # Create an edge definition for works to person.%0A    Author = graph.create_edge_definition(%0A        edge_collection='Author',%0A        from_vertex_collections=%5B'Works'%5D,%0A        to_vertex_collections=%5B'Person'%5D%0A    )%0A%0A    # Create an edge definition relation between persons.%0A    Collaborator = graph.create_edge_definition(%0A        edge_collection='Collaborator',%0A        from_vertex_collections=%5B'Person'%5D,%0A        to_vertex_collections=%5B'Person'%5D%0A    )%0A%0A%0Adef intialize_client():%0A    %22%22%22%0A    Returns%0A    -------%0A    database object%0A        db object for python-arango driver functions.%0A    %22%22%22%0A    # Initialize the client for ArangoDB.%0A    client = ArangoClient(hosts='http://localhost:8529')%0A    # Connect to %22test%22 database as root user.%0A    return client.db(db_name, user, password)%0A

Create initialize_arango.py