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; }
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(); }
/** * 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); }
/** * 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); }
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; } }
if (!archetype.getOntology().termDefinition(langPrim, ccobj.getNodeId()).equals( parentArchetype.getOntology().termDefinition(langPrim, ccobj.getNodeId()))) { if (archetype.getOntology().termDefinition(langPrim, ccobj.getNodeId()) !=null) { log.debug("child desc: "+archetype.getOntology().termDefinition(langPrim, ccobj.getNodeId()).getText()); log.debug("child desc: "+archetype.getOntology().termDefinition(langPrim, ccobj.getNodeId()).getDescription()); if (parentArchetype.getOntology().termDefinition(langPrim, ccobj.getNodeId()) !=null) { log.debug("parent desc: "+ parentArchetype.getOntology().termDefinition(langPrim, ccobj.getNodeId()).getText()); log.debug("parent desc: "+ parentArchetype.getOntology().termDefinition(langPrim, ccobj.getNodeId()).getDescription()); if (parentArchetype.getOntology().termDefinition(langPrim, ccobj.getNodeId()) != null) { errors.add(new ValidationError(ErrorType.VSONIR, "TEXTDESCRIPTION", ccobj.path(), ccobj.getRmTypeName(), parentNode.getRmTypeName(), ccobj.getNodeId(), langPrim)); if (!archetype.getOntology().termDefinition(trans.getValue().getLanguage().getCodeString(), ccobj.getNodeId()).equals( parentArchetype.getOntology().termDefinition(trans.getValue().getLanguage().getCodeString(), ccobj.getNodeId()))) { if (parentArchetype.getOntology().termDefinition(trans.getValue().getLanguage().getCodeString(), ccobj.getNodeId()) != null) { errors.add(new ValidationError(ErrorType.VSONIR, "TEXTDESCRIPTION", ccobj.path(), ccobj.getRmTypeName(), parentNode.getRmTypeName(), ccobj.getNodeId(), trans.getValue().getLanguage().getCodeString()));
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); } } } } } }