@Override public Concept visit(OWLSubClassOfAxiom axiom) { OWLClassExpression subclass = axiom.getSubClass(); EntityType subtype; if (subclass.isOWLClass()) { subtype = migrator.entityType(subclass.asOWLClass()); } else { // TODO - we need a strategy to support class expressions, e.g. as constraints // on instances return null; } OWLClassExpression superclass = axiom.getSuperClass(); EntityType supertype; if (superclass.isOWLClass()) { supertype = migrator.entityType(superclass.asOWLClass()); } else { // TODO - we need a strategy to support class expressions, e.g. as constraints // on instances return null; } if (!supertype.equals(subtype.sup())) { subtype.sup(supertype); } return null; }
public Entity entity(OWLNamedIndividual individual) { String id = namer.individualEntityName(individual.getIRI()); Entity entity = tx.getConcept(ConceptId.of(id)); if (entity != null) { return entity; } OWLClass owlclass = eval(() -> { Optional<OWLClassAssertionAxiom> expr = ontology .classAssertionAxioms(individual) .filter(ax -> ax.getClassExpression().isOWLClass()) .findFirst(); return expr.isPresent() ? expr.get().getClassExpression().asOWLClass() : null; }); return putEntity(id, owlclass == null ? owlThingEntityType() : entityType(owlclass)); }
@Override public Concept visit(OWLObjectPropertyRangeAxiom axiom) { if (!axiom.getProperty().isOWLObjectProperty()) { return null; } RelationshipType objectRelation = migrator.relation(axiom.getProperty().asOWLObjectProperty()); if (axiom.getRange().isOWLClass()) { EntityType entityType = migrator.entityType(axiom.getRange().asOWLClass()); Role range = migrator.objectRole(objectRelation); objectRelation.relates(range); migrator.owlThingEntityType().deletePlays(range); entityType.plays(range); } return objectRelation; }
@Override public Concept visit(OWLObjectPropertyDomainAxiom axiom) { if (!axiom.getProperty().isOWLObjectProperty()) { return null; } RelationshipType objectRelation = migrator.relation(axiom.getProperty().asOWLObjectProperty()); if (axiom.getDomain().isOWLClass()) { EntityType entityType = migrator.entityType(axiom.getDomain().asOWLClass()); Role domain = migrator.subjectRole(objectRelation); migrator.owlThingEntityType().deletePlays(domain); entityType.plays(domain); objectRelation.relates(domain); // System.out.println("Replaced domain thing with " + entityType.getLabel()); } return objectRelation; }