def __init__(self, args):
        """
        Initializes the internal structures of the Goal Generator and does
        some checks.

        :param args: the goal generator's arguments
        """

        if 'ontology' not in args:
            raise ValueError('Goal Generator called without an ontology!')

        if 'database' not in args:
            raise ValueError('Goal Generator called without a database!')

        self.ontology = None
        if isinstance(args['ontology'], Ontology):
            self.ontology = args['ontology']

        elif isinstance(args['ontology'], str):
            self.ontology = Ontology(args['ontology'])

        else:
            raise ValueError('Unacceptable ontology type %s '
                             % args['ontology'])

        self.database = None
        if isinstance(args['database'], DataBase):
            self.database = args['database']

        elif isinstance(args['database'], str):
            if args['database'][-3:] == '.db':
                self.database = SQLDataBase(args['database'])
            elif args['database'][-5:] == '.json':
                self.database = JSONDataBase(args['database'])
            else:
                raise ValueError('Unacceptable database type %s '
                                 % args['database'])
        else:
            raise ValueError('Unacceptable database type %s '
                             % args['database'])

        self.goals_file = None
        if 'goals_file' in args:
            self.goals_file = args['goals_file']

        self.goals = None

        if self.goals_file:
            self.load_goals(self.goals_file)

        # Get the slot names from the database
        cursor = self.database.SQL_connection.cursor()

        # Get Table name
        result = \
            cursor.execute(
                "select * from sqlite_master where type = 'table';").fetchall()
        if result and result[0] and result[0][1]:
            self.db_table_name = result[0][1]
        else:
            raise ValueError('Goal Generator cannot specify Table Name from '
                             'database {0}'.format(self.database.db_file_name))

        # Dummy SQL command
        sql_command = "SELECT * FROM " + self.db_table_name + " LIMIT 1;"

        cursor.execute(sql_command)
        self.slot_names = [i[0] for i in cursor.description]

        self.db_row_count = \
            cursor.execute("SELECT COUNT(*) FROM " +
                           self.db_table_name + ";").fetchall()[0][0]

        Initializes the internal structures of the Goal Generator and does
        some checks.

        :param args: the goal generator's arguments
        
plato/agent/component/user_simulator/goal.py