class ResourceType:
    """ base class for constructing resource model nodes from domain model elements """
    def __init__(self, basePath, baseType, resource):
        self._nodeMap = {
                 v._bn: v._null,
                 v._l:[],
                 v._e:[]
                 }
        self._basePath = basePath
        self._baseType = baseType
        self._name = resource[v._name]
        self._type = resource[v._type] 
        self._resource = resource
        self._nodeMap[v._bn] = self._basePath 
        """ Make an empty SenML Collection """
        self._node = ResourceNode(self._nodeMap)
        self._node.load(json.dumps(self._resourceTemplate))
        """ patch the type attribute link of the resource template """
        self.getNode()._resource._links.selectMerge( {}, {v._rt: self._type} )
        """ remove and replace href """
        self.getNode()._resource._links.selectMerge( {}, {v._href: None} )
        self.getNode()._resource._links.selectMerge( {}, {v._href: self._name} )
        """ Class-specific override to configure the node """
        self.configure()
        
    def configure(self):
        pass
    
    def getNode(self):
        return self._node
class ResourceContent:
    """ base class for constructing resource model content nodes from domain model elements """
    def __init__(self, _content, basePath):
        self._nodeMap = {
                 v._bn: v._null,
                 v._l:[],
                 v._e:[]
                 }
        self._basePath = basePath
        self._content = _content
        self._nodeMap[v._bn] = self._basePath 
        self._node = ResourceNode(self._nodeMap)
        self._node.load(json.dumps(self._contentTemplate))
        self.configure()
                
    def configure(self):
        pass

    def getNode(self):
        return self._node
 def __init__(self, _content, basePath):
     self._nodeMap = {
              v._bn: v._null,
              v._l:[],
              v._e:[]
              }
     self._basePath = basePath
     self._content = _content
     self._nodeMap[v._bn] = self._basePath 
     self._node = ResourceNode(self._nodeMap)
     self._node.load(json.dumps(self._contentTemplate))
     self.configure()