Schema with rules error

I have following schema with:

define
token sub entity;
TEXT sub attribute, value string;
token sub entity, owns TEXT;
POS sub attribute, value string;
token sub entity, owns POS ;
DEP sub attribute, value string;
token sub entity, owns DEP ;
NomBank sub attribute, value string;
token sub entity, owns NomBank ;
ent_type sub attribute, value string;
token sub entity, owns ent_type;

define
semantic-class sub relation,
relates ADJ,
relates ADV,
relates INTJ,
relates NOUN,
relates PROPN,
relates VERB,
relates ADP,
relates AUX,
relates CCONJ,
relates DET,
relates NUM;

define
semantic-role sub relation,
relates det,
relates advmod,
relates amod,
relates nsubj,
relates nsubjpass,
relates csubj;

I would like to add a rule:
define
rule universionSemanticTags1ADJ:
when {
$a isa token, has POS “ADJ”;
}
then
{
(ADJ:$a) isa semantic-class;
};

But when I add this rule, I get following error:
[RUW07] Invalid Rule Write: The rule ‘universionSemanticTags1ADJ’ has a then clause ‘{ $_0 (ADJ:$a); $_0 isa semantic-class; }’ that can never be satisfied in the current schema.

From my point of view, this should work. So maybe someone can help me to better understand what I doing wrong.

You’re only missing one piece, which is to specify that token can play ADJ in semantic-class.

token sub entity, owns TEXT, plays semantic-class:ADJ;

You’ll need to re-order your schema file to define this after you’ve defined semantic-class, otherwise your token entity definition won’t know what semantic-class is.

1 Like

sure - thanks!

Another question came up:

I have following schema

define
token sub entity;
TEXT sub attribute, value string;
token sub entity, owns TEXT;
POS sub attribute, value string;
token sub entity, owns POS ;
DEP sub attribute, value string;
token sub entity, owns DEP ;
NomBank sub attribute, value string;
token sub entity, owns NomBank ;
ent_type sub attribute, value string;
token sub entity, owns ent_type;

define
semantic-class sub relation,
relates ADJ,
relates ADV,
relates INTJ,
relates NOUN,
relates PROPN,
relates VERB,
relates ADP,
relates AUX,
relates CCONJ,
relates DET,
relates NUM;

define
semantic-role sub relation,
relates det,
relates advmod,
relates amod,
relates nsubj,
relates nsubjpass,
relates csubj;

define
token sub entity, plays semantic-class:ADJ,
plays semantic-class:ADV,
plays semantic-class:INTJ,
plays semantic-class:NOUN,
plays semantic-class:PROPN,
plays semantic-class:VERB,
plays semantic-class:ADP,
plays semantic-class:AUX,
plays semantic-class:CCONJ,
plays semantic-class:DET,
plays semantic-class:NUM;
token sub entity, plays semantic-role:det,
plays semantic-role:advmod,
plays semantic-role:amod,
plays semantic-role:nsubj,
plays semantic-role:nsubjpass,
plays semantic-role:csubj;

And add following rule

define
rule universionSemanticTags1NOUN:
when {
$a isa token, has POS “NOUN”;
}
then
{
(NOUN: $a) isa semantic-class;
};

Than I add data:

Insert
$a isa token, has TEXT “coordination”, has POS “NOUN”, has DEP “compound”, has NomBank “nominalization”;

I can do this without error.

The idea is to add a relation with this rule. But when I try to proofe if it works

match
$x (NOUN:$a) isa semantic-class;
get $a;

I get not data. “Match query did not match any concepts in the database”

What I am doing wrong?

Do you definitely have inference on? I’ve followed your instructions and am getting data in response. See attached.

Thanks!
I havn’t turned on the “infer”. I was not aware about this! Thank your very much!

1 Like