@Override public Set<ONDEXConcept> getTags() { return parent.getTags(); }
@Override public boolean accepts() { for (ONDEXConcept n : entities) { if (!n.getTags().isEmpty()) return true; } return false; }
@Override public boolean accepts() { for (ONDEXConcept n : entities) { if (!n.getTags().isEmpty()) return true; } return false; }
public HashSet<ONDEXConcept> getNonRedundant(ONDEXConcept acTo, ONDEXConcept acFrom){ HashSet<ONDEXConcept> nonRedundantConcepts = new HashSet<ONDEXConcept>(); for (ONDEXConcept concept : acFrom.getTags()){ if (acTo != null && acTo.getTags().contains(concept) == false ) nonRedundantConcepts.add(concept); else if(acTo == null){ nonRedundantConcepts.add(concept); } } return nonRedundantConcepts; } }
public HashSet<ONDEXConcept> getNonRedundant(ONDEXConcept acTo, ONDEXConcept acFrom){ HashSet<ONDEXConcept> nonRedundantConcepts = new HashSet<ONDEXConcept>(); for (ONDEXConcept concept : acFrom.getTags()){ if (acTo != null && acTo.getTags().contains(concept) == false ) nonRedundantConcepts.add(concept); else if(acTo == null){ nonRedundantConcepts.add(concept); } } return nonRedundantConcepts; } }
public HashSet<ONDEXConcept> getNonRedundant(ONDEXConcept acTo, ONDEXConcept acFrom){ HashSet<ONDEXConcept> nonRedundantConcepts = new HashSet<ONDEXConcept>(); for (ONDEXConcept concept : acFrom.getTags()){ if (acTo != null && !acTo.getTags().contains(concept)) nonRedundantConcepts.add(concept); else if(acTo == null){ nonRedundantConcepts.add(concept); } } return nonRedundantConcepts; } }
public HashSet<ONDEXConcept> getNonRedundant(ONDEXConcept acTo, ONDEXConcept acFrom){ HashSet<ONDEXConcept> nonRedundantConcepts = new HashSet<ONDEXConcept>(); for (ONDEXConcept concept : acFrom.getTags()){ if (acTo != null && acTo.getTags().contains(concept) == false ) nonRedundantConcepts.add(concept); else if(acTo == null){ nonRedundantConcepts.add(concept); } } return nonRedundantConcepts; } }
/** * Copies a context list from on concept to another concept * @param acFrom * @param acTo */ public void copyContext(ONDEXConcept acTo, Set<ONDEXConcept> acFrom){ for (ONDEXConcept concept : acFrom) { if (!acTo.getTags().contains(concept)) { acTo.addTag(concept); } } } /**
/** * Copies a context list from on concept to another concept * @param acFrom * @param acTo */ public void copyContext(ONDEXConcept acTo, Set<ONDEXConcept> acFrom){ for (ONDEXConcept concept : acFrom) { if (acTo.getTags().contains(concept) == false) { acTo.addTag(concept); } } } /**
/** * Copies a context list from on concept to another concept * @param acFrom * @param acTo */ public void copyContext(ONDEXConcept acTo, Set<ONDEXConcept> acFrom){ Iterator<ONDEXConcept> concepts = acFrom.iterator(); while(concepts.hasNext()){ ONDEXConcept concept = concepts.next(); if ( acTo.getTags().contains(concept) == false ) acTo.addTag(concept); } } /**
/** * Copies a context list from on concept to another concept * @param acFrom * @param acTo */ public void copyContext(ONDEXConcept acTo, Set<ONDEXConcept> acFrom){ Iterator<ONDEXConcept> concepts = acFrom.iterator(); while(concepts.hasNext()){ ONDEXConcept concept = concepts.next(); if ( acTo.getTags().contains(concept) == false ) acTo.addTag(concept); } } /**
/** * Shows all other members of all the contexts that the selected concept(s) * are members of * * @param viewer */ public static void showRelevantContexts(OVTK2PropertiesAggregator viewer) { ONDEXJUNGGraph graph = viewer.getONDEXJUNGGraph(); Set<ONDEXConcept> contexts = new HashSet<ONDEXConcept>(); for (ONDEXConcept c : viewer.getPickedNodes().toArray(new ONDEXConcept[0])) { contexts.addAll(c.getTags()); } for (ONDEXConcept contextConcept : contexts) { graph.setVisibility(graph.getConceptsOfTag(contextConcept), true); graph.setVisibility(graph.getRelationsOfTag(contextConcept), true); } }
/** * Shows all other members of all the contexts that the selected concept(s) * are members of, if the contexts are of particular class * * @param viewer * @param contextClasses */ public static void showRelevantContextsByTypes(OVTK2PropertiesAggregator viewer, String... contextClasses) { ONDEXJUNGGraph graph = viewer.getONDEXJUNGGraph(); Set<ONDEXConcept> contexts = new HashSet<ONDEXConcept>(); Set<ConceptClass> selectedClasses = new HashSet<ConceptClass>(); for (String s : contextClasses) { createCC(viewer.getONDEXJUNGGraph(), s); } for (ONDEXConcept c : viewer.getPickedNodes().toArray(new ONDEXConcept[0])) { for (ONDEXConcept candidate : c.getTags()) { if (selectedClasses.contains(candidate.getOfType())) contexts.add(candidate); } } for (ONDEXConcept contextConcept : contexts) { graph.setVisibility(graph.getConceptsOfTag(contextConcept), true); graph.setVisibility(graph.getRelationsOfTag(contextConcept), true); } }
@Override public void pointerToRelation(AbstractNode node) { HashSet<ONDEXRelation> relations = new HashSet<ONDEXRelation>(); Compound compound = (Compound) node; for (AbstractNode abstractNode : compound.getCofactorOf()) { // Compound (cofactor of)=> Enzyme relations.add(graph.getFactory().createRelation(abstractNode.getConcept(), compound.getConcept(), rtCofectorOf, etIMPD)); } for( ONDEXRelation relation: relations ){ for (ONDEXConcept c : node.getConcept().getTags()){ relation.addTag(c); } }/* for( AbstractNode n: compound.getCofactorOf()){ Set<ONDEXConcept> toConcepts = node.getConcept().getContext(s); while( toConcepts.hasNext() ){ ONDEXConcept toContext = toConcepts.next(); if ( !n.getConcept().getContext(s).contains(toContext) ) n.getConcept().addContext(toContext); } }*/ } }
@Override public void pointerToRelation(AbstractNode node) { HashSet<ONDEXRelation> relations = new HashSet<ONDEXRelation>(); Compound compound = (Compound) node; for (AbstractNode abstractNode : compound.getCofactorOf()) { // Compound (cofactor of)=> Enzyme relations.add(graph.getFactory().createRelation(abstractNode.getConcept(), compound.getConcept(), rtCofectorOf, etIMPD)); } for( ONDEXRelation relation: relations ){ for (ONDEXConcept c : node.getConcept().getTags()){ relation.addTag(c); } }/* for( AbstractNode n: compound.getCofactorOf()){ Set<ONDEXConcept> toConcepts = node.getConcept().getContext(s); while( toConcepts.hasNext() ){ ONDEXConcept toContext = toConcepts.next(); if ( !n.getConcept().getContext(s).contains(toContext) ) n.getConcept().addContext(toContext); } }*/ } }
@Override public void pointerToRelation(AbstractNode node) { HashSet<ONDEXRelation> relations = new HashSet<ONDEXRelation>(); Compound compound = (Compound) node; for (AbstractNode abstractNode : compound.getCofactorOf()) { // Compound (cofactor of)=> Enzyme relations.add(graph.getFactory().createRelation(abstractNode.getConcept(), compound.getConcept(), rtCofectorOf, etIMPD)); } for( ONDEXRelation relation: relations ){ for (ONDEXConcept c : node.getConcept().getTags()){ relation.addTag(c); } }/* for( AbstractNode n: compound.getCofactorOf()){ Set<ONDEXConcept> toConcepts = node.getConcept().getContext(s); while( toConcepts.hasNext() ){ ONDEXConcept toContext = toConcepts.next(); if ( !n.getConcept().getContext(s).contains(toContext) ) n.getConcept().addContext(toContext); } }*/ } }
@Override public void pointerToRelation(AbstractNode node) { HashSet<ONDEXRelation> relations = new HashSet<ONDEXRelation>(); Compound compound = (Compound) node; for (AbstractNode abstractNode : compound.getCofactorOf()) { // Compound (cofactor of)=> Enzyme relations.add(graph.getFactory().createRelation(abstractNode.getConcept(), compound.getConcept(), rtCofectorOf, etIMPD)); } for( ONDEXRelation relation: relations ){ for(ONDEXConcept c : node.getConcept().getTags()){ relation.addTag(c); } }/* for( AbstractNode n: compound.getCofactorOf()){ Set<ONDEXConcept> toConcepts = node.getConcept().getContext(s); while( toConcepts.hasNext() ){ ONDEXConcept toContext = toConcepts.next(); if ( !n.getConcept().getContext(s).contains(toContext) ) n.getConcept().addContext(toContext); } }*/ } }
/** * Copies all context information from old concept to new concept and * updates context references on other entities. * * @param oldC * old ONDEXConcept * @param newC * new ONDEXConcept */ private void copyContext(ONDEXConcept oldC, ONDEXConcept newC) { // add new concept to same references as old concept for (ONDEXConcept c : graph.getConceptsOfTag(oldC)) { c.addTag(newC); } for (ONDEXRelation r : graph.getRelationsOfTag(oldC)) { r.addTag(newC); } // transfer context from old concept to new concept for (ONDEXConcept c : oldC.getTags()) { newC.addTag(c); } }
@Override protected void doAction() { for (ONDEXConcept c : entities) { for (ONDEXConcept concept : c.getTags()) { // first set concepts visible for (ONDEXConcept ctxt : viewer.getONDEXJUNGGraph().getConceptsOfTag(concept)) { viewer.getONDEXJUNGGraph().setVisibility(ctxt, true); } // second set relations visible for (ONDEXRelation r : viewer.getONDEXJUNGGraph().getRelationsOfTag(concept)) { viewer.getONDEXJUNGGraph().setVisibility(r, true); } } } }
@Override protected void doAction() { for (ONDEXConcept vertex : entities) { ONDEXConcept c = vertex; for (ONDEXConcept concept : c.getTags()) { // first set relations invisible for (ONDEXRelation r : viewer.getONDEXJUNGGraph().getRelationsOfTag(concept)) { viewer.getONDEXJUNGGraph().setVisibility(r, false); } // second set concepts invisible for (ONDEXConcept c2 : viewer.getONDEXJUNGGraph().getConceptsOfTag(concept)) { viewer.getONDEXJUNGGraph().setVisibility(c2, false); } } } }