TITLE: Categories of $n$-ary relations?
QUESTION [5 upvotes]: Arrows in the category $\bf Rel$ are binary (2-valued) relations between set objects. 
Do ternary, 4-term, $n$-term and variadic (2-valued) relations form categories? (Or perhaps one category?). 
It may be convenient to study categorically how binary relations relate to mutual relations, as this and this question, or to represent Helly type relations.
$n$-ary relations are mentioned in nlab, but no explicit category seems defined. Neither does the concept seem to be discussed in Freyd & Scedrov's Categories, Allegories. Did I miss it?
By analogy with graphs and hypergraphs, where the former are defined by edges between pairs of vertices, whereas the latter are defined by arbitrary subsets of vertices, it's not clear offhand how would arrows be defined even for a ternary relation $R \subset X \times Y \times Z$?

REPLY [4 votes]: $\text{Rel}$ forms a structure a bit different from a category because it is very "undirected": when considering a relation among $n$ sets it's in some sense unnatural to decide that some of these sets are sources and some of them are targets. While you can describe $\text{Rel}$ as something like a symmetric monoidal dagger category, you're still imposing a directionality on the morphisms that they don't have in the first place, then removing it using further structure.
Instead you can do the following. Let's define a hypercategory to consist of a collection $C_0$ of objects and a collection $C_1$ of bonds. Each bond has an arity $n$, and bonds of arity $n$ come equipped with a tuple of $n$ objects which we'll call the boundary of the bond. 
Finally, there are composition operations of the following type: if $f$ is a bond with boundary $(a_1, \dots a_n)$ and $g$ is a bond with boundary $(b_1, \dots b_m)$, and the boundary has some objects $(c_1, \dots c_k)$ in common, then there is a composition given by "gluing along the common boundary," producing a new bond with boundary given by the parts of the boundaries of $f$ and $g$ that weren't glued. These operations satisfy various axioms that I don't know how to cleanly write down but they should be basically intuitive. 
The hypercategory structure on $\text{Rel}$ is given by having the objects be sets and the bonds be relations $R \subseteq X_1 \times \dots \times X_n$, with the boundary of $R$ being $(X_1, \dots X_n)$. Composition is given by the usual composition of relations.