public interface Relation extends Thing
Encapsulates relationships between Thing
A relation which is an instance of a RelationType defines how instances may relate to one another.
It represents how different entities relate to one another.
Relations are used to model n-ary relationships between instances.
| Modifier and Type | Method and Description |
|---|---|
Relation |
addRolePlayer(Role role,
Thing thing)
Expands this Relation to include a new role player which is playing a specific role.
|
Map<Role,Set<Thing>> |
allRolePlayers()
Retrieve a list of all Instances involved in the Relation, and the Role Types they play.
|
Relation |
resource(Resource resource)
Creates a relation from this instance to the provided resource.
|
Collection<Thing> |
rolePlayers(Role... roles)
|
RelationType |
type()
Retrieve the associated Relation Type for this Relation.
|
asEntity, asEntityType, asInstance, asOntologyConcept, asRelation, asRelationType, asResource, asResourceType, asRoleType, asRule, asRuleType, asType, delete, getId, isEntity, isEntityType, isInstance, isOntologyConcept, isRelation, isRelationType, isResource, isResourceType, isRoleType, isRule, isRuleType, isTypecompareToRelation resource(Resource resource)
RelationType type()
type in interface ThingRelationType@CheckReturnValue Map<Role,Set<Thing>> allRolePlayers()
Role@CheckReturnValue Collection<Thing> rolePlayers(Role... roles)
Relation addRolePlayer(Role role, Thing thing)
role - The Role Type of the new role player.thing - The new role player.PropertyNotUniqueException - if the concept is only allowed to play this role once.Copyright © 2017 Grakn Labs Ltd. All rights reserved.