/** * Gets all names, if any. * * @param bpe BioPAX element * @return Collection of names. */ public static Collection<String> getSynonyms(BioPAXElement bpe) { Collection<String> names = new HashSet<String>(); if(bpe instanceof Named) { names = ((Named)bpe).getName(); } return names; }
/** * Gets all names, if any present. * * @param bpe BioPAX element * @return Collection of names. */ private static Collection<String> getSynonyms(BioPAXElement bpe) { Collection<String> names = new HashSet<String>(); if(bpe instanceof Named) { names = ((Named)bpe).getName(); } return names; }
/** * Finds a name for the variable. * @param ele element to check * @return a name */ public String getAName(BioPAXElement ele) { String name = null; if (ele instanceof Named) { Named n = (Named) ele; if (n.getDisplayName() != null && n.getDisplayName().length() > 0) name = n.getDisplayName(); else if (n.getStandardName() != null && n.getStandardName().length() > 0) name = n.getStandardName(); else if (!n.getName().isEmpty() && n.getName().iterator().next().length() > 0) name = n.getName().iterator().next(); } if (name == null ) name = ele.getUri(); return name + " (" + ele.getModelInterface().getName().substring( ele.getModelInterface().getName().lastIndexOf(".") + 1) + ")"; } }
/** * Duplicate names syntax rule: * if a value is set either for the standardName * or displayName, adding it to the name is not necessary * (best practices) * * @param jp * @param name */ @Before("target(org.biopax.paxtools.model.level3.Named) " + "&& ( execution(public void addName(*)) || execution(public void set*(*)) ) " + "&& args(name)") public void adviseAddName(JoinPoint jp, String name) { Named bpe = (Named) jp.getTarget(); if (log.isDebugEnabled()) { log.debug("duplicateNamesControl rule checks: " + bpe + " gets name " + name); } if (bpe.getName().contains(name)) { report(bpe, BiopaxValidatorUtils.getId(bpe), "duplicate.names", "duplicateNamesAdvice", Behavior.WARNING, true, name); } }
/** * Gets synonym names. * * @param bpe BioPAX element * @return Collection of Synonym String Objects. */ public static Collection<String> getSynonymList(BioPAXElement bpe) { Collection<String> names = new HashSet<String>(); if(bpe instanceof Named) { names = ((Named)bpe).getName(); } else if(bpe instanceof sequenceFeature) { names = ((sequenceFeature)bpe).getSYNONYMS(); } else if(bpe instanceof physicalEntityParticipant){ names = getSynonymList(((physicalEntityParticipant)bpe).getPHYSICAL_ENTITY()); } else if(bpe instanceof entity) { names = ((entity)bpe).getSYNONYMS(); } return names; }
master.addComment(comm); if(master instanceof Named && clone instanceof Named) // - may be too much safety.. for(String n : ((Named)clone).getName()) ((Named)master).addName(n);