Search in sources :

Example 6 with CodeEntry

use of eu.esdihumboldt.hale.common.codelist.CodeList.CodeEntry 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 7 with CodeEntry

use of eu.esdihumboldt.hale.common.codelist.CodeList.CodeEntry 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)

Example 8 with CodeEntry

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

the class SkosCodeListTest method testSKOSFromRDF2.

/**
 * test rdf file consisting concept scheme and concepts
 *
 * @throws Exception throws exception if something wrong occurs
 */
@Test
public void testSKOSFromRDF2() throws Exception {
    CodeList codeList = readCodeList(getResourceURI("/data/test2.rdf"));
    Collection<CodeEntry> entries = codeList.getEntries();
    assertFalse(entries.isEmpty());
    assertEquals(entries.size(), 3);
    assertNotNull(codeList.getLocation());
    assertNotNull(codeList.getIdentifier());
    assertEquals("Types of aquifers.", codeList.getDescription());
    List<String> concepts = Arrays.asList("confined subartesian", "confined artesian", "unconfined");
    for (CodeEntry entry : entries) {
        assertTrue(concepts.contains(entry.getName()));
    }
}
Also used : CodeList(eu.esdihumboldt.hale.common.codelist.CodeList) CodeEntry(eu.esdihumboldt.hale.common.codelist.CodeList.CodeEntry) Test(org.junit.Test)

Example 9 with CodeEntry

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

the class SkosCodeListTest method testSKOSFromRDF5_language_en.

/**
 * test read SKOS properties in preferred language (fallback).
 *
 * @throws Exception throws exception if something wrong occurs
 */
@Test
public void testSKOSFromRDF5_language_en() throws Exception {
    CodeList codeList = readCodeList_WithLanguage(getResourceURI("/data/test4_lang_fallback.rdf"), "en");
    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 10 with CodeEntry

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

the class SkosCodeListTest method testSKOSFromRDF3.

/**
 * test url saved as xml consisting concepts (case: fallback).
 *
 * @throws Exception throws exception if something wrong occurs
 */
@Test
public void testSKOSFromRDF3() throws Exception {
    String id = "http://vocab.ices.dk/services/rdf/collection/PARAM/%25DNAtail";
    CodeList codeList = readCodeList(getResourceURI("/data/test3.rdf"));
    Collection<CodeEntry> entries = codeList.getEntries();
    assertFalse(entries.isEmpty());
    assertEquals(entries.size(), 4);
    assertNotNull(codeList.getLocation());
    assertNotNull(codeList.getIdentifier());
    CodeEntry entry = codeList.getEntryByIdentifier(id);
    assertEquals("% DNA in tail (a measure of the proportion of total DNA present in the comet tail)", entry.getName());
}
Also used : CodeList(eu.esdihumboldt.hale.common.codelist.CodeList) CodeEntry(eu.esdihumboldt.hale.common.codelist.CodeList.CodeEntry) Test(org.junit.Test)

Aggregations

CodeEntry (eu.esdihumboldt.hale.common.codelist.CodeList.CodeEntry)11 CodeList (eu.esdihumboldt.hale.common.codelist.CodeList)10 Test (org.junit.Test)9 CodeListAssociations (eu.esdihumboldt.hale.common.codelist.config.CodeListAssociations)1 CodeListReference (eu.esdihumboldt.hale.common.codelist.config.CodeListReference)1 IOMessageImpl (eu.esdihumboldt.hale.common.core.io.report.impl.IOMessageImpl)1 ValidationException (eu.esdihumboldt.hale.common.instance.extension.validation.ValidationException)1 NodeList (org.w3c.dom.NodeList)1