Graph Database Prototyping made easy with Graphgen
-
Upload
christophe-willemsen -
Category
Technology
-
view
997 -
download
3
Transcript of Graph Database Prototyping made easy with Graphgen
GRAPHGENGraphDB Prototyping made easy
#FOSDEM31-01-2015
graphgen.neoxygen.io
#whoami
Christophe WillemsenSoftware Engineer
Neo4j Consultant
World’s #1Neo4j consultancy
@graph_awaregraphaware.com
@ikwattro
WHY GRAPHGEN ?QUICK OVERVIEW ABOUT THE NEO4J NATIVE TOOLS
TO BUILD A GRAPH
BY HANDCREATE (n:Person {firstname: ‘Roger’, lastname:’Laguadec’})
100XFor 100 nodes and you need to be really inventive
for the node properties
A LOOPFOREACH ( i in range(0,99) | CREATE (n:Person
{id:i} ) )Not non-developer friendly and no properties except the id
LOAD CSVUSING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM FILE‘file:///Users/me/docs/import.csv’ AS line
MERGE (n:Person {firstname: line.firstname} )
You need initial data !
GRAPH MODEL DECISIONS
GRAPH MODEL DECISIONS
WITH GRAPHGEN THEN ?(p:Person {firstname: firstName, lastname:
lastName} *100)(p)-[:KNOWS *n..n]->(p)
100 NODES
REAL VALUES
Many 2 ManyRelationships
At 80%
DEMO 1
NODES SYNTAXBASED OFF THE AMAZING CYPHER QUERY LANGUAGE!
(p:Person {firstname: firstName} *100 )
identifierlabel
Node property key
Sample dateprovider type amount
RELATIONSHIPS SYNTAXBASEE SUR LE LANGAGE CYPHER !
-[:KNOWS {since: unixTime} *n..n ]->
type
Relationship propertykey
Sample dataProvider type cardinality
PROPERTY PARAMETERSE.g.: I want 100 person nodes with a name and a birth date, the birth
date Should be realistic so that people are adults and not already in
retirement.(p:Personne {nom: fullName, ddn: { dateTimeBetween: [‘’-65 years’’, ‘’-18
years’’]}} *100)YAML inline
Sample data providers• word• sentence• dateTime• dateTimeBetween• text• unixTime• randomDigit• numberBetween• company• firstName, lastName• country• city• address
• latitude, longitude• url• username• password• creditCardNumber• ip• userAgent• uuid• ean13• fileExtension• hashTag• …… et plein d’autres
DEMO 2
GRAPHGEN CAN DO BETTER
NODE MODELSWRITING THIS:
(user:User:Person {_id: uuid,login: userName,password: password,email: email,prenom: firstName,nom: lastName,ddn: { dateTimeBetween: [‘’-50 years’’, ‘’-18
years’’]}} *100)IS LONG TO WRITE AND REPETITIVE
IF YOU USE GRAPHGEN A LOT( which is good in fact )
NODE MODELSTHIS IS BETTER AND PEOPLE SAY WOW:
(user:#User:#Person *100)
# = Node model activation
NODE MODELS
• #Person• #User• #Tweet• #File• #HashTag• #BlogPost• #Company• … and soon you’ll be able to create your own models in
the Graphgen UI
TIPS & TRICKS
TIP 1Fixed Value
SOLUTION: randomElement with 1 element
(p:Person:Administrator {group: {randomElement:[‘’ADMIN’’]}} *20)
GRAPHGEN THE GOOD POINTS
• BASED ON CYPHER SPEC (NO NEW SYNTAX TO LEARN)
• FOR EVERYBODY• PROPERTY VALUES GENERATION• IMMEDIATE VISUALISATION FEEDBACK• IMPORT WHAT YOU SEE IN YOUR DATABASE• EXPORT
NOT SO BAD
GRAPHGEN THE BAD POINTS
• YOUNG PROJECT WORKED ON IN FREE TIME (10 OCTOBER)
• ADAPT TO 75% OF GRAPH MODELING POSSIBILITIES• LIMITED TO 1000 NODES IN THE WEBAPP (DUE TO THE
VIZ) AND NO LIMIT IN THE CLI VERSION (well your memory could be the limit)
SOON IN GRAPHGEN
• User Dashboard • Define your own models• Define cardinalities percentage • Define indexed and unique constraints• Public API• More export formats
QUESTIONS ?
THANK YOU Graphgen : http://graphgen.neoxygen.io
PHP components for Neo4j : https://github.com/neoxygen
Follow me : @ikwattro