Could we use Chinese or other 'utf-8' characters as the variable names?

Problem to Solve

Use Chinese characters as the variable names, since it’s more readable in application and more mantenable in development.

Current Workaround

No good solusion yet. Like the Python supports any utf-8 as the variable names, I suggest that TypeDB should do this as well.

Proposed Solution

No idea. Probably, learn from Python.

Additional Information

I’m considering use LLM to query TypeDB, if TypeDB supports utf-8 variable names, then no translation between them.

It seems we can. But the read/write file of encoding of GUI seem not ‘utf-8’.

(Let’s move the discussion to this issue to avoid duplicate threads: Could we use Chinese or other 'utf-8' characters as the variable names? · Issue #6899 · vaticle/typedb · GitHub)

Using Chinese characters for variable names in TypeDB could enhance readability. Emulating Python’s UTF-8 support might aid compatibility.

Hello,
I just confirmed that TypeDB console, which shows that Chinese support is working in TypeDB labels and attribute values:

> transaction test-unicode data read
test-unicode::data::read> match $x isa entity; fetch $x: attribute;
                          
{
    "x": {
        "attribute": [ { "value": "test", "type": { "label": "name", "root": "attribute", "value_type": "string" } } ],
        "type": { "label": "人", "root": "entity" }
    }
}
{
    "x": {
        "attribute": [ { "value": "黄", "type": { "label": "name", "root": "attribute", "value_type": "string" } } ],
        "type": { "label": "人", "root": "entity" }
    }
}

However, I can also confirm that we don’t support variable names with utf-8:

test-unicode::data::read> match $人 isa entity; get;
                          
[TQL03] TypeQL Error: There is a syntax error at line 1:
match $人 isa entity; get;

We will look into relaxing this to allow unicode in variable names as well.

Yes, as you confirmed, the values support utf-8, but not the variables. Actually, if the variables can be utf-8, it will open a huge opportunity to use TypeDB as a knowledge engine for the east world, at least for Chinese/Asian people. If it’s not too hard to support the feature, please consider do it, I’m waiting for this for quite a long time. Hope I’m not alone, am I :smile:

Best part of TypeDB quering is that it’s human readable. But without utf-8 of variable, it’s painful to construct the schema and query it when doing local language projects, since those important concepts are not obvious at first glance.

I think we’ll get UTF8 variables into the next release !

1 Like

More than happy! Awesome~~

Try the 2.26.6-rc1 release that is out now :slight_smile:

Wow, I definitely will, thanks for all your hard and great work!!