@Override public Concept visit(OWLAnnotationAssertionAxiom axiom) { if (! (axiom.getSubject() instanceof OWLNamedIndividual) ) { return null; } Optional<OWLLiteral> value = axiom.getValue().asLiteral(); if (!value.isPresent()) { return null; } @SuppressWarnings("unchecked") AttributeType<String> attributeType = (AttributeType<String>)visit(axiom.getProperty()); Entity entity = migrator.entity((OWLNamedIndividual)axiom.getSubject()); Attribute<String> attribute = attributeType.putAttribute(value.get().getLiteral()); RelationshipType propertyRelation = migrator.relation(axiom.getProperty()); return propertyRelation.addRelationship() .addRolePlayer(migrator.entityRole(entity.type(), attribute.type()), entity) .addRolePlayer(migrator.resourceRole(attribute.type()), attribute); }
public Entity putEntity(String id, EntityType type) { Entity current = getEntity(id, owlIriResource()); if(current != null) return current; Label hasIriResourceId = Label.of(OwlModel.IRI.owlname()); AttributeType<String> iriResource = owlIriResource(); Role hasIriOwner = entityRole(type, iriResource); Role hasIriValue = resourceRole(iriResource); RelationshipType hasIriRelation = tx.putRelationshipType(namer.resourceRelation(hasIriResourceId)) .relates(hasIriOwner).relates(hasIriValue); Entity entity = type.addEntity(); Attribute attributeInstance = iriResource.putAttribute(id); hasIriRelation.addRelationship() .addRolePlayer(hasIriOwner, entity) .addRolePlayer(hasIriValue, attributeInstance); return entity; }
public static ConceptMethod<Void> setRolePlayer(RolePlayer rolePlayer) { return ConceptMethod.builder(ConceptResponseType.UNIT) .requestSetter(builder -> builder.setSetRolePlayer(convert(rolePlayer))) .functionVoid(concept -> concept.asRelationship().addRolePlayer(rolePlayer.role(), rolePlayer.player())) .build(); }
@Override public Concept visit(OWLObjectPropertyAssertionAxiom axiom) { if (!axiom.getSubject().isNamed() || !axiom.getObject().isNamed() || !axiom.getProperty().isOWLObjectProperty()) { return null; } Entity subject = migrator.entity(axiom.getSubject().asOWLNamedIndividual()); Entity object = migrator.entity(axiom.getObject().asOWLNamedIndividual()); RelationshipType relationshipType = migrator.relation(axiom.getProperty().asOWLObjectProperty()); return relationshipType.addRelationship() .addRolePlayer(migrator.subjectRole(relationshipType), subject) .addRolePlayer(migrator.objectRole(relationshipType), object); }
try { return propertyRelation.addRelationship() .addRolePlayer(entityRole, entity) .addRolePlayer(resourceRole, attribute);