public interface Var extends Pattern
A Var may be given a variable name, or left as an "anonymous" variable. Graql provides
static methods for constructing Var objects.
The methods on Var are used to set its properties. A Var behaves differently depending on the type of
query its used in. In a MatchQuery, a Var describes the properties any matching concept must have. In
an InsertQuery, it describes the properties that should be set on the inserted concept. In a
DeleteQuery, it describes the properties that should be deleted.
| Modifier and Type | Method and Description |
|---|---|
VarAdmin |
admin() |
Var |
datatype(ResourceType.DataType<?> datatype) |
Var |
has(String type) |
Var |
has(String type,
Object value)
the variable must have a resource or name of the given type with an exact matching value
|
Var |
has(String type,
ValuePredicate predicate)
the variable must have a resource or name of the given type that matches the given atom
|
Var |
has(String type,
Var var)
the variable must have a resource or name of the given type that matches the given atom
|
Var |
has(Var var) |
Var |
hasKey(String type) |
Var |
hasKey(Var type) |
Var |
hasResource(String type) |
Var |
hasResource(Var type) |
Var |
hasRole(String type) |
Var |
hasRole(Var type) |
Var |
hasScope(Var type) |
Var |
id(String id) |
Var |
isa(String type) |
Var |
isa(Var type) |
Var |
isAbstract()
set this concept type variable as abstract, meaning it cannot have direct instances
|
Var |
lhs(Pattern lhs) |
Var |
name(String name) |
Var |
neq(String varName)
Specify that the variable is different to another variable
|
Var |
neq(Var var)
Specify that the variable is different to another variable
|
Var |
playsRole(String type) |
Var |
playsRole(Var type) |
Var |
regex(String regex)
Specify the regular expression instances of this resource type must match
|
Var |
rel(String roleplayer)
the variable must be a relation with the given roleplayer
|
Var |
rel(String roletype,
String roleplayer)
the variable must be a relation with the given roleplayer playing the given roletype
|
Var |
rel(String roletype,
Var roleplayer)
the variable must be a relation with the given roleplayer playing the given roletype
|
Var |
rel(Var roleplayer)
the variable must be a relation with the given roleplayer
|
Var |
rel(Var roletype,
String roleplayer)
the variable must be a relation with the given roleplayer playing the given roletype
|
Var |
rel(Var roletype,
Var roleplayer)
the variable must be a relation with the given roleplayer playing the given roletype
|
Var |
rhs(Pattern rhs) |
Var |
sub(String type) |
Var |
sub(Var type) |
Var |
value()
this variable must have a value
|
Var |
value(Object value) |
Var |
value(ValuePredicate predicate) |
Var name(String name)
name - a string that this variable's name must matchVar value()
Var value(Object value)
value - a value that this variable's value must exactly matchVar value(ValuePredicate predicate)
predicate - a atom this variable's value must matchVar has(String type)
type - a resource type that this variable must have an instance ofVar has(String type, Object value)
type - a resource type in the ontologyvalue - a value of a resourceVar has(String type, ValuePredicate predicate)
type - a resource type in the ontologypredicate - a atom on the value of a resourceVar has(String type, Var var)
type - a resource type in the ontologyvar - a variable representing a resourceVar isa(String type)
type - a concept type id that the variable must be of this typeVar isa(Var type)
type - a concept type that this variable must be an instance ofVar sub(String type)
type - a concept type id that this variable must be a kind ofVar sub(Var type)
type - a concept type that this variable must be a kind ofVar hasRole(String type)
type - a role type id that this relation type variable must haveVar hasRole(Var type)
type - a role type that this relation type variable must haveVar playsRole(String type)
type - a role type id that this concept type variable must playVar playsRole(Var type)
type - a role type that this concept type variable must playVar hasScope(Var type)
type - a scope that this variable must haveVar hasResource(String type)
type - a resource type that this type variable can be related toVar hasResource(Var type)
type - a resource type that this type variable can be related toVar hasKey(String type)
type - a resource type that this type variable can be one-to-one related toVar hasKey(Var type)
type - a resource type that this type variable can be one-to-one related toVar rel(String roleplayer)
roleplayer - a variable representing a roleplayerVar rel(Var roleplayer)
roleplayer - a variable representing a roleplayerVar rel(String roletype, String roleplayer)
roletype - a role type in the ontologyroleplayer - a variable representing a roleplayerVar rel(Var roletype, String roleplayer)
roletype - a variable representing a roletyperoleplayer - a variable representing a roleplayerVar rel(String roletype, Var roleplayer)
roletype - a role type in the ontologyroleplayer - a variable representing a roleplayerVar rel(Var roletype, Var roleplayer)
roletype - a variable representing a roletyperoleplayer - a variable representing a roleplayerVar isAbstract()
Var datatype(ResourceType.DataType<?> datatype)
datatype - the datatype to set for this resource type variableVar regex(String regex)
regex - the regex to set for this resource type variableVar neq(String varName)
varName - the variable name that this variable should not be equal toVar neq(Var var)
var - the variable that this variable should not be equal toCopyright © 2016 Grakn Labs Ltd. All rights reserved.