Skip to content

Latest commit

 

History

History
 
 

java

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

TypeQL Language Library for Java

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.

Importing TypeQL Language Library through Maven

<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

Building TypeQL from Source

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.

  1. Make sure you have the following dependencies installed on your machine:

  2. 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