/** * Term definition for a code, in a specified language. * * @param language * @param code * @return null if not found */ public ArchetypeTerm termDefinition(String language, String code) { return definition(language, code, termDefinitionMap); }
if(ontology.getTermDefinitionsList() != null) { final List<OntologyDefinitions> termDefinitions = ontology.getTermDefinitionsList(); if(ontology.getConstraintDefinitionsList() != null) { final List<OntologyDefinitions> constraintDefinitions = ontology.getConstraintDefinitionsList(); if (ontology.getTermBindingList() != null) { final List<OntologyBinding> termBindings = ontology.getTermBindingList(); if (ontology.getConstraintBindingList() != null) { final List<OntologyBinding> constraintBindings = ontology.getConstraintBindingList();
/** * 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); }
public void checkArchetypeTermBindingsValidity(Archetype archetype, List<ValidationError> errors) { List<OntologyBinding> termBindings = archetype.getOntology().getTermBindingList(); ValidationError error = null; if (termBindings != null) { for (OntologyBinding binding : termBindings) { for (OntologyBindingItem obi : binding.getBindingList()) { if (obi.getCode().startsWith("at")) { // bound to an atcode if (archetype.getOntology().termDefinition(archetype.getOriginalLanguage().getCodeString(), obi.getCode()) == null) { error = new ValidationError(ErrorType.WITB, "ATCODE", obi.getCode()); errors.add(error); } } else { // bound to a complete path if (!archetype.physicalPaths().contains(obi.getCode())) { error = new ValidationError(ErrorType.WITB, "PATH", obi.getCode()); errors.add(error); } } } } } }
private static ArchetypeTerm getArchetypeTerm(Archetype ar, String codeStr, String language) { ArchetypeTerm term = ar.getOntology().termDefinition(language, codeStr); if (term == null) { term = ar.getOntology().termDefinition(ar.getOriginalLanguage().getCodeString(), codeStr); } return term; }
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); } } }
String lang = archetype.getOriginalLanguage().getCodeString(); List<OntologyDefinitions> defList = archetype.getOntology().getConstraintDefinitionsList(); OntologyDefinitions priDefs = null; ValidationError error = null;
{if (true) return new ArchetypeOntology(primaryLanguage, terminologies, termDefinitionsList, constraintDefinitionsList, termBindingList, constraintBindingList);}
if (ontology.getTerminologies() != null) { indent(1, out); out.write("terminologies_available = <"); for (String terminology : ontology.getTerminologies()) { out.write(quoteString(terminology)); out.write(", "); out.write("term_definitions = <"); newline(out); List<OntologyDefinitions> termDefinitionsList = ontology.getTermDefinitionsList(); printDefinitionList(out, termDefinitionsList); indent(1, out); List<OntologyDefinitions> constraintDefinitionsList = ontology.getConstraintDefinitionsList(); if (constraintDefinitionsList != null) { indent(1, out); if (ontology.getTermBindingList() != null) { indent(1, out); out.write("term_binding = <"); newline(out); for (int i = 0; i < ontology.getTermBindingList().size(); i++) { OntologyBinding bind = ontology.getTermBindingList().get(i); indent(2, out); out.write("["); for (int j = 0; j < ontology.getTermBindingList().get(i) .getBindingList().size(); j++) { TermBindingItem item = (TermBindingItem) ontology
String primaryLang = archetype.getOriginalLanguage().getCodeString(); List<OntologyDefinitions> termDefList = archetype.getOntology().getTermDefinitionsList(); checkDuplicateLanguage(errors, termDefList); List<OntologyDefinitions> constraintDefList = archetype.getOntology().getConstraintDefinitionsList(); checkDuplicateLanguage(errors, constraintDefList);
String retrieveArchetypeTermText(String nodeId, Archetype archetype) throws Exception { String language = archetype.getOriginalLanguage().getCodeString(); ArchetypeTerm term = archetype.getOntology().termDefinition(language, nodeId); if(term == null) { throw new Exception("term of given code: " + nodeId + ", language: " + language + " not found.."); } return term.getText(); }
String lang = archetype.getOriginalLanguage().getCodeString(); List<OntologyDefinitions> defList = archetype.getOntology().getTermDefinitionsList(); OntologyDefinitions priDefs = null; ValidationError error = null;
{if (true) return new ArchetypeOntology(primaryLanguage, terminologies, termDefinitionsList, constraintDefinitionsList, termBindingList, constraintBindingList);}
if (ontology.getTerminologies() != null) { indent(1, out); out.write("terminologies_available = <"); for (String terminology : ontology.getTerminologies()) { out.write(quoteString(terminology)); out.write(", "); out.write("term_definitions = <"); newline(out); List<OntologyDefinitions> termDefinitionsList = ontology.getTermDefinitionsList(); printDefinitionList(out, termDefinitionsList); indent(1, out); List<OntologyDefinitions> constraintDefinitionsList = ontology.getConstraintDefinitionsList(); if (constraintDefinitionsList != null) { indent(1, out); if (ontology.getTermBindingList() != null) { indent(1, out); out.write("term_binding = <"); newline(out); for (int i = 0; i < ontology.getTermBindingList().size(); i++) { OntologyBinding bind = ontology.getTermBindingList().get(i); indent(2, out); out.write("["); for (int j = 0; j < ontology.getTermBindingList().get(i) .getBindingList().size(); j++) { TermBindingItem item = (TermBindingItem) ontology
/** * The concept name of the archetype in language * language; corresponds to the term definition of * the concept attribute in the archetype ontology. * * @param language the language of the concept name * @return concept name in the requested language or * null if the language as a whole or the concept * in that language does not exist. */ public String getConceptName(String language) { ArchetypeTerm term = null; String conceptCode = this.getConcept(); term = this.getOntology().termDefinition(language, conceptCode); if (term == null) { return null; } return term.getItem(ArchetypeTerm.TEXT); }
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; } }
/** * Term definition for a code in the primary language. * * @param code * @return not null */ public ArchetypeTerm termDefinition(String code) { return definition(primaryLanguage, code, termDefinitionMap); }
/** * The concept name of the archetype in language * language; corresponds to the term definition of * the concept attribute in the archetype ontology. * * @param language the language of the concept name * @return concept name in the requested language or * null if the language as a whole or the concept * in that language does not exist. */ public String getConceptName(String language) { ArchetypeTerm term = null; String conceptCode = this.getConcept(); term = this.getOntology().termDefinition(language, conceptCode); if (term == null) { return null; } return term.getItem(ArchetypeTerm.TEXT); }
/** * Constraint definition for a code, in a specified language. * * @param language * @param code * @return null if not found */ public ArchetypeTerm constraintDefinition(String language, String code) { return definition(language, code, constraintDefinitionMap); }
private String getDescription(Archetype ar, CObject constrainedObj, String language) { String desc = getDescription(ar, constrainedObj.getNodeId(), language); if (desc != null) { return desc; } else { Archetype archetype = archetypeMap.get(constrainedObj.getNodeId()); if (archetype != null) { String conceptCode = archetype.getConcept(); ArchetypeTerm term = archetype.getOntology().termDefinition(language, conceptCode); desc = term.getDescription(); } else { desc = constrainedObj.getNodeId(); } return desc; } }