private String getParentOrgan( Document document, Element description, Element parentStructure, String parentOfParentStructure) { // check for 'part_of' relation on parentstructure String partOfChain = getPartOfChain(document, description, parentStructure, 0) .replace(" of ", ",") .trim(); // part of organ of organ if (!partOfChain.isEmpty()) { // use explicit part_of parentOfParentStructure = partOfChain; } // add constraint organ to parentorgan list String parentStructureConstraint = parentStructure.getAttributeValue("constraint"); if (parentStructureConstraint != null) { if (characterKnowledgeBase.isEntityStructuralContraint(parentStructureConstraint)) { // parentorgan = constraint; //use the constraint of parentstruct as parentorgan, e.g. leaf // blade ..., petiole ..., vein .... parentOfParentStructure = parentStructureConstraint + "," + parentOfParentStructure; // blade, leaf } } // add name organ to parentorgan list // parentorgan = parentofparentstructure+" "+parentstruct.getAttributeValue("name");//leaf blade return parentStructure.getAttributeValue("name") + "," + parentOfParentStructure; // blade, leaf }
/** * @param struct * @return true if the structure element has a constraint that refers to a(nother) structure */ private boolean hasStructuralConstraint(Element struct) { String constraint = struct.getAttributeValue("constraint"); if (constraint == null || constraint.isEmpty()) return false; if (characterKnowledgeBase.isEntityStructuralContraint(constraint)) return true; return false; }