/** * @param graph */ public InstanceAccessor_RDF_TYPE(G graph) { this.graph = graph; this.descendantsEngine = new DescendantEngine(graph); }
/** * Compute the set of exclusive descendants of a class. Exclusive process: * the focused vertex will NOT be included in the set of descendants. * * @param v the vertex of interest * @return the exclusive set of descendants of the concept (empty set if * any). */ public Set<URI> getDescendantsExc(URI v) { return getRV(v); }
/** * * @return @throws SLIB_Ex_Critic * */ public Map<URI, Integer> getnbPathLeadingToAllVertex() throws SLIB_Ex_Critic { if (cache.nbPathLeadingToAllVertices == null) { cache.nbPathLeadingToAllVertices = descGetter.computeNbPathLeadingToAllVertices(); } return Collections.unmodifiableMap(cache.nbPathLeadingToAllVertices); }
DescendantEngine descEngine = new DescendantEngine(g); Set<URI> descsInclusive = descEngine.getDescendantsInc(rootURI);
private void computeLeaves() { classesLeaves = new HashSet<URI>(); WalkConstraint wc = descGetter.getWalkConstraint(); for (URI v : classes) { if (graph.getV(v, wc).isEmpty()) { classesLeaves.add(v); } } }
/** * Compute the set of exclusive descendants of all vertices contained in the * graph. Exclusive process: the focused vertex will NOT be included in the * set of ancestors. * * @return a map containing the exclusive set of descendants of each vertex * concept (empty set if any). * @throws SLIB_Ex_Critic */ public Map<URI, Set<URI>> getAllDescendantsExc() throws SLIB_Ex_Critic { return getAllRV(); }
@Override public Set<URI> getInstances(URI v) { Set<URI> instances = new HashSet<URI>(); instances.addAll(getDirectInstances(v)); for (URI d : descendantsEngine.getDescendantsExc(v)) { instances.addAll(getDirectInstances(d)); } return instances; } }
/** * Compute the inclusive descendants for all classes. * * @throws SLIB_Ex_Critic */ private void computeAllclassesDescendants() throws SLIB_Ex_Critic { cache.descendantsInc = descGetter.getAllDescendantsInc(); }
/** * Compute the set of inclusive descendants of all vertices contained in the * graph. Exclusive process: the focused vertex will be included in the * set of ancestors. * * @return a map containing the inclusive set of descendants of each vertex * concept. * @throws SLIB_Ex_Critic */ public Map<URI, Set<URI>> getAllDescendantsInc() throws SLIB_Ex_Critic { return getAllRVInc(); } }
/** * Compute for each class x the classes which are leaves which are subsumed * by x. Inclusive i.e. a leaf will contain itself in it set of reachable * leaves. The result is cached for fast access. * * * @return the subsumed leaves for each classes */ public synchronized Map<URI, Set<URI>> getReachableLeaves() { if (cache.reachableLeaves.isEmpty()) { Map<URI, Set<URI>> leaves = descGetter.getTerminalVertices(); /* according to the documentation of the method used above, if there are classes which are isolated (which do not establish rdfs:subClassOf in this case), the algorithm will not process them and them will not be associated to an entry in the returned map. We therefore add this classes in the result map. */ for (URI c : classes) { if (!leaves.containsKey(c)) { Set<URI> s = new HashSet<URI>(); s.add(c); leaves.put(c, s); } } cache.reachableLeaves = leaves; } return Collections.unmodifiableMap(cache.reachableLeaves); }
DescendantEngine descEngine = new DescendantEngine(g); Set<URI> descsInclusive = descEngine.getDescendantsInc(rootURI);
/** * Give access to a view of the maximal depth of all classes. The result is * stored by the engine. * * @return a resultStack containing the maximal depths for all classes * @throws SLIB_Ex_Critic */ public Map<URI, Integer> getMaxDepths() throws SLIB_Ex_Critic { if (cache.maxDepths == null) { DepthAnalyserAG dephtAnalyser = new DepthAnalyserAG(graph, descGetter.getWalkConstraint()); cache.maxDepths = dephtAnalyser.getVMaxDepths(); } return Collections.unmodifiableMap(cache.maxDepths); }
/** * Compute the set of exclusive descendants of all vertices contained in the * graph. Exclusive process: the focused vertex will NOT be included in the * set of ancestors. * * @return a map containing the exclusive set of descendants of each vertex * concept (empty set if any). * @throws SLIB_Ex_Critic */ public Map<URI, Set<URI>> getAllDescendantsExc() throws SLIB_Ex_Critic { return getAllRV(); }
@Override public Set<URI> getInstances(URI v) { Set<URI> instances = new HashSet<URI>(); instances.addAll(getDirectInstances(v)); for (URI d : descendantsEngine.getDescendantsExc(v)) { instances.addAll(getDirectInstances(d)); } return instances; } }
DescendantEngine descEngine = new DescendantEngine(g); Set<URI> descsInclusive = descEngine.getDescendantsInc(rootURI);
/** * Compute the set of exclusive descendants of a class. Exclusive process: * the focused vertex will NOT be included in the set of descendants. * * @param v the vertex of interest * @return the exclusive set of descendants of the concept (empty set if * any). */ public Set<URI> getDescendantsExc(URI v) { return getRV(v); }
/** * @param graph */ public InstanceAccessor_RDF_TYPE(G graph) { this.graph = graph; this.descendantsEngine = new DescendantEngine(graph); }
/** * Give access to a view of the minimal depth of all classes. The result is * stored by the engine. * * @return a resultStack containing the maximal depths for all classes * @throws SLIB_Ex_Critic */ public Map<URI, Integer> getMinDepths() throws SLIB_Ex_Critic { if (cache.minDepths == null) { DepthAnalyserAG dephtAnalyser = new DepthAnalyserAG(graph, descGetter.getWalkConstraint()); cache.minDepths = dephtAnalyser.getVMinDepths(); } return Collections.unmodifiableMap(cache.minDepths); }
/** * Compute the set of inclusive descendants of all vertices contained in the * graph. Exclusive process: the focused vertex will be included in the * set of ancestors. * * @return a map containing the inclusive set of descendants of each vertex * concept. * @throws SLIB_Ex_Critic */ public Map<URI, Set<URI>> getAllDescendantsInc() throws SLIB_Ex_Critic { Map<URI, Set<URI>> allDescs = getAllRV(); for (URI v : allDescs.keySet()) { allDescs.get(v).add(v); } return allDescs; } }
DescendantEngine descEngine = new DescendantEngine(g); Set<URI> descsInclusive = descEngine.getDescendantsInc(rootURI);