Changeset 4575


Ignore:
Timestamp:
02/25/14 15:05:49 (10 years ago)
Author:
teckart
Message:

Attempt to fix ticket #412: "Allow for plain <language> tagging" by adding language DCMI to facet concepts and supporting ISO639-2/B language codes

Location:
vlo/branches/vlo-3.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • vlo/branches/vlo-3.0/vlo-commons/src/main/resources/facetConcepts.xml

    r4557 r4575  
    9494    <concept>http://www.isocat.org/datcat/DC-5361</concept> <!-- language usage (TEI) -->
    9595    <concept>http://www.isocat.org/datcat/DC-5358</concept> <!--language (TEI) - MENZO: added for CLARIN-DK -->
     96   
     97    <concept>http://purl.org/dc/terms/language</concept>
    9698   <!-- Had to be removed due to IDSAGD_Speaker  <acceptableContext includeAny="false" includeEmpty="true"/>
    9799    <rejectableContext includeAny="true"  includeEmpty="false">
     
    126128    <concept>http://www.isocat.org/datcat/DC-5361</concept> <!-- language usage (TEI) -->
    127129    <concept>http://www.isocat.org/datcat/DC-5358</concept> <!--language (TEI) - MENZO: added for CLARIN-DK -->
     130   
     131    <concept>http://purl.org/dc/terms/language</concept>
    128132   <!-- Had to be removed due to IDSAGD_Speaker <acceptableContext includeAny="false" includeEmpty="true"/>
    129133    <rejectableContext includeAny="true"  includeEmpty="false">
  • vlo/branches/vlo-3.0/vlo-importer/src/main/java/eu/clarin/cmdi/vlo/importer/LanguageCodePostProcessor.java

    r4507 r4575  
    3232    private Map<String, String> languageNameToIso639Map;
    3333    private Map<String, String> iso639ToLanguageNameMap;
     34    private Map<String, String> iso639_2TToISO639_3Map;
    3435
    3536    /**
     
    7374            }
    7475        }
     76       
     77        // convert ISO 639-2/T codes to ISO 639-3
     78        if (getIso6392TToISO6393Map().containsKey(value.toUpperCase())) {
     79            result = getIso6392TToISO6393Map().get(value.toUpperCase());
     80        }
     81       
    7582        // Convert to lowercase to capture erroneously capitalized language codes in the CMDI files.
    7683        // NOTE: In the mappings themselves we do not capitalize.
     
    122129
    123130        return iso639ToLanguageNameMap;
     131    }
     132   
     133    /**
     134     * Returns map of ISO 639-2/B codes to ISO 639-3
     135     *
     136     *  It is strongly advised to use ISO 639-3 codes, the support for ISO 639-2 may be discontinued in the future
     137     *
     138     * @return map of ISO 639-2/B codes to ISO 639-3
     139     */
     140    private Map<String, String> getIso6392TToISO6393Map() {
     141        if (iso639_2TToISO639_3Map == null) {
     142            iso639_2TToISO639_3Map = new HashMap<String, String>();
     143            iso639_2TToISO639_3Map.put("ALB", "SQI");
     144            iso639_2TToISO639_3Map.put("ARM", "HYE");
     145            iso639_2TToISO639_3Map.put("BAQ", "EUS");
     146            iso639_2TToISO639_3Map.put("BUR", "MYA");
     147            iso639_2TToISO639_3Map.put("CZE", "CES");
     148            iso639_2TToISO639_3Map.put("CHI", "ZHO");
     149            iso639_2TToISO639_3Map.put("DUT", "NLD");
     150            iso639_2TToISO639_3Map.put("FRE", "FRA");
     151            iso639_2TToISO639_3Map.put("GEO", "KAT");
     152            iso639_2TToISO639_3Map.put("GER", "DEU");
     153            iso639_2TToISO639_3Map.put("GRE", "ELL");
     154            iso639_2TToISO639_3Map.put("ICE", "ISL");
     155            iso639_2TToISO639_3Map.put("MAC", "MKD");
     156            iso639_2TToISO639_3Map.put("MAO", "MRI");
     157            iso639_2TToISO639_3Map.put("MAY", "MSA");
     158            iso639_2TToISO639_3Map.put("PER", "FAS");
     159            iso639_2TToISO639_3Map.put("RUM", "RON");
     160            iso639_2TToISO639_3Map.put("SLO", "SLK");
     161            iso639_2TToISO639_3Map.put("TIB", "BOD");
     162            iso639_2TToISO639_3Map.put("WEL", "CYM");
     163        }
     164       
     165        return iso639_2TToISO639_3Map;
    124166    }
    125167
  • vlo/branches/vlo-3.0/vlo-importer/src/test/java/eu/clarin/cmdi/vlo/importer/LanguageCodePostProcessorTest.java

    r4517 r4575  
    3030        assertEquals("German", processor.process("RFC1766:x-sil-GER"));
    3131        assertEquals("RFC1766:sgn-NL", processor.process("RFC1766:sgn-NL"));
     32        assertEquals("Basque", processor.process("baq"));
    3233    }
    3334
Note: See TracChangeset for help on using the changeset viewer.