/** * * @param graph * @return true if the graph contains a taxonomic graph. * @throws SLIB_Ex_Critic */ public boolean containsTaxonomicDag(G graph) throws SLIB_Ex_Critic { WalkConstraint wct = new WalkConstraintGeneric(RDFS.SUBCLASSOF, Direction.IN); return isDag(graph, wct); }
/** * * @param graph * @return true if the graph contains a taxonomic graph. * @throws SLIB_Ex_Critic */ public boolean containsTaxonomicDag(G graph) throws SLIB_Ex_Critic { WalkConstraint wct = new WalkConstraintGeneric(RDFS.SUBCLASSOF, Direction.IN); return isDag(graph, wct); }
/** * Check if the underlying graph defined by the edges of the given edge * types and build using a traversal starting from the given root node is a * DAG. shortcut of {@link ValidatorDAG#isDag(G, WalkConstraint)} only * considering the given set of edge types * * @param graph the graph on which the evaluation has to be made * @param rootURI * @param wc * @return true if the the (underlying) graph reduction is a DAG * @throws SLIB_Ex_Critic * */ public boolean isDag(G graph, URI rootURI, WalkConstraint wc) throws SLIB_Ex_Critic { return isDag(graph, SetUtils.buildSet(rootURI), wc); }
/** * Check if the underlying graph defined by the edges of the given edge * types and build using a traversal starting from the given root node is a * DAG. shortcut of {@link ValidatorDAG#isDag(G, WalkConstraint)} only * considering the given set of edge types * * @param graph the graph on which the evaluation has to be made * @param rootURI * @param wc * @return true if the the (underlying) graph reduction is a DAG * @throws SLIB_Ex_Critic * */ public boolean isDag(G graph, URI rootURI, WalkConstraint wc) throws SLIB_Ex_Critic { return isDag(graph, SetUtils.buildSet(rootURI), wc); }
/** * Check if the given graph contains a underlying taxonomic graph with a * unique root. * * @param g the graph on which the test is performed * @return true if the graph contains a unique underlying rooted taxonomic * graph * * @throws SLIB_Ex_Critic */ public boolean containsTaxonomicDagWithUniqueRoot(G g) throws SLIB_Ex_Critic { WalkConstraintGeneric wc = new WalkConstraintGeneric(RDFS.SUBCLASSOF, Direction.OUT); Set<URI> roots = getDAGRoots(g, wc); logger.info("Number of roots " + roots.size()); logger.debug("Root(s): " + roots); if (roots.size() == 1) { isDag(g, roots.iterator().next(), new WalkConstraintGeneric(RDFS.SUBCLASSOF, Direction.IN)); } else { valid = false; } logger.debug("isRootedTaxonomicDag (" + roots.size() + " root(s)) valid " + valid); return valid; }
/** * Do not check if the graph is a DAG * * @param g * @param root * @param wc * @return true if the graph is a DAG and rooted by a unique vertex. * @throws SLIB_Ex_Critic */ public boolean isUniqueRootedDagRoot(G g, URI root, WalkConstraint wc) throws SLIB_Ex_Critic { if (isDag(g, wc)) { Set<URI> roots = getDAGRoots(g, WalkConstraintUtils.getInverse(wc, false)); logger.debug("roots: " + roots); if (roots.size() == 1 && roots.iterator().next().equals(root)) { return true; } } return false; }
/** * Check if the given graph contains a underlying taxonomic graph with a * unique root. * * @param g the graph on which the test is performed * @return true if the graph contains a unique underlying rooted taxonomic * graph * * @throws SLIB_Ex_Critic */ public boolean containsTaxonomicDagWithUniqueRoot(G g) throws SLIB_Ex_Critic { WalkConstraintGeneric wc = new WalkConstraintGeneric(RDFS.SUBCLASSOF, Direction.OUT); Set<URI> roots = getDAGRoots(g, wc); logger.info("Number of roots " + roots.size()); if (roots.size() <= 20) { logger.debug("Root(s): " + roots); } if (roots.size() == 1) { isDag(g, roots.iterator().next(), new WalkConstraintGeneric(RDFS.SUBCLASSOF, Direction.IN)); } else { valid = false; } logger.debug("isRootedTaxonomicDag (" + roots.size() + " root(s)) valid " + valid); return valid; }
/** * Do not check if the graph is a DAG * * @param g * @param root * @param wc * @return true if the graph is a DAG and rooted by a unique vertex. * @throws SLIB_Ex_Critic */ public boolean isUniqueRootedDagRoot(G g, URI root, WalkConstraint wc) throws SLIB_Ex_Critic { if (isDag(g, wc)) { Set<URI> roots = getDAGRoots(g, WalkConstraintUtils.getInverse(wc, false)); logger.debug("roots: " + roots); if (roots.size() == 1 && roots.iterator().next().equals(root)) { return true; } } return false; }
return false; else if(!isDag(graph, startingNodes, wc)){ return false;
/** * Check if the underlying graph defined by given {@link WalkConstraint} is * a DAG. shortcut of {@link ValidatorDAG#isDag(G, WalkConstraint)} * considering the given edge types and the root vertices according to the * inverse of the specified edge types as root (see * {@link ValidatorDAG#getDAGRoots(G, WalkConstraint)}) * * @param graph the graph on which the evaluation has to be made * @param wc * @return true if the the (underlying) graph reduction is a DAG * * @throws SLIB_Ex_Critic */ public boolean isDag(G graph, WalkConstraint wc) throws SLIB_Ex_Critic { logger.debug("Check DAG property of the graph " + graph.getURI() + " considering the walkconstraint " + wc); Set<URI> startingNodes = getDAGRoots(graph, WalkConstraintUtils.getInverse(wc, false)); boolean isDag = false; logger.info("Starting process from " + startingNodes.size() + " vertices"); if (graph.getE().isEmpty()) { logger.info("No edge"); isDag = false; } else if (startingNodes.isEmpty()) { // No root No Dag logger.debug("No roots have been detected..."); logger.debug("DAG = false"); isDag = false; } else { isDag = isDag(graph, startingNodes, wc); } return isDag; }
private void checkGraphProperties() throws SLIB_Ex_Critic { logger.debug("Checking DAG property"); ValidatorDAG vdag = new ValidatorDAG(); WalkConstraint wc = new WalkConstraintGeneric(); for (URI edgeType : predicatesTC) { wc.addAcceptedTraversal(edgeType, Direction.IN); } boolean isDag = vdag.isDag(graph, wc); logger.debug("is DAG: " + isDag); if (!isDag) { throw new SLIB_Ex_Critic( "Treatment can only be performed on a DAG, traversal " + "respecting your parameters define a cyclic graph."); } // ValidatorDAG validator = new ValidatorDAG(); // // boolean uniqueRoot = validator.isUniqueRootedTaxonomicDag(graph, rootURI); // // if (!uniqueRoot) { // logger.info("Specified root is not a unique Root: " + rootVertex); // logger.info("Roots : " + validator.getTaxonomicDAGRoots(graph)); // } } }
private void checkGraphProperties() throws SLIB_Ex_Critic { logger.debug("Checking DAG property"); ValidatorDAG vdag = new ValidatorDAG(); WalkConstraint wc = new WalkConstraintGeneric(); for (URI edgeType : predicatesTC) { wc.addAcceptedTraversal(edgeType, Direction.IN); } boolean isDag = vdag.isDag(graph, wc); logger.debug("is DAG: " + isDag); if (!isDag) { throw new SLIB_Ex_Critic( "Treatment can only be performed on a DAG, traversal " + "respecting your parameters define a cyclic graph."); } // ValidatorDAG validator = new ValidatorDAG(); // // boolean uniqueRoot = validator.isUniqueRootedTaxonomicDag(graph, rootURI); // // if (!uniqueRoot) { // logger.info("Specified root is not a unique Root: " + rootVertex); // logger.info("Roots : " + validator.getTaxonomicDAGRoots(graph)); // } } }
private void checkGraphProperties() throws SLIB_Ex_Critic { logger.debug("Checking DAG property"); ValidatorDAG vdag = new ValidatorDAG(); WalkConstraint wc = new WalkConstraintGeneric(); for (URI edgeType : predicatesTC) { wc.addAcceptedTraversal(edgeType, Direction.IN); } boolean isDag = vdag.isDag(graph, wc); logger.debug("is DAG: " + isDag); if (!isDag) { throw new SLIB_Ex_Critic( "Treatment can only be performed on a DAG, traversal " + "respecting your parameters define a cyclic graph."); } // ValidatorDAG validator = new ValidatorDAG(); // // boolean uniqueRoot = validator.isUniqueRootedTaxonomicDag(graph, rootURI); // // if (!uniqueRoot) { // logger.info("Specified root is not a unique Root: " + rootVertex); // logger.info("Roots : " + validator.getTaxonomicDAGRoots(graph)); // } } }
private void checkGraphProperties() throws SLIB_Ex_Critic { logger.debug("Checking DAG property"); ValidatorDAG vdag = new ValidatorDAG(); WalkConstraint wc = new WalkConstraintGeneric(); for (URI edgeType : predicatesTC) { wc.addAcceptedTraversal(edgeType, Direction.IN); } boolean isDag = vdag.isDag(graph, wc); logger.debug("is DAG: " + isDag); if (!isDag) { throw new SLIB_Ex_Critic( "Treatment can only be performed on a DAG, traversal " + "respecting your parameters define a cyclic graph."); } // ValidatorDAG validator = new ValidatorDAG(); // // boolean uniqueRoot = validator.isUniqueRootedTaxonomicDag(graph, rootURI); // // if (!uniqueRoot) { // logger.info("Specified root is not a unique Root: " + rootVertex); // logger.info("Roots : " + validator.getTaxonomicDAGRoots(graph)); // } } }
if (checkUnderlyingDAG && !validator.isDag(g, wc)) { throw new SLIB_Ex_Critic("Error during rerooting: " + "Underlying graph build from contraint " + wc + ""
if (checkUnderlyingDAG && !validator.isDag(g, wc)) { throw new SLIB_Ex_Critic("Error during rerooting: " + "Underlying graph build from contraint " + wc + ""
if (checkUnderlyingDAG && !validator.isDag(g, wc)) { throw new SLIB_Ex_Critic("Error during rerooting: " + "Underlying graph build from contraint " + wc + ""
if (checkUnderlyingDAG && !validator.isDag(g, wc)) { throw new SLIB_Ex_Critic("Error during rerooting: " + "Underlying graph build from contraint " + wc + ""