N-ary Relations for Logical Analysis of Data and Knowledge