typedb / typeql

TypeQL: the power of programming, in your database
https://typedb.com
Mozilla Public License 2.0
219 stars 46 forks source link

Unintuitive error when trying to insert an attribute without a value #51

Closed grabl closed 1 year ago

grabl commented 6 years ago

This issue was originally posted by @jmsfltchr on 2018-08-31 12:51.

Encountered an unintuitive error message when loading a gql file.

 define name sub attribute datatype string; 

Given the above, when making the below (incorrect) query, the user should be told more explicitly that they didn't provide a value for attribute name.

 >>> insert $n isa name; INVALID_ARGUMENT: GraqlQueryException-missing expected property `` in `$n isa name`. Please check server logs for the stack trace. >>> 

Server log:

 2018-08-31 12:04:07,885 [grpc-default-executor-46] ERROR a.g.e.r.SessionService$TransactionListener - Runtime Exception in RPC TransactionListener: ai.grakn.exception.GraqlQueryException: missing expected property `` in `$n isa name` at ai.grakn.exception.GraqlQueryException.create(GraqlQueryException.java:89) at ai.grakn.exception.GraqlQueryException.insertNoExpectedProperty(GraqlQueryException.java:211) at ai.grakn.graql.internal.query.executor.ConceptBuilder.useOrDefault(ConceptBuilder.java:339) at ai.grakn.graql.internal.query.executor.ConceptBuilder.use(ConceptBuilder.java:355) at ai.grakn.graql.internal.query.executor.ConceptBuilder.putInstance(ConceptBuilder.java:415) at ai.grakn.graql.internal.query.executor.ConceptBuilder.tryPutConcept(ConceptBuilder.java:247) at ai.grakn.graql.internal.query.executor.ConceptBuilder.build(ConceptBuilder.java:184) at ai.grakn.graql.internal.query.executor.QueryOperationExecutor.buildConcept(QueryOperationExecutor.java:270) at java.util.HashMap.forEach(HashMap.java:1289) at ai.grakn.graql.internal.query.executor.QueryOperationExecutor.insertAll(QueryOperationExecutor.java:256) at ai.grakn.graql.internal.query.executor.QueryOperationExecutor.insertAll(QueryOperationExecutor.java:102) at ai.grakn.graql.internal.query.executor.QueryExecutorImpl.run(QueryExecutorImpl.java:84) at ai.grakn.graql.internal.query.InsertQueryImpl.stream(InsertQueryImpl.java:81) at ai.grakn.engine.rpc.SessionService$TransactionListener.query(SessionService.java:235) at ai.grakn.engine.rpc.SessionService$TransactionListener.handleRequest(SessionService.java:142) at ai.grakn.engine.rpc.SessionService$TransactionListener.lambda$onNext$0(SessionService.java:117) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 
flyingsilverfin commented 1 year ago

TypeDB server 2.x now throws:

[THW25] Invalid Thing Write: Unable to insert attribute '$x' of type 'val' without a value assigned to the variable.