Trying Something New

I never really got the hang of having a ‘holiday’, and dammit, futzing about on the computer still is fun, when there’s no deadline or pressing compulsion to do so… so the idea is:

  • i want a graph database (looks like neo4j is the most accessible thing?), because the relationships in this data seem pretty important
  • but the people entering the data can’t be expected to write cypher queries to do that

But we can import CSV tables describing objects and properties and relations and the properties of those relations. OK. So maybe just fill out a bunch of spreadsheets and export to csv.

But filling out cells in a spreadsheet can be pretty mind numbing, and we also know that excel does weird shit to data sometimes, and well, couldn’t we just avoid it?

So I’ve been designing data entry forms using jupyter notebooks, widgets, and voila. I’ve also been trying out tkinter for making forms directly in python too. So far, tkinter is winning. And at the end of that process, I end up with an sqlite database which I could push online using say datasette and have an api all of a sudden for the data, too. So that’s a win.

But back to the csv. I get a csv out of my tkinter data entry forms. It’s still not really in the format for entry into neo4j through its load.csv stuff. This probably is more a reflection on me than on neo4j, of course. Came across this – which looks like it’ll do what I want. Remember, the data is being added and worked with by folks with even less experience in this domain than me. Aspen looks pretty cool. Describe your data, it translates it into cypher queries, pushes into neo4js.

Problem is, I’m getting all sorts of weird errors that lead me to suspect that the version of ruby I’m running is the wrong version. I have no experience with ruby, other than a couple of jekyll experiments. The Aspen documentation says 2.6 or higher, but I’m running 3, and this isn’t working. It turns out you can run many versions of ruby at once (see stackoverflow) so I’ll give that a try, install 2.6 and see what happens….

… not much; but a new error message ‘undefined method `merge’ for false:FalseClass (NoMethodError)’ so that’s progress I guess.


memo to self. In the aspen.rb line, if I comment out the merge command, all works:

def self.compile_text(text, environment = {})

    if text.include?(SEPARATOR)
      env, _sep, code = text.partition(SEPARATOR)
      compile_code(code, )#YAML.load(env).merge(environment))
      code = text
      compile_code(code, environment)

Now, if I follow the wiki to do the csv import, modify the bin/convert script as directed and have empty ‘main.aspen’ files in ‘grammars’ and ‘discourse’, plus remember to capitalize nodes, node properties, then… hot damn, it writes a cypher query!