public class Graql extends Object
| Modifier and Type | Method and Description |
|---|---|
static ValuePredicate |
all(ValuePredicate predicate,
ValuePredicate... predicates) |
static Pattern |
and(Collection<? extends Pattern> patterns) |
static Pattern |
and(Pattern... patterns) |
static ValuePredicate |
any(ValuePredicate predicate,
ValuePredicate... predicates) |
static Aggregate<Map<String,Concept>,Optional<Double>> |
average(String varName)
Create an aggregate that will find the mean of a variable's values.
|
static ValuePredicate |
contains(String substring) |
static Aggregate<Object,Long> |
count()
Create an aggregate that will count the results of a query.
|
static ValuePredicate |
eq(Object value) |
static Aggregate<Map<String,Concept>,Map<Concept,List<Map<String,Concept>>>> |
group(String varName)
Create an aggregate that will group a query by a variable name.
|
static <T> Aggregate<Map<String,Concept>,Map<Concept,T>> |
group(String varName,
Aggregate<? super Map<String,Concept>,T> aggregate)
Create an aggregate that will group a query by a variable name and apply the given aggregate to each group
|
static ValuePredicate |
gt(Comparable value) |
static ValuePredicate |
gte(Comparable value) |
static Var |
id(String id) |
static InsertQuery |
insert(Collection<? extends Var> vars) |
static InsertQuery |
insert(Var... vars) |
static ValuePredicate |
lt(Comparable value) |
static ValuePredicate |
lte(Comparable value) |
static MatchQuery |
match(Collection<? extends Pattern> patterns) |
static MatchQuery |
match(Pattern... patterns) |
static Aggregate<Map<String,Concept>,Optional<?>> |
max(String varName)
Create an aggregate that will find the maximum of a variable's values.
|
static Aggregate<Map<String,Concept>,Optional<Number>> |
median(String varName)
Create an aggregate that will find the median of a variable's values.
|
static Aggregate<Map<String,Concept>,Optional<?>> |
min(String varName)
Create an aggregate that will find the minimum of a variable's values.
|
static ValuePredicate |
neq(Object value) |
static Pattern |
or(Collection<? extends Pattern> patterns) |
static Pattern |
or(Pattern... patterns) |
static <T extends Query<?>> |
parse(String queryString) |
static java.util.stream.Stream<Pattern> |
parsePatterns(InputStream inputStream) |
static List<Pattern> |
parsePatterns(String patternsString) |
static String |
parseTemplate(String template,
Map<String,Object> data) |
static ValuePredicate |
regex(String pattern) |
static <S,T> Aggregate<S,Map<String,T>> |
select(NamedAggregate<? super S,? extends T>... aggregates)
Create an aggregate that will collect together several named aggregates into a map.
|
static <S,T> Aggregate<S,Map<String,T>> |
select(Set<NamedAggregate<? super S,? extends T>> aggregates)
Create an aggregate that will collect together several named aggregates into a map.
|
static Aggregate<Map<String,Concept>,Number> |
sum(String varName)
Create an aggregate that will sum the values of a variable.
|
static Var |
var() |
static Var |
var(String name) |
static QueryBuilder |
withGraph(MindmapsGraph graph) |
static QueryBuilder |
withoutGraph() |
public static QueryBuilder withoutGraph()
public static QueryBuilder withGraph(MindmapsGraph graph)
graph - the graph to operate the query onpublic static MatchQuery match(Pattern... patterns)
patterns - an array of patterns to match in the graphpublic static MatchQuery match(Collection<? extends Pattern> patterns)
patterns - a collection of patterns to match in the graphpublic static InsertQuery insert(Var... vars)
vars - an array of variables to insert into the graphpublic static InsertQuery insert(Collection<? extends Var> vars)
vars - a collection of variables to insert into the graphpublic static java.util.stream.Stream<Pattern> parsePatterns(InputStream inputStream)
inputStream - a stream representing a list of patternspublic static List<Pattern> parsePatterns(String patternsString)
patternsString - a string representing a list of patternspublic static <T extends Query<?>> T parse(String queryString)
queryString - a string representing a querypublic static String parseTemplate(String template, Map<String,Object> data)
template - a string representing a templated graql querydata - data to use in templatepublic static Var var(String name)
name - the name of the variablepublic static Var var()
public static Var id(String id)
id - the id of a conceptpublic static Pattern and(Pattern... patterns)
patterns - an array of patterns to matchpublic static Pattern and(Collection<? extends Pattern> patterns)
patterns - a collection of patterns to matchpublic static Pattern or(Pattern... patterns)
patterns - an array of patterns to matchpublic static Pattern or(Collection<? extends Pattern> patterns)
patterns - a collection of patterns to matchpublic static Aggregate<Object,Long> count()
public static Aggregate<Map<String,Concept>,Number> sum(String varName)
public static Aggregate<Map<String,Concept>,Optional<?>> max(String varName)
varName - the variable to find the maximum ofpublic static Aggregate<Map<String,Concept>,Optional<?>> min(String varName)
varName - the variable to find the maximum ofpublic static Aggregate<Map<String,Concept>,Optional<Double>> average(String varName)
varName - the variable to find the mean ofpublic static Aggregate<Map<String,Concept>,Optional<Number>> median(String varName)
varName - the variable to find the median ofpublic static Aggregate<Map<String,Concept>,Map<Concept,List<Map<String,Concept>>>> group(String varName)
varName - the variable name to group results bypublic static <T> Aggregate<Map<String,Concept>,Map<Concept,T>> group(String varName, Aggregate<? super Map<String,Concept>,T> aggregate)
T - the type the aggregate returnsvarName - the variable name to group results byaggregate - the aggregate to apply to each group@SafeVarargs public static <S,T> Aggregate<S,Map<String,T>> select(NamedAggregate<? super S,? extends T>... aggregates)
S - the type that the query returnsT - the type that each aggregate returnsaggregates - the aggregates to join togetherpublic static <S,T> Aggregate<S,Map<String,T>> select(Set<NamedAggregate<? super S,? extends T>> aggregates)
S - the type that the query returnsT - the type that each aggregate returnsaggregates - the aggregates to join togetherpublic static ValuePredicate eq(Object value)
value - the valuepublic static ValuePredicate neq(Object value)
value - the valuepublic static ValuePredicate gt(Comparable value)
value - the valuepublic static ValuePredicate gte(Comparable value)
value - the valuepublic static ValuePredicate lt(Comparable value)
value - the valuepublic static ValuePredicate lte(Comparable value)
value - the valuepublic static ValuePredicate all(ValuePredicate predicate, ValuePredicate... predicates)
predicates - an array of predicatespublic static ValuePredicate any(ValuePredicate predicate, ValuePredicate... predicates)
predicates - an array of predicatespublic static ValuePredicate regex(String pattern)
pattern - a regex patternpublic static ValuePredicate contains(String substring)
substring - a substring to matchCopyright © 2016. All rights reserved.