public interface GraknGraph extends AutoCloseable
| Modifier and Type | Method and Description |
|---|---|
GraknAdmin |
admin()
Returns access to the low-level details of the graph via GraknAdmin
|
void |
clear()
Closes and clears the current graph.
|
void |
close()
Closes the current graph, rendering it unusable.
|
void |
commit()
Validates and attempts to commit the graph.
|
<T extends Concept> |
getConcept(String id)
Get the Concept with identifier provided, if it exists.
|
EntityType |
getEntityType(String name)
Get the Entity Type with the name provided, if it exists.
|
String |
getKeyspace()
Utility function to get the name of the keyspace where the graph is persisted.
|
Relation |
getRelation(RelationType relationType,
Map<RoleType,Instance> roleMap)
Get a collection of Relations that match the specified Relation Type and role map, if it exists.
|
RelationType |
getRelationType(String name)
Get the Relation Type with the name provided, if it exists.
|
<V> Collection<Resource<V>> |
getResourcesByValue(V value)
Get the Resources holding the value provided, if they exist.
|
<V> ResourceType<V> |
getResourceType(String name)
Get the Resource Type with the name provided, if it exists.
|
RoleType |
getRoleType(String name)
Get the Role Type with the name provided, if it exists.
|
RuleType |
getRuleType(String name)
Get the Rule Type with the name provided, if it exists.
|
Type |
getType(String name)
Get the Type with the name provided, if it exists.
|
QueryBuilder |
graql()
Returns a QueryBuilder
|
boolean |
implicitConceptsVisible()
Utility function to specify whether implicit concepts should be exposed.
|
boolean |
isClosed()
Utility function to determine whether the graph has been closed.
|
EntityType |
putEntityType(String name)
Create a new Entity Type, or return a pre-existing Entity Type, with the specified name.
|
RelationType |
putRelationType(String name)
Create a Relation Type, or return a pre-existing Relation Type, with the specified name.
|
<V> ResourceType<V> |
putResourceType(String name,
ResourceType.DataType<V> dataType)
Create a Resource Type, or return a pre-existing Resource Type, with the specified name.
|
<V> ResourceType<V> |
putResourceTypeUnique(String name,
ResourceType.DataType<V> dataType)
Create a unique Resource Type, or return a pre-existing Resource Type, with the specified name.
|
RoleType |
putRoleType(String name)
Create a Role Type, or return a pre-existing Role Type, with the specified name.
|
RuleType |
putRuleType(String name)
Create a Rule Type, or return a pre-existing Rule Type, with the specified name.
|
void |
rollback()
Resets the current transaction without committing.
|
void |
showImplicitConcepts(boolean flag)
Utility function to specify whether implicit and system-generated types should be returned.
|
EntityType putEntityType(String name)
name - A unique name for the Entity Type<V> ResourceType<V> putResourceType(String name, ResourceType.DataType<V> dataType)
V - The data type of the resource type. Supported types include: String, Long, Double, Boolean.
This should match the parameter typename - A unique name for the Resource TypedataType - The data type of the resource type.
Supported types include: DataType.STRING, DataType.LONG, DataType.DOUBLE, and DataType.BOOLEAN<V> ResourceType<V> putResourceTypeUnique(String name, ResourceType.DataType<V> dataType)
V - The data type of the resource type. Supported types include: String, Long, Double, Boolean.
This should match the parameter typename - A unique name for the Resource TypedataType - The data type of the resource type.
Supported types include: DataType.STRING, DataType.LONG, DataType.DOUBLE, and DataType.BOOLEANRuleType putRuleType(String name)
name - A unique name for the Rule TypeRelationType putRelationType(String name)
name - A unique name for the Relation TypeRoleType putRoleType(String name)
name - A unique name for the Role Type<T extends Concept> T getConcept(String id)
id - A unique identifier for the Concept in the graph.Type getType(String name)
name - A unique name which identifies the Type in the graph.<V> Collection<Resource<V>> getResourcesByValue(V value)
V - The data type of the value. Supported types include: String, Long, Double, and Boolean.value - A value which a Resource in the graph may be holding.EntityType getEntityType(String name)
name - A unique name which identifies the Entity Type in the graph.RelationType getRelationType(String name)
name - A unique name which identifies the Relation Type in the graph.<V> ResourceType<V> getResourceType(String name)
V - The data type of the value. Supported types include: String, Long, Double, and Boolean.name - A unique name which identifies the Resource Type in the graph.RoleType getRoleType(String name)
name - A unique name which identifies the Role Type in the graph.RuleType getRuleType(String name)
name - A unique name which identifies the Rule Type in the graph.Relation getRelation(RelationType relationType, Map<RoleType,Instance> roleMap)
relationType - The Relation Type which we wish to find a Relation instance of.roleMap - A role map specifying the rolePlayers (Instances or Resources) in the relationship and the roles (Role Types) they play.GraknAdmin admin()
GraknAdminvoid showImplicitConcepts(boolean flag)
flag - Specifies if implicit and system-generated types should be returned.boolean implicitConceptsVisible()
void clear()
String getKeyspace()
boolean isClosed()
QueryBuilder graql()
QueryBuildervoid commit()
throws GraknValidationException
GraknValidationException - is thrown when a structural validation fails.void rollback()
void close()
close in interface AutoCloseableCopyright © 2016 Grakn Labs Ltd. All rights reserved.