在 OrientDB Studio 中显示节点标签 [英] Showing node labels in OrientDB Studio

查看:33
本文介绍了在 OrientDB Studio 中显示节点标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

但是当我运行 Susheel 的代码(为后代发布在下面)时,节点全部显示为由它们的 @rid 字段标记,如下图所示:

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

我可以通过单击 (1) 节点、(2) 眼睛"符号、(3) 来告诉 单个节点 将其名称"字段显示为标签设置符号,然后从下拉菜单中选择名称",但是当我有大量节点时这是不可能的.这似乎是您在定义Person"节点类时会做的事情,但我在 Susheel 的代码(在下面发布)中没有看到这一点,而且我无法联系到他.

对于我的应用程序,如果我无法可视化节点标签,那么可视化基本上是无用的,因此非常感谢任何帮助:)

以下是我从 Susheel 的 OrientDB 简介中获取的代码,用于生成上面的屏幕截图:

<前>-- 创建一个类 Person 并使用以下命令添加两个属性 lastName 和 firstName创建类 Person 扩展 V;创建属性 Person.lastName 字符串;创建属性 Person.firstName 字符串;-- 创建一个从 Person 扩展的类 Employee 并为其添加一些属性创建类 Employee 扩展 Person;创建属性 Employee.empno 整数;创建属性 Employee.sal 整数;-- 创建一个类 Department extends from V创建类部门扩展V;创建属性Department.deptno 整数;创建属性 Department.name 字符串;-- 如果您注意到我们在通过从 Person 扩展它来创建 Employee 类时使用了上面的继承.这是一个很酷的功能!!!现在我们有了表示顶点(一个文档)的类,让我们创建一个类来表示 Edge 以建立关系.创建类 WorksAt 扩展 E;-- 所以现在我们都准备好向我们上面创建的图形模型添加/创建数据.-- 让我们创建一些员工(顶点或文档)创建顶点员工集 empno=101,firstName='John',lastName='Jacob',sal=5000;创建顶点员工集 empno=102,firstName='Adam',lastName='Bill',sal=7000;创建顶点员工集 empno=103,firstName='David',lastName='Manon',sal=4000;-- 同样让我们创建一些部门创建顶点部门设置deptno=10,name='Accounts';创建顶点部门设置deptno=20,name='HR';创建顶点部门 set deptno=20,name='IT';-- 现在是建立关系的时候了.创建一些边从 #12:0 到 #13:1 创建 Edge WorksAt;从 #12:1 到 #13:0 创建 Edge WorksAt;从 #12:2 到 #13:2 创建 Edge WorksAt;-- 显示所有员工从员工中选择*;

解决方案

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

select * from _studio

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

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

I'm trying to make OrientDB Studio display a string as a label for each node, like in this screenshot from Susheel Kumar

But when I run Susheel's code (posted below for posterity), the nodes all appear labelled by their @rid fields instead, like this screenshot:

Question: Is there an automated way to display all these labels?

I can tell an individual node to display its "name" field as a label by clicking (1) the node, (2) the "eye" symbol, (3) the settings symbol, and selecting "name" from the dropdown menu, but this will be impossible to do when I have a large number of nodes. This seems like the sort of thing you'd do when defining the "Person" node class, but I see no indication of this this in Susheel's code (posted below), and I haven't been able to reach him.

And for my application, the visualization is essentially useless if I can't visualize node labels, so any help would be much appreciated :)

Below is the code I took from Susheel's Introduction to OrientDB to produce my screenshot above:


    -- 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;

解决方案

This is a preference setting that can be easily changed, for each class. You can display the current display settings by issuing the following query (in Browse tab) :

select * from _studio

If there are no records, simply follow the procedure you have described before (click on the node, click the "eye" symbol, than change the "display" property). When you are done, simply click "Save Configuration".

Now the previous query should display a JSON object of type GraphConfig that you can edit. There are a lot of parameters that you can change, such as nodes width, color, icon, radius and display which is the option you are looking for.

这篇关于在 OrientDB Studio 中显示节点标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆