Java Code Examples for org.semanticweb.owlapi.model.OWLClass#isBuiltIn()
The following examples show how to use
org.semanticweb.owlapi.model.OWLClass#isBuiltIn() .
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: ModelAnnotationSolrDocumentLoader.java From owltools with BSD 3-Clause "New" or "Revised" License | 6 votes |
static Set<OWLClass> getAspect(OWLGraphWrapper graph, String aspect) { Set<OWLClass> result = new HashSet<OWLClass>(); for(OWLClass cls : graph.getAllOWLClasses()) { if (cls.isBuiltIn()) { continue; } String id = graph.getIdentifier(cls); if (id.startsWith("GO:") == false) { continue; } String namespace = graph.getNamespace(cls); if (namespace != null && namespace.equals(aspect)) { result.add(cls); } } return result; }
Example 2
Source File: BasicAnnotationPropagator.java From owltools with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Retrieve the non redundant set of linked classes using the given * relation. The reasoner is used to infer the super and subsets for the * subClass hierarchy. Only return classes, which are in the given super set * (a.k.a. ontology branch).<br> * <br> * This can be an expensive operation, especially the * {@link #reduceToNonRedundant(Set, OWLReasoner)}. Therefore the results of * that method are cached in a map.<br> * For example, using the cache for GO, there was a reduction of the startup * time from 95 seconds to 10 seconds. * * @param c * @param properties * @param g * @param reasoner * @param superSet * @param cache * @return set of linked classes, never null */ protected static Set<OWLClass> getNonRedundantLinkedClasses(OWLClass c, Set<OWLObjectProperty> properties, OWLGraphWrapper g, OWLReasoner reasoner, Set<OWLClass> superSet, Map<Set<OWLClass>, Set<OWLClass>> cache) { // get all superClasses for the current class Set<OWLClass> currentSuperClasses = reasoner.getSuperClasses(c, false).getFlattened(); currentSuperClasses.add(c); Set<OWLClass> linkedClasses = new HashSet<OWLClass>(); for (OWLClass currentSuperClass : currentSuperClasses) { if (currentSuperClass.isBuiltIn()) { continue; } // find all direct links via the property to the selected super set linkedClasses.addAll(getDirectLinkedClasses(currentSuperClass, properties, g, superSet)); } // create remove redundant super classes from link set Set<OWLClass> nonRedundantLinks = cache.get(linkedClasses); if (nonRedundantLinks == null) { nonRedundantLinks = reduceToNonRedundant(linkedClasses, reasoner); cache.put(linkedClasses, nonRedundantLinks); } return nonRedundantLinks; }
Example 3
Source File: EcoTools.java From owltools with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Wrapper method for the reasoner. * * @param sources * @param reflexive * @return set of super classes */ public Set<OWLClass> getAncestors(Set<OWLClass> sources, boolean reflexive) { if (sources == null || sources.isEmpty()) { return Collections.emptySet(); } Set<OWLClass> result = new HashSet<OWLClass>(); for (OWLClass source : sources) { Set<OWLClass> set = reasoner.getSuperClasses(source, false).getFlattened(); for (OWLClass cls : set) { if (cls.isBuiltIn() == false) { result.add(cls); } } } if (reflexive) { result.addAll(sources); } if (result.isEmpty()) { return Collections.emptySet(); } return result; }
Example 4
Source File: EcoTools.java From owltools with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Wrapper method for the reasoner * * @param sources * @param reflexive * @return set of sub classes */ public Set<OWLClass> getDescendents(Set<OWLClass> sources, boolean reflexive) { if (sources == null || sources.isEmpty()) { return Collections.emptySet(); } Set<OWLClass> result = new HashSet<OWLClass>(); for (OWLClass source : sources) { Set<OWLClass> set = reasoner.getSubClasses(source, false).getFlattened(); for (OWLClass cls : set) { if (cls.isBuiltIn() == false) { result.add(cls); } } } if (reflexive) { result.addAll(sources); } if (result.isEmpty()) { return Collections.emptySet(); } return result; }
Example 5
Source File: TraversingEcoMapperImpl.java From owltools with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public Set<OWLClass> getAncestors(Set<OWLClass> sources, boolean reflexive) { if (sources == null || sources.isEmpty()) { return Collections.emptySet(); } Set<OWLClass> result = new HashSet<OWLClass>(); for (OWLClass source : sources) { Set<OWLClass> set = reasoner.getSuperClasses(source, false).getFlattened(); for (OWLClass cls : set) { if (cls.isBuiltIn() == false) { result.add(cls); } } } if (reflexive) { result.addAll(sources); } if (result.isEmpty()) { return Collections.emptySet(); } return result; }
Example 6
Source File: TraversingEcoMapperImpl.java From owltools with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public Set<OWLClass> getDescendents(Set<OWLClass> sources, boolean reflexive) { if (sources == null || sources.isEmpty()) { return Collections.emptySet(); } Set<OWLClass> result = new HashSet<OWLClass>(); for (OWLClass source : sources) { Set<OWLClass> set = reasoner.getSubClasses(source, false).getFlattened(); for (OWLClass cls : set) { if (cls.isBuiltIn() == false) { result.add(cls); } } } if (reflexive) { result.addAll(sources); } if (result.isEmpty()) { return Collections.emptySet(); } return result; }
Example 7
Source File: TaxonTools.java From owltools with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Wrapper method for the reasoner. * * @param taxonClass * @param reflexive * @return set of super classes */ public Set<OWLClass> getAncestors(OWLClass taxonClass, boolean reflexive) { if (taxonClass == null) { return Collections.emptySet(); } Set<OWLClass> result = new HashSet<OWLClass>(); Set<OWLClass> set = reasoner.getSuperClasses(taxonClass, false).getFlattened(); for (OWLClass cls : set) { if (cls.isBuiltIn() == false) { result.add(cls); } } if (reflexive) { result.add(taxonClass); } if (result.isEmpty()) { return Collections.emptySet(); } return result; }
Example 8
Source File: TaxonTools.java From owltools with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Wrapper method for the reasoner * * @param sources * @param reflexive * @return set of sub classes */ public Set<OWLClass> getDescendents(Set<OWLClass> sources, boolean reflexive) { if (sources == null || sources.isEmpty()) { return Collections.emptySet(); } Set<OWLClass> result = new HashSet<OWLClass>(); for (OWLClass source : sources) { Set<OWLClass> set = reasoner.getSubClasses(source, false).getFlattened(); for (OWLClass cls : set) { if (cls.isBuiltIn() == false) { result.add(cls); } } } if (reflexive) { result.addAll(sources); } if (result.isEmpty()) { return Collections.emptySet(); } return result; }
Example 9
Source File: LegoUnitTools.java From owltools with BSD 3-Clause "New" or "Revised" License | 5 votes |
private OWLClass getType(OWLIndividual individual) { OWLClass type = null; if (individual.isNamed()) { Set<OWLClass> set = reasoner.getTypes(individual.asOWLNamedIndividual(), true).getFlattened(); if (set.size() == 1) { OWLClass cls = set.iterator().next(); if (cls.isBuiltIn() == false) { type = cls; } } } return type; }