typedb-driver-python icon indicating copy to clipboard operation
typedb-driver-python copied to clipboard

concept rule methods: .get_then() does not include curly braces and is missing final semicolon

Open JonThom opened this issue 3 years ago • 1 comments

Description

In the concept rule API, the rule.get_when() method returns a string that includes an outer pair of curly braces around the when statements. rule.get_then() returns a string without curly braces, and that lacks the final semicolon that would make it a valid typeql statement.

JonThom avatar Jan 15 '22 12:01 JonThom

Thanks for the report!

@flyingsilverfin please confirm: As far as I know this is the intended behaviour, because in client-java, RuleImpl internally stores fields when and then as Conjunction<? extends Pattern> and ThingVariable<?>.

However:

  • the interface Rule in client-java abstracts both types away as Pattern, which may result in unexpected behaviour for the user
  • client-python and client-nodejs return strings because they don't have TypeQL libraries
  • the return type in client-java is incorrectly documented in the docs (and the docs make no indication that get_when will include outer braces since it's a Conjunction under the hood)

Looks like the internal types in client-java should be made explicit and the docs updated with the correct typings and examples?

alexjpwalker avatar Jan 18 '22 09:01 alexjpwalker

Yeah that sounds about right, we should clarify the client docs and internals

flyingsilverfin avatar Jan 11 '23 13:01 flyingsilverfin