public final class ElementFactory extends Object
Constructs Concepts And Edges
This class turns Tinkerpop Vertex and Edge
into Grakn Concept and EdgeElement.
Construction is only successful if the vertex and edge properties contain the needed information.
A concept must include a label which is a Schema.BaseType.
An edge must include a label which is a Schema.EdgeLabel.
| Constructor and Description |
|---|
ElementFactory(GraknTxAbstract tx) |
| Modifier and Type | Method and Description |
|---|---|
VertexElement |
addVertexElement(Schema.BaseType baseType,
ConceptId... conceptIds)
Creates a new
VertexElement with a ConceptId which can optionally be set. |
Casting |
buildCasting(EdgeElement edge) |
<X extends Concept> |
buildConcept(org.apache.tinkerpop.gremlin.structure.Edge edge)
Constructors are called directly because this is only called when reading a known
Edge or Concept. |
<X extends Concept> |
buildConcept(EdgeElement edgeElement) |
<X extends Concept> |
buildConcept(org.apache.tinkerpop.gremlin.structure.Vertex vertex)
Constructors are called directly because this is only called when reading a known vertex or concept.
|
<X extends Concept> |
buildConcept(VertexElement vertexElement) |
EdgeElement |
buildEdgeElement(org.apache.tinkerpop.gremlin.structure.Edge edge) |
EntityTypeImpl |
buildEntityType(VertexElement vertex,
EntityType type) |
RelationshipImpl |
buildRelation(EdgeElement edge,
RelationshipType type,
Role owner,
Role value) |
RelationshipTypeImpl |
buildRelationType(VertexElement vertex,
RelationshipType type,
Boolean isImplicit) |
<V> AttributeTypeImpl<V> |
buildResourceType(VertexElement vertex,
AttributeType<V> type,
AttributeType.DataType<V> dataType) |
RoleImpl |
buildRole(VertexElement vertex,
Role type,
Boolean isImplicit) |
RuleImpl |
buildRule(VertexElement vertex,
Rule type,
Pattern when,
Pattern then) |
Optional<VertexElement> |
buildVertexElement(org.apache.tinkerpop.gremlin.structure.Vertex vertex)
Builds a
VertexElement from an already existing Vertex. |
public ElementFactory(GraknTxAbstract tx)
public <V> AttributeTypeImpl<V> buildResourceType(VertexElement vertex, AttributeType<V> type, AttributeType.DataType<V> dataType)
public RelationshipTypeImpl buildRelationType(VertexElement vertex, RelationshipType type, Boolean isImplicit)
public RelationshipImpl buildRelation(EdgeElement edge, RelationshipType type, Role owner, Role value)
public EntityTypeImpl buildEntityType(VertexElement vertex, EntityType type)
public RuleImpl buildRule(VertexElement vertex, Rule type, Pattern when, Pattern then)
public RoleImpl buildRole(VertexElement vertex, Role type, Boolean isImplicit)
public <X extends Concept> Optional<X> buildConcept(org.apache.tinkerpop.gremlin.structure.Vertex vertex)
vertex - A vertex of an unknown typepublic <X extends Concept> Optional<X> buildConcept(VertexElement vertexElement)
public <X extends Concept> Optional<X> buildConcept(org.apache.tinkerpop.gremlin.structure.Edge edge)
Edge or Concept.
Thus tracking the concept can be skipped.edge - A Edge of an unknown typepublic <X extends Concept> Optional<X> buildConcept(EdgeElement edgeElement)
public EdgeElement buildEdgeElement(org.apache.tinkerpop.gremlin.structure.Edge edge)
public Casting buildCasting(EdgeElement edge)
public Optional<VertexElement> buildVertexElement(org.apache.tinkerpop.gremlin.structure.Vertex vertex)
VertexElement from an already existing Vertex. An empty optional is returned if the passed in
vertex is not valid. A vertex is not valid if it is null or has been deletedvertex - A vertex which can possibly be turned into a VertexElementVertexElement ofpublic VertexElement addVertexElement(Schema.BaseType baseType, ConceptId... conceptIds)
VertexElement with a ConceptId which can optionally be set.baseType - The Schema.BaseTypeconceptIds - the optional ConceptId to set as the new ConceptIdVertexElementCopyright © 2017 Grakn Labs Ltd. All rights reserved.