我正在使用bulbs
并且rexster
正在尝试存储具有 unicode 属性的节点(参见下面的示例)。显然,在图中创建节点可以正常工作,因为我可以在 rexster(Rexster Dog House)附带的 Web 界面中看到节点,但检索相同的节点不起作用 - 我得到的只是None
.
当我创建并查找属性中具有非 unicode 特定字母的节点时,一切都按预期工作。例如,在以下示例中,一个节点name = u'University of Cambridge'
可以按预期检索。
雷克斯特版本:
[INFO] Application - Rexster version [2.4.0]
示例代码:
# -*- coding: utf-8 -*-
from bulbs.rexster import Graph
from bulbs.model import Node
from bulbs.property import String
from bulbs.config import DEBUG
import bulbs
class University(Node):
element_type = 'university'
name = String(nullable=False, indexed=True)
g = Graph()
g.add_proxy('university', University)
g.config.set_logger(DEBUG)
name = u'Université de Montréal'
g.university.create(name=name)
print g.university.index.lookup(name=name)
print bulbs.__version__
在命令行上给出以下输出:
POST url: http://localhost:8182/graphs/emptygraph/tp/gremlin
POST body: {"params": {"keys": null, "index_name": "university", "data": {"element_type": "university", "name": "Universit\u00e9 de Montr\u00e9al"}}, "script": "def createIndexedVertex = {\n vertex = g.addVertex()\n index = g.idx(index_name)\n for (entry in data.entrySet()) {\n if (entry.value == null) continue;\n vertex.setProperty(entry.key,entry.value)\n if (keys == null || keys.contains(entry.key))\n\tindex.put(entry.key,String.valueOf(entry.value),vertex)\n }\n return vertex\n }\n def transaction = { final Closure closure ->\n try {\n results = closure();\n g.commit();\n return results; \n } catch (e) {\n g.rollback();\n throw e;\n }\n }\n return transaction(createIndexedVertex);"}
GET url: http://localhost:8182/graphs/emptygraph/indices/university?value=Universit%C3%A9+de+Montr%C3%A9al&key=name
GET body: None
None
0.3