Probabilistic Relational Models

For now, pyAgrum only allows to explore Probabilistic Relational Models written with o3prm syntax (see O3PRM website).

class pyAgrum.PRMexplorer

PRMexplorer helps navigate through probabilistic relational models.

PRMexplorer() -> PRMexplorer
default constructor
aggType

min/max/count/exists/forall/or/and/amplitude/median

classAggregates(self, class_name)
Parameters:class_name (str) – a class name
Returns:the list of aggregates in the class
Return type:list
Raises:gum.IndexError – If the class is not in the PRM
classAttributes(self, class_name)
Parameters:class_name (str) – a class name
Returns:the list of attributes
Return type:list
Raises:gum.IndexError – If the class is not in the PRM
classDag(self, class_name)
Parameters:class_name (str) – a class name
Returns:a description of the DAG
Return type:tuple
Raises:gum.IndexError – If the class is not in the PRM
classImplements(self, class_name)
Parameters:class_name (str) – a class name
Returns:the list of interfaces implemented by the class
Return type:list
classParameters(self, class_name)
Parameters:class_name (str) – a class name
Returns:the list of parameters
Return type:list
Raises:gum.IndexError – If the class is not in the PRM
classReferences(self, class_name)
Parameters:class_name (str) – a class name
Returns:the list of references
Return type:list
Raises:gum.IndexError – If the class is not in the PRM
classSlotChains(self, class_name)
Parameters:class_name (str) – a class name
Returns:the list of class slot chains
Return type:list
Raises:gum.IndexError – if the class is not in the PRM
classes(self)
Returns:the list of classes
Return type:list
cpf(self, class_name, attribute)
Parameters:
  • class_name (str) – a class name
  • attribute (str) – an attribute
Returns:

the potential of the attribute

Return type:

pyAgrum.Potential

Raises:
  • gum.OperationNotAllowed – If the class element doesn’t have any pyAgrum.Potential (like a pyAgrum.PRMReferenceSlot).
  • gum.IndexError – If the class is not in the PRM
  • gum.IndexError – If the attribute in parameters does not exist
getDirectSubClass(self, class_name)
Parameters:class_name (str) – a class name
Returns:the list of direct subclasses
Return type:list
Raises:gum.IndexError – If the class is not in the PRM
getDirectSubInterfaces(self, interface_name)
Parameters:interface_name (str) – an interface name
Returns:the list of direct subinterfaces
Return type:list
Raises:gum.IndexError – If the interface is not in the PRM
getDirectSubTypes(self, type_name)
Parameters:type_name (str) – a type name
Returns:the list of direct subtypes
Return type:list
Raises:gum.IndexError – If the type is not in the PRM
getImplementations(self, interface_name)
Parameters:interface_name (str) – an interface name
Returns:the list of classes implementing the interface
Return type:str
Raises:gum.IndexError – If the interface is not in the PRM
getLabelMap(self, type_name)
Parameters:type_name (str) – a type name
Returns:a dict containing pairs of label and their values
Return type:dict
Raises:gum.IndexError – If the type is not in the PRM
getLabels(self, type_name)
Parameters:type_name (str) – a type name
Returns:the list of type labels
Return type:list
Raises:gum.IndexError – If the type is not in the PRM
getSuperClass(self, class_name)
Parameters:class_name (str) – a class name
Returns:the class extended by class_name
Return type:str
Raises:gum.IndexError – If the class is not in the PRM
getSuperInterface(self, interface_name)
Parameters:interface_name (str) – an interface name
Returns:the interace extended by interface_name
Return type:str
Raises:gum.IndexError – If the interface is not in the PRM
getSuperType(self, type_name)
Parameters:type_name (str) – a type name
Returns:the type extended by type_name
Return type:str
Raises:gum.IndexError – If the type is not in the PRM
getalltheSystems(self)
Returns:the list of all the systems and their components
Return type:list
interAttributes(self, interface_name, allAttributes=False)
Parameters:
  • interface_name (str) – an interface
  • allAttributes (bool) – True if supertypes of a custom type should be indicated
Returns:

the list of (<type>,<attribute_name>) for the given interface

Return type:

list

Raises:

gum.IndexError – If the type is not in the PRM

interReferences(self, interface_name)
Parameters:interface_name (str) – an interface
Returns:the list of (<reference_type>,<reference_name>,<True if the reference is an array>) for the given interface
Return type:list
Raises:gum.IndexError – If the type is not in the PRM
interfaces(self)
Returns:the list of interfaces in the PRM
Return type:list
isAttribute(self, class_name, att_name)
Parameters:
  • class_name (str) – a class name
  • att_name (str) – the name of the attribute to be tested
Returns:

True if att_name is an attribute of class_name

Return type:

bool

Raises:
  • gum.IndexError – If the class is not in the PRM
  • gum.IndexError – If att_name is not an element of class_name
isClass(self, name)
Parameters:name (str) – an element name
Returns:True if the parameter correspond to a class in the PRM
Return type:bool
isInterface(self, name)
Parameters:name (str) – an element name
Returns:True if the parameter correspond to an interface in the PRM
Return type:bool
isType(self, name)
Parameters:name (str) – an element name
Returns:True if the parameter correspond to a type in the PRM
Return type:bool
load(self, filename, classpath="", verbose=False)

Load a PRM into the explorer.

Parameters:
  • filename (str) – the name of the o3prm file
  • classpath (str) – the classpath of the PRM
Raises:

gum.FatalError – If file not found

types(self)
Returns:the list of the custom types in the PRM
Return type:list