# Path: tmapi/constants.py
# XSD_ANY_URI = XSD + 'anyURI'
# 
# XSD_STRING = XSD + 'string'
# 
# Path: tmapi/exceptions.py
# class ModelConstraintException (TMAPIRuntimeException):
# 
#     """This exception is used to report Topic Maps - Data Model
#     constraint violations."""
# 
#     def __init__ (self, reporter, message):
#         """Creates a new ModelConstraintException with the specified
#         message.
# 
#         :param reporter: the construct which has thrown this exception
#         :type reporter: `Construct`
#         :param message: the detail message
#         :type message: string
# 
#         """
#         self._reporter = reporter
#         self._message = message
#     
#     def get_reporter (self):
#         """Return the `Construct` which has thrown the exception.
# 
#         :rtype: `Construct`
# 
#         """
#         return self._reporter


from django.db import models
from tmapi.constants import XSD_ANY_URI, XSD_STRING
from tmapi.exceptions import ModelConstraintException
from construct_fields import ConstructFields
from locator import Locator
from reifiable import Reifiable
from scoped import Scoped
from typed import Typed
from variant import Variant
        app_label = 'tmapi'

    def create_variant (self, value, scope, datatype=None):
        """Creates a `Variant` of this topic name with the specified
        string `value` and `scope`.

        If `datatype` is None, the newly created `Variant` will have
        the datatype xsd:string.

        The newly created `Variant` will contain all themes from the
        parent name and the themes specified in `scope`.

        :param value: the string value or locator which represents an IRI
        :type value: string or `Locator`
        :param scope: list of themes
        :type scope: list of `Topic`s
        :rtype: `Variant`

        """
        if value is None:
            raise ModelConstraintException(self, 'The value may not be None')
        if not scope:
            raise ModelConstraintException(self, 'The scope may not be None')
        if type(scope) not in (type([]), type(())):
            scope = [scope]
        if scope == list(self.get_scope()):
            raise ModelConstraintException(
                self, 'The variant would be in the same scope as the parent')
        if datatype is None:
            if isinstance(value, Locator):

# Path: tmapi/constants.py
# XSD_ANY_URI = XSD + 'anyURI'
# 
# XSD_STRING = XSD + 'string'
# 
# Path: tmapi/exceptions.py
# class ModelConstraintException (TMAPIRuntimeException):
# 
#     """This exception is used to report Topic Maps - Data Model
#     constraint violations."""
# 
#     def __init__ (self, reporter, message):
#         """Creates a new ModelConstraintException with the specified
#         message.
# 
#         :param reporter: the construct which has thrown this exception
#         :type reporter: `Construct`
#         :param message: the detail message
#         :type message: string
# 
#         """
#         self._reporter = reporter
#         self._message = message
#     
#     def get_reporter (self):
#         """Return the `Construct` which has thrown the exception.
# 
#         :rtype: `Construct`
# 
#         """
#         return self._reporter


# Path: tmapi/models/name.py
from django.db import models
from tmapi.constants import XSD_ANY_URI, XSD_STRING
from tmapi.exceptions import ModelConstraintException
from construct_fields import ConstructFields
from locator import Locator
from reifiable import Reifiable
from scoped import Scoped
from typed import Typed
from variant import Variant

        app_label = 'tmapi'

    def create_variant (self, value, scope, datatype=None):
        """Creates a `Variant` of this topic name with the specified
        string `value` and `scope`.

        If `datatype` is None, the newly created `Variant` will have
        the datatype xsd:string.

        The newly created `Variant` will contain all themes from the
        parent name and the themes specified in `scope`.

        :param value: the string value or locator which represents an IRI
        :type value: string or `Locator`
        :param scope: list of themes
        :type scope: list of `Topic`s
        :rtype: `Variant`

        """
        if value is None:
            raise ModelConstraintException(self, 'The value may not be None')
        if not scope:
            raise ModelConstraintException(self, 'The scope may not be None')
        if type(scope) not in (type([]), type(())):
            scope = [scope]
        if scope == list(self.get_scope()):
            raise ModelConstraintException(
                self, 'The variant would be in the same scope as the parent')
        if datatype is None:
            if isinstance(value, Locator):

                datatype = Locator(XSD_ANY_URI)