/** * Retrieves the cellular location of the PhysicalEntity. * @return cellular location of the PhysicalEntity */ public Set<String> getCellularLocations() { Set<String> locs = new HashSet<String>(); for (PhysicalEntity pe : pes) { CellularLocationVocabulary voc = pe.getCellularLocation(); if (voc != null) { for (String term : voc.getTerm()) { if (term != null && term.length() > 0) locs.add(term); } } } return locs; }
public void check(Complex thing, boolean fix) { Set<PhysicalEntity> ents = thing.getComponent(); if (ents != null) { Collection<String> diffLocs = new HashSet<String>(); PhysicalEntity ref = thing; for (PhysicalEntity e : ents) { if(ref.getCellularLocation()==null && e.getCellularLocation() != null) { ref = e; continue; } if (e.getCellularLocation() != null && !ref.getCellularLocation().isEquivalent(e.getCellularLocation())) { diffLocs.add(e + " " + e.getCellularLocation()); } } if(!diffLocs.isEmpty()) { error(thing, "component.different.location", false, thing.getCellularLocation() + "", diffLocs); } } }
public void check(final Validation validation, Complex thing) { Set<PhysicalEntity> ents = thing.getComponent(); if (ents != null) { Collection<String> diffLocs = new HashSet<String>(); PhysicalEntity ref = thing; for (PhysicalEntity e : ents) { if(ref.getCellularLocation()==null && e.getCellularLocation() != null) { ref = e; continue; } if (e.getCellularLocation() != null && !ref.getCellularLocation().isEquivalent(e.getCellularLocation())) { diffLocs.add(e + " " + e.getCellularLocation()); } } if(!diffLocs.isEmpty()) { error(validation, thing, "component.different.location", false, thing.getCellularLocation() + "", diffLocs); } } }
/** * Gets the compartment of the given PhysicalEntity. * * @param pe PhysicalEntity to look for its compartment * @return name of compartment or null if there is none */ private Glyph getCompartment(PhysicalEntity pe) { CellularLocationVocabulary cl = pe.getCellularLocation(); if (cl != null && !cl.getTerm().isEmpty()) { String name = null; // get a cv term, // ignoring IDs (should not be there but happens) for(String term : cl.getTerm()) { term = term.toLowerCase(); if(!term.matches("(go|so|mi|bto|cl|pato|mod):")) { name = term; break; } } return getCompartment(name); } else return null; }
entityUri += "_" + encode(cellularLocation.getTerm().iterator().next());