Logic-algebraic method for knowledge-based relation systems