neoxygen / neogen
Neo4j 图生成器,支持 PHP5.4+
1.0.8
2015-04-28 07:40 UTC
Requires
- php: >=5.4
- doctrine/collections: ~1.2
- fzaninotto/faker: ~1.4
- ikwattro/faker-extra: ~0.3
- jms/serializer: ~0.16
- neoxygen/neoclient: ~2.1
- symfony/console: ~2.5
- symfony/dependency-injection: ~2.5
- symfony/finder: ~2.5
- symfony/yaml: ~2.5
Requires (Dev)
- phpspec/phpspec: ~2.0
- phpunit/phpunit: 4.*
- dev-master / 1.0.x-dev
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.5.13
- 0.5.12
- 0.5.11
- 0.5.10
- 0.5.9
- 0.5.8
- 0.5.7
- 0.5.6
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.0
- dev-localized-faker
- dev-test
- dev-refactoring
- dev-gs
- dev-cypher-import
- dev-rik
- dev-distribution
- dev-fix-frank
- dev-development
- dev-feature_cypher_cmd
- dev-extract-cypher
- dev-nostar
- dev-proof
This package is not auto-updated.
Last update: 2024-09-14 17:03:47 UTC
README
Neo4j 图生成器
该库简化了测试图的生成。还使用了faker库来生成随机的属性值。
您可以使用 YAML 或稍作修改的 Cypher 模式定义您的图模型。
此库处于开发中
该库处于早期阶段,旨在用于开发环境。
该库是流行的Graphgen 网络应用程序的核心
用法
下载库
git clone https://github.com/neoxygen/neogen
cd neogen
在 YAML 中定义您的图模型
connection: scheme: http host: localhost port: 7474 nodes: persons: label: Person count: 50 properties: firstname: firstName lastname: lastName companies: label: Company count: 10 properties: name: company description: catchPhrase relationships: person_works_for: start: persons end: companies type: WORKS_AT mode: n..1 friendships: start: persons end: persons type: KNOWS mode: n..n
运行生成命令
vendor/bin/neogen generate
或者您可能想要将生成查询导出到文件中,便于在 Neo4j 控制台中导入
./vendor/bin/neogen generate --export="myfile.cql"
在图浏览器中查看结果!
快速配置细节
- 当定义属性类型(如公司、firstName 等)时,这些类型指的是标准faker类型。
- count 定义您想要的节点数量
- 关系模式:1 表示每个节点只有一个现有关系,random 表示随机数量的关系
属性参数
有时您可能想要为属性定义一些参数,例如,为了为 Person
节点提供一个现实生活中的出生日期,您可能想确保日期在 50 年前和 18 年前之间,如果您为在一家公司工作的人设置了 dob。
nodes: persons: label: Person count: 10 properties: firstname: firstName date_of_birth: { type: "dateTimeBetween", params: ["-50 years", "-18 years"]} relationships: person_works_for: start: persons end: companies type: WORKS_AT mode: random properties: since: { type: "dateTimeBetween", params: ["-10 years", "now"]}
在 Cypher 中定义您的图模型
//eg:
(person:Person {firstname:firstName, lastname:lastName} *30)-[:KNOWS *n..n]->(person)
(person)-[:WORKS_AT *n..1]->(company:Company {name:company, slogan:catchPhrase} *5)
对于完整描述,请参阅Graphgen 文档
从 Cypher 模式生成图
./bin/neogen generate-cypher --source="pattern.cypher" --export="export.gen"
或者您可能希望直接将图导入可访问的 Neo4j 数据库
./bin/neogen generate-cypher --source="pattern.cypher" --export-db="localhost:7474"
开发
欢迎贡献、反馈和要求。请通过打开问题或 PR 或在推特上联系我:@ikwattro