Stuck On Contains Syntax Question


#1

Hello everyone!

I am kinda stuck on the contains syntax in conjunction with graql inference rules.
I am trying to write a rule where if the identifier/name (of datatype string) of some entity (which has those resources) is part of the description (resource) of a detail entity the relation ship denoting the link between the detail and the entity is made. The premisses would be the following:

$detailsInferenceRule isa inference-rule
when
{
    $x has name $xi;
    $d isa detail;
    $d has description $dd;
    $dd val contains $xi;
}
then
{
    (detailed-element: $x, details: $d) isa detailing;
};

I have also tried this variation of the rule:

$detailsInferenceRule isa inference-rule
when
{
    $x has name $xi;
    $d isa detail;
    $d has description contains $dd;
}
then
{
    (detailed-element: $x, details: $d) isa detailing;
};

both variations end up with this error mismatched input '$xi' expecting STRING although name is defined as resource datatype string…
could it be that no variable and only constant sub strings (eg “daugther” like in the example file rules and the examples in the docs) are valid contains syntax?
Thank you very much in advance!

Stephanie


#2

Hi Stephanie,

You’ve got it exactly right: unfortunately only constant strings are allowed as the argument to contains. We intend to add support for variables as well in the future.

Felix


#3

Hi!
Thank you very much! I am looking forward to the feature :slight_smile:
Currently I am just inferring the most interesting relations with the constant string work-around, but as soon as the variable support is integrated I’ll gladly use it to infer even more data. I guess variable support for contains will aid batch-inference as well as for discovering more obscure connections quite well! :smiley:
Stephanie