# Path: tmapi/exceptions.py
# class TopicMapExistsException (TMAPIException):
# 
#     """Exception thrown when an attempt is made to create a new
#     `TopicMap` under a storage address (an IRI) that is already
#     assigned to another `TopicMap` in the same `TopicMapSystem`."""
# 
#     pass
# 
# 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


from django.db import models
from tmapi.exceptions import TopicMapExistsException, \
    FeatureNotRecognizedException
from locator import Locator
from tmapi_feature import TMAPIFeature
from topic_map import TopicMap
        :type iri: `Locator` or String
        :rtype: `TopicMap`

        """
        if not isinstance(iri, Locator):
            iri = self.create_locator(iri)
        if self.get_topic_map(iri) is not None:
            raise TopicMapExistsException()
        reference = iri.to_external_form()
        tm = proxy(topic_map_system=self, iri=reference)
        tm.save()
        return tm

    def get_feature (self, feature_name):
        """Returns the value of the feature specified by
        `feature_name` for this TopicMapSystem instance.

        The features supported by the TopicMapSystem and the value for
        each feature are set when the TopicMapSystem is created by a
        call to `TopicMapSystemFactory.new_topic_map_system()` and
        cannot be modified subsequently.

        :param feature_name: the name of the feature to check
        :type feature_name: string
        :rtype: Boolean

        """
        try:
            feature = self.features.get(feature_string=feature_name)
        except TMAPIFeature.DoesNotExist:

# Path: tmapi/exceptions.py
# class TopicMapExistsException (TMAPIException):
# 
#     """Exception thrown when an attempt is made to create a new
#     `TopicMap` under a storage address (an IRI) that is already
#     assigned to another `TopicMap` in the same `TopicMapSystem`."""
# 
#     pass
# 
# 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


# Path: tmapi/models/topic_map_system.py
from django.db import models
from tmapi.exceptions import TopicMapExistsException, \
    FeatureNotRecognizedException
from locator import Locator
from tmapi_feature import TMAPIFeature
from topic_map import TopicMap

        :type iri: `Locator` or String
        :rtype: `TopicMap`

        """
        if not isinstance(iri, Locator):
            iri = self.create_locator(iri)
        if self.get_topic_map(iri) is not None:
            raise TopicMapExistsException()
        reference = iri.to_external_form()
        tm = proxy(topic_map_system=self, iri=reference)
        tm.save()
        return tm

    def get_feature (self, feature_name):
        """Returns the value of the feature specified by
        `feature_name` for this TopicMapSystem instance.

        The features supported by the TopicMapSystem and the value for
        each feature are set when the TopicMapSystem is created by a
        call to `TopicMapSystemFactory.new_topic_map_system()` and
        cannot be modified subsequently.

        :param feature_name: the name of the feature to check
        :type feature_name: string
        :rtype: Boolean

        """
        try:
            feature = self.features.get(feature_string=feature_name)
        except TMAPIFeature.DoesNotExist:

            raise FeatureNotRecognizedException