@Override public ConceptClass getOfType() { return parent.getOfType(); }
/** * @param c the concept to check * @return is it valid to traverse this concept */ public boolean isValid(ONDEXConcept c, EvidencePathNode<ONDEXConcept, ONDEXRelation, State> p) { return cc.equals(c.getOfType()); }
/** * This method will return all concept classes in a given OndexView. This * method is non-destructive and will operate on a copy of a view, so it can * be reused afterwards, but also must be closed, if no longer needed. * * @return - a set of concept classes. */ public static final Set<ConceptClass> getContainedConceptClasses(Set<ONDEXConcept> concepts) { Set<ConceptClass> result = new HashSet<ConceptClass>(); for (ONDEXConcept c : concepts) { result.add(c.getOfType()); } return result; }
/** * Return all of the concept classes of the concepts * contained in the collection * * @param cs * @return set of concept classes */ public static Set<ConceptClass> getConceptClasses(Collection<ONDEXConcept> cs) { Set<ConceptClass> result = new HashSet<ConceptClass>(); for (ONDEXConcept c : cs) { result.add(c.getOfType()); } return result; }
/** * Return all of the concept classes of the concepts * contained in the collection * * @param cs * @return set of concept classes */ public static Set<ConceptClass> getConceptClasses(Collection<ONDEXConcept> cs) { Set<ConceptClass> result = new HashSet<ConceptClass>(); for (ONDEXConcept c : cs) { result.add(c.getOfType()); } return result; }
@Override public Integer transform(ONDEXConcept input) { if (input != null) return Config.getSizeForConceptClass(input.getOfType()); return Config.defaultNodeSize; } }, new Transformer<ONDEXConcept, Float>() {
@Override public Integer transform(ONDEXConcept input) { return Config.getSizeForConceptClass(input.getOfType()); } };
@Override public boolean accepts() { for (ONDEXConcept n : entities) { ConceptClass cc = n.getOfType(); if (isAcceptedConceptClass(cc)) return true; } return false; }
private boolean instanceOf(ConceptClass cc, ONDEXConcept c) { ConceptClass cc_query = c.getOfType(); while (!cc_query.equals(cc)) { if (cc_query.getSpecialisationOf() == null) { return false; } cc_query = cc_query.getSpecialisationOf(); } return true; }
public String getValue(ONDEXEntity cOrr) throws InvalidOndexEntityException { if(AbstractConcept.class.isAssignableFrom(cOrr.getClass())){ return ((ONDEXConcept)cOrr).getOfType().getId(); } if(AbstractRelation.class.isAssignableFrom(cOrr.getClass())){ return ((ONDEXRelation)cOrr).getOfType().getId(); } throw new InvalidOndexEntityException(cOrr.getClass()+": is not an Ondex class for which type is known"); }
/** * Displays and links the accessions of concepts * * @see AbstractContentDisplayPlugin#compileContent(ONDEXEntity); */ @Override public String compileContent(ONDEXEntity e) { StringBuffer b = new StringBuffer(); if (e instanceof ONDEXConcept) { ONDEXConcept c = (ONDEXConcept) e; // group accessions by DataSource [DataSource -> Accession] Map<DataSource, List<ConceptAccession>> cvMap = getCVtoAccessions(c); writeAccessions(cvMap, c.getOfType(), b); } return b.toString(); }
/** * Method to copy a concept * * @param graph * - graph to copy concept to * @param c * concept to copy * @return a copy of a concept created * @throws AccessDeniedException * @throws NullValueException * @throws EmptyStringException */ public static ONDEXConcept copyConcept(ONDEXGraph graph, ONDEXConcept c) throws NullValueException, AccessDeniedException, EmptyStringException { return copyConcept(graph, c, c.getOfType(), c.getElementOf()); }
@Override public String getUri ( ONDEXConcept c, Map<String, Object> params ) { String ns = Java2RdfUtils.getParam ( params, "instanceNamespace", NamespaceUtils.ns ( "bkr" ) ); String ccPart = Optional .ofNullable ( c.getOfType () ) .flatMap ( cc -> Optional.ofNullable ( cc.getId () ) ) .orElse ( null ); return OndexRDFUtils.iri ( ns, ccPart, c.getPID (), c.getId () ); } }
private void createEdgeForRelationType(RelationType rt) { // collect information on pairs of concept classes Set<Pair<ConceptClass>> betweenCC = new HashSet<Pair<ConceptClass>>(); for (ONDEXRelation r : graph.getRelationsOfRelationType(rt)) { ConceptClass from = r.getFromConcept().getOfType(); ConceptClass to = r.getToConcept().getOfType(); betweenCC.add(new Pair<ConceptClass>(from, to)); } // create meta relation for each pair for (Pair<ConceptClass> ccPair : betweenCC) { ONDEXMetaConcept from = new ONDEXMetaConcept(graph, ccPair.getFirst()); ONDEXMetaConcept to = new ONDEXMetaConcept(graph, ccPair.getSecond()); this.addEdge(new ONDEXMetaRelation(graph, rt, ccPair), new Pair<ONDEXMetaConcept>(from, to)); } this.fireStateChange(); }
public static void countMembers(OVTK2PropertiesAggregator viewer, String clsOfConctext, String clsOfMemeber) { ONDEXGraph graph = viewer.getONDEXJUNGGraph(); AttributeName an = createAttName(graph, clsOfMemeber + "_members", Double.class); ConceptClass cls = createCC(graph, clsOfMemeber); for (ONDEXConcept c : graph.getConceptsOfConceptClass(createCC(graph, clsOfConctext))) { Double count = 0d; for (ONDEXConcept oc : graph.getConceptsOfTag(c)) { if (oc.getOfType().equals(cls)) { count++; } } c.createAttribute(an, count, false); } }
/** * Clone concept with having a new PID. * * @param oldC * old ONDEXConcept * @param newPID * new PID to use * @return new ONDEXConcept */ public ONDEXConcept clone(ONDEXConcept oldC, String newPID) { // first clone concept with new PID ONDEXConcept newC = graph.createConcept(newPID, oldC.getAnnotation(), oldC.getDescription(), oldC.getElementOf(), oldC.getOfType(), oldC.getEvidence()); // copies everything else copyEverythingElse(oldC, newC); return newC; }
/** * Clone concept with having a new DataSource. * * @param oldC * old ONDEXConcept * @param newDataSource * new DataSource to use * @return new ONDEXConcept */ public ONDEXConcept clone(ONDEXConcept oldC, DataSource newDataSource) { // first clone concept with new DataSource ONDEXConcept newC = graph.createConcept(oldC.getPID(), oldC.getAnnotation(), oldC.getDescription(), newDataSource, oldC.getOfType(), oldC.getEvidence()); // copies everything else copyEverythingElse(oldC, newC); return newC; }
public Model createModel(ONDEXGraph og) { Model instanceModel = ModelFactory.createDefaultModel(); for (ONDEXConcept concept : og.getConcepts()) { Resource classOfConcept = instanceModel.createResource(urlPrefixMetaData + concept.getOfType().getId()); instanceModel.createResource(urlPrefixInstances + concept.getId(), classOfConcept); } for (ONDEXRelation or : og.getRelations()) { Property propertyOfPredicate = instanceModel.createProperty(urlPrefixMetaData, or.getOfType().getId()); Resource fromConcept = instanceModel.getResource(urlPrefixInstances + or.getFromConcept().getId()); Resource toConcept = instanceModel.getResource(urlPrefixInstances + or.getToConcept().getId()); instanceModel.createStatement(toConcept, propertyOfPredicate, fromConcept); } return instanceModel; }