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

  class State
    constructor: (@base, @profile, resolveURI) ->
      @resolveURI = resolveURI
      @mapper = new Mapper(null, contexts[@profile])
      @lang = null

      @lists = {}

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

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

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

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


  class Context
    constructor: (@vocab=null, @prefixes={}) ->

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

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