Skip to content

Commit 37baf49

Browse files
Upgrade TypeQL and Driver to 2.18.x (#71)
1 parent 81fbbb6 commit 37baf49

File tree

15 files changed

+252
-251
lines changed

15 files changed

+252
-251
lines changed

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
---
33
---
44

5-
###
5+
###
66

77
[![TypeDB Loader Test](https://github.com/bayer-science-for-a-better-life/grami/actions/workflows/testandbuild.yaml/badge.svg)](https://github.com/bayer-science-for-a-better-life/grami/actions/workflows/testandbuild.yaml)
88
[![TypeDB Loader Build](https://github.com/bayer-science-for-a-better-life/grami/actions/workflows/release.yaml/badge.svg)](https://github.com/bayer-science-for-a-better-life/grami/actions/workflows/release.yaml)
@@ -129,7 +129,7 @@ public class LoadingData {
129129

130130
## Step-by-Step Tutorial
131131

132-
A complete tutorial for TypeDB version >= 2.5.0 is in work and will be published asap.
132+
A complete tutorial for TypeDB version >= 2.5.0 is in work and will be published.
133133

134134
An example of configuration and usage of TypeDB Loader on real data can be
135135
found [in the TypeDB Examples](https://github.com/vaticle/typedb-examples/tree/master/biology/catalogue_of_life).
@@ -142,6 +142,7 @@ There is an [example repository](https://github.com/bayer-science-for-a-better-l
142142
## Connecting to TypeDB Cluster
143143

144144
To connect to TypeDB Cluster, a set of options is provided:
145+
145146
```
146147
--typedb-cluster=<address:port>
147148
--username=<username>
@@ -154,18 +155,20 @@ To connect to TypeDB Cluster, a set of options is provided:
154155

155156
Ranges are [inclusive, exclusive).
156157

157-
| TypeDB Loader | TypeDB Client (internal) | TypeDB | TypeDB Cluster |
158-
|:--------------:|:------------------------:|:----------------:|:----------------:|
159-
| 1.6.0 | 2.14.2 | 2.14.x to 2.16.x | 2.14.x to 2.16.x |
160-
| 1.2.0 to 1.6.0 | 2.8.0 - 2.14.0 | 2.8.0 to 2.14.0 | N/A |
161-
| 1.1.0 to 1.2.0 | 2.8.0 | 2.8.x | N/A |
162-
| 1.0.0 | 2.5.0 to 2.7.1 | 2.5.x to 2.7.x | N/A |
163-
| 0.1.1 | 2.0.0 to 2.5.0 | 2.0.x to 2.4.x | N/A |
164-
| <0.1 | 1.8.0 | 1.8.x | N/A |
158+
| TypeDB Loader | TypeDB Client (internal) | TypeDB | TypeDB Cluster |
159+
|:-------------:|:------------------------:|:---------------:|:---------------:|
160+
| 1.7.0 | 2.18.1 | 2.18.x - | 2.18.x - |
161+
| 1.6.0 | 2.14.2 | 2.14.x - 2.17.x | 2.14.x - 2.16.x |
162+
| 1.2.0 - 1.6.0 | 2.8.0 - 2.14.0 | 2.8.0 - 2.14.0 | N/A |
163+
| 1.1.0 - 1.2.0 | 2.8.0 | 2.8.x | N/A |
164+
| 1.0.0 | 2.5.0 - 2.7.1 | 2.5.x - 2.7.x | N/A |
165+
| 0.1.1 | 2.0.0 - 2.5.0 | 2.0.x - 2.4.x | N/A |
166+
| <0.1 | 1.8.0 | 1.8.x | N/A |
165167

166168
* [Type DB](https://github.com/vaticle/typedb)
167169

168-
Find the Readme for GraMi for grakn < 2.0 [here](https://github.com/bayer-science-for-a-better-life/grami/blob/b3d6d272c409d6c40254354027b49f90b255e1c3/README.md)
170+
Find the Readme for GraMi for grakn <
171+
2.0 [here](https://github.com/bayer-science-for-a-better-life/grami/blob/b3d6d272c409d6c40254354027b49f90b255e1c3/README.md)
169172

170173
## Contributions
171174

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
group 'com.vaticle.typedb-osi'
8-
version '1.6.0'
8+
version '1.7.0'
99

1010
repositories {
1111
mavenCentral()
@@ -15,8 +15,8 @@ repositories {
1515
}
1616

1717
dependencies {
18-
implementation("com.vaticle.typedb:typedb-client:2.14.2")
19-
implementation("com.vaticle.typeql:typeql-grammar:2.14.0")
18+
implementation("com.vaticle.typedb:typedb-client:2.18.1")
19+
implementation("com.vaticle.typeql:typeql-lang:2.18.0")
2020
implementation("com.google.code.gson:gson:2.8.6")
2121
implementation("org.slf4j:slf4j-api:1.7.25")
2222
implementation("org.apache.logging.log4j:log4j-api:2.17.1")

gradle/wrapper/gradle-wrapper.jar

-216 Bytes
Binary file not shown.

gradlew

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ esac
8282

8383
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
8484

85-
8685
# Determine the Java command to use to start the JVM.
8786
if [ -n "$JAVA_HOME" ] ; then
8887
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -130,7 +129,6 @@ fi
130129
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131130
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132131
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133-
134132
JAVACMD=`cygpath --unix "$JAVACMD"`
135133

136134
# We build the pattern for arguments to be converted via cygpath

gradlew.bat

Lines changed: 103 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,103 @@
1-
@rem
2-
@rem Copyright 2015 the original author or authors.
3-
@rem
4-
@rem Licensed under the Apache License, Version 2.0 (the "License");
5-
@rem you may not use this file except in compliance with the License.
6-
@rem You may obtain a copy of the License at
7-
@rem
8-
@rem https://www.apache.org/licenses/LICENSE-2.0
9-
@rem
10-
@rem Unless required by applicable law or agreed to in writing, software
11-
@rem distributed under the License is distributed on an "AS IS" BASIS,
12-
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
@rem See the License for the specific language governing permissions and
14-
@rem limitations under the License.
15-
@rem
16-
17-
@if "%DEBUG%" == "" @echo off
18-
@rem ##########################################################################
19-
@rem
20-
@rem Gradle startup script for Windows
21-
@rem
22-
@rem ##########################################################################
23-
24-
@rem Set local scope for the variables with windows NT shell
25-
if "%OS%"=="Windows_NT" setlocal
26-
27-
set DIRNAME=%~dp0
28-
if "%DIRNAME%" == "" set DIRNAME=.
29-
set APP_BASE_NAME=%~n0
30-
set APP_HOME=%DIRNAME%
31-
32-
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
33-
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34-
35-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36-
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37-
38-
@rem Find java.exe
39-
if defined JAVA_HOME goto findJavaFromJavaHome
40-
41-
set JAVA_EXE=java.exe
42-
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto init
44-
45-
echo.
46-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47-
echo.
48-
echo Please set the JAVA_HOME variable in your environment to match the
49-
echo location of your Java installation.
50-
51-
goto fail
52-
53-
:findJavaFromJavaHome
54-
set JAVA_HOME=%JAVA_HOME:"=%
55-
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56-
57-
if exist "%JAVA_EXE%" goto init
58-
59-
echo.
60-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61-
echo.
62-
echo Please set the JAVA_HOME variable in your environment to match the
63-
echo location of your Java installation.
64-
65-
goto fail
66-
67-
:init
68-
@rem Get command-line arguments, handling Windows variants
69-
70-
if not "%OS%" == "Windows_NT" goto win9xME_args
71-
72-
:win9xME_args
73-
@rem Slurp the command line arguments.
74-
set CMD_LINE_ARGS=
75-
set _SKIP=2
76-
77-
:win9xME_args_slurp
78-
if "x%~1" == "x" goto execute
79-
80-
set CMD_LINE_ARGS=%*
81-
82-
:execute
83-
@rem Setup the command line
84-
85-
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
86-
87-
88-
@rem Execute Gradle
89-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
90-
91-
:end
92-
@rem End local scope for the variables with windows NT shell
93-
if "%ERRORLEVEL%"=="0" goto mainEnd
94-
95-
:fail
96-
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
97-
rem the _cmd.exe /c_ return code!
98-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
99-
exit /b 1
100-
101-
:mainEnd
102-
if "%OS%"=="Windows_NT" endlocal
103-
104-
:omega
1+
@rem
2+
@rem Copyright 2015 the original author or authors.
3+
@rem
4+
@rem Licensed under the Apache License, Version 2.0 (the "License");
5+
@rem you may not use this file except in compliance with the License.
6+
@rem You may obtain a copy of the License at
7+
@rem
8+
@rem https://www.apache.org/licenses/LICENSE-2.0
9+
@rem
10+
@rem Unless required by applicable law or agreed to in writing, software
11+
@rem distributed under the License is distributed on an "AS IS" BASIS,
12+
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
@rem See the License for the specific language governing permissions and
14+
@rem limitations under the License.
15+
@rem
16+
17+
@if "%DEBUG%" == "" @echo off
18+
@rem ##########################################################################
19+
@rem
20+
@rem Gradle startup script for Windows
21+
@rem
22+
@rem ##########################################################################
23+
24+
@rem Set local scope for the variables with windows NT shell
25+
if "%OS%"=="Windows_NT" setlocal
26+
27+
set DIRNAME=%~dp0
28+
if "%DIRNAME%" == "" set DIRNAME=.
29+
set APP_BASE_NAME=%~n0
30+
set APP_HOME=%DIRNAME%
31+
32+
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
33+
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34+
35+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36+
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37+
38+
@rem Find java.exe
39+
if defined JAVA_HOME goto findJavaFromJavaHome
40+
41+
set JAVA_EXE=java.exe
42+
%JAVA_EXE% -version >NUL 2>&1
43+
if "%ERRORLEVEL%" == "0" goto init
44+
45+
echo.
46+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47+
echo.
48+
echo Please set the JAVA_HOME variable in your environment to match the
49+
echo location of your Java installation.
50+
51+
goto fail
52+
53+
:findJavaFromJavaHome
54+
set JAVA_HOME=%JAVA_HOME:"=%
55+
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56+
57+
if exist "%JAVA_EXE%" goto init
58+
59+
echo.
60+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61+
echo.
62+
echo Please set the JAVA_HOME variable in your environment to match the
63+
echo location of your Java installation.
64+
65+
goto fail
66+
67+
:init
68+
@rem Get command-line arguments, handling Windows variants
69+
70+
if not "%OS%" == "Windows_NT" goto win9xME_args
71+
72+
:win9xME_args
73+
@rem Slurp the command line arguments.
74+
set CMD_LINE_ARGS=
75+
set _SKIP=2
76+
77+
:win9xME_args_slurp
78+
if "x%~1" == "x" goto execute
79+
80+
set CMD_LINE_ARGS=%*
81+
82+
:execute
83+
@rem Setup the command line
84+
85+
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
86+
87+
@rem Execute Gradle
88+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
89+
90+
:end
91+
@rem End local scope for the variables with windows NT shell
92+
if "%ERRORLEVEL%"=="0" goto mainEnd
93+
94+
:fail
95+
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
96+
rem the _cmd.exe /c_ return code!
97+
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
98+
exit /b 1
99+
100+
:mainEnd
101+
if "%OS%"=="Windows_NT" endlocal
102+
103+
:omega

src/main/java/com/vaticle/typedb/osi/loader/config/Configuration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class Configuration {
3939
public static AttributeValueType getValueType(TypeDBSession session, String conceptType) {
4040
AttributeValueType valueType = null;
4141
try (TypeDBTransaction txn = session.transaction(TypeDBTransaction.Type.READ)) {
42-
Set<ConceptMap> answers = txn.query().match(TypeQL.match(TypeQL.var("t").type(conceptType)).get("t")).collect(Collectors.toSet());
42+
Set<ConceptMap> answers = txn.query().match(TypeQL.match(TypeQL.cVar("t").type(conceptType)).get(TypeQL.cVar("t"))).collect(Collectors.toSet());
4343
assert answers.size() == 1;
4444
for (ConceptMap answer : answers) {
4545
valueType = AttributeValueType.valueOf(answer.get("t").asAttributeType().getValueType().name());

src/main/java/com/vaticle/typedb/osi/loader/config/ConfigurationValidation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ private boolean valConceptTypeInSchema(HashMap<String, ArrayList<String>> valida
377377
String conceptType,
378378
String breadcrumbConceptType) {
379379
boolean exists = false;
380-
TypeQLMatch query = TypeQL.match(TypeQL.var("t").type(conceptType));
380+
TypeQLMatch query = TypeQL.match(TypeQL.cVar("t").type(conceptType));
381381
try (TypeDBTransaction txn = session.transaction(TypeDBTransaction.Type.READ)) {
382382
Util.trace(Integer.toString((int) txn.query().match(query).count()));
383383
exists = true;
@@ -532,7 +532,7 @@ private void valRoleType(HashMap<String, ArrayList<String>> validationReport,
532532
String breadcrumbs,
533533
String relationType,
534534
String roleType) {
535-
TypeQLMatch query = TypeQL.match(TypeQL.type(relationType).relates(TypeQL.var("r"))).get("r");
535+
TypeQLMatch query = TypeQL.match(TypeQL.type(relationType).relates(TypeQL.cVar("r"))).get(TypeQL.cVar("r"));
536536
try (TypeDBTransaction txn = session.transaction(TypeDBTransaction.Type.READ)) {
537537
Stream<ConceptMap> answers = txn.query().match(query);
538538
if (answers.noneMatch(a -> a.get("r").asRoleType().getLabel().name().equals(roleType))) {
@@ -547,7 +547,7 @@ private void valRolePlayedByConcept(HashMap<String, ArrayList<String>> validatio
547547
String relationType,
548548
String role,
549549
String conceptType) {
550-
TypeQLMatch query = TypeQL.match(TypeQL.var("c").plays(relationType, role)).get("c");
550+
TypeQLMatch query = TypeQL.match(TypeQL.cVar("c").plays(relationType, role)).get(TypeQL.cVar("c"));
551551
try (TypeDBTransaction txn = session.transaction(TypeDBTransaction.Type.READ)) {
552552
Stream<ConceptMap> answers = txn.query().match(query);
553553
if (answers.noneMatch(c -> c.get("c").asThingType().getLabel().name().equals(conceptType))) {

src/main/java/com/vaticle/typedb/osi/loader/generator/AppendAttributeGenerator.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import com.vaticle.typeql.lang.TypeQL;
2828
import com.vaticle.typeql.lang.pattern.constraint.ThingConstraint;
2929
import com.vaticle.typeql.lang.pattern.variable.ThingVariable;
30-
import com.vaticle.typeql.lang.pattern.variable.UnboundVariable;
30+
import com.vaticle.typeql.lang.pattern.variable.UnboundConceptVariable;
3131
import com.vaticle.typeql.lang.query.TypeQLInsert;
3232
import org.apache.commons.io.FilenameUtils;
3333
import org.apache.logging.log4j.LogManager;
@@ -87,22 +87,22 @@ public void write(TypeDBTransaction tx, String[] row, boolean allowMultiInsert)
8787

8888
public TypeQLInsert generateMatchInsertStatement(String[] row) {
8989
if (row.length > 0) {
90-
ThingVariable.Thing entityMatchStatement = TypeQL.var("thing")
90+
ThingVariable.Thing entityMatchStatement = TypeQL.cVar("thing")
9191
.isa(appendConfiguration.getMatch().getType());
9292
for (Configuration.Definition.Attribute consAtt : appendConfiguration.getMatch().getOwnerships()) {
93-
ArrayList<ThingConstraint.Value<?>> constraintValues = GeneratorUtil.generateValueConstraintsConstrainingAttribute(
93+
ArrayList<ThingConstraint.Predicate> constraintValues = GeneratorUtil.generateValueConstraintsConstrainingAttribute(
9494
row, header, filePath, fileSeparator, consAtt);
95-
for (ThingConstraint.Value<?> constraintValue : constraintValues) {
95+
for (ThingConstraint.Predicate constraintValue : constraintValues) {
9696
entityMatchStatement.constrain(GeneratorUtil.valueToHasConstraint(consAtt.getAttribute(), constraintValue));
9797
}
9898
}
9999

100-
UnboundVariable insertUnboundVar = TypeQL.var("thing");
100+
UnboundConceptVariable insertUnboundVar = TypeQL.cVar("thing");
101101
ThingVariable.Thing insertStatement = null;
102102
for (Configuration.Definition.Attribute attributeToAppend : appendConfiguration.getInsert().getOwnerships()) {
103-
ArrayList<ThingConstraint.Value<?>> constraintValues = GeneratorUtil.generateValueConstraintsConstrainingAttribute(
103+
ArrayList<ThingConstraint.Predicate> constraintValues = GeneratorUtil.generateValueConstraintsConstrainingAttribute(
104104
row, header, filePath, fileSeparator, attributeToAppend);
105-
for (ThingConstraint.Value<?> constraintValue : constraintValues) {
105+
for (ThingConstraint.Predicate constraintValue : constraintValues) {
106106
if (insertStatement == null) {
107107
insertStatement = insertUnboundVar.constrain(GeneratorUtil.valueToHasConstraint(attributeToAppend.getAttribute(), constraintValue));
108108
} else {
@@ -114,10 +114,10 @@ public TypeQLInsert generateMatchInsertStatement(String[] row) {
114114
if (insertStatement != null) {
115115
return TypeQL.match(entityMatchStatement).insert(insertStatement);
116116
} else {
117-
return TypeQL.insert(TypeQL.var("null").isa("null").has("null", "null"));
117+
return TypeQL.insert(TypeQL.cVar("null").isa("null").has("null", "null"));
118118
}
119119
} else {
120-
return TypeQL.insert(TypeQL.var("null").isa("null").has("null", "null"));
120+
return TypeQL.insert(TypeQL.cVar("null").isa("null").has("null", "null"));
121121
}
122122
}
123123

0 commit comments

Comments
 (0)