#NEWLINE# def __str__( self ) : #NEWLINE# #INDENT# '\n        Returns the UAI file as a string.\n        ' #NEWLINE# self . network += ( var . no_nodes + '\n' ) #NEWLINE# domain = sorted ( self . domain . items ( ) , key = ( lambda x : ( x [ 1 ] , x [ 0 ] ) ) ) #NEWLINE# self . network += ( ' ' . join ( [ var [ 1 ] for var in domain ] ) + '\n' ) #NEWLINE# self . network += ( str ( len ( self . functions ) ) + '\n' ) #NEWLINE# for fun in self . functions : #NEWLINE# #INDENT# self . network += ( str ( len ( fun ) ) + ' ' ) #NEWLINE# self . network += ( ' ' . join ( fun ) + '\n' ) #NEWLINE# #UNINDENT# self . network += '\n' #NEWLINE# for table in self . tables : #NEWLINE# #INDENT# self . network += ( str ( len ( table ) ) + '\n' ) #NEWLINE# self . network += ( ' ' . join ( table ) + '\n' ) #NEWLINE# #UNINDENT# return self . network [ : ( - 1 ) ]