knowledge: fix backward incompatible change in API

* Refactors of remaining function in knowledge api.
  (closes #2555)

Signed-off-by: Leonardo Rossi <leonardo.r@cern.ch>
`:return: a mapping`