neoxygen / neo4j-neogen Goto Github PK
View Code? Open in Web Editor NEWEasy generation of dummy Neo4j graphs with PHP
License: MIT License
Easy generation of dummy Neo4j graphs with PHP
License: MIT License
When I try to export queries to file, it works fine.
But when I try without export, it says:
$ bin/neogen generate
Locating fixtures file
[InvalidArgumentException]
Invalid Response Format
generate [--export="..."]
Is this correct?
Reported by @jexp
(p:Person *20)-[:WORKS_AT *n..1]->(s:Startup *10)-[:IN_MARKET *n..1]->(m:Market *10)
The regex is modified locally and tests are adapted to handle it.
Push will come in the day.
Reported by @rvanbruggen the following pattern was not handled correctly, this was an issue when defining multiple relationships with the same type name.
(p:Product *10)
(cc:ComponentCategory *20)-[:PART_OF *n..1]->(p)
(csc:ComponentSubCategory *20)-[:PART_OF *n..1]->(cc)
(c:Component *20)-[:PART_OF *n..1]->(csc)
This has been fixed by SHA 7feec6a
It is quite easy with the Cypher notation to define tree structure thanks to identifiers:
(user:User {email:email} *5)
(user)-[:filespace *1..1]->(fs:FileSpace *5)
(fs)-[:contains *1..n]->(file:File {name: randomNumber} *10)
(fs)-[:contains *1..n]->(folder:Folder {name: randomNumber} *5)
(folder)-[:contains *1..n]->(file2:File {name: randomNumber} *10)
However with Yaml definition it is something else. If we take an example of something that currently as expected:
connection:
scheme: http
host: localhost
port: 7474
nodes:
users:
label: User
count: 5
properties:
email: email
fileSpaces:
label: FileSpace
count: 5
files:
label: File
count: 10
relationships:
fileSpaceRels:
start: User
end: FileSpace
type: FILESPACE
mode: 1..1
fileSpaceContainsFiles:
start: FileSpace
end: File
type: CONTAINS
mode: 1..n
We see that relationships start and end nodes are described based on the label rather than on the identifier like for the Cypher Query. Adding folders in the later example should be quite easy. However, introducing files inside folder is another story as the relationship description will match files at the root and files that should be in folders at the same time.
It is somehow possible to have a tree-like structure by cheating using new intermediate labels for nested files. But it's really messy has we cannot make clean Cypher on that tree afterward:
connection:
scheme: http
host: localhost
port: 7474
nodes:
users:
label: User
count: 5
properties:
email: email
fileSpaces:
label: FileSpace
count: 5
files:
label: File
count: 10
folders:
label: Folder
count: 5
firstLvlFiles:
label: FirstLvlFile
count: 15
relationships:
fileSpaceRels:
start: User
end: FileSpace
type: FILESPACE
mode: 1..1
fileSpaceContainsFiles:
start: FileSpace
end: File
type: CONTAINS
mode: 1..n
fileSpaceContainsFolders:
start: FileSpace
end: Folder
type: CONTAINS
mode: 1..n
foldersContainsFirstLvlFiles:
start: Folder
end: FirstLvlFile
type: CONTAINS
mode: 1..n
Some feature plans for next versions :
A new property percentage
can be added to the relationship yaml definition, with a default of 100.
// for constraints
(person:Person {firstname!: firstName})
// for indexes
(person:Person {firstname?: firstName})
Copied from here to the upstream.
Works:
(thing:Thing { number: {randomElement:['Hello']} } *10)
Doesn't work:
(thing:Thing { number: {randomElement:['Hello.']} } *10)
// The part "(thing:Thing { number: {randomElement:['Hello.']} } *10)" could not be parsed, check it for type errors.
Works:
(thing:Thing { number: {randomElement:[1]} } *10)
Doesn't work:
(thing:Thing { number: {randomElement:[1.1]} } *10)
// The part "(thing:Thing { number: {randomElement:[1.1]} } *10)" could not be parsed, check it for type errors.
Works:
(thing:Thing { number: {randomElement:['1']} } *10)
Doesn't work:
(thing:Thing { number: {randomElement:['1.1']} } *10)
// The part "(thing:Thing { number: {randomElement:['1.1']} } *10)" could not be parsed, check it for type errors.
Using example neogen.yml from README:
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
It generates a runtime exception that "node has no label", but they actually does:
$ ./bin/neogen generate --export="export.gen"
[RuntimeException]
The node has no label
generate [--export[="..."]]
I figured out that problem could be that nodes could have multiple labels
so I tried to use labels
instead of label
, and it is probably running successfully then:
$ ./bin/neogen generate
0.023596048355103
But the problem is no matter I am specifying --export="export.cql"
or using connection
setting from yml file - it doesn't output anything anywhere except this times.
Using an example from README, I got a fatal error:
$ ./bin/neogen generate-cypher --source="pattern.cypher" --export="export.gen"
Locating fixtures file
PHP Fatal error: Call to undefined method Neoxygen\Neogen\Neogen::generateGraphFromCypher() in /app/src/Console/GenerateCypherCommand.php on line 99
Fatal error: Call to undefined method Neoxygen\Neogen\Neogen::generateGraphFromCypher() in /app/src/Console/GenerateCypherCommand.php on line 99
It looks like generateGraphFromCypher
function really do not exist:
$ find . -name "*.php" | xargs egrep 'generateGraphFromCypher'
./src/Console/GenerateCypherCommand.php: $graph = $gen->generateGraphFromCypher($this->source);
./tests_old/Neoxygen/Neogen/Tests/Integration/IntegrationTest.php: $schema = $gen->generateGraphFromCypher($pattern);
./tests_old/Neoxygen/Neogen/Tests/Integration/StandardCypherConverterTest.php: $graph = $gen->generateGraphFromCypher($p);
./tests_old/Neoxygen/Neogen/Tests/Integration/CypherStatementsConverterTest.php: $graph = $gen->generateGraphFromCypher($p);
./tests_old/Neoxygen/Neogen/Tests/Integration/GraphJsonTest.php: $graph = $gen->generateGraphFromCypher($p);
./tests_old/Neoxygen/Neogen/Tests/Integration/GraphJsonTest.php: $graph = $gen->generateGraphFromCypher($p);
./tests_old/Neoxygen/Neogen/Tests/Integration/GraphJsonTest.php: $graph = $gen->generateGraphFromCypher($p);
./tests_old/Neoxygen/Neogen/Tests/ProcessorTest.php: $schema = $gen->generateGraphFromCypher($p);
Hey there,
I would like to give your tool a try but I guess I am not doing it right.
How to I specify the yml input file? Does it expect a neogen.yml
file in the current working directory?
Cheers
Reported by @jexp
The following returns error because there is no space ๐
(p:Person {name: lastName}*35)
It would be grate to support Neo4j basic auth for security reasons.
I cannot run neogen with default config neogen.yml on my macbook pro OSX 10.10
php --version
PHP 5.5.20 (cli) (built: Feb 25 2015 23:30:53)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
I've set memory_limit in /etc/php.ini to be 2048M
localhost:~/neogen generate
Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 72 bytes) in /neogen/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php on line 279
Thanks so much for sharing this Christophe.
I cloned the repository and tried running neogen with the sample yml, but the command just hangs on the console. wonder what I am missing. any suggestions?
Thanks again
Hari
The following will output the desired star graph
(root:Root *1)-[:LINK *1..n]->(l:Link *5)
Btw doing this should ouptut the same, but currently it is not the case
(root:Root *1)<-[:LINK *1..n]-(l:Link *5)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.