kpsychas / brain2neo

Convert The Brain XML documents to a Neo4j db
BSD 2-Clause "Simplified" License
2 stars 2 forks source link

Build Status Code Health Scrutinizer Code Quality Coverage Status Requirements Status

About

This project is a tool for converting XML documents exported from The Brain application to a Neo4j database.

The project itself and its motivation are related to version 8 of The Brain. Unfortunately starting from version 9 application no longer supports exports to XML.

Motivation

The Brain provides a nice user interface to create modify and navigate between thoughts, which can be anything from quotes or ideas to songs, movies or people. Querying capabilities on the other hand are limited, so one cannot find for example how many thoughts of certain type (e.g. songs) are there in the visualization. Neo4j can do that and even more, provided the user has created the appropriate connections while creating the brain file (e.g. one can order singers by the number of their songs in database).

Quick Demo

  1. Edit the following line in test/example.cfg

    neo4j_uri = http://localhost:7474/db/data/

    to respective URI of your database (should be empty initially). Include any credentials in URI like what is described in py2neo documentation

  2. Run your database server

  3. Run the script in any of the following ways

    • While being in brain2neo folder run

      $ python brain2neo.py -f ../test/example.xml
    • or while being in project's root folder run

      $ python run_brain2neo.py -f test/example.xml
    • or while being in project's root folder run

      $ python -m brain2neo -f test/example.xml
  4. Access database using the web interface or any other preferred UI and test/example.xml using the import feature of The Brain app to make a comparison.

The script was tested for TheBrain version 8.0.2.1 and Neo4j 2.3.1 If things don't work for other versions consider submitting an issue or a pull request with a fix.

Install

After cloning the repository and while being in project's root folder run

$ python setup.py install

Then the following command runs the main script of demo above

$ brain2neo -f <path_to_xml>

About Brain XML

An example XML is given in test/example.xml. It can be imported in the free version of The Brain, although it cannot be exported again.

The specification of exported XML can be found here. Some notes on how script converts XML to database format are given in REFERENCE.md.

License

This software is licensed under the BSD License.