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(EmbeddedGraknTx 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. |
<V> AttributeTypeImpl<V> |
buildAttributeType(VertexElement vertex,
AttributeType<V> type,
AttributeType.DataType<V> dataType) |
<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 |
buildRelationshipType(VertexElement vertex,
RelationshipType type) |
RoleImpl |
buildRole(VertexElement vertex,
Role type) |
RuleImpl |
buildRule(VertexElement vertex,
Rule type,
Pattern when,
Pattern then) |
VertexElement |
buildVertexElement(org.apache.tinkerpop.gremlin.structure.Vertex vertex)
Builds a
VertexElement from an already existing Vertex. |
public ElementFactory(EmbeddedGraknTx tx)
public <V> AttributeTypeImpl<V> buildAttributeType(VertexElement vertex, AttributeType<V> type, AttributeType.DataType<V> dataType)
public RelationshipTypeImpl buildRelationshipType(VertexElement vertex, RelationshipType type)
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)
public <X extends Concept> X buildConcept(org.apache.tinkerpop.gremlin.structure.Vertex vertex)
vertex - A vertex of an unknown typepublic <X extends Concept> X buildConcept(VertexElement vertexElement)
public <X extends Concept> 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> X buildConcept(EdgeElement edgeElement)
public EdgeElement buildEdgeElement(org.apache.tinkerpop.gremlin.structure.Edge edge)
public 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 © 2018 Grakn Labs Ltd. All rights reserved.