Ejemplo n.º 1
0
  /**
   * Adds a dialect to the <code>initialVariantMap</code>.
   *
   * @param dialectSpec the <code>ConceptSpec</code> representing the dialect concept
   * @param viewCoordinate the view coordinate specifying which versions are active or inactive
   * @param varientsSpec the <code>ConceptSpec</code> representing the dialect refex concept
   * @param terminologySnapshot the terminologySnapshot to use for getting component versions
   * @param initialVariantMap the map to udpate
   * @throws ContradictionException if more than one version is found for a given position or view
   *     coordinate
   * @throws IOException signals that an I/O exception has occurred
   */
  private static void addDialect(
      ConceptSpec dialectSpec,
      ViewCoordinate viewCoordinate,
      ConceptSpec varientsSpec,
      TerminologySnapshotDI terminologySnapshot,
      HashMap<Integer, Map<String, String>> initialVariantMap)
      throws ContradictionException, IOException {
    ConceptVersionBI dialectC = dialectSpec.getStrict(viewCoordinate);
    ConceptVersionBI variantTextRefsetC = varientsSpec.getStrict(viewCoordinate);

    Collection<? extends RefexChronicleBI<?>> dialectVarients =
        variantTextRefsetC.getRefexMembersActive(viewCoordinate);
    Map<String, String> variantDialectMap = new HashMap<String, String>();
    for (RefexChronicleBI<?> refex : dialectVarients) {
      if (RefexStringVersionBI.class.isAssignableFrom(refex.getClass())) {
        RefexStringVersionBI<?> dialectText =
            (RefexStringVersionBI<?>) refex.getVersion(viewCoordinate);
        if (dialectText != null) {
          RefexStringVersionBI<?> variantText =
              (RefexStringVersionBI<?>)
                  terminologySnapshot.getComponentVersion(dialectText.getReferencedComponentNid());
          variantDialectMap.put(variantText.getString1(), dialectText.getString1());
        }
      }
    }
    initialVariantMap.put(dialectC.getNid(), variantDialectMap);
  }
 public IdentifierDdo(TerminologySnapshotDI ss, IdBI id)
     throws IOException, ContradictionException {
   super(ss, id);
   this.authorityRef = new ComponentReference(ss.getConceptVersion(id.getAuthorityNid()));
 }