/** * Get the root of the taxonomic graph contained in the graph associated to * the engine. An exception will be thrown if the taxonomic graph contains * multiple roots. * * @return the class corresponding to the root. * @throws slib.utils.ex.SLIB_Ex_Critic */ public synchronized URI getRoot() throws SLIB_Ex_Critic { if (root == null) { URI rooturi = new ValidatorDAG().getUniqueTaxonomicRoot(graph); root = rooturi; } return root; }
/** * Root the underlying taxonomic DAG of the specified graph. * * @param g * @param rootUri * @return the URI of the root * @throws SLIB_Ex_Critic */ public static URI rootUnderlyingTaxonomicDAG(G g, URI rootUri) throws SLIB_Ex_Critic { Logger logger = LoggerFactory.getLogger(RooterDAG.class); logger.info("Rooting taxonomic Graph using " + rootUri); ValidatorDAG validator = new ValidatorDAG(); if (!validator.containsTaxonomicDagWithUniqueRoot(g)) { return rootUnderlyingDAG(g, rootUri, new WalkConstraintGeneric(RDFS.SUBCLASSOF,Direction.OUT),true); } else { return validator.getUniqueTaxonomicRoot(g); } } }
/** * Root the underlying taxonomic DAG of the specified graph. * * @param g * @param rootUri * @return the URI of the root * @throws SLIB_Ex_Critic */ public static URI rootUnderlyingTaxonomicDAG(G g, URI rootUri) throws SLIB_Ex_Critic { Logger logger = LoggerFactory.getLogger(RooterDAG.class); logger.info("Rooting taxonomic Graph using " + rootUri); ValidatorDAG validator = new ValidatorDAG(); if (!validator.containsTaxonomicDagWithUniqueRoot(g)) { return rootUnderlyingDAG(g, rootUri, new WalkConstraintGeneric(RDFS.SUBCLASSOF,Direction.OUT),true); } else { return validator.getUniqueTaxonomicRoot(g); } } }
/** * Root the underlying taxonomic DAG of the specified graph. * * @param g * @param rootUri * @return the URI of the root * @throws SLIB_Ex_Critic */ public static URI rootUnderlyingTaxonomicDAG(G g, URI rootUri) throws SLIB_Ex_Critic { Logger logger = LoggerFactory.getLogger(RooterDAG.class); logger.info("Rooting taxonomic Graph using " + rootUri); ValidatorDAG validator = new ValidatorDAG(); if (!validator.containsTaxonomicDagWithUniqueRoot(g)) { return rootUnderlyingDAG(g, rootUri, new WalkConstraintGeneric(RDFS.SUBCLASSOF,Direction.OUT),true); } else { return validator.getUniqueTaxonomicRoot(g); } } }
/** * Root the underlying taxonomic DAG of the specified graph. * * @param g * @param rootUri * @return the URI of the root * @throws SLIB_Ex_Critic */ public static URI rootUnderlyingTaxonomicDAG(G g, URI rootUri) throws SLIB_Ex_Critic { Logger logger = LoggerFactory.getLogger(RooterDAG.class); logger.info("Rooting taxonomic Graph using " + rootUri); ValidatorDAG validator = new ValidatorDAG(); if (!validator.containsTaxonomicDagWithUniqueRoot(g)) { return rootUnderlyingDAG(g, rootUri, new WalkConstraintGeneric(RDFS.SUBCLASSOF,Direction.OUT),true); } else { return validator.getUniqueTaxonomicRoot(g); } } }