TypeQL language library for Java allows you to construct TypeQL queries programmatically, as opposed to manual string concatenations. For example, take the following native TypeQL query.
match $x isa person, has name "alice", has age 32;
The native TypeQL query above can be constructed programmatically in Java using this library, in the following way.
TypeQL.match(cVar("x").isa("person").has("name", "alice").has("age", 32));
You can learn more about TypeQL Language Library for Java from typedb.com/docs. You can find TypeDB and TypeQL repositories at vaticle/typedb and vaticle/typeql.
<repositories>
<repository>
<id>repo.typedb.com</id>
<url>https://repo.typedb.com/public/public-release/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.vaticle.typeql</groupId>
<artifactId>typeql-lang</artifactId>
<version>{version}</version>
</dependency>
</dependencies>
Replace {version}
with the version number, in which you can find the latest on TypeQL's Maven Repository. Further documentation: http://typedb.com/docs/client-api/java#typeql
Note: You don't need to compile TypeQL from source if you just want to use it in your code. See the "Importing TypeQL" section above.
-
Make sure you have the following dependencies installed on your machine:
- Java 11
- Bazel
-
Build the JAR:
a) to build the native/raw JAR:
bazel build//java:typeql
The Java library JAR will be produced at:
bazel-bin/libclient-java.jar
b) to build the JAR for a Maven application:
bazel build //java:assemble-maven
The Maven JAR and POM will be produced at:
bazel-bin/java/com.vaticle.typeql:lang.jar bazel-bin/java/pom.xml