Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
186 views
in Technique[技术] by (71.8m points)

graql - How do I find Grakn 2.0 entities that lack an attribute of a specific type?

I am running Grakn 2.0.0-alpha in a docker container. I have a hypergraph representing a state machine, with state transitions between states.

Some of these transitions have an attribute of type some-attribute-type, and some do not. I can confirm this by querying for all transitions and checking them one by one. However, when I use negation in the following query, I get nothing. What am I doing wrong? I have tried the following query both via the Python client and via the console.

match {
$next (preceding $current_state, succeeding $next_state) isa next;
 { 
   not {
    $next has some-attribute-type $g0;
   };
 };
};

The grakn 2.0.0-alpha negation may have a bug or the semantics may have diverged from the prior major release. It appears that if you try to first match a variable against the type you want to negate, and then use that variable to check the non-existence, then you get too many matches (as expected)

The following query returns some results, but more than expected from the previous query.

match {
$next (preceding: $current_state, succeeding: $next_state) isa next;
  $e isa some-attribute-type;
   not {
   $next has $e;
  };
};

See the following bug report: https://github.com/graknlabs/grakn/issues/6034

question from:https://stackoverflow.com/questions/65833692/how-do-i-find-grakn-2-0-entities-that-lack-an-attribute-of-a-specific-type

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Can you provide a simple reproducible example, please?

Also, is that possible that you forgot to close the write transaction?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...