# Path: tmapi/constants.py
# XSD_ANY_URI = XSD + 'anyURI'
# 
# XSD_FLOAT = XSD + 'float'
# 
# XSD_INT = XSD + 'int'
# 
# XSD_LONG = XSD + 'long'
# 
# 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_FLOAT, XSD_INT, XSD_LONG, \
    XSD_STRING
from tmapi.exceptions import ModelConstraintException
from locator import Locator
from reifiable import Reifiable
from scoped import Scoped

    def locator_value (self):
        """Returns the `Locator` representation of the value.

        :rtype: `Locator`

        """
        if self.datatype == XSD_ANY_URI:
            return Locator(self.value)
        raise TypeError('Value is not a Locator')
    
    def set_value (self, value, datatype=None):
        """Sets the value.

        If `datatype` is None, the datatype will be implicitly set to
        match the type of `value`.

        :param value: the value
        :param datatype: optional datatype of `value`
        :type datatype: `Locator`

        """
        if value is None:
            raise ModelConstraintException(self, 'The value may not be None')
        if datatype is None:
            # This mapping is not comprehensive, since the mapping
            # (from section 1.10.3 at
            # http://cvs.zope.org/~checkout~/Packages/WebService/doc/WebService.html)
            # has the same Python type mapped to multiple XSD types.
            if isinstance(value, str) or isinstance(value, unicode):

# Path: tmapi/constants.py
# XSD_ANY_URI = XSD + 'anyURI'
# 
# XSD_FLOAT = XSD + 'float'
# 
# XSD_INT = XSD + 'int'
# 
# XSD_LONG = XSD + 'long'
# 
# 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/datatype_aware.py
from django.db import models
from tmapi.constants import XSD_ANY_URI, XSD_FLOAT, XSD_INT, XSD_LONG, \
    XSD_STRING
from tmapi.exceptions import ModelConstraintException
from locator import Locator
from reifiable import Reifiable
from scoped import Scoped


    def locator_value (self):
        """Returns the `Locator` representation of the value.

        :rtype: `Locator`

        """
        if self.datatype == XSD_ANY_URI:
            return Locator(self.value)
        raise TypeError('Value is not a Locator')
    
    def set_value (self, value, datatype=None):
        """Sets the value.

        If `datatype` is None, the datatype will be implicitly set to
        match the type of `value`.

        :param value: the value
        :param datatype: optional datatype of `value`
        :type datatype: `Locator`

        """
        if value is None:
            raise ModelConstraintException(self, 'The value may not be None')
        if datatype is None:
            # This mapping is not comprehensive, since the mapping
            # (from section 1.10.3 at
            # http://cvs.zope.org/~checkout~/Packages/WebService/doc/WebService.html)
            # has the same Python type mapped to multiple XSD types.
            if isinstance(value, str) or isinstance(value, unicode):

                datatype = XSD_STRING