Skip to content

@doc and @meta annotations#412

Draft
dmitrii-ubskii wants to merge 1 commit intotypedb:masterfrom
dmitrii-ubskii:doc-annos
Draft

@doc and @meta annotations#412
dmitrii-ubskii wants to merge 1 commit intotypedb:masterfrom
dmitrii-ubskii:doc-annos

Conversation

@dmitrii-ubskii
Copy link
Copy Markdown
Member

Usage and product changes

Implementation

When get answers of typeql read query
"""
match
let $metadata = function_get_doc("get_random_number");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mistake

Then connection open read transaction for database: typedb
When get answers of typeql read query
"""
match let $metadata = get_constraint_metadata("key", "person", "<constraint>", "<rhs>");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be get_xxx_meta to match the annotation

Then connection open read transaction for database: typedb
When get answers of typeql read query
"""
match let $metadata = get_metadata("key", "person");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I think the first arg should be the type, then the key? any specific reason it's this way around?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like the key is the closest conceptually to the function name. @meta("key", ...) -> get_meta("key", ...). That is, we're retrieving the meta("key" in a way.

Then connection open read transaction for database: typedb
When get answers of typeql read query
"""
match let $doc = get_doc("person");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually think that it's powerful to make this a type, not a string input, and also to allow a type variable to be passed in. Then users can do this:

match
  $t sub legal-entity;
fetch {
  "label": label($t),
  "doc": get_doc($t),
};

When get answers of typeql read query
"""
match
let $doc = get_function_doc("get_random_number");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe get_fun_doc? to match keywords

Then connection open read transaction for database: typedb
When get answers of typeql read query
"""
match let $doc = get_constraint_doc("person", "<constraint>", "<rhs>");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thin it'll be much easier for people if we just have more functions:

  • get_owns_doc
  • get_plays_doc
  • get_relates_doc

also shorter, and easier to use IMO:

match let $doc = get_owns_doc(person, name);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants