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
Currently, instance variables can be casted into value variables and the below query is valid.
match $entity isa entity-name has attribute-one $attributeOne;
?attributeValue = $attributeOne;
fetch nestedQuery: {
match $anotherEntity is another-entity-name, has attribute-two ?attributeValue;
fetch $anotherEntity: attribute;
};
But the same cannot be done with a type variable. For example, the below query is invalid. The below use case is to fetch the super types of an entity and then use a subquery to fetch another entity with an attribute filter that depends on the label of the supertype. Essentially, it's trying to cast a type variable into a value variable.
Query 1
match $someEntity isa $someEntityType, has id "some id";
$someEntityType sub entity;
not { $someEntityType sub someEntityType; };
?someEntityTypeValue = $someEntityType; # illegal operation
fetch $someEntityType;
metadataOfSomeEntity: {
match $metadata isa metadata, has entity-type ?someEntityTypeValue;
fetch $metadata: attribute;
};
Current Workaround
To run the aforementioned query, first get the labels of $someEntityType and then pass them into another query to run the sub query from above (metadataOfSomeEntity) either as a single query by using the OR operator or running them as separate queries for each of the labels.
Proposed Solution
To be able to run Query 1 without splitting it into >1 queries - support the casting of type variables to value variables.
The text was updated successfully, but these errors were encountered:
dmitrii-ubskii
changed the title
Allow casting of type variables to value variables
Allow casting of thing variables to value variables
Jun 26, 2024
dmitrii-ubskii
changed the title
Allow casting of thing variables to value variables
Allow casting of type variables to value variables
Jun 26, 2024
Problem to Solve
Currently,
instance variables
can be casted intovalue variables
and the below query is valid.But the same cannot be done with a type variable. For example, the below query is invalid. The below use case is to fetch the super types of an entity and then use a subquery to fetch another entity with an attribute filter that depends on the
label
of the supertype. Essentially, it's trying to cast atype variable
into avalue variable
.Query 1
Current Workaround
To run the aforementioned query, first get the
label
s of$someEntityType
and then pass them into another query to run the sub query from above (metadataOfSomeEntity
) either as a single query by using theOR
operator or running them as separate queries for each of thelabel
s.Proposed Solution
To be able to run Query 1 without splitting it into >1 queries - support the casting of type variables to value variables.
The text was updated successfully, but these errors were encountered: