G - A vendor specific implementation of a Tinkerpop Graph.public abstract class EmbeddedGraknTx<G extends org.apache.tinkerpop.gremlin.structure.Graph> extends Object implements GraknAdmin
GraknTx Base Implementation.
This defines how a grakn graph sits on top of a Tinkerpop Graph.
It mostly act as a construction object which ensure the resulting graph conforms to the Grakn Object model.| Constructor and Description |
|---|
EmbeddedGraknTx(EmbeddedGraknSession session,
G graph) |
| Modifier and Type | Method and Description |
|---|---|
VertexElement |
addVertexElement(Schema.BaseType baseType,
ConceptId... conceptIds) |
GraknAdmin |
admin() |
<T extends Concept> |
buildConcept(org.apache.tinkerpop.gremlin.structure.Edge edge) |
<T extends Concept> |
buildConcept(org.apache.tinkerpop.gremlin.structure.Vertex vertex) |
void |
checkMutationAllowed() |
void |
checkSchemaMutationAllowed() |
void |
clearGraph() |
void |
close()
Close the transaction without committing
|
void |
closeSession()
Closes the root session this graph stems from.
|
void |
commit()
Commits and closes the transaction without returning CommitLog
|
Optional<CommitLog> |
commitAndGetLogs()
Commits, closes transaction and returns CommitLog.
|
LabelId |
convertToId(Label label)
Converts a Type Label into a type Id for this specific graph.
|
boolean |
duplicateResourcesExist(String index,
Set<ConceptId> resourceVertexIds)
Check if there are duplicate resources in the provided set of vertex IDs
|
ElementFactory |
factory() |
boolean |
fixDuplicateResources(String index,
Set<ConceptId> resourceVertexIds)
Merges the provided duplicate resources
|
<V> Collection<Attribute<V>> |
getAttributesByValue(V value) |
<V> AttributeType<V> |
getAttributeType(String label) |
<T extends Concept> |
getConcept(ConceptId id) |
<T extends Concept> |
getConcept(Schema.VertexProperty key,
Object value) |
EntityType |
getEntityType(String label) |
RelationshipType |
getRelationshipType(String label) |
Role |
getRole(String label) |
Rule |
getRule(String label) |
<T extends SchemaConcept> |
getSchemaConcept(Label label) |
<T extends SchemaConcept> |
getSchemaConcept(LabelId id) |
long |
getShardCount(Type concept)
Returns the current number of shards the provided
Type has. |
G |
getTinkerPopGraph() |
org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource |
getTinkerTraversal()
Utility function to get a read-only Tinkerpop traversal.
|
<T extends Type> |
getType(Label label) |
QueryBuilder |
graql() |
boolean |
isBatchTx()
A flag to check if batch loading is enabled and consistency checks are switched off
|
boolean |
isClosed() |
abstract boolean |
isTinkerPopGraphClosed() |
boolean |
isValidElement(org.apache.tinkerpop.gremlin.structure.Element element) |
abstract int |
numOpenTx() |
void |
openTransaction(GraknTxType txType)
Opens the thread bound transaction
|
<V> AttributeType<V> |
putAttributeType(Label label,
AttributeType.DataType<V> dataType) |
EntityType |
putEntityType(Label label) |
RelationshipType |
putRelationshipType(Label label) |
RelationshipType |
putRelationTypeImplicit(Label label) |
Role |
putRole(Label label) |
Role |
putRoleTypeImplicit(Label label) |
Rule |
putRule(Label label,
Pattern when,
Pattern then) |
QueryExecutor |
queryExecutor() |
TxRuleCache |
ruleCache() |
EmbeddedGraknSession |
session() |
void |
shard(ConceptId conceptId)
Creates a new shard for the concept
|
long |
shardingThreshold()
|
java.util.stream.Stream<SchemaConcept> |
sups(SchemaConcept schemaConcept) |
TxCache |
txCache() |
GraknTxType |
txType() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMetaAttributeType, getMetaConcept, getMetaEntityType, getMetaRelationType, getMetaRole, getMetaRuleabort, keyspace, putAttributeType, putEntityType, putRelationshipType, putRole, putRulepublic EmbeddedGraknTx(EmbeddedGraknSession session, G graph)
public EmbeddedGraknSession session()
public TxRuleCache ruleCache()
public LabelId convertToId(Label label)
label - The label to be converted to the idpublic abstract int numOpenTx()
public void openTransaction(GraknTxType txType)
public long shardingThreshold()
Type must have before the Type
if automatically sharded.Type must have before it is sharededpublic TxCache txCache()
public abstract boolean isTinkerPopGraphClosed()
public GraknTxType txType()
public GraknAdmin admin()
public <T extends Concept> T buildConcept(org.apache.tinkerpop.gremlin.structure.Vertex vertex)
T - The type of the concept being builtvertex - A vertex which contains properties necessary to build a concept from.public <T extends Concept> T buildConcept(org.apache.tinkerpop.gremlin.structure.Edge edge)
public boolean isBatchTx()
public G getTinkerPopGraph()
public org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource getTinkerTraversal()
public QueryBuilder graql()
public ElementFactory factory()
public <T extends Concept> Optional<T> getConcept(Schema.VertexProperty key, Object value)
key - The concept property tp search by.value - The value of the conceptpublic final java.util.stream.Stream<SchemaConcept> sups(SchemaConcept schemaConcept)
sups in interface GraknAdminpublic void checkSchemaMutationAllowed()
public void checkMutationAllowed()
public VertexElement addVertexElement(Schema.BaseType baseType, ConceptId... conceptIds)
public EntityType putEntityType(Label label)
putEntityType in interface GraknTxpublic RelationshipType putRelationshipType(Label label)
putRelationshipType in interface GraknTxpublic RelationshipType putRelationTypeImplicit(Label label)
public <V> AttributeType<V> putAttributeType(Label label, AttributeType.DataType<V> dataType)
putAttributeType in interface GraknTxpublic <T extends Concept> T getConcept(ConceptId id)
getConcept in interface GraknTx@Nullable public <T extends SchemaConcept> T getSchemaConcept(LabelId id)
public <V> Collection<Attribute<V>> getAttributesByValue(V value)
getAttributesByValue in interface GraknTxpublic <T extends SchemaConcept> T getSchemaConcept(Label label)
getSchemaConcept in interface GraknTxpublic EntityType getEntityType(String label)
getEntityType in interface GraknTxpublic RelationshipType getRelationshipType(String label)
getRelationshipType in interface GraknTxpublic <V> AttributeType<V> getAttributeType(String label)
getAttributeType in interface GraknTxpublic void clearGraph()
public void closeSession()
public void close()
close in interface GraknTxclose in interface AutoCloseablepublic void commit()
throws InvalidKBException
commit in interface GraknTxInvalidKBExceptionpublic Optional<CommitLog> commitAndGetLogs() throws InvalidKBException
InvalidKBException - when the graph does not conform to the object conceptpublic boolean isValidElement(org.apache.tinkerpop.gremlin.structure.Element element)
public boolean duplicateResourcesExist(String index, Set<ConceptId> resourceVertexIds)
index - index of the resource to find duplicates ofresourceVertexIds - vertex Ids containing potential duplicatespublic boolean fixDuplicateResources(String index, Set<ConceptId> resourceVertexIds)
resourceVertexIds - The resource vertex ids which need to be merged.public void shard(ConceptId conceptId)
conceptId - the id of the concept to shardpublic long getShardCount(Type concept)
Type has. This is used in creating more
efficient query plans.public final QueryExecutor queryExecutor()
queryExecutor in interface GraknAdminCopyright © 2018 Grakn Labs Ltd. All rights reserved.