package bap-knowledge

  1. Overview
  2. Docs

An information provider.

A piece of information could be predicated with its source to denote the trustworthiness of the information an/or to enable information provenance.

An agent is a registry entity with associated name, description, and reliability. The name and description are used for introspection. The reliability could be used for conflict resolution.

Using Domain.opinions it is easy to embed any data into the domain structure, by pairing the elements of this set with the information about its source, i.e., with the agent.

type t = agent
type id

the agent's id.

type reliability

abstract ordered type to quantify reliability of agents.

val register : ?desc:string -> ?package:string -> ?reliability:reliability -> string -> agent

register name registers a new agent.

The provided package and name pair should be unique. If an agent with the given package:name is already registered, the registration of the new agent will fail.

  • parameter desc

    a description of the registered agent.

  • parameter package

    a namespace of the registered agent.

  • parameter reliability

    is the amount of agent's trustworthiness (defaults to trustworthy).

val registry : unit -> id list

registry () is the current registry of agents.

Each registered agent is represented by its ID, which could be inspected or used to change the reliability.

val name : id -> name

name id is the name of the agent.

val desc : id -> string

desc id is the overall description of the agent.

val reliability : id -> reliability

reliability id is the current reliability of the agent

val set_reliability : id -> reliability -> unit

set_reliability id changes the reliability of the agent.

Reliability Levels

val authorative : reliability

The highest level of reliability.

The information was obtained from a source in which we trust absolutely. There are no possible doubts that this information is incorrect.

The authorative source is definitional and is always preferred to any other information.

It could be compared to the information obtained from the official legislative document, mathematical textbook, etc.

val reliable : reliability

A highly reliable source.

This source rarely, if ever, provides inaccurate results.

It could be compared to the information obtained from a well-known expert, peer-reviewed journal, etc.

val trustworthy : reliability

A very reliable source.

This source provides accurate results most of the time. Only in exceptional cases it could provide an inaccurate result.

It could be compared to the information obtained from a field expert.

val doubtful : reliability

Nearly reliable source.

This source sometimes provides inaccurate information or relies on doubtful methods. It is still providing useful and accurate information more often than not.

It could be compared to the information obtained from a knowledgeable person.

val unreliable : reliability

A not worthwhile source.

This source provides accurate information slightly more often than inaccurate. Though it is a bad source of information, many unreliable source could be combined to.

It could be compared to the knowledge obtained from gossips, i.e., from not knowledgeable persons close to the knowledge.

val pp : Format.formatter -> t -> unit

prints the agent information.

val pp_id : Format.formatter -> id -> unit

prints the agent's id.

val pp_reliability : Format.formatter -> reliability -> unit

prints the reliability level.

OCaml

Innovation. Community. Security.