private void checkTermExistsInParent(Archetype parentArchetype, String code, List<ValidationError> errors) { String lang = parentArchetype.getOriginalLanguage().getCodeString(); List<OntologyDefinitions> defList = parentArchetype.getOntology().getTermDefinitionsList(); OntologyDefinitions priDefs = null; ValidationError error = null; for(OntologyDefinitions defs : defList) { if(lang.equals(defs.getLanguage())) { priDefs = defs; } } if(priDefs == null) { error = new ValidationError(ErrorType.VATDF, "INPARENT", code); errors.add(error); } else { List<ArchetypeTerm> terms = priDefs.getDefinitions(); Set<String> definedCodes = new LinkedHashSet<String>(); for(ArchetypeTerm term : terms) { definedCodes.add(term.getCode()); } if( ! definedCodes.contains(code)) { error = new ValidationError(ErrorType.VATDF, "INPARENT", code); errors.add(error); } } }
/** * Checks ontology code specialisation level validity. No archetype code * (at-code or ac-code) defined in the ontology can be of a greater * specialisation depth than the archetype. * * @param archetype * @param errors */ public void checkOntologyCodeSpecialisationLevelValidity( Archetype archetype, List<ValidationError> errors) { log.debug("validating ontology code specialisation of archetype: " + archetype.getArchetypeId()); List<String> specialisation = archetype.getArchetypeId().specialisation(); log.debug("specialisation list: " + specialisation); int level = specialisation == null ? 0 : specialisation.size(); log.debug("specialisation level: " + level); List<OntologyDefinitions> list = null; list = archetype.getOntology().getTermDefinitionsList(); checkOntologyDefinitions(list, errors, level); list = archetype.getOntology().getConstraintDefinitionsList(); checkOntologyDefinitions(list, errors, level); }
if(ontology.getTermDefinitionsList() != null) { final List<OntologyDefinitions> termDefinitions = ontology.getTermDefinitionsList();
String lang = archetype.getOriginalLanguage().getCodeString(); List<OntologyDefinitions> defList = archetype.getOntology().getTermDefinitionsList(); OntologyDefinitions priDefs = null; ValidationError error = null;
String primaryLang = archetype.getOriginalLanguage().getCodeString(); List<OntologyDefinitions> termDefList = archetype.getOntology().getTermDefinitionsList(); checkDuplicateLanguage(errors, termDefList);
out.write("term_definitions = <"); newline(out); List<OntologyDefinitions> termDefinitionsList = ontology.getTermDefinitionsList(); printDefinitionList(out, termDefinitionsList); indent(1, out);
out.write("term_definitions = <"); newline(out); List<OntologyDefinitions> termDefinitionsList = ontology.getTermDefinitionsList(); printDefinitionList(out, termDefinitionsList); indent(1, out);
public Collection<ArchetypeTermVO> generateArchetypeTerms() { Collection<ArchetypeTermVO> archetypeTermVOs = new ArrayList<>(); ArchetypeOntology ao = ar.getOntology(); List<OntologyDefinitions> ods = ao.getTermDefinitionsList(); for (OntologyDefinitions od : ods) { String lang = od.getLanguage(); List<ArchetypeTerm> archetypeTerms = od.getDefinitions(); for (ArchetypeTerm archetypeTerm : archetypeTerms) { archetypeTermVOs.add( ArchetypeTermVO.builder() .archetypeId(ar.getArchetypeId().getValue()) .code(archetypeTerm.getCode()) .language(lang) .text(archetypeTerm.getText()) .description(archetypeTerm.getDescription()) .build()); } } return archetypeTermVOs; } }