Neo4j 2.0.1 graphstyle.grass用于多个标签 [英] Neo4j 2.0.1 graphstyle.grass for multiple labels

查看:157
本文介绍了Neo4j 2.0.1 graphstyle.grass用于多个标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难为具有多个标签的节点设置属性.

I'm having a hard time setting properties for nodes with multiple labels.

我的graphstyle.grass文件如下:

My graphstyle.grass file looks like this:

node {
  diameter: 40px;
  color: #aaaaaa;
  border-color: #888888;
  border-width: 1.5px;
  text-color-internal: #000000;
  caption: '{name}';
  font-size: 12px;
}

node.foo {
  color: #aaaaff;
}

node.bar {
  color: #aaffaa;
}

node.bar.a {
  border-color: #ff0000;
}

node.bar.b {
  border-color: #0000ff;
}

因此,这里的意图是,如果您具有"bar"标签,则该节点将以某种方式着色;如果您还具有一个附加标签"a"或"b",则边框将被正确着色.我的CSS知识很薄弱,但是我认为传统上这是完成多个类选择器的方式.

So the intention here is that if you have a label of 'bar' the node is colored a certain way, if you also have an additional label of 'a' or 'b' your border is colored appropriately. My CSS knowledge is weak but I think this is traditionally how multiple class selectors are done.

我在Neo 2.0.1浏览器图形显示中看到的行为是,如果节点具有多个标签,它将选择第一个标签,并尝试在草文件中查找node.first_label选择器(如果没有).找不到它只是为其添加了一个新的选择器.有两个具体的例子:

The behavior I'm seeing in the Neo 2.0.1 browser graph display is that if a node has multiple labels, it picks the first label, tries to find a node.first_label selector in the grass file, if it doesn't find it it just adds a new selector for it. So two concrete examples:

  1. 如果有一个标签为['bar','a'](按此顺序)的节点,则Neo4j将在上面找到并使用node.bar选择器,而不对第二类做任何操作.即,"node" .bar.a'属性将不会应用.
  2. 如果节点的标签为['a','bar'](按此顺序),则Neo4j将查找形式为"node.a"的选择器,而不调用上面的任何选择器,而是创建一个带有一组默认参数的新选择器.

任何指导或建议都将不胜感激.

Any guidance or suggestions are greatly appreciated.

推荐答案

这是一种非常明智的方法,这是正确的.从Neo4j 2.0.1开始,图形样式表还不够聪明,无法处理链接的类选择器.选择的顺序(如您所观察到的)也被打乱了.

That's a perfectly sensible approach, which would be correct. As of Neo4j 2.0.1, the graph stylesheets aren't yet clever enough to handle chained class selectors. The order of selection is (as you've observed) also broken.

更新: 从2.2版本开始,只要您通过以下方式编辑草定义,支持多个类选择器.手.

update: As of 2.2, multiple class selectors are supported, as long as you edit the grass definition by hand.

这篇关于Neo4j 2.0.1 graphstyle.grass用于多个标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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