   exports.extract = extract
   exports.Description = Description
   exports.State = State
-  exports.Mapper = Mapper
+  exports.Context = Context
   exports.ElementData = ElementData
   exports.contexts = contexts
 

    createSubState: (base, lang, vocab, prefixes) ->
      subState = inherit(this)
      subState.lang = if lang? then lang else @lang
      subState.mapper = @mapper.createSubMap(vocab, prefixes)
      return subState

    expandTermOrCurieOrIRI: (expr) ->
      @mapper.expandTermOrCurieOrIRI(expr)

    expandCurieOrIRI: (expr) ->
      @mapper.expandCurieOrIRI(expr)

    expandAndResolve: (curieOrIri) ->
      @resolveURI(@expandCurieOrIRI(curieOrIri))


  class Mapper
    constructor: (@vocab=null, @map={}) ->

    createSubMap: (vocab, prefixes) ->
      vocab ?= @vocab
      subMap = inherit(@map)
      for pfx, iri of prefixes
        subMap[pfx] = iri
      return new Mapper(vocab, subMap)

    expandTermOrCurieOrIRI: (expr) ->
      iri = @map[expr]
      if iri
        return iri
      else if expr.indexOf(":") is -1

        return expr
      if term.slice(0, 2) is "//"
        return expr
      ns = @prefixes[pfx]
      if ns
        return ns + term
      return expr
