Discussion Forum

How do we use rules to automatically define relations between instances of different types which have distinct attributes with identical literal values?

How do we use rules to automatically define relations between instances of different types which have distinct attributes with identical literal values?

We have some rules that are supposed to instantiate relations, like so:

    rule lemma-synset-rel:
    when
    {
        $1 isa lemma, has lemma-synset $lemma-synset;
        $2 isa synset, has name = $lemma-synset;
    }
    then
    {
        (lemma: $1, synset: $2) isa lemma-synset-rel;
    };

As far as we can tell this follows the one example of such a rule that exists in your documentation (there is no mention there that I can see of “=”, that’s something we eventually tried after bashing away at this for a day).

Anyway, such rules load and we have found a single query which seems to return something:

    match
                $l isa lemma, has name "dog";
                $s isa synset;
                (lemma: $l, synset: $s) isa lemma-synset-rel;
                get $s;


{ $s iid 0x966e800a8000000000007efe isa synset; }
{ $s iid 0x966e800a8000000000008e41 isa synset; }
{ $s iid 0x966e800a800000000000a89e isa synset; }
{ $s iid 0x966e800a800000000000f728 isa synset; }
{ $s iid 0x966e800a8000000000012588 isa synset; }
{ $s iid 0x966e800a80000000000127a1 isa synset; }
{ $s iid 0x966e800a8000000000012b17 isa synset; }
{ $s iid 0x966e800a800000000001bd2d isa synset; }
answers: 8, duration: 4545 ms

However, every other query we try hangs the server. I have to force it to quit to get it to close. Every other query we have tried (many) hangs the server.

So, can anyone explain what is going on here? What do we need to do to define these rules and how do we write queries that don’t hang the server?

Thanks,
Alan

The syntax you’re looking for would be:

    rule lemma-synset-rel:
    when
    {
        $1 isa lemma, has lemma-synset $lemma-synset;
        $2 isa synset, has name $n; $n = $lemma-synset;
    }
    then
    {
        (lemma: $1, synset: $2) isa lemma-synset-rel;
    };

Regarding the hanging, could of questions:

  • presumably reasoning is enabled?
  • how much data do you have?
  • what version are you on?