How to include in the query, from what super-type the attribute came from?

Hi,

During schema introspection I need to know from what super-type (if any) every field came from.

E.g.

define
  name sub attribute, value string;
  description sub attribute, value string;

  supertype sub entity, owns name;
  subtype sub supertype, owns description;

When I do match $x sub entity; $x owns $attr; the result doesn’t seem to have the information from what super-type name or description came from. Is there a native way to find it?

To clarify, you are trying to find the supertype of the name and description attribute types?
You can do

match $type sub entity, owns $attr-type; $attr-type sub $attr-super-type;

Not really that. I want to find that:

  • subtype has two attributes, name and description
  • attribute name has come from the supertype
  • attribute description is its own attribute

We should extend the language with owns! which would help resolve this pretty quickly!
However in the meantime:

match $x sub entity, owns $attr-type; $x sub $super-owner; $super-owner owns $attr-type; not { $super-owner sub! $super-super-owner; $super-super-owner owns $attr-type;};

In other words, find the ownership, then find a supertype that also has the ownership, such that it doesn’t have a supertype that also owns the attribute-type.

1 Like