定制 neoxygen/neogen 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

neoxygen/neogen

Composer 安装命令:

composer require neoxygen/neogen

包简介

Neo4j Graph generator for PHP5.4+

README 文档

README

Build Status

Graph Generator for Neo4j

The library ease the generation of test graphs. The faker library is also used to generate random property values.

You can define your graph model in YAML or in a slightly modified Cypher pattern.

This is in development

The library is in its early stage and is targetted to be used in developement environment.

This library is the heart of the popular Graphgen web application

Usage

Download the library :

git clone https://github.com/neoxygen/neogen

cd neogen

Define your graph model in 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

Run the generate command :

vendor/bin/neogen generate

or you may want to export the generation queries to a file, handy for importing it in the Neo4j Console :

./vendor/bin/neogen generate --export="myfile.cql"

See the results in your graph browser !

Quick configuration precisions:

  • When defining properties types (like company, firstName, ...), these types refers to the standard faker types.
  • count define the number of nodes you want
  • relationship mode : 1 for only one existing relationship per node, random for randomized number of relationships

Properties parameters

Sometimes you'll maybe want to define some parameters for your properties, for e.g. to have a realistic date of birth for Person nodes, you may want to be sure that the date will be between 50 years ago and 18 years ago if you set dob for people working for a company.

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"]}

Define your graph model in 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)

For a complete description, see the Graphgen documentation

Generating the graph from a cypher pattern :

./bin/neogen generate-cypher --source="pattern.cypher" --export="export.gen"

Or you may want to import the graph directly in an accessible neo4j database :

./bin/neogen generate-cypher --source="pattern.cypher" --export-db="localhost:7474"

Development

Contributions, feedbacks, requirements welcome. Shoot me by opening issues or PR or on twitter : @ikwattro

统计信息

  • 总下载量: 199
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 18
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 18
  • Watchers: 6
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-10-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固