# Path: tmapi/constants.py
# AUTOMERGE_FEATURE_STRING = TMAPI_FEATURE_STRING_BASE + 'automerge'
# 
# MERGE_BY_TOPIC_NAME_FEATURE_STRING = TMAPI_FEATURE_STRING_BASE + \
#     'merge/byTopicName'
# 
# READ_ONLY_FEATURE_STRING = TMAPI_FEATURE_STRING_BASE + 'readOnly'
# 
# TYPE_INSTANCE_ASSOCIATIONS_FEATURE_STRING = TMAPI_FEATURE_STRING_BASE + \
#     'type-instance-associations'
# 
# Path: tmapi/exceptions.py
# class FeatureNotRecognizedException (FactoryConfigurationException):
# 
#     """Exception raised when the TopicMapSystemFactory does not
#     recognize the name of a feature that the application is trying to
#     enable or disable."""
# 
#     pass
# 
# class FeatureNotSupportedException (FactoryConfigurationException):
# 
#     """Exception raised when the underlying implementation cannot
#     support enabling or disabling a recognised feature. If the feature
#     name is not recognised, implementations must throw a
#     FeatureNotRecognizedException rather than a
#     FeatureNotSupportedException."""
# 
#     pass


from tmapi.constants import AUTOMERGE_FEATURE_STRING, \
    MERGE_BY_TOPIC_NAME_FEATURE_STRING, READ_ONLY_FEATURE_STRING, \
    TYPE_INSTANCE_ASSOCIATIONS_FEATURE_STRING
from tmapi.exceptions import FeatureNotRecognizedException, \
    FeatureNotSupportedException
from tmapi_feature import TMAPIFeature
from topic_map_system import TopicMapSystem
        tms = TopicMapSystem()
        tms.save()
        for feature_string, values in self._features.items():
            feature = TMAPIFeature(feature_string=feature_string,
                                   topic_map_system=tms, value=values[0])
            feature.save()
        return tms

    def set_feature (self, feature_name, enable):
        """Sets a particular feature in the underlying implementation
        of `TopicMapSystem`.

        A list of the core features can be found at
        http://tmapi.org/features/.

        :param feature_name: the name of the feature to be set
        :type feature_name: string
        :param enable: True to enable the feature, False to disable it
        :type enable: Boolean

        """
        if feature_name in self._features:
            if self._features[feature_name][1]:
                self._features[feature_name][0] = enable
            elif self._features[feature_name][0] == enable:
                # Do nothing if trying to set the feature to its
                # current value, even if it is not permitted to change
                # the value.
                pass
            else:

# Path: tmapi/constants.py
# AUTOMERGE_FEATURE_STRING = TMAPI_FEATURE_STRING_BASE + 'automerge'
# 
# MERGE_BY_TOPIC_NAME_FEATURE_STRING = TMAPI_FEATURE_STRING_BASE + \
#     'merge/byTopicName'
# 
# READ_ONLY_FEATURE_STRING = TMAPI_FEATURE_STRING_BASE + 'readOnly'
# 
# TYPE_INSTANCE_ASSOCIATIONS_FEATURE_STRING = TMAPI_FEATURE_STRING_BASE + \
#     'type-instance-associations'
# 
# Path: tmapi/exceptions.py
# class FeatureNotRecognizedException (FactoryConfigurationException):
# 
#     """Exception raised when the TopicMapSystemFactory does not
#     recognize the name of a feature that the application is trying to
#     enable or disable."""
# 
#     pass
# 
# class FeatureNotSupportedException (FactoryConfigurationException):
# 
#     """Exception raised when the underlying implementation cannot
#     support enabling or disabling a recognised feature. If the feature
#     name is not recognised, implementations must throw a
#     FeatureNotRecognizedException rather than a
#     FeatureNotSupportedException."""
# 
#     pass


# Path: tmapi/models/topic_map_system_factory.py
from tmapi.constants import AUTOMERGE_FEATURE_STRING, \
    MERGE_BY_TOPIC_NAME_FEATURE_STRING, READ_ONLY_FEATURE_STRING, \
    TYPE_INSTANCE_ASSOCIATIONS_FEATURE_STRING
from tmapi.exceptions import FeatureNotRecognizedException, \
    FeatureNotSupportedException
from tmapi_feature import TMAPIFeature
from topic_map_system import TopicMapSystem

        tms = TopicMapSystem()
        tms.save()
        for feature_string, values in self._features.items():
            feature = TMAPIFeature(feature_string=feature_string,
                                   topic_map_system=tms, value=values[0])
            feature.save()
        return tms

    def set_feature (self, feature_name, enable):
        """Sets a particular feature in the underlying implementation
        of `TopicMapSystem`.

        A list of the core features can be found at
        http://tmapi.org/features/.

        :param feature_name: the name of the feature to be set
        :type feature_name: string
        :param enable: True to enable the feature, False to disable it
        :type enable: Boolean

        """
        if feature_name in self._features:
            if self._features[feature_name][1]:
                self._features[feature_name][0] = enable
            elif self._features[feature_name][0] == enable:
                # Do nothing if trying to set the feature to its
                # current value, even if it is not permitted to change
                # the value.
                pass
            else:

                raise FeatureNotSupportedException