Skip to content
This repository was archived by the owner on Jun 26, 2022. It is now read-only.

Commit 9cbbe96

Browse files
committed
Deleted TypeQL Compute language framework
1 parent eaabc84 commit 9cbbe96

File tree

12 files changed

+23
-1503
lines changed

12 files changed

+23
-1503
lines changed

BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ java_library(
4646

4747
# Internal Repository Dependencies
4848
"@vaticle_typedb_common//:common",
49-
"@vaticle_typeql//grammar:java",
49+
"@vaticle_typeql//grammar/java:typeql-grammar",
5050

5151
# External dependencies
5252
"@maven//:com_google_code_findbugs_jsr305",

TypeQL.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,14 @@
3636
import com.vaticle.typeql.lang.pattern.variable.ThingVariable;
3737
import com.vaticle.typeql.lang.pattern.variable.TypeVariable;
3838
import com.vaticle.typeql.lang.pattern.variable.UnboundVariable;
39-
import com.vaticle.typeql.lang.query.TypeQLCompute;
4039
import com.vaticle.typeql.lang.query.TypeQLDefine;
4140
import com.vaticle.typeql.lang.query.TypeQLInsert;
4241
import com.vaticle.typeql.lang.query.TypeQLMatch;
4342
import com.vaticle.typeql.lang.query.TypeQLQuery;
4443
import com.vaticle.typeql.lang.query.TypeQLUndefine;
45-
4644
import java.time.LocalDateTime;
4745
import java.util.List;
4846
import java.util.stream.Stream;
49-
5047
import static com.vaticle.typedb.common.collection.Collections.list;
5148
import static com.vaticle.typeql.lang.common.TypeQLToken.Predicate.Equality.EQ;
5249
import static com.vaticle.typeql.lang.common.TypeQLToken.Predicate.Equality.GT;
@@ -79,9 +76,9 @@ public static List<? extends Pattern> parsePatterns(String pattern) {
7976
return parser.parsePatternsEOF(pattern);
8077
}
8178

82-
public static List<Definable> parseDefinables(String pattern) { return parser.parseDefinablesEOF(pattern); }
79+
public static List<Definable> parseDefinables(String pattern) {return parser.parseDefinablesEOF(pattern);}
8380

84-
public static Rule parseRule(String pattern) { return parser.parseSchemaRuleEOF(pattern).asRule(); }
81+
public static Rule parseRule(String pattern) {return parser.parseSchemaRuleEOF(pattern).asRule();}
8582

8683
public static BoundVariable parseVariable(String variable) {
8784
return parser.parseVariableEOF(variable);
@@ -135,10 +132,6 @@ public static TypeQLUndefine undefine(List<Definable> definables) {
135132
return new TypeQLUndefine(definables);
136133
}
137134

138-
public static TypeQLCompute.Builder compute() {
139-
return new TypeQLCompute.Builder();
140-
}
141-
142135
// Pattern Builder Methods
143136

144137
public static Conjunction<? extends Pattern> and(Pattern... patterns) {

common/TypeQLArg.java

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public static QueryType of(int value) {
4242
return null;
4343
}
4444

45-
public boolean isRead() { return !isWrite; }
45+
public boolean isRead() {return !isWrite;}
4646

47-
public boolean isWrite() { return isWrite; }
47+
public boolean isWrite() {return isWrite;}
4848
}
4949

5050
public enum ValueType {
@@ -99,33 +99,4 @@ public static Order of(String value) {
9999
return null;
100100
}
101101
}
102-
103-
/**
104-
* TypeQL Compute algorithm names
105-
*/
106-
public enum Algorithm {
107-
DEGREE("degree"),
108-
K_CORE("k-core"),
109-
CONNECTED_COMPONENT("connected-component");
110-
111-
private final String algorithm;
112-
113-
Algorithm(String algorithm) {
114-
this.algorithm = algorithm;
115-
}
116-
117-
@Override
118-
public String toString() {
119-
return this.algorithm;
120-
}
121-
122-
public static Algorithm of(String value) {
123-
for (Algorithm a : Algorithm.values()) {
124-
if (a.algorithm.equals(value)) {
125-
return a;
126-
}
127-
}
128-
return null;
129-
}
130-
}
131102
}

common/TypeQLToken.java

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
package com.vaticle.typeql.lang.common;
2323

2424
import com.vaticle.typeql.lang.common.exception.TypeQLException;
25-
2625
import static com.vaticle.typedb.common.util.Objects.className;
2726
import static com.vaticle.typeql.lang.common.exception.ErrorMessage.INVALID_CASTING;
2827

@@ -57,7 +56,6 @@ public static Type of(String value) {
5756
}
5857

5958
public enum Command {
60-
COMPUTE("compute"),
6159
DEFINE("define"),
6260
UNDEFINE("undefine"),
6361
INSERT("insert"),
@@ -398,101 +396,4 @@ public static Aggregate.Method of(String value) {
398396
}
399397
}
400398

401-
public static class Compute {
402-
403-
public enum Method {
404-
COUNT("count"),
405-
MIN("min"),
406-
MAX("max"),
407-
MEDIAN("median"),
408-
MEAN("mean"),
409-
STD("std"),
410-
SUM("sum"),
411-
PATH("path"),
412-
CENTRALITY("centrality"),
413-
CLUSTER("cluster");
414-
415-
private final String method;
416-
417-
Method(String method) {
418-
this.method = method;
419-
}
420-
421-
@Override
422-
public String toString() {
423-
return this.method;
424-
}
425-
426-
public static Compute.Method of(String name) {
427-
for (Compute.Method m : Compute.Method.values()) {
428-
if (m.method.equals(name)) {
429-
return m;
430-
}
431-
}
432-
return null;
433-
}
434-
}
435-
436-
/**
437-
* TypeQL Compute conditions keyword
438-
*/
439-
public enum Condition {
440-
FROM("from"),
441-
TO("to"),
442-
OF("of"),
443-
IN("in"),
444-
USING("using"),
445-
WHERE("where");
446-
447-
private final String condition;
448-
449-
Condition(String algorithm) {
450-
this.condition = algorithm;
451-
}
452-
453-
@Override
454-
public String toString() {
455-
return this.condition;
456-
}
457-
458-
public static Compute.Condition of(String value) {
459-
for (Compute.Condition c : Compute.Condition.values()) {
460-
if (c.condition.equals(value)) {
461-
return c;
462-
}
463-
}
464-
return null;
465-
}
466-
}
467-
468-
/**
469-
* TypeQL Compute parameter names
470-
*/
471-
public enum Param {
472-
MIN_K("min-k"),
473-
K("k"),
474-
CONTAINS("contains"),
475-
SIZE("size");
476-
477-
private final String param;
478-
479-
Param(String param) {
480-
this.param = param;
481-
}
482-
483-
@Override
484-
public String toString() {
485-
return this.param;
486-
}
487-
488-
public static Compute.Param of(String value) {
489-
for (Compute.Param p : Compute.Param.values()) {
490-
if (p.param.equals(value)) {
491-
return p;
492-
}
493-
}
494-
return null;
495-
}
496-
}
497-
}
498399
}

common/exception/ErrorMessage.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,14 @@ public class ErrorMessage extends com.vaticle.typedb.common.exception.ErrorMessa
8989
new ErrorMessage(32, "Rule '%s' 'then' variables must be present in rule 'when'.");
9090
public static final ErrorMessage REDUNDANT_NESTED_NEGATION =
9191
new ErrorMessage(33, "Invalid query containing redundant nested negations.");
92-
public static final ErrorMessage MISSING_COMPUTE_CONDITION =
93-
new ErrorMessage(34, "Missing condition(s) for 'compute '%s''. The required condition(s) are: '%s'.");
94-
public static final ErrorMessage INVALID_COMPUTE_METHOD_ALGORITHM =
95-
new ErrorMessage(35, "Invalid algorithm for 'compute '%s''. The accepted algorithm(s) are: '%s'.");
96-
public static final ErrorMessage INVALID_COMPUTE_ARGUMENT =
97-
new ErrorMessage(36, "Invalid argument(s) 'compute %s using %s'. The accepted argument(s) are: '%s'.");
9892
public static final ErrorMessage INVALID_SORTING_ORDER =
99-
new ErrorMessage(37, "Invalid sorting order. Valid options: '%s' or '%s'.");
93+
new ErrorMessage(34, "Invalid sorting order. Valid options: '%s' or '%s'.");
10094
public static final ErrorMessage INVALID_COUNT_VARIABLE_ARGUMENT =
101-
new ErrorMessage(38, "Aggregate COUNT does not accept a Variable.");
95+
new ErrorMessage(35, "Aggregate COUNT does not accept a Variable.");
10296
public static final ErrorMessage ILLEGAL_GRAMMAR =
103-
new ErrorMessage(39, "Illegal grammar!");
97+
new ErrorMessage(36, "Illegal grammar!");
10498
public static final ErrorMessage ILLEGAL_CHAR_IN_LABEL =
105-
new ErrorMessage(40, "'%s' is not a valid Type label. Type labels must start with a letter, and may contain only letters, numbers, '-' and '_'.");
99+
new ErrorMessage(47, "'%s' is not a valid Type label. Type labels must start with a letter, and may contain only letters, numbers, '-' and '_'.");
106100

107101

108102
private static final String codePrefix = "TQL";

parser/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ java_library(
3838
"//query:query",
3939

4040
# Internal Repository Dependencies
41-
"@vaticle_typeql//grammar:java",
41+
"@vaticle_typeql//grammar/java:typeql-grammar",
4242
"@vaticle_typedb_common//:common",
4343

4444
# External dependencies

0 commit comments

Comments
 (0)