Giter VIP home page Giter VIP logo

neo4j-neogen's People

Contributors

ikwattro avatar leward avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

neo4j-neogen's Issues

only works with --export

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?

Multiple relations with same type are not handled correctly

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

Yaml definition does not allow proper tree structure definition

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

Features for next versions

Some feature plans for next versions :

  • possibility to assign the percentage of relationships when having a x..n cardinality :

A new property percentage can be added to the relationship yaml definition, with a default of 100.

  • Seed
  • 5 default values always returned for all types, the implementation should be planned
  • possibility to define property constraints and indexes
// for constraints
(person:Person {firstname!: firstName})

// for indexes
(person:Person {firstname?: firstName})

Parse error if a randomElement has a full stop in it

Copied from here to the upstream.

String

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.

Number

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.

Number in string

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.

[RuntimeException] The node has no label

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.

undefined method Neoxygen\Neogen\Neogen::generateGraphFromCypher()

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);

neogen generate

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

Out of memory error

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

unable to run neogen

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

allowing inversed patterns

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.