code: private String selectTerm(String iri, List<String> containers, String typeLanguage,
              List<String> preferredValues) {
          final Map<String, Object> inv = getInverse();
          // 1)
          final Map<String, Object> containerMap = (Map<String, Object>) inv.get(iri);
          // 2)
          for (final String container : containers) {
              // 2.1)
              if (!containerMap.containsKey(container)) {
                  continue;
              }
              // 2.2)
              final Map<String, Object> typeLanguageMap = (Map<String, Object>) containerMap
                      .get(container);
              // 2.3)
              final Map<String, Object> valueMap = (Map<String, Object>) typeLanguageMap
                      .get(typeLanguage);
              // 2.4 )
              for (final String item : preferredValues) {
                  // 2.4.1
                  if (!valueMap.containsKey(item)) {
                      continue;
                  }
                  // 2.4.2
                  return (String) valueMap.get(item);
              }
          }
          // 3)
          return null;
      }
docs: Term Selection
  
  http://json-ld.org/spec/latest/json-ld-api/#term-selection
  
  This algorithm, invoked via the IRI Compaction algorithm, makes use of an
  active context's inverse context to find the term that is best used to
  compact an IRI. Other information about a value associated with the IRI
  is given, including which container mappings and which type mapping or
  language mapping would be best used to express the value.
  
  @return the selected term.