typedb / typeql

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

Ontologically invalid queries should not be allowed. See example. #48

Closed grabl closed 1 year ago

grabl commented 6 years ago

This issue was originally posted by @haikalpribadi on 2017-04-24 13:31.

 match $a isa cancer; ($a, $b); $b isa mirna; ($b, $c); ($c, $d); $d isa gene; ($d, $e); $d isa drug; offset 0; limit 3; 

In the query above, I defined $d to have two types (that are not an abstraction of one another). This query should not be allowed: a) it should return an error that explains why. b) it should not try to execute the traversal.

grabl commented 6 years ago

This comment was originally posted by @haikalpribadi on 2017-04-24 13:33:48+02:00.

cc: Sheldon Hall this might be relevant to the the "type inference upon query planning" thing that Sheldon was working on.

grabl commented 6 years ago

This comment was originally posted by Filipe Peliz Pinto Teixeira on 2017-11-02 12:21:19+01:00.

Felix Chapman this is done no?

grabl commented 6 years ago

This comment was originally posted by Felix Chapman on 2017-11-02 12:23:02+01:00.

Filipe Peliz Pinto Teixeira It depends what it means. In general we allow invalid queries, but we do check super-simple stuff like "is the type there". For example, Graql won't mind if you say match $r ($x, $y); $r isa person; $r isa dog; or whatever.

grabl commented 6 years ago

This comment was originally posted by Filipe Peliz Pinto Teixeira on 2017-11-02 12:24:28+01:00.

Felix Chapman I suppose then the goal of this task is to optimise around not executing queries which we know are invalid. Like the above having two types. So this is not done then I would say.

grabl commented 6 years ago

This comment was originally posted by @kasper-piskorski on 2018-04-13 11:05:10+02:00.

isn't that a feature?

grabl commented 6 years ago

This comment was originally posted by Jason Liu on 2018-04-13 13:23:35+02:00.

@kasper-piskorski I think this should be allowed

flyingsilverfin commented 1 year ago

Generally, detecting invalid queries in the schema is now caught by type inference before the query is executed in TypeDB as of 2.x