Search in sources :

Example 6 with CodeList

use of eu.esdihumboldt.hale.common.codelist.CodeList in project hale by halestudio.

the class SkosCodeListTest method testSKOSFromRDF5_language_de.

/**
 * test read SKOS properties in preferred language (fallback). As "de" not
 * available, it will load "en" by default
 *
 * @throws Exception throws exception if something wrong occurs
 */
@Test
public void testSKOSFromRDF5_language_de() throws Exception {
    CodeList codeList = readCodeList_WithLanguage(getResourceURI("/data/test4_lang_fallback.rdf"), "de");
    Collection<CodeEntry> entries = codeList.getEntries();
    assertFalse(entries.isEmpty());
    assertEquals(entries.size(), 4);
    assertNotNull(codeList.getLocation());
    assertNotNull(codeList.getIdentifier());
    CodeEntry entry = codeList.getEntryByIdentifier("EuroGeoNamesLocationTypeValue/1");
    assertEquals("Countries, administrative units and other areas", entry.getName());
    assertEquals("Country, territorial units of a country for administrative purposes and other manmade areas.", entry.getDescription());
}
Also used : CodeList(eu.esdihumboldt.hale.common.codelist.CodeList) CodeEntry(eu.esdihumboldt.hale.common.codelist.CodeList.CodeEntry) Test(org.junit.Test)

Example 7 with CodeList

use of eu.esdihumboldt.hale.common.codelist.CodeList in project hale by halestudio.

the class CodeListAdvisor method handleResults.

@Override
public void handleResults(CodeListReader provider) {
    CodeList codeList = provider.getCodeList();
    if (codeList != null) {
        CodeListReference key = new CodeListReference(codeList.getNamespace(), codeList.getIdentifier());
        codeLists.put(key, codeList);
    }
}
Also used : CodeList(eu.esdihumboldt.hale.common.codelist.CodeList) CodeListReference(eu.esdihumboldt.hale.common.codelist.config.CodeListReference)

Example 8 with CodeList

use of eu.esdihumboldt.hale.common.codelist.CodeList in project hale by halestudio.

the class CodeListSelectionDialog method okPressed.

/**
 * @see Dialog#okPressed()
 */
@Override
protected void okPressed() {
    CodeListSelector selector = selectors.get(tabFolder.getSelectionIndex());
    CodeList codeList = selector.getCodeList();
    if (codeList != null) {
        this.codeList = codeList;
        super.okPressed();
    } else {
        // setErrorMessage("Invalid code list selection");
        MessageDialog.openError(getShell(), Messages.CodeListSelectionDialog_5, // $NON-NLS-1$ //$NON-NLS-2$
        Messages.CodeListSelectionDialog_6);
    }
}
Also used : CodeList(eu.esdihumboldt.hale.common.codelist.CodeList)

Example 9 with CodeList

use of eu.esdihumboldt.hale.common.codelist.CodeList in project hale by halestudio.

the class SkosCodeListTest method testSKOSFromRDF1.

/**
 * test rdf file consisting only concepts
 *
 * @throws Exception throws exception if something wrong occurs
 */
@Test
public void testSKOSFromRDF1() throws Exception {
    CodeList codeList = readCodeList(getResourceURI("/data/test1.rdf"));
    Collection<CodeEntry> entries = codeList.getEntries();
    assertFalse(entries.isEmpty());
    assertEquals(entries.size(), 1);
    assertNotNull(codeList.getLocation());
    assertNotNull(codeList.getIdentifier());
    for (CodeEntry entry : entries) {
        assertEquals("Data scientist", entry.getName());
    }
}
Also used : CodeList(eu.esdihumboldt.hale.common.codelist.CodeList) CodeEntry(eu.esdihumboldt.hale.common.codelist.CodeList.CodeEntry) Test(org.junit.Test)

Example 10 with CodeList

use of eu.esdihumboldt.hale.common.codelist.CodeList in project hale by halestudio.

the class SkosCodeListTest method testSKOSFromRDF5_language_nl.

/**
 * test read SKOS properties in preferred language (fallback).
 *
 * @throws Exception throws exception if something wrong occurs
 */
@Test
public void testSKOSFromRDF5_language_nl() throws Exception {
    CodeList codeList = readCodeList_WithLanguage(getResourceURI("/data/test4_lang_fallback.rdf"), "nl");
    Collection<CodeEntry> entries = codeList.getEntries();
    assertFalse(entries.isEmpty());
    assertEquals(entries.size(), 4);
    assertNotNull(codeList.getLocation());
    assertNotNull(codeList.getIdentifier());
    CodeEntry entry = codeList.getEntryByIdentifier("EuroGeoNamesLocationTypeValue/1");
    assertEquals("Landen, administratieve en overige gebieden", entry.getName());
    assertEquals("Country, territorial units of a country for administrative purposes and other manmade areas.", entry.getDescription());
}
Also used : CodeList(eu.esdihumboldt.hale.common.codelist.CodeList) CodeEntry(eu.esdihumboldt.hale.common.codelist.CodeList.CodeEntry) Test(org.junit.Test)

Aggregations

CodeList (eu.esdihumboldt.hale.common.codelist.CodeList)14 CodeEntry (eu.esdihumboldt.hale.common.codelist.CodeList.CodeEntry)10 Test (org.junit.Test)9 CodeListReference (eu.esdihumboldt.hale.common.codelist.config.CodeListReference)3 CodeListAssociations (eu.esdihumboldt.hale.common.codelist.config.CodeListAssociations)1 ValidationException (eu.esdihumboldt.hale.common.instance.extension.validation.ValidationException)1 CodeListService (eu.esdihumboldt.hale.ui.codelist.service.CodeListService)1