Probabilistic Relational Models

For now, pyAgrum only allows to explore Probabilistic Relational Models written with o3prm syntax.

class pyAgrum.PRMexplorer

PRMexplorer helps navigate through probabilistic relational models.

PRMexplorer() -> PRMexplorer
default constructor
aggType

a(9).str

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

Type:aggType
classAggregates(PRMexplorer self, str 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(PRMexplorer self, str 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(PRMexplorer self, str 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(PRMexplorer self, str class_name)
Parameters:class_name (str) – a class name
Returns:the list of interfaces implemented by the class
Return type:list
classParameters(PRMexplorer self, str 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(PRMexplorer self, str 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(PRMexplorer self, str 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(PRMexplorer self)
Returns:the list of classes
Return type:list
cpf(PRMexplorer self, str class_name, str 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(PRMexplorer self, str 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(PRMexplorer self, str 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(PRMexplorer self, str 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(PRMexplorer self, str 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(PRMexplorer self, str 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(PRMexplorer self, str 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(PRMexplorer self, str 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(PRMexplorer self, str 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(PRMexplorer self, str 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(PRMexplorer self)
Returns:the list of all the systems and their components
Return type:list
interAttributes(PRMexplorer self, str interface_name, bool 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(PRMexplorer self, str 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(PRMexplorer self)
Returns:the list of interfaces in the PRM
Return type:list
isAttribute(PRMexplorer self, str class_name, str 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(PRMexplorer self, str name)
Parameters:name (str) – an element name
Returns:True if the parameter correspond to a class in the PRM
Return type:bool
isInterface(PRMexplorer self, str name)
Parameters:name (str) – an element name
Returns:True if the parameter correspond to an interface in the PRM
Return type:bool
isType(PRMexplorer self, str name)
Parameters:name (str) – an element name
Returns:True if the parameter correspond to a type in the PRM
Return type:bool
load(PRMexplorer self, str filename, str classpath="", bool 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(PRMexplorer self)
Returns:the list of the custom types in the PRM
Return type:list