public class RelationshipImpl extends Object implements Relationship, ConceptVertex, CacheOwner
Encapsulates relationships between Thing
A relation which is an instance of a RelationshipType defines how instances may relate to one another.
clone, finalize, getClass, notify, notifyAll, wait, wait, waitasRelationship, isRelationshipasAttribute, asAttributeType, asEntity, asEntityType, asRelationshipType, asRole, asRule, asSchemaConcept, asType, isAttribute, isAttributeType, isEntity, isEntityType, isRelationshipType, isRole, isRule, isSchemaConcept, isTypefromfrom, registerCache, txCacheClear, txCacheFlushpublic static RelationshipImpl create(ai.grakn.kb.internal.concept.RelationshipStructure relationshipStructure)
public Optional<RelationshipReified> reified()
RelationshipReified if the Relationship has been reified.
To reify the Relationship you use reify().
NOTE: This approach is done to make sure that only write operations will cause the Relationship to reifyRelationshipReified if the Relationship has been reifiedpublic RelationshipReified reify()
RelationshipReifiedpublic ai.grakn.kb.internal.concept.RelationshipStructure structure()
public Relationship has(Attribute attribute)
has in interface Relationshiphas in interface Thingpublic Relationship relhas(Attribute attribute)
public java.util.stream.Stream<Attribute<?>> attributes(AttributeType[] attributeTypes)
attributes in interface Thingpublic java.util.stream.Stream<Attribute<?>> keys(AttributeType[] attributeTypes)
public RelationshipType type()
type in interface Relationshiptype in interface Thingpublic java.util.stream.Stream<Relationship> relationships(Role... roles)
relationships in interface Thingpublic java.util.stream.Stream<Role> roles()
public Map<Role,Set<Thing>> rolePlayersMap()
rolePlayersMap in interface RelationshipRoles and the Things playing them in this Relationship.Rolepublic java.util.stream.Stream<Thing> rolePlayers(Role... roles)
rolePlayers in interface Relationshippublic Relationship assign(Role role, Thing player)
Relationship to include a new role player which is playing a specific Role.assign in interface Relationshiprole - The role of the new role player.player - The new role player.Relationship itselfpublic Relationship unhas(Attribute attribute)
unhas in interface Relationshipunhas in interface Thingpublic boolean isInferred()
isInferred in interface Thingpublic void unassign(Role role, Thing player)
unassign in interface Relationshippublic VertexElement vertex()
vertex in interface ConceptVertexpublic static RelationshipImpl from(Relationship relationship)
public Collection<Cache> caches()
caches in interface CacheOwnerCacheOwnerpublic Relationship attributeInferred(Attribute attribute)
Copyright © 2018 Grakn Labs Ltd. All rights reserved.