The Visitor Pattern in Clojure

I first discovered the Visitors pattern from reading the original design patterns book, sometime in the last century when, having jumped into computer science, I was busy hoovering up everything I could about programming. After reading the chapter on visitors, it made no sense to me then and I had no real cause to go near them again until I started working on Tawny-OWL [@url:www.russet.org.uk/blog/2989] This library includes a renderer which takes a set of OWL API OWLObjects and turns them into Clojure data structures. Originally, I added this simply to generate documentation, but since then it's grown to have rather a life of its own. In Java, this would be be implemented with a visitor. In Clojure, I implemented this with multimethods which is often used as a replacement for the visitor …

On Function, Applicability and Evolution

I was entertained to see the recent publication of a new paper on the definition of function [@doi:10.1186/2041-1480-5-27] I met one of the authors at a meeting a few years back in Durham, and had a very nice discussion about my own contribution to this definition which I published previously [@arxiv:1309.5984] I do not want to discuss the paper in full, which is a nice paper and worth a read. I do however want to comment more specifically about the parts that explicitly and implicitly address my own paper. At the start of the paper, the authors discuss the criteria for their definition which includes this: Avoidance of epiphenomenalism: Functions should be determined by current performance of its bearer, not mainly by causally inert historical facts like its (evolutionary or cultural) hi…

Why do DOIs make things citable

I've noted in the past some of the strange beliefs about DOIs [@url:www.russet.org.uk/blog/1849] One of these is that DOIs provide some magic archiving capability [@url:www.russet.org.uk/blog/2360] The other is the strange one that "DOIs make things citable". This was one of the selling points for Figshare, for instance. I'm interested to see that now GitHub have now joined the party [@url:github.com/blog/1840-improving-github-for-science] and again using the justification that "DOIs make things citable". I am lost in attempting to understand this. First, GitHub have stable URIs for repositories. It's in their business interests to keep these and if they change them they will break every single repository that has checked things out using the URI. Second, if I have a gi…

Clojure Gotchas

I've been programming in Clojure for well over a year now; originally, I heard about it care of Sam Aaron, an old PhD student of ours who gave a fun lunch time talk; I rarely go to these (although I probably should). Indirectly, Tawny-OWL came out of this one, so it is good that I went. During the time that I have used Clojure, I have come to know it fairly well, and appreciate many of it's finer points; these are not the same as many people, I realise; for me, the Java integration is simple, effective and very important, as Tawny-OWL is essentially a wrapper over a Java library. Meanwhile, a lot of the nice concurrency features are a matter of indifference to me, again for the same reason. But like any language there are some problems, or at least thing that don't work for me. On the off-…

Tawny-OWL 1.1.0

I am please to announce the second full release of Tawny-OWL, my library for fully programmatic development of OWL ontologies. Tawny-OWL now has a fairly large feature set and is becoming a rich development environment. Perhaps the biggest single change in this release in terms of code base is the least immediately obvious from the user perspective. Previously a large part of the code base was using Java reflection and therefore quite slow. I have now type-hinted all the namespaces meaning that tawny should never reflect. The practical upshot of this is that Tawny runs faster; in the most extreme case, tawny.render is about 5x faster. The most difficult change for me has be the regularisation of :subclass and :subproperty keywords. The reasons behind this have been described in great detai…

Manchester Syntax is a bit backward

Before commit eb2f0e04, I used to have this function in tawny.owl. (defbdontfn add-subclass {:doc "Adds one or more subclass to name in ontology." :arglists '([name & subclass] [ontology name & subclass])} [o name subclass] (add-axiom o (.getOWLSubClassOfAxiom (owl-data-factory) (ensure-class o name) (ensure-class o subclass)))) The idea is, as the name suggests to add a subclass relationship to the ontology; on the face of it, everything looks fine. However, a closer look at the OWL API raises a question: getOWLSubClassOfAxiom(OWLClassExpression subClass, OWLClassExpression superClass) The subclass parameter in Clojure maps to the superClass parameter in Java. The subclass in Clojure is actually the …

Tawny and Protege

Tawny-OWL [@url:www.russet.org.uk/blog/2366] enables a rich programmatic interface to OWL and ontology building. To an extent, I wrote Tawny because I wanted to get away from the use of Protege [@url:protege.stanford.edu/] as an ontology editor. I compare the experience of Protege to Tawny as similar to a comparison between Excel and R; if the former does what you need, then it's fine, but it's hard to extend. So, it is with Tawny --- it is simple to add patterns, new syntaxes, new capabilities. And I have access to all the standard tools that I expect with any programmatic environment; I can use versioning, build tools and test harnesses. Having said all of this, Tawny-OWL comes with some cost. Although most IDEs have good capabilities for jumping to definitions and the like, they are lim…

Catch-22

I was lucky enough to catch (er) the premier of Catch-22 at the Northern Stage on Saturday. I've been to quite a few shows there now, and they are generally good; an adaption of what I consider to be best book that I've ever read, I was optimistic. We had good seats as well, middle, fifth row (far enough away not to get a stiff neck, close enough to hear clearly). Looking through the programme, I was confused as to who had made the adaption as it wasn't not mentioned anywhere; fortunately, BBC News put me right; the play was my Joseph Heller himself. The stage set was fantastic, a cut-away bomber with the back-end merging into a beach hut. Like the rest of the set, it was used for many purposes --- as a plane, an office, an entrance way. The cast was the same; nine actors jumping backward …

Further Experiments with Literate Programming

Literate programming comes in many forms and disguises but is essentially the notion that the documentation and programmatic code should be written together, so that the documentation supports the code and vice versa. In this post, I discuss some of the problems with literate programming, my early attempts to circumvent these with respect to ontology development. Finally, I finish up with a description of some new technology which, I think, offers a solution. Literate Programming for Ontologies The reality is, I think, that literate programming has never really take off; there are a large number of reasons for this of course. Code does not naturally have an linear narrative and is not necessarily read in this way: rather, when read by an experienced programmer, they often track the flow of…

Book Reviews

This year I have been on a bit of a mission. I decided that having being here for 8 years, I would actually use the library. So I have started off by requesting books and reading them. It's been a while since I have regularly read books and it's been quite an interesting experience. I've remembered that reading tech books is quite a reflective process, away from the computer. It's a less stressful, although perhaps more time consuming experience than hunting through the web, reading documentation or code until you understand what ever it is you are reading about. I don't know how long this trend will continue, but while it is, I thought I would write some short book reviews on the books that I have read; as normal, mostly for my own purposes; like many lecturers I get asked for book recomm…