Loader Client API Issues


#1

Following the documentation: https://dev.grakn.ai/docs/java-library/loader-api
I’ve created the simple test class:

public class LoaderTest {
public static void main(String[] args) {
SimpleURI uri = SimpleURI.withDefaultPort(“localhost”, 4567);
Keyspace keyspace = Keyspace.of(“grakn”);

    BatchExecutorClient loader = BatchExecutorClient.newBuilderforURI(uri).build();
    InsertQuery insert = insert(var().isa("person"));

    for (int i = 0; i < 1; i++) {
        loader.add(insert, keyspace).subscribe(it -> {
            System.out.println(it);
            loader.close();
        });
    }
}

}

Running this class however results in the following error:

Caused by: ai.grakn.client.GraknClientException: Failed graqlExecute. Error status: 400, error info: {“exception”:“person doesn’t have an ‘isa’, a ‘sub’ or an ‘id’”}
queries: insert isa person;
at ai.grakn.client.GraknClientImpl.graqlExecute(GraknClientImpl.java:85)
at ai.grakn.client.BatchExecutorClient$CommandQueries.lambda$run$1(BatchExecutorClient.java:390)
at com.github.rholder.retry.AttemptTimeLimiters$NoAttemptTimeLimit.call(AttemptTimeLimiters.java:78)
at com.github.rholder.retry.Retryer.call(Retryer.java:160)
at ai.grakn.client.BatchExecutorClient$CommandQueries.run(BatchExecutorClient.java:388)
at ai.grakn.client.BatchExecutorClient$CommandQueries.run(BatchExecutorClient.java:337)
at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)
at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)
… 26 more

Before running the above code I run:

  1. ./graql console
  2. define person sub entity;
  3. commit
  4. (verify http://localhost:4567/#/graph shows “person” when clicking “All Types”)
  5. (also verified I can successfully run “insert $p isa person;” in the Graql console)

I’ve recreated this issue in the repo: https://github.com/BFergerson/grakn-loader-test

This seems to be straight forward so I’m not sure what I’m doing wrong here. Is something off in the documentation? Using Grakn 1.1 on Ubuntu 16.04.4 LTS.


#2

I tried reproducing the issue but didn’t manage to. I started grakn, defined the person as you did and then copied your code and ran it. The insert was executed correctly.

After you commit, try exiting and rerunning console and then querying :

match $x sub entity;get;

and see whether person is there.


#3

@kasper, I tried following your instructions with exiting after the commit and going back into the console to test the match query. That worked but still the loader client had the same issue. I figured the issue might be coming from the fact that I’ve been running the same Grakn server constantly and just flushing it with “clean/confirm” and decided to use a fresh Grakn distribution. This is what actually solved the issue.

It seems the “clean/confirm” functionality in Grakn isn’t 100% effective. Given that I’ve been cleaning my Grakn server for several days with a couple different projects I’m not going to go through all the cache folders to try to find the issue. If I can reproduce it again with less cache I’ll see if I can determine the least amount of steps to reproduce it and create an actual issue.

Thanks for the help.