Java Code Examples for org.semanticweb.owlapi.reasoner.NodeSet#isBottomSingleton()
The following examples show how to use
org.semanticweb.owlapi.reasoner.NodeSet#isBottomSingleton() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReasonerTaxonomyWalker.java From snomed-owl-toolkit with Apache License 2.0 | 5 votes |
private NodeSet<OWLClass> computeNextNodeSet(final Node<OWLClass> node) { final NodeSet<OWLClass> subClasses = reasoner.getSubClasses(node.getRepresentativeElement(), true); if (!subClasses.isBottomSingleton()) { return subClasses; } if (nothingProcessed) { return EMPTY_NODE_SET; } else { nothingProcessed = true; return subClasses; } }
Example 2
Source File: TBoxUnFoldingTool.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Create a new instance for the given ontology graph. Use the given set of parent * ids to retrieve the classes which are to be unfolded. * * @param graph ontology * @param parents set of OBO-style ids * @param reasonerName type of reasoner to be used for inferring the relevant sub classes of the parent set. * @throws NonDeterministicUnfoldException */ public TBoxUnFoldingTool(OWLGraphWrapper graph, Set<String> parents, String reasonerName) throws NonDeterministicUnfoldException { this.graph = graph; this.ontology = graph.getSourceOntology(); final InferenceBuilder inferenceBuilder = new InferenceBuilder(graph, reasonerName); final OWLReasoner reasoner = inferenceBuilder.getReasoner(ontology); final Set<OWLClass> unfoldClasses = new HashSet<OWLClass>(); try { for(String parent : parents) { OWLClass parentClass = graph.getOWLClassByIdentifier(parent); NodeSet<OWLClass> nodeSet = reasoner.getSubClasses(parentClass , false); if (nodeSet != null && !nodeSet.isEmpty() && !nodeSet.isBottomSingleton()) { unfoldClasses.addAll(nodeSet.getFlattened()); } } } finally { inferenceBuilder.dispose(); } if (unfoldClasses.isEmpty()) { throw new RuntimeException("No classes found for given parents."); } visitor = new UnfoldingVisitor(unfoldClasses, ontology); }
Example 3
Source File: LegoTools.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
private OWLClassExpression getType(OWLNamedIndividual individual) { NodeSet<OWLClass> types = reasoner.getTypes(individual, true); if (types.isEmpty() || types.isBottomSingleton() || types.isTopSingleton()) { return null; } Set<OWLClass> set = types.getFlattened(); if (set.size() == 1) { return set.iterator().next(); } OWLDataFactory fac = graph.getManager().getOWLDataFactory(); OWLObjectIntersectionOf intersectionOf = fac.getOWLObjectIntersectionOf(set); return intersectionOf; }