use of org.semanticweb.owlapi.model.OWLClass in project molgenis by molgenis.
the class OntologyLoader method getChildClass.
public Set<OWLClass> getChildClass(OWLClass cls) {
Set<OWLClass> listOfClasses = new HashSet<>();
for (OWLSubClassOfAxiom axiom : ontology.getSubClassAxiomsForSuperClass(cls)) {
OWLClassExpression expression = axiom.getSubClass();
if (!expression.isAnonymous()) {
OWLClass asOWLClass = expression.asOWLClass();
listOfClasses.add(asOWLClass);
}
}
return listOfClasses;
}
use of org.semanticweb.owlapi.model.OWLClass in project molgenis by molgenis.
the class OntologyRepositoryCollection method createNodePaths.
/**
* Creates {@link OntologyTermNodePathMetadata} {@link Entity}s for an entire ontology tree and
* writes them to the {@link #nodePathsPerOntologyTerm} {@link Multimap}.
*/
private void createNodePaths() {
TreeTraverser<OWLClassContainer> traverser = new TreeTraverser<OWLClassContainer>() {
@Override
public Iterable<OWLClassContainer> children(OWLClassContainer container) {
int count = 0;
List<OWLClassContainer> containers = new ArrayList<>();
for (OWLClass childClass : loader.getChildClass(container.getOwlClass())) {
containers.add(new OWLClassContainer(childClass, constructNodePath(container.getNodePath(), count), false));
count++;
}
return containers;
}
};
OWLClass pseudoRootClass = loader.createClass(PSEUDO_ROOT_CLASS_LABEL, loader.getRootClasses());
for (OWLClassContainer container : traverser.preOrderTraversal(new OWLClassContainer(pseudoRootClass, PSEUDO_ROOT_CLASS_NODEPATH, true))) {
OWLClass ontologyTerm = container.getOwlClass();
String ontologyTermNodePath = container.getNodePath();
String ontologyTermIRI = ontologyTerm.getIRI().toString();
OntologyTermNodePath nodePathEntity = createNodePathEntity(container, ontologyTermNodePath);
nodePathsPerOntologyTerm.put(ontologyTermIRI, nodePathEntity);
}
}
use of org.semanticweb.owlapi.model.OWLClass in project webprotege by protegeproject.
the class DataFactory_TestCase method test_getFreshEntityReturnsFreshEntityWithNoLangTag.
@Test
public void test_getFreshEntityReturnsFreshEntityWithNoLangTag() {
OWLClass cls = DataFactory.getFreshOWLEntity(EntityType.CLASS, "X", Optional.empty());
assertTrue(DataFactory.isFreshEntity(cls));
assertEquals("X", DataFactory.getFreshEntityShortName(cls));
assertEquals(Optional.empty(), DataFactory.getFreshEntityLangTag(cls));
}
use of org.semanticweb.owlapi.model.OWLClass in project webprotege by protegeproject.
the class DataFactory_TestCase method test_getFreshEntityReturnsFreshEntity.
@Test
public void test_getFreshEntityReturnsFreshEntity() {
OWLClass cls = DataFactory.getFreshOWLEntity(EntityType.CLASS, "X", Optional.empty());
assertTrue(DataFactory.isFreshEntity(cls));
assertEquals("X", DataFactory.getFreshEntityShortName(cls));
}
use of org.semanticweb.owlapi.model.OWLClass in project webprotege by protegeproject.
the class FormSubjectFactoryDescriptorPresenter method getDescriptor.
@Nonnull
public Optional<FormSubjectFactoryDescriptor> getDescriptor() {
EntityType<?> entityType = view.getEntityType();
OWLClass parent = view.getParentClass().map(OWLClassData::getEntity).orElse(null);
return Optional.of(FormSubjectFactoryDescriptor.get(entityType, parent, Optional.empty()));
}
Aggregations