public interface Relation extends Instance
Encapsulates relationships between Instance
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(RoleType roleType,
Instance instance)
Expands this Relation to include a new role player which is playing a specific role.
|
Map<RoleType,Set<Instance>> |
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<Instance> |
rolePlayers(RoleType... roleTypes)
|
RelationType |
type()
Retrieve the associated Relation Type for this Relation.
|
asEntity, asEntityType, asInstance, asRelation, asRelationType, asResource, asResourceType, asRoleType, asRule, asRuleType, asType, delete, getId, isEntity, isEntityType, isInstance, isRelation, isRelationType, isResource, isResourceType, isRoleType, isRule, isRuleType, isTypecompareToRelation resource(Resource resource)
RelationType type()
type in interface InstanceRelationTypeMap<RoleType,Set<Instance>> allRolePlayers()
RoleTypeCollection<Instance> rolePlayers(RoleType... roleTypes)
Relation addRolePlayer(RoleType roleType, Instance instance)
roleType - The Role Type of the new role player.instance - The new role player.ConceptNotUniqueException - if the concept is only allowed to play this role once.Copyright © 2017 Grakn Labs Ltd. All rights reserved.