# MEBN-RM: A Mapping between Multi-Entity Bayesian Network and Relational Model
## 2 Background
### Multi-Entity Bayesian Network  
MEBN [48] allows compact representation of repeated structure in a joint distribution on a set of random variables. In MEBN, random variables are defined as templates that can be repeatedly instantiated to construct probabilistic models with repeated structure. MEBN represents domain knowledge using an MTheory, which consists of a collection of MFrags (see Figure 1). An MFrag is a fragment of a graphical model that is a template for probabilistic relationships among instances of its random variables. Random variables (RVs) may contain _ordinary variables_, which can be instantiated for different domain entities. We can think of an MFrag as a class which can generate instances of BN fragments. These can then be assembled into a Bayesian network, called a _situation-specific Bayesian Network_ (SSBN), using an SSBN algorithm [48]. A given MTheory can be used to construct many different SSBNs for different situations. To understand how this works, consider Figure 1, which shows an MTheory called the _Danger Assessment_ MTheory. This MTheory contains seven MFrags: _Speed_, _ImageTypeReport_, _VehicleObject_, _Danger_, _Weather_, _Region_, and _Reference_. An MFrag may contain three types of random variables: context RVs, denoted by green pentagons, resident RVs, denoted by yellow ovals, and input RVs, denoted by gray trapezoids. Each MFrag defines local probability distributions for its input RVs. These distributions may depend on the input RVs, whose distributions are defined in other MFrags. Context RVs express conditions that must be satisfied for the distributions defined in the MFrag to apply. For example, consider the _VehicleObject_ MFrag in the MTheory of Figure 1. This MFrag expresses knowledge of how the vehicle class is related to the terrain type. The context RVs, _IsA(obj, VEHICLE)_, _IsA(rgn,_ REGION)_, and _rgn = Location(obj)_, indicate that the ordinary variable _obj_ must refer to a vehicle, the ordinary variable _rgn_ must refer to a region, and the object denoted by _obj_ must be located in the region denoted by _rgn_. The resident RV _VehicleClass(obj)_ refers to the type of _obj_. This type is uncertain, with its distribution defined in the MFrag. The distribution depends on the type of terrain in the region, with wheeled vehicles more likely on roads and tracked vehicles more likely on rough terrain. The terrain type is represented by the input RV _TerrainType(rgn)_, whose distribution is defined in the MFrag _Region_. The distribution for a resident random variable, defined in its home MFrag, is called a _class local distribution_. For example, the class local distribution (CLD) of _VehicleClass(obj)_, which depends on the type of terrain where the vehicle is located, can be expressed as Listing 1. This CLD specifies that if the terrain type is _Road_, then there is an 80% chance the vehicle is _wheeled_; and if the terrain type is _OffRoad_, then there is an 80% chance the vehicle is _tracked_. The final clause specifies a distribution if none of these conditions is met, which is equal probabilities for tracked and wheeled vehicles. Formally, an MFrag is defined as follows [48]. **Definition 1** (MFrag). : _An MFrag F, or MEBN fragment, consists of: (i) a set **C** of context nodes, which represent conditions under which the distribution defined in the MFrag is valid; (ii) a set **I** of input nodes, which have their distributions defined elsewhere and condition the distributions defined in the MFrag; (iii) a set **R** of resident nodes, whose distributions are defined in the MFrag; (iv) an acyclic directed graph **G**, whose nodes are associated with resident and input nodes; and (v) a set **L\({}^{\text{C}}\)** of CLDs, in which an element of **L\({}^{\text{C}}\)** is associated with each resident node._  
The nodes in an MFrag are different from the nodes in a common Bayesian network.