/** * Performs a transitive reduction of the underlying taxonomic graph of the * given graph. The underlying taxonomic graph is defined based on the * rdfs:SubClassOf relationship. * * @param graph the graph on which the transitive reduction needs to be * performed * @throws SLIB_Ex_Critic * @return the set of edges removed. */ public static Set<E> process(G graph) throws SLIB_Ex_Critic { logger.info("Processing self-loop"); // remove self loops int selfLoops = 0; for (E e : graph.getE(RDFS.SUBCLASSOF)) { if (e.getSource().equals(e.getTarget())) { graph.removeE(e); selfLoops++; } } logger.info(selfLoops + " self loops have been removed"); ValidatorDAG validator = new ValidatorDAG(); if (!validator.containsTaxonomicDag(graph)) { throw new SLIB_Ex_Critic("Transitive reduction on taxonomic graph requires an underlying DAG to be defined"); } Set<URI> roots = new ValidatorDAG().getTaxonomicRoots(graph); logger.info("Transitive reduction considering " + roots.size() + " root(s)"); logger.debug("roots: " + roots); return process(graph, roots); }
if (!validator.containsTaxonomicDag(graph)) { throw new SLIB_Ex_Critic("Transitive reduction on taxonomic graph requires an underlying DAG to be defined");
if (!validator.containsTaxonomicDag(graph)) { throw new SLIB_Ex_Critic("Transitive reduction on taxonomic graph requires an underlying DAG to be defined");
if (!validator.containsTaxonomicDag(graph)) { throw new SLIB_Ex_Critic("Transitive reduction on taxonomic graph requires an underlying DAG to be defined");