use of eu.esdihumboldt.hale.common.codelist.CodeList in project hale by halestudio.
the class CodeListImportAdvisor method handleResults.
/**
* @see IOAdvisor#handleResults(IOProvider)
*/
@Override
public void handleResults(CodeListReader provider) {
CodeList code = provider.getCodeList();
CodeListService cs = getService(CodeListService.class);
if (cs != null) {
cs.addCodeList(provider.getResourceIdentifier(), code);
}
super.handleResults(provider);
}
use of eu.esdihumboldt.hale.common.codelist.CodeList in project hale by halestudio.
the class CodeListServiceImpl method findCodeListByEntity.
@Override
public CodeList findCodeListByEntity(EntityDefinition entity) {
CodeList result = null;
CodeListReference ref = associations.getCodeList(entity);
if (ref != null) {
result = findCodeListByIdentifier(ref.getNamespace(), ref.getIdentifier());
}
if (result == null) {
// fall-back to legacy mechanism
String ident = entity.getDefinition().getIdentifier();
result = findCodeListByAttribute(ident);
}
return result;
}
use of eu.esdihumboldt.hale.common.codelist.CodeList in project hale by halestudio.
the class SkosCodeListTest method testSKOSFromRDF4_language_en.
/**
* test read SKOS properties in preferred language.
*
* @throws Exception throws exception if something wrong occurs
*/
@Test
public void testSKOSFromRDF4_language_en() throws Exception {
String base_ns = "http://www.locationframework.eu/codelist/";
CodeList codeList = readCodeList_WithLanguage(getResourceURI("/data/test4_lang.rdf"), "en");
Collection<CodeEntry> entries = codeList.getEntries();
assertFalse(entries.isEmpty());
assertEquals(entries.size(), 4);
assertNotNull(codeList.getLocation());
assertNotNull(codeList.getIdentifier());
CodeEntry entry = codeList.getEntryByIdentifier(base_ns + "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());
}
use of eu.esdihumboldt.hale.common.codelist.CodeList in project hale by halestudio.
the class SkosCodeListTest method testSKOSFromRDF4_language_nl.
/**
* test read SKOS properties in preferred language.
*
* @throws Exception throws exception if something wrong occurs
*/
@Test
public void testSKOSFromRDF4_language_nl() throws Exception {
String base_ns = "http://www.locationframework.eu/codelist/";
CodeList codeList = readCodeList_WithLanguage(getResourceURI("/data/test4_lang.rdf"), "nl");
Collection<CodeEntry> entries = codeList.getEntries();
assertFalse(entries.isEmpty());
assertEquals(entries.size(), 4);
assertNotNull(codeList.getLocation());
assertNotNull(codeList.getIdentifier());
CodeEntry entry = codeList.getEntryByIdentifier(base_ns + "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());
}
use of eu.esdihumboldt.hale.common.codelist.CodeList in project hale by halestudio.
the class SkosCodeListTest method testSKOSFromRDF4_language_de.
/**
* test read SKOS properties in preferred language, as "de" not available,
* it will load "en" by default
*
* @throws Exception throws exception if something wrong occurs
*/
@Test
public void testSKOSFromRDF4_language_de() throws Exception {
String base_ns = "http://www.locationframework.eu/codelist/";
CodeList codeList = readCodeList_WithLanguage(getResourceURI("/data/test4_lang.rdf"), "de");
Collection<CodeEntry> entries = codeList.getEntries();
assertFalse(entries.isEmpty());
assertEquals(entries.size(), 4);
assertNotNull(codeList.getLocation());
assertNotNull(codeList.getIdentifier());
CodeEntry entry = codeList.getEntryByIdentifier(base_ns + "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());
}
Aggregations