我想对 Neo4J (2.0.1) 中现有的关系属性建立索引,并为将来出现的关系属性设置自动索引。
我发现可以通过旧的自动索引以及一些 Java 代码的示例在 Neo4J 文档中做到这一点。
然而,由于我既不是 Java 专家,也不想使用“遗留”功能,我想问您是否有一种简单的方法可以使用 Cypher 命令或任何其他方式(rest API? )这不需要我编写一些 Java 程序并运行它(我不知道该怎么做)。
感谢您的帮助!
我的应用程序的细节要求节点可以链接到自己.可以在Neo4J中完成吗?可以使用CREATE语句在节点和自身之间创建新边缘吗?我可以使用MATCH查询获取它吗?
我使用brypt-nodejs生成哈希,但有时它会在生成的字符串中添加斜杠,如下所示,当我尝试通过 URL 发送它时,这给我带来了困难。
$12$G/KJOwTBLjGwcnAGaTlJMnAnkXa6/M1jt8FppD
Run Code Online (Sandbox Code Playgroud)
bcrypt 中是否有一个设置可以生成不带斜杠的哈希值,或者我应该手动删除它们或替换为一些不太可能的模式(例如slashslash)以便能够恢复其出现,它应该出现吗?
$12$GslashslashKJOwTBLjGwcnAGaTlJMnAnkXa6slashslashM1jt8FppD
Run Code Online (Sandbox Code Playgroud)
感谢您让我知道您的想法!
我有一个 node.js 应用程序,它有一个包含敏感数据的配置文件。我想通过 AWS ECS(集群)将其作为 Docker 容器启动。
存储敏感配置数据的最佳方式是什么?
我目前正在通过 Docker 容器的任务定义中的环境变量发送它们,但必须有更好的方法来做到这一点。
对于这样的事情,最佳实践是什么?我应该使用 Docker 密钥还是 Amazon 密钥管理器?
我知道这是一个非常普遍的问题,但我找不到答案,所以也许有人有建议?
containers environment-variables amazon-web-services amazon-ecs docker
假设我有一个 MongoDB,其中有单独texts的statements.
我需要能够搜索texts,其中包含某些关键字statements(还有出现搜索词的多个文本)。
我还需要能够找到statements特定用户添加的所有文本中的所有内容,其中包含特定的搜索短语。
我的问题:我是否需要创建一个单独的集合,statements或者我可以简单地将它们添加为嵌套到texts集合中吗?
因此,选项 1(单独的集合):
文字集
text: {
name: 'nabokov',
id: '1'
}
Run Code Online (Sandbox Code Playgroud)
报表集合:
statement: {
text_id: '1',
id: '24',
text: 'He opened the window and saw the sky`
}
Run Code Online (Sandbox Code Playgroud)
选项 2(嵌套):
text: {
name: 'nabokov',
id: '1'
statements: [
id: '24',
text: 'He opened the window and saw the sky`
]
}
Run Code Online (Sandbox Code Playgroud)
如果我想根据关键字搜索单独检索语句并保留上下文数据(例如它们属于哪个文本等),哪种 MongoDB 存储模式更好
这将如何影响较大数据库(例如 > 100 Gb)的写入/读取速度。
我的文本大小限制为 16 Mb。
我刚刚将Neo4J从1.9.4升级到2.0.1最新的稳定版本.
升级说明说您可以使用提供的旧数据库启动新的Neo4J
allow_store_upgrade=true
Run Code Online (Sandbox Code Playgroud)
这正是我所做的.
但是,当我将旧的graph.db文件夹(包含所有数据)复制到新安装的数据文件夹中并尝试首次运行neo4j时,它无法正常工作.我在neo4j启动时在终端中收到的错误消息是
Using additional JVM arguments: -server -XX:+DisableExplicitGC -
Dorg.neo4j.server.properties=conf/neo4j-server.properties -
Djava.util.logging.config.file=conf/logging.properties -
Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -
XX:+CMSClassUnloadingEnabled
Starting Neo4j Server...WARNING: not changing user
process [462]... waiting for server to be ready... Failed to start within 120 seconds.
Neo4j Server may have failed to start, please check the logs.
Run Code Online (Sandbox Code Playgroud)
当我从新安装中删除graph.db文件夹并再次运行neo4j start时,一切都很顺利,但当然还有一个新的干净数据库.
我在Mac OS X 10.9上运行它,安装了最新的Java 1.7.0_51-b13 SDK.
有谁知道我做错了什么?谢谢!
我真的不明白Cypher中其他类型输出的集合有什么不同.有人可以向我解释一下吗?
例如查询
match (c:Context) where c.name="health" or c.name="opinion" return collect(c);
Run Code Online (Sandbox Code Playgroud)
在查询时返回1行
match (c:Context) where c.name="health" or c.name="opinion" return c;
Run Code Online (Sandbox Code Playgroud)
返回6行(我的数据库中有6个符合条件的节点).
这似乎是唯一的区别.
那么,这只是数据的表示方式吗?或者使用集合有某种优势?
谢谢您的帮助!
有人可以推荐Node.Js模块或Javascript库(不基于可读性),可用于从网页和RSS源中提取内容吗?
我找到了一个可以完成这项工作的好的PHP库 - http://fivefilters.org/content-only/ - 但是寻找一个可以做同样事情的Node.Js模块.
谢谢!
您好,我正在尝试让pdfreader模块在 node.js 中工作以将 PDF 转换为文本格式。
当我简单地使用命令行node sandbox/pdf.js(如下面的内容)运行它时,它工作得很好。
var pdfreader = require('pdfreader');
var rows = {}; // indexed by y-position
function printRows() {
Object.keys(rows) // => array of y-positions (type: float)
.sort((y1, y2) => parseFloat(y1) - parseFloat(y2)) // sort float positions
.forEach((y) => console.log((rows[y] || []).join('')));
}
new pdfreader.PdfReader().parseFileItems('lib/sandbox/book-eric.pdf', function(err, item){
if (!item || item.page) {
// end of file, or page
printRows();
console.log('PAGE:', item.page);
rows = {}; // clear rows for next page
}
else …Run Code Online (Sandbox Code Playgroud) 我有以下params一组:
:params "userId":"15229100-b20e-11e3-80d3-6150cb20a1b9",
"contextNames":[{"uid":"94e71bf0-1e7d-11e9-8f33-4f0c99ea0da1","name":"zhora"}],
"statements":[{"text":"oranges apples bananas","concepts":["orange","apple","banana"],
"mentions":[],"timestamp":15481867295710000,"name":"# banana","uid":"34232870-1e7f-11e9-8609-a7f6b478c007",
"uniqueconcepts":[{"name":"orange","suid":"34232870-1e7f-11e9-8609-a7f6b478c007","timestamp":15481867295710000},{"name":"apple","suid":"34232870-1e7f-11e9-8609-a7f6b478c007","timestamp":15481867295710000},{"name":"banana","suid":"34232870-1e7f-11e9-8609-a7f6b478c007","timestamp":15481867295710000}],"uniquementions":[]}],"timestamp":15481867295710000,"conceptsRelations":[{"from":"orange","to":"apple","context":"94e71bf0-1e7d-11e9-8f33-4f0c99ea0da1","statement":"34232870-1e7f-11e9-8609-a7f6b478c007","user":"15229100-b20e-11e3-80d3-6150cb20a1b9","timestamp":15481867295710000,"uid":"apoc.create.uuid()","gapscan":"2","weight":3},{"from":"apple","to":"banana","context":"94e71bf0-1e7d-11e9-8f33-4f0c99ea0da1","statement":"34232870-1e7f-11e9-8609-a7f6b478c007","user":"15229100-b20e-11e3-80d3-6150cb20a1b9","timestamp":15481867295710002,"uid":"apoc.create.uuid()","gapscan":"2","weight":3},{"from":"orange","to":"banana","context":"94e71bf0-1e7d-11e9-8f33-4f0c99ea0da1","statement":"34232870-1e7f-11e9-8609-a7f6b478c007","user":"15229100-b20e-11e3-80d3-6150cb20a1b9","timestamp":15481867295710002,"uid":"apoc.create.uuid()","gapscan":4,"weight":2}],"mentionsRelations":[]
Run Code Online (Sandbox Code Playgroud)
然后当我进行以下查询时:
MATCH (u:User {uid: $userId})
UNWIND $contextNames as contextName
MERGE (context:Context {name:contextName.name,by:u.uid,uid:contextName.uid})
ON CREATE SET context.timestamp=$timestamp
MERGE (context)-[:BY{timestamp:$timestamp}]->(u)
WITH u, context
UNWIND $statements as statement
CREATE (s:Statement {name:statement.name, text:statement.text, uid:statement.uid, timestamp:statement.timestamp})
CREATE (s)-[:BY {context:context.uid,timestamp:s.timestamp}]->(u)
CREATE (s)-[:IN {user:u.id,timestamp:s.timestamp}]->(context)
WITH u, s, context, statement
FOREACH (conceptName in statement.uniqueconcepts |
MERGE (c:Concept {name:conceptName}) ON CREATE SET c.uid=apoc.create.uuid()
CREATE (c)-[:BY {context:context.uid,timestamp:s.timestamp,statement:s.suid}]->(u)
CREATE (c)-[:OF {context:context.uid,user:u.uid,timestamp:s.timestamp}]->(s)
CREATE (c)-[:AT {user:u.uid,timestamp:s.timestamp,context:context.uid,statement:s.uid}]->(context) )
WITH u, s
UNWIND …Run Code Online (Sandbox Code Playgroud) neo4j ×5
cypher ×3
node.js ×3
amazon-ecs ×1
bcrypt ×1
containers ×1
docker ×1
ejs ×1
encryption ×1
eval ×1
express ×1
indexing ×1
javascript ×1
mongodb ×1
rss-reader ×1
text ×1