typeql icon indicating copy to clipboard operation
typeql copied to clipboard

Statements can be filled with nonsense that is only caught in toString()

Open alexjpwalker opened this issue 4 years ago • 0 comments

Description

Statements can be filled with nonsense that is only caught in toString().

Environment

  1. OS (where Grakn server runs): Mac OS 10
  2. Grakn version (and platform): Grakn Core 1.8
  3. Grakn client: core

Reproducible Steps

Construct a StatementInstance as follows:

StatementInstance propStatement = Graql.var("x").isa("has-attribute-property")
    .rel("owned", ((HasAttributeProperty) varProp).attribute());

where varProp is a VarProperty whose attribute has variable $name and has [1] property, which is isa name. (This is performed in grakn:RuleResolutionBuilder.java:137)

Expected Output

An error should be thrown attempting to build the statement instance, because $x (owned: $name isa name) isa has-attribute-property; is not valid Graql.

Actual Output

The statement instance is built successfully and now contains nonsense. An error is thrown - later - if you try calling toString() on it. This is weird, as we would not expect toString() to ever throw, unless the statement instance is null.

alexjpwalker avatar Jul 15 '20 10:07 alexjpwalker