You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a user queries using just the roles of relations, without specifying the relation types, TypeDB can accidentally Alias the role types together, and cause the query to be rejected.
Environment
TypeDB distribution: Core/Cloud
TypeDB version: 2.10 onwards
Reproducible Steps
define
person sub entity;
pet sub entity;
toy sub entity;
pet-ownership sub relation, relates owner, relates pet;
toy-ownership sub relation, relates owner, relates toy;
person plays pet-ownership:owner;
pet plays pet-ownership:pet, plays toy-ownership:owner;
toy plays toy-ownership:toy;
match
(owner: $x, pet: $y);
(owner: $y, toy: $z);
get;
We get:
[CXN05] The transaction is closed because of the error(s):
[QRY16] Invalid Query Pattern: Could not infer compatible types for the match pattern:
'{{
$_1 (owner:$y, toy:$z);
$_0 (owner:$x, pet:$y);
}}'
Expected result
We should find that the query is satisfiable, returning person that have pets, where the pets have toys.
Additional information
TypeDB receives type labelled variables: relation:owner, relation:pet, relation:owner, and relation:toy
Due to receiving the same type label twice, we then construct a query graph with only one Type Variable for relation:owner! However, these should be kept separate and wired up to the neighbors.
This will require allowing anonymous type variables, and generating a new type variable with an anonymous name for each scoped type label (and the label constraint), and then allowing Type inference to resolve the labels on the variables independently.
The text was updated successfully, but these errors were encountered:
flyingsilverfin
changed the title
Matching by role type without scope causes incorrect query rejection
Matching by role type without scope incorrectly rejects query
Mar 26, 2024
Description
If a user queries using just the roles of relations, without specifying the relation types, TypeDB can accidentally Alias the role types together, and cause the query to be rejected.
Environment
Reproducible Steps
We get:
Expected result
We should find that the query is satisfiable, returning
person
that havepet
s, where thepet
s havetoy
s.Additional information
TypeDB receives type labelled variables:
relation:owner
,relation:pet
,relation:owner
, andrelation:toy
Due to receiving the same type label twice, we then construct a query graph with only one Type Variable for
relation:owner
! However, these should be kept separate and wired up to the neighbors.This will require allowing anonymous type variables, and generating a new type variable with an anonymous name for each scoped type label (and the label constraint), and then allowing Type inference to resolve the labels on the variables independently.
The text was updated successfully, but these errors were encountered: