在OrientDB Studio

时间:2015-10-13 20:30:50

标签: orientdb

我试图让OrientDB Studio显示一个字符串作为每个节点的标签,如Susheel Kumar的截图

但是当我运行Susheel的代码(下面发布的后代代码)时,所有节点都显示为其@rid字段标记,如下截图所示:

问题:是否有自动显示所有这些标签的方式?

我可以告诉个别节点显示其名称"名称"通过单击(1)节点,(2)" eye"符号,(3)设置符号,并选择" name"从下拉菜单中,但当我有大量节点时,这是不可能的。这似乎是你在定义" Person"时所做的事情。节点类,但我在Susheel的代码(下面发布)中没有看到这个,并且我还没有能够联系到他。

对于我的应用程序,如果我无法显示节点标签,那么可视化基本上是无用的,所以任何帮助都会非常感激:)

以下是我从Susheel的OrientDB简介中获取的代码,用于制作我的截图:


    -- Create a class Person and add two properties lastName & firstName using below commands
    create class Person extends V;
    create property Person.lastName string;
    create property Person.firstName string;

    -- Create a class Employee which extends from Person & add few properties to it
    create class Employee extends Person;
    create property Employee.empno integer;
    create property Employee.sal integer;

    -- Create a class Department extends from V
    create class Department extends V;
    create property Department.deptno integer;
    create property Department.name string;

    -- If you noticed we used Inheritance above when creating Employee class by extending it from Person. That's a cool feature!!! Now we have classes to represent vertex (a document) & let's create a class to represent Edge to establish the relationship.

    create class WorksAt extends E;

    -- So now we are all set to add/create data to graph model we create above.

    -- Let's create some employees (vertex or document)
    create vertex Employee set empno=101,firstName='John',lastName='Jacob',sal=5000;
    create vertex Employee set empno=102,firstName='Adam',lastName='Bill',sal=7000;
    create vertex Employee set empno=103,firstName='David',lastName='Manon',sal=4000;

    -- Similarly lets create some departments 
    create vertex Department set deptno=10,name='Accounts';
    create vertex Department set deptno=20,name='HR';
    create vertex Department set deptno=20,name='IT';

    -- Now time to establish relationship. Create some Edges
    create Edge WorksAt from #12:0 to #13:1;
    create Edge WorksAt from #12:1 to #13:0;
    create Edge WorksAt from #12:2 to #13:2;

    -- Show all employees
    select * from Employee;

2 个答案:

答案 0 :(得分:2)

这是一个可以轻松更改的首选项设置,适用于每个班级。您可以通过发出以下查询来显示当前显示设置(在“浏览”选项卡中):

select * from _studio

如果没有记录,只需按照之前描述的步骤进行操作(单击节点,单击"眼睛"符号,然后更改"显示"属性)。完成后,只需单击"保存配置"。

现在,上一个查询应该显示一个可以编辑的GraphConfig类型的JSON对象。您可以更改许多参数,例如节点宽度,颜色,图标,半径和显示,这是您要查找的选项。

答案 1 :(得分:0)

您可以通过运行@cheseaux贡献的查询来验证配置是否已保存(从_studio中选择*) 此外,请确保在顶点视图(更改标签时)以及OrientDB studio的主图形视图中单击保存配置。

例如,当我在更改标签(“display”:“hash”)后在我的数据库上运行它时,这就是我得到的:

{"width":1770,"height":500,"classes":{"psswd":{"fill":"#d62728","stroke":"#951b1c","icon":null,"display":"hash"}},"node":{"r":30},"linkDistance":140,"charge":-1000,"friction":0.9,"gravity":0.1}