@Override public void start() { for (ConceptClass conceptClass : graph.getMetaData().getConceptClasses()) { Set<ONDEXConcept> concepts = graph.getConceptsOfConceptClass(conceptClass); System.out.println("ConceptClassId\tNumber of instances"); if (concepts.size() > 0) { System.out.println(conceptClass.getId() + "\t" + concepts.size()); } } }
public ONDEXRelation createRealtion(ONDEXConcept from, ONDEXConcept to, RelationType rt) { ONDEXRelation result = graph.getRelation(from, to, rt); if (result == null) { result = graph.getFactory().createRelation(from, to, rt, evidence); } return result; }
@Override protected ONDEXConcept reallyGetEntity(int i) { return aog.getConcept(i); } };
/** * @param og * ONDEXGraph to wrap */ LuceneONDEXGraph(ONDEXGraph og) { this(og.getName(), og.getMetaData()); this.parent = og; super.readOnly = true; }
/** * @return Object2DoubleOpenHashMap<ONDEXConcept> * @throws AccessDeniedException * @throws NullValueException * @author taubertj Calculates betweenness centrality on the ONDEX graph. * Result returned as a map of concept to its betweennes centrality * value. */ public static final Map<ONDEXConcept, Double> getBetweenessCentrality(ONDEXGraph aog) throws NullValueException, AccessDeniedException { return getBetweenessCentrality(aog.getConcepts(), aog.getRelations(), aog); }
public void start() throws Exception { AttributeName att = this.graph.getMetaData().createAttributeName("fact", "fact", "Interesting fact", null, String.class, null); for (ONDEXRelation rel : this.graph.getRelations()) { rel.createAttribute(att, "bob", false); } }
public void start() { ONDEXGraphMetaData metadata = graph.getMetaData(); for (ConceptClass cc : metadata.getConceptClasses()) { System.out.println("ConceptClass " + cc.getId() + " " + cc.getFullname()); System.out.println("\tConcepts = " + graph.getConceptsOfConceptClass(cc).size()); } for (DataSource dataSource : metadata.getDataSources()) { System.out.println("DataSource " + dataSource.getId() + " " + dataSource.getFullname()); System.out.println("\tConcepts = " + graph.getConceptsOfDataSource(dataSource).size()); } for (AttributeName att : metadata.getAttributeNames()) { System.out.println("AttributeName " + att.getId() + " " + att.getFullname()); System.out.println("\tConcepts = " + graph.getConceptsOfAttributeName(att).size()); System.out.println("\tRelations = " + graph.getRelationsOfAttributeName(att).size()); } for (RelationType rt : metadata.getRelationTypes()) { System.out.println("RelationType " + rt.getId() + " " + rt.getFullname()); System.out.println("\tRelations = " + graph.getRelationsOfRelationType(rt).size()); } }
/** * @return * @see net.sourceforge.ondex.core.ONDEXGraph#getMetaData() */ public ONDEXGraphMetaData getMetaData() { return og.getMetaData(); }
private ONDEXConcept createConcept(String nodelabel, String nodeId) { ONDEXConcept concept = graph.getFactory().createConcept(nodeId, dataSource, cc, et); concept.createConceptName(nodelabel, true); nodeID2Concept.put(nodeId, concept); return concept; }
private void writeSynonym(String synonym, String conceptName, ONDEXConcept c) { String check = (String) ValidatorRegistry.validators.get("cvregex").validate(synonym); if (check != null) { DataSource dataSource = aog.getMetaData().getDataSource(check); if (dataSource == null) { if (!reportedMissingCVs.contains(check)) { ONDEXEventHandler.getEventHandlerForSID(aog.getSID()).fireEventOccurred(new DataSourceMissingEvent("DataSource missing => " + check, "")); reportedMissingCVs.add(check); } } else { if (c.getConceptAccession(synonym, dataSource) == null) { c.createConceptAccession(synonym.toUpperCase(), dataSource, false); } } } else { if (!synonym.equalsIgnoreCase(conceptName)) { c.createConceptName(synonym,false); } } }
@Override public void start() { for (DataSource dataSource : graph.getMetaData().getDataSources()) { Set<ONDEXConcept> concepts = graph.getConceptsOfDataSource(dataSource); System.out.println("Data source C.V. id\tNumber of instances"); if (concepts.size() > 0) { System.out.println(dataSource.getId() + "\t" + concepts.size()); } } }
@Override protected ONDEXRelation reallyGetEntity(int i) { return aog.getRelation(i); } };
public static void createContext(OVTK2PropertiesAggregator viewer, String name) { ONDEXGraph graph = viewer.getONDEXJUNGGraph(); ONDEXConcept context = graph.getFactory().createConcept(name, createDataSource(graph, "unknown"), createCC(graph, "Thing"), createEvidence(graph, "manual")); context.createConceptName(name, true); for (ONDEXConcept c : graph.getConcepts()) { c.addTag(context); } }
/** * @param concept * @return * @see net.sourceforge.ondex.core.ONDEXGraph#getRelationsOfConcept(net.sourceforge.ondex.core.ONDEXConcept) */ public Set<ONDEXRelation> getRelationsOfConcept(ONDEXConcept concept) { return og.getRelationsOfConcept(concept); }
/** * @see net.sourceforge.ondex.filter.ONDEXFilter#getVisibleConcepts() */ @Override public Set<ONDEXConcept> getVisibleConcepts() { return graph.getConcepts(); }
private Path(List<Integer> ids) throws MalformedPathException { path = new ONDEXEntity[ids.size()]; for (int i = 0; i < path.length; i++) { if (i % 2 == 0) { path[i] = og.getConcept(ids.get(i)); if (path[i] == null) { throw new MalformedPathException("No concept for id "+ids.get(i)); } } else { path[i] = og.getRelation(ids.get(i)); if (path[i] == null) { throw new MalformedPathException("No relation for id"+ids.get(i)); } } } } public ONDEXConcept head() {
/** * Clones a concept from the original graph to the new graph * * @param cid * the id of the concept in the original graph * @return the new Concept in the new graph */ public ONDEXConcept cloneConcept(int cid) { ONDEXConcept concept = origGraph.getConcept(cid); if (concept == null) { throw new NullPointerException(cid + " is not found in orginal Graph " + origGraph.getSID()); } return cloneConcept(concept); }
/** * @return * @see net.sourceforge.ondex.core.ONDEXAssociable#getSID() */ public long getSID() { return og.getSID(); }
@Override protected Set<ONDEXConcept> retrieveConceptAllConceptClass( ConceptClass conceptClass) { return parent.getConceptsOfConceptClass(conceptClass); }
/** * Calculates degree centrality on the ONDEX graph. Result returned as a map * of concept to its degree centrality value. * * @return Object2DoubleOpenHashMap<ONDEXConcept> * @throws AccessDeniedException * @throws NullValueException */ public static final Map<ONDEXConcept, Double> getDegreeCentrality(Set<ONDEXConcept> itc, Set<ONDEXRelation> itr, ONDEXGraph aog) throws NullValueException, AccessDeniedException { Map<ONDEXConcept, Double> conceptToDegree = new HashMap<ONDEXConcept, Double>(); double normalisationFactor = itc.size() - 1; for (ONDEXConcept c : itc) { if (itr.size() == aog.getRelations().size()) conceptToDegree.put(c, aog.getRelationsOfConcept(c).size() / normalisationFactor); else conceptToDegree.put(c, BitSetFunctions.and(aog.getRelationsOfConcept(c), itr).size() / normalisationFactor); } return conceptToDegree; }