public Role entityRole(EntityType entityType, AttributeType<?> attributeType) { Role role = tx.putRole(namer.entityRole(attributeType.getLabel())); entityType.plays(role); return role; }
@Override public void buildSchema(GraknTx tx) { key = tx.putAttributeType("name", AttributeType.DataType.STRING); geoEntity = tx.putRole("geo-entity"); entityLocation = tx.putRole("entity-location"); isLocatedIn = tx.putRelationshipType("is-located-in") .relates(geoEntity).relates(entityLocation); geographicalObject = tx.putEntityType("geoObject") .plays(geoEntity) .plays(entityLocation); geographicalObject.has(key); continent = tx.putEntityType("continent") .sup(geographicalObject) .plays(entityLocation); country = tx.putEntityType("country") .sup(geographicalObject) .plays(geoEntity) .plays(entityLocation); region = tx.putEntityType("region") .sup(geographicalObject) .plays(geoEntity) .plays(entityLocation); city = tx.putEntityType("city") .sup(geographicalObject) .plays(geoEntity) .plays(entityLocation); university = tx.putEntityType("university") .plays(geoEntity); university.has(key); }
public RelationshipType relation(OWLObjectProperty property) { RelationshipType relType = tx.putRelationshipType(namer.objectPropertyName(property.getIRI())); Role subjectRole = subjectRole(relType); Role objectRole = objectRole(relType); relType.relates(subjectRole); relType.relates(objectRole); EntityType top = this.owlThingEntityType(); top.plays(subjectRole); top.plays(objectRole); return relType; }
.plays(productionWithCluster).plays(productionBeingDirected).plays(productionWithCast) .plays(productionWithGenre); .plays(director).plays(actor).plays(characterBeingPlayed); person.has(realName); genre = tx.putEntityType("genre").plays(genreOfProduction); genre.key(name); .plays(characterBeingPlayed); cluster = tx.putEntityType("cluster").plays(clusterOfProduction); cluster.has(name);
@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; }