 Good night, everyone. OK, I'm Eric Lee, and I'm from Silicon Cloud International because it's interesting. A few months ago, I applied an engineer position in Skyscanner, but you know the reason. But I'm still here now. Because we are talking about graph database, so I'm using a graph way to introduce myself and what I'm doing and what my company is doing. OK, my background is bioinformatics. So during my study, my advisor asked me to use graph database to construct biology-related database. So that's why I started using Neo4j. And formerly, I'm using Pro, but I think one year ago, I started using Python because I think the learning curve is really low. So just like lots of people, I'm also a starter too. OK, now I'm working for Silicon Cloud International. And we are a startup company providing private cloud solution for semiconductor industry. So if you are familiar with EDA2 or another semiconductor workflow, maybe you may have our company before. OK, not only Neo4j, I'm also using Cassandra, another non-SQL database. OK, that's me. I think I have to introduce non-SQL for lots of you because not everyone have the experience to handle non-SQL database. I think lots of you have the experience with SQL database or just like my SQL or post-ditch SQL or DB2 or step-side base. The feature of SQL is using the structure query language just like SQL or PL SQL to manipulate the database. So let's call SQL. And if you want to model the database model in SQL database, you have to use ER model to model in your data structure inside the database. So let's use the SQL database. But there is a new solution called non-SQL, not only SQL, just like you can use in document-based store or key-vail store, for example, Cassandra or MongoDB. I think all of you know if you're using SQL database, it's a row major, which means one row is one data record. So there is another solution using column major, just like Dynamo, AWS, using Dynamo as the database solution already. Or graph database, what I'm talking about, Neo4j or Titan. Well, Titan just acquired a few months ago. Now it's a part of Datastakes. So I think for next release, if you are using Cassandra's enterprise solution and you can have fun with Titan, because our company just did a pilot program of Datastakes, we are using Titan to construct our database system now. But I'm still like Neo4j, so I still have some research in Neo4j. And you may ask a question, why using non-SQL? Because lots of people using SQL, if you have some problem, you just open your browser and open Stack Overflow, and you can find lots of solutions. But non-SQL is quite a benefit for new generation application, just like cloud-based application. For example, if you launch a service and deploy in your server just like AWS or another cloud solution, it's very difficult to change the schema. Because if you're using SQL database, you have to use an ER model and define your query structure, data structure. And after you start a database, deploy your service, it's very difficult to change the architecture. But if you're using non-SQL, it has a capability to do some changes. I can show you later why the non-SQL database is extendable and changeable. And another important thing is availability, just like for some transaction, just like e-commerce or just like Taobao or another eBay or other database, you cannot close your database service during the transaction. Maybe the database will be done for network connection issue or server loading issue. But you can use non-SQL database server to construct a high availability, which means it's a database cluster. Just like if I have two nodes in our database cluster and one node is done and another node will put power on and keep the service working. So I think if you want to deploy the database service for your cloud service or cloud application or maybe financial-related or high-frequency transaction, you can pick up non-SQL. OK, so now I want to talking about cloud database. Because I know lots of you have some experience or professional in Python. So today I will using lots of time to introduce how Neo4j working and how it's work and give you a live demo and we can code in together. OK, so as I mentioned before, cloud database is schema-less based on graph theory. You can see everything in the world is a graph data. Around the world also a graph, you can construct the database using the graph way. So in the graph theory, there are only two data types. No pointer. OK, one is the node and one is the age. OK, so you can imagine inside a node is a data record and you can define some property inside a node. And lots of data and you can connect it with some specific relationship using the age. So it's very easy to modeling your data. So for example, if you want to construct a database for your company for actual department and you have the employee data and there is another employee, maybe employer just like your boss and you. So your boss and you has a relationship just like the boss of somebody or anything. So using this kind of method to construct all of the data. OK, so for graph database, if you want to query or manipulate the database, you have to using another query language, not C core. Today, lots of people using Gremlin because it's open source, but the learning curve is very high. Just like you have to memory so many squeeze nips. But if you're using Cypher and you can use the ASCII way to memorize the query language, I will show how easy it is. OK, so another thing is graph database now is widely used in social network. Just like Facebook, I think this example is quite good. Just like relationship and relationship between people. OK, today our topic is Neo4j. And Neo4j is a Java-based graph GDB-MS graph database management system. And the data inside the Neo4j is quite simple. Only four types of data definition. Why is node? Just like I mentioned, you can store your main data in a node and label it just like, OK, I'm Eric and I'm a step. So assign me a step label. And property, just like Eric is a name. Name is a property. Lee is surname, so it's another property. And relationship, just like Eric Lee, this node is belong to Silicon Cloud International. Silicon Cloud International is another node to define a company. So it's quite simple. OK, about the query language, I think is the attractive part of Neo4j, because it's using Cypher query language instead of SQL. I think if you want to familiar with Cypher query language, you just maybe spend one week or one month and you can be the expert for general comments for some detailed comments, maybe you just need a cheat sheet or stack overflow to find the answer. OK, for business and scientific occasion, lots of projects using Neo4j as a database storage system, just like there is a project called Bio4j. You can Google it. It's using Neo4j to construct all of the biology related data into a Neo4j database. And I remember when I was working for a research institute, I tried to install and using the Bio4j, the data node, maybe more than 20 million nodes. So the data is quite huge. So maybe if you're using a 4TB hard drive and this database will eat all of your storage space. OK. So you may have some interest in it, but also curious about whether it's be free or very expensive. I can tell you it's free for most of the case, just like I'm working at a startup company and our company is still not making money. So we can using it for free. And you can see the policy is if your company annual revenue less than 3 million US dollars, and you can using it for free. So I just tell my folks every week, earn more than 3 million, I think we are happy to pay. So you're just using the enterprise edition. I think Eugene already mentioned you can download a community or enterprise edition. Both are available on Neo4j's website. So for production or for learning, for another person, I recommend you just using the enterprise edition. Because if you want to construct a high availability database, only enterprise edition is allowed. Just like you want to create a cluster for Neo4j, but community only allow single node, but enterprise allow multi nodes. So you're just using enterprise edition. OK, so that's a simple instruction just let us start our live demo. So I think all of you are using Mac, or some guys are using Windows PC. Sorry, I don't have any Windows PC, so I cannot debug with your Windows. OK, so if you are using Mac or Linux, you just install Oracle JDK version 8. There's another distribution is called OpenJDK. It's work, but it will have some issues on its path. So I just using Oracle JDK can avoid some possible troubles. OK, and you just download it on zip and start it. It's quite simple. For example, you can check your Java's version, JDK's version. OK, so if the command line without Java version 1.8, which means you have Java 8 already, if you are using 1.7, which means it's JDK 7 or cannot work, so please upgrade to JDK 8. OK, and the data you download from Neo4j is like this. There are enterprise version or community version, or both two versions, the data structure or folder structure inside the top compression file are the same. OK, so all of you have Neo4j in your computer. So it's quite easy. For example, I have so many versions and I want to try, OK, community. So I just X-rays. Uh-huh. How to make it bigger, OK. Clear? I hope. OK, you just decompress it, change the folder. OK, and inside the root folder of Neo4j community, version, and you can find there is a bin folder, so you just change the folder. OK, so if you want to install to your operating system as a service, you just run the Neo4j installer command or just run an instance for temporary, like me. So using Neo4j with start parameter, the server is ready. Local password and the port number is 7474. So now you can use an open browser. Yes, Neo4j server is running now. For first time login, you have to change your password. The default password here is both Neo4j and Neo4j. User name and password is Neo4j and Neo4j. OK, I'll be asked for password change. Now it's done. It's a Neo4j server. Let us back to the slide. OK, I will share my slide with you, so if you don't want to have a memo and you can download my slide later. OK, it's a web console. And it's also support the CLI mode, so you can use the terminal to manipulate the database. But I prefer the web console because most of the APIs can help me debug. So please just open your Neo4j console and try to type this command. Play and cease info. You can see the database server's current status. Because I just noticed this interface is just changing since I think version 2.3, because previous version has a web-admin interface. But now the web-admin interface is already integrated to this web console. So from the cease-ten info, you can understand how much node inside your database or how many relationships, how many properties, and the memory cost or another related information. My experience, if you want to use Neo4j, I think your system memory, at least 8 gigabytes, for you just play for fun. So if you want to use it for production environment, at least I think 32 is better. But I think 32 in most of the environment is fine, just like AWS or muscle environment. Because if you want to handle a high-frequency transaction and the Java will eat your memory very quickly, there is cease-ten info. And another important thing is remote connection. You just start a Neo4j server but only allow local host. So I think all of us will set up a Neo4j in remote site, just like in AWS or another computer. But I want to control it in my laptop or local. So you have to change the config file in Neo4j. So what can we do? Please back to the Neo4j root folder. Did you see there is a config folder? Inside config folder there is, I think except with me, four important files. Now please edit your Neo4j server properties with your familiar text editor. And in first page, you can see there is a knife. Mention about localhost.org.neo4j.server.webserver. And address is 0.0.0. Please uncomment it. And after you uncomment this knife and restart the Neo4j server, and you can access your database remotely. I think this config setting is quite important. For someone who doesn't have the local desktop environment or another browser. You can just change this. Sorry, uncomment this knife and save the config file. And let us reboot the Neo4j server. You just execute Neo4j in the Bing folder and with a restart parameter. It's ready now and you can test it at home because now I only have this computer so I can show you the power of remotely. OK, so I think it's an interest part. Cypher query language. It's just like a course for coding, but unlike coding, I always call it drawing. I think all of us have a basic knowledge about SQL query language. What is the main language? Select, where and from. And Neo4j is similar. There are match, create, where, and return. No match is just like select. Select specific data region, so graph region. And create is to create data node or relationship. Where is, you can add some conditional query just like a greater, less than equal or do some regular expression operations. And return is return the query result. Because some operation, you don't have to ask the database engine return just like create. Create node and create relationship. So if you want to do some query, you must have the return parameter inside your query syntax. OK, so it's just four important statements. Match, create, where, and return. OK, and I mentioned before, it's inspired by ASCII art. So what is ASCII art? ASCII art is you just using the ASCII correctors to join something just like, I think, maybe you can using a line and an arrow to draw an arrow line to mention about the direction. It's a kind of ASCII art, just like this. So if you imagine a graph in your mind, the circle is a node. This arrow is relationship. And connect with another circle, another node. OK, it's a simple graph. Two point and a line connect as a graph. And the user is a label. OK, and first place is a label. Country is a label, too. So we can create a simple relationship just like this user. His or her first place is from which country. And please note, the relationship is directional. And it can be only directional by directional. Just put another arrow side here. Greater and smaller. OK, for example, it's a create statement. Just like I want to create a node, it's label is in Poi. And this node has three main property, name, surname, and gender. So it's quite simple. We just open our web console to do that. For the main statement, it's not case sensitive. But your property or your label, user defined data, is case sensitive. Yes, let us assign a name, a semicolon, and press Enter. You can see the database engine already add a new node for you with three properties. I highlight the syntax by the web console for you. Because I'm using Neo4j more than two years, but I still cannot find an editor like this web console to provide the syntax highlight with a spatial color. So I'm still using Neo4j web console for development, for coding. OK, so after you add a node, you can query this node. So if you want to start a new query, the main statement starts with a match. For example, I want to query the node with a label. The label name is in Poi. So I just match and in Poi and return. OK, this n is for variable to tell the database engine I want to set this query with a variable and return the result of this variable. OK, and there is an important thing in the second command. It affects another command called limit. Because originally, if you're using Neo4j's web console, the maximum return result, maximum number is 1,000. So if your result is more than 1,000 and some error message will pop up, so please just tell the database engine how many results you want to return. OK, so just like, sorry, hello. What's the difference between gender as a property and gender as a relation? Gender. Gender. Here? Yeah, so it's possible to search by. Yes, yes, yes. You can define some property for return. I will tell you later. OK. So this one, you just maybe a huge company, maybe like Skyscanner, more than 10,000 employees in their company, so they can just set a criteria. Only return 100. OK, so if you're interested in it and you can also learn another conditional return just like order, descending, or ascending. I will tell you how to learn this specific query language using the online resource later. OK, and another thing, because inside an employee node, maybe I just want to see the gender or first name, or less name only, or less name and first name. So you can define it. OK, let us start a simple query. You see? I just create a node. The node property has a name property called Eric. So the visualization part show me this node. And you can click here. There is a raw view. And you can see inside a node what property is inside. So I just create a node with three properties. So if I only want to see name and gender, it's simple. I just with a dot and a name with a comma and gender. And press the Enter again. You can see only first name and gender. And you can see maybe the return header is ugly. So you can with a special parameter named Earth, you can see. The return node is customized. It's become the name and the gender now. OK, for this statement, I didn't write on my slide. So you can have a note. OK, any trouble? If you were to represent that data as a graph? Represent the data as graph. So. Understanding that the database is based on graph view. Based on you mean the graph view? This one? Is there a way to explain or do you mean? Because in the web console, if you want to represent the data in graph or growth, the table, you just click the button to switch it. And if you want to represent the data with your project, I think your project is coding with another language, not the console. So you may apply another JavaScript-based framework just like D3 or another framework to represent your data. OK, and this web console is also usable here. You can see here is an export button. So if you want to export your data with a CSV file, you just click this button and it will generate the CSV for you right away. Can you upload the CSV? You can import the data by CSV format, but cannot work in web console. You have to use Neo4j data import. It's parameter in the CLI mode, command line mode, to import your data. Yes? The CSV format, is there a common format that Neo4j likes? Like is it just doing the triples? Or is it something that keeps and tracks the directionality and the property? I think it's just like a traditional comma-separate format. So it's supposed to format one is JSON and one is CSV. OK, so just like I click CSV, it's just like that. And I remember this type of data in Espo only work in Safari and the Google Chrome. I remember if I'm using this function in Firefox, some error will happen. So I don't know, now this bug still exists or not. Sorry, what kind of format can you export your graphic? You mean the visualization? After you visualize it, now that we export it, what kind of format can you export in, RDF, XML? If you want to export your graph in visualization format, you have to find another graph framework and using the API with Neo4j to export your data. Because I know lots of third-party plug-in is not free of charge you have to pay. So you still can use my experience, Google Chart or D3.js with Neo4j to export my data. Just like I export my data with maybe JSON format, and it's OK. How very dangerous. You can stand up. I suggest that you move to another. No, because it's my fault, because my talk is too poor, so the light tube is angry now. OK, so if I click the JSON button, it's a JSON format. It's your query result and it's pulled by JSON format. So you can see inside the JSON format, the first element is the current name and the data. This function is very useful. So just like if I want to analyze some data in Excel, I just explore with CSV format and open it with Excel. It's cool. And what's another cool comment. OK, I tell you there is a messy model. So in this build, you can just click the wheel on the left-hand corner of the window, and you can see that you can configure your Neo4j web console environment. So you can redefine the messy models. So if your computer has more memory, and you can maybe set 10,000, it's fine. But I guess it's a memory-related issue in previous versions. So only 1,000 is allowed. OK, you can also define the execution type, because maybe sometimes you submit your query, but the result is huge. And the database engine maybe is done or crashed or another reason. And you can set my execution time to define the engine. OK, this is a match. By the way, I tell you how to create a node, but have you ever seen how to modify the property inside a node? For example, I match this node, match to find this node, because currently I only have one node. So the name is Eric. And I want to delete the property of gender. So I just match this node. This is a quite simple statement here, because I didn't tell you how to use the WHERE statement, because I only have one node now. So with a set parameter, and its name is gender equal node. OK, and if you type this command and execute it, you can set one property, which means this property will really change. So let us query it again. No gender. What is the gender property? Because it's changed. Wait a second. I just show you the full information of this node. You can see the gender is gone. So if your gender is there itself, then you actually want to remove the instance of Eric itself. Remove what? Remove the instance of the person. Or will that gender property also cascade down and be removed or will it still stay there? OK, because in Neo4j, no primary key. So the node still exists. For example, we can do it right now. OK, and we set the name property NO, which means I want to remove Eric's this property and return the result. You can see this node still exists, but Eric is gone. How to delete the node? How to delete the node? We just find this node first and delete it. Because I already assigned an unverable here. Fight and delete. This node is gone. So right now the database is not here? Yes, so you can verify. If you type match n return n, no rows. If you type match n return, which means the database engine will return all of the data inside the Neo4j database. Just to verify, if you remove or delete a node, all agents attached to it will be removed as well? No. If this node connects with a specific relationship, you have to delete the relationship together. You cannot delete the node or you cannot delete a node only. You can remove the relationship, but you cannot remove the node connected with another relationship. If I want to delete a node, do you first delete all of those relationships? Yes, you have to match the relationship and the node and delete the relationship and the node. I will show you later. I will tell you how to create a relationship. I think you have some basic concept of match. Do you think this query language is simple or difficult? Maybe you just first try to use the cyber query language. A little bit different. OK. Where condition is important to avoid some mistake operation. For example, I want to delete a node with a property named Eric, so I just create a where statement. OK. And the second one is regular expression. I want to delete the employee label. So the node with employee label and the name initial with E in capital. And you can use this command. Sorry. I do some stupid. These two commands duplicate. OK. And last one is with ER. You can see you don't have to create regular expression. You just with the starts with command. OK. So Neo4Z already defined this command in their engine. So you can see there is a starts with, so ends with also available too. Give some try. I have to create a node again. OK. Let me create this node again and match. All right. Now to, as we bring a bracket. And there. Yes. And you can see a result. Graph mode or in table mode for using regular expression. I just added two nodes with exactly the same data. So what exactly is the primary key? Sorry. Is there any concept of primary key? No primary key. OK. So I can add the same nodes with the same data. So if you execute this command create twice and you will have two nodes with same properties. The difference inside the database is the node ID is different. The node ID is for database engine to process. D4 is hide. So if you want to see the node ID, you have to using another command to check the node ID. OK. So it's important. No primary key. So I think because in relational database in most of case you have to define a primary key in a table. But in graph database no table so no primary key. OK. OK. Now create relationship. So for example there is two nodes employee and company and with a relationship working. So just using this command to create a relationship with two nodes. And the second command is the bidirectional. Totally three nodes because in the circle is Eric working in this company and he knows Neo4j so I'm using another relationship to define it between the nodes. OK. And last one. You can see there is an important term create unique. What difference between create and create unique. I think one of our friend already tell us how about duplicate node. If I ask you a same comment twice and I will create two nodes so in relationship to so if you if you create a syntax without this unique comment the database will the database engine will generate a node again for you. So for example if you do it create unique but if you want to do the unique but you didn't clarify it's unique and the Eric node already existing database and it will be create again. So you finally if you do it without unique and you can see there is a two nodes two employee node and with name is Eric you can try it to find the difference. OK. Let us create a node with relationship. OK. So in my example I want to create a employee name. I change another name. Not Eric. Andy and the server name and gender and working in SCI. I just enter it and you can see the query is always this statement create two label nodes and create two nodes with one is employee label and another is company label and set for four properties and with one relationship the relationship name is working. OK. So if I query this graph you can see the result is different. For example I just want. Quick question about that. When you create the employee node it's in colon but the company node is a C colon. What's the difference? C colon is for variable. Right. Yes. This is for variable to return the result. So sometimes you can ignore the variable maybe it's my hobby to using this variable because sometimes it can avoid I met something. And this is a variable to so you can change it or anything. You can use anything. Yes. OK. We can don't use the end. We just create employee. Because the important thing is the employee is a label. OK. And the company is a label to. So the N with N is a variable. OK. C is variable too. OK. So let me query the new create graph or how it's like. So you can see when I using match and I have to return. So N is important now. Return is variable. OK. I'm using a graph mode. And you just double click. And you can see the relationship. Let me make it bigger. OK. So let's know and in point no with a name N, D and works in SCI and its direction. Another query case. For example, I want to know N, D and SCI has what kinds of relationship. So I want to know the relationship between N, D and SCI. So remember now change the return. Return is R because now R is a variable for the relationship. So I would like to return the relationship. You can see here is a work in. This one may be significant. Oh. Because here you don't have to define the direction. Because maybe sometimes you don't know the direction. You just tell the database season. I guess there is a relationship between the two now. But I don't know the direction or relationship name. So we're just using this command. For that query right there that you just ran. If you ran that from Python or from shell, would the return just be a string that says work in? In Python or in the COI, it will be a table. It will return a table. Yes. It will return a table. Draw by a key. So we can see lots of lines and circles to draw a table for you. Okay. So you can use type of relationship. I get works in. But are there other things that I could use? You want to use the relationship and. When I return the relationship, I just returning R. I use type R and I get works in. Right. So but what I want to know is are there other methods that I could use? And I'm returning something. Let me just return the relationship's name or. Yeah. Now I was able to return the type of relationship. But are there other things that I can return? Relationship. No type. Only label. So the return could be label. So by the way, the label of relationship you can define multiple label name. For example, you can use work in or employee or for anything. So you can buy multiple label. Just like employee, you can set another label name just like people or anything. Yes, I have a slide for career relationship. So if you are interested in it, you can follow my slide. Yeah. Could a node itself be another graph database itself to be another graph database? Like you can have like a graph database of companies. Each company has its own. That's the role of you know. Except to store anything in the graph. Yeah, you can store anything. So could you store a graph database inside the node? Graph, you mean the inside a node is another graph database? Yeah. So like you had a graph database of companies. Okay. I think your idea is quite like the pointer of C. No, you cannot because inside a node you can only define the properties. The node only allow properties and extend the relationship with another node. So no graph inside a node. No, because it's too complicated and cannot be queried. Actually is there a size limitation on a node? Size, no limitation. Depends on your memory size. My previous project using Bio4j is just inside all of the dynamic related data to the node. I remember nodes amongst more than 20 million. What is your size limitation? Oh, you mean to store the property to the, yes, okay. No, no limitation. Still depends on your memory. So unlike my C core or Microsoft C core, I remember one table only more than 60,000. But in graph database, no limitation. You can import all of the data because no table. Okay. Is there any way we can compute the shortest system? Yes. Okay. Neo4j has this comment but it's a advanced usage. So I won't tell you today. You can find a resource because if you familiar with the query language and Neo4j they bundle with the graph traversal just like how many pages, how fast is the shortest distance. And for you then I want to know more about small world between user A and user B and how can I reach it from user A by which page. Yes, you can try it. If you Google Dijkstra's algorithm Neo4j, it gets quite a few videos back to the next explanation. Yeah. If you use network X, I'm just going to network X like for Python doing graphs. I'm just going to ask if there was a logical point where you stopped using that but always go to... Yes, I think you can and you can decide the graph traversal algorithm because maybe you have better traversal solution for your graph. So I think you can. Okay. Because for biological research, just like gene and gene interaction, there are so many reaction pages so lots of people using graph database to handle it for network analysis. I think that's a good point. So is there something that network X can actually do and Neo4j can do? What's comparison? How can they actually complement each other? They can complement each other. Yes. So is there something that Neo4j has a deficiency in that I'll use network X to actually deal with? Yes. You can check with their blog and lots of interesting topics. Can that graph store in memory? No. You mean in memory mode? Currently you're doing query, right? Yes. Is that graph in memory or it knows how to query from this when you need to? Actually you can set it in memory mode off the query and manipulation in memory and you have to set up in the config file or using the default is the memory control is managed by JDK, the Java virtual machine depending on Java virtual machine setting. You mentioned that enterprise version can run on cluster, right? Yes. So the back end, they set everything for you. You just need to plug the machine. Yes. If I know just like which know is for seed and to duplicate from specific know. So if the main seed is dead and another know will power up to replace the dead one. So I do not need to do any help? Yes. The configuration is simple. I think maybe less than 10 lines. Are the nodes created already persisted or do we have to save the database? No need to set. It's already do some read and write inside the storage back end just like your hard drive or your solid state drive. By the way, about the solid state drive, you can use solid state drive as a cache or using it as a main storage. The performance is huge different. So the enterprise version is distributed? Sorry? Enterprise version is distributed? No, nothing. Default is staying alone, only one know, but you can extend it as a HA mode for high availability. I think for some research or business case, you must using the cluster to do that because memory is a problem. Just like Bio4J. More than 20 million nodes, so maybe staying alone machine will crash. The job loss problem. Okay, about the learning resources, if you're interested in some graph traversal or another interesting case, query case, please check with the cheat sheet. Okay, so another thing is for Neo4j sandbox. For example, if I just want to play with Neo4j and I don't want to set up a machine or I don't have a machine with JDK and I can just launch the sandbox from Neo4j. They will set up a sandbox for you for 7 days in AWS. In this page, you type your email address and username and they will reply you a link and you can log in and try your Neo4j. Only for 7 days. Oh, and you can see this book. This book is free, so you can download from Neo4j's website. And now it's second edition. I think why this book is important. This book tells you how to model in your graph. For many perspective, just like optimize. Just like maybe you may create duplicate relationship or duplicate properties and it will lower your performance. But if you look in this book and you can find some tips for you. How do we get your slides? I will post my slides at the pie to data, the comment, today's comment. Okay, about Python Neo4j for short break. Do you want to take a break now? Okay, it depends on you. I think maybe lots of you have questions or tired or want to drink something. Take a break and resume with my friend Neo4j. Oh, okay. Okay, it's time for Python. Okay, so I hope you have some basic knowledge and idea about Neo4j and Cypher. One year ago, Cypher query language is a proprietary, which means you can only use it in Neo4j. But three months ago, Neo4j open sourced the Cypher query language. Now the name is OpenCypher. So I think another graph database may apply for Cypher for query language in the future. So I'm optimistic about this situation. So maybe Cypher is still useful or you can use Gremlin. Okay, so Python library for Neo4j, the main these three types, because Neo4j support REST for web service native in native mode. So if you know how to use REST for web service and you can manipulate your Neo4j by the REST API. So based on REST, these lots of API, no matter Python, Perl or C or anything, it's based on REST for service. It's just like the developer just package the REST inside the library. I want to introduce the Py2neo because it's always update and based on the new release of Neo4j. So it's my advice, please using Py2neo. So if you prefer the REST for web using the second one. So the installation is simple. I think we have the internet access privilege now. So you can install Py2neo just using Py2neo. Okay, so if you want to use your Python API to assess your Neo4j database, authentication is very, very important. Because before version 2.2, Neo4j without any authentication method, sounds is very stupid, but it's true. So after 2.2 and 2.3, you have to do some authentication to get the authentication token. So do remember you already set up a password in the first stage. When you first time launch your Neo4j web console and you already set up the password. So just apply it. Okay, but if you just play for fun or another content you don't want to using authentication, you can disable it. Okay, so here's a screenshot. Okay, I tell you how to disable it. Still, it's Neo4j. It's very un-miss. You see, in first page, dbms security, files enable and you can just change it to false. And the authentication mechanism will be disabled. Actually, you can dig some server configuration from this file just like you can change the poll number or using HTTPS. I think for financial or production, HTTPS is very, very important. So you can change the HTTPS protocol here or change the poll. Because you know D4 is 7474, maybe I just using a tool and try lots of IP with 7474 and some MIS didn't set an authentication and I can manipulate your database. So for security reason, you may change the port and log. Only few lines, so you can dig it by yourself. Okay, when you change the configuration, don't forget to restart. And after that, now I disable my Neo4j authentication. Okay, I'll just make some code. I import Neo4j. Interesting. Maybe I have to change my slide. Because in previous version is work. Okay, because of I'm already disable the authentication, so I just using the formal command. Oops. Yeah, so now the database already connect. Okay, so you don't disable your authentication token. So you had to put the username and password inside parameters. Okay, now let us try to create a node by Python and queries in web console. I just create a simple node with the label is employee and name is Tony Neo4j. I know why because I have to import a node property. That's camel case. This is Neo4j.createNode, actually like graph.createNode. Because you bind the graph to the Neo4j graph object. This is Neo4j.graph. That's no graph. No graph.create, yeah. Okay, graph.create. And then don't even know the other name. No, it's just not for graph.createNode. No, not a query. You replace this one with node here. Yeah, node is the parameter. Yeah. It's not graph.createNode. Creator, creator, node. No, that's very good. You created node. Graph.createNode. So, sorry, it's Neo4j.tapNode to create the node and you should assign it to a variable. Neo4j.tap capital. Do you don't need a node here? No, you don't need a node. This one? You should put... You bind it to a variable, sorry. assign it to a variable. Go to the beginning. It goes here. Good. Okay, you can see Tony is here. Okay, now I'm very afraid of life demo. We see this slide. Now it's create relationship. Just follow this and modify your code. Because I think compared with Cypher query language, if you want using API and you don't have to memory the syntax, you just understand the API in and out and you can create a relationship. So, for this case, I want to create a user and name properties Eric and walk-in. And this walk-in. Did you see this walk-in? Sorry. This walk-in relationship, I assigned with a property. So, the relationship, you can define a property too. Yes, and as I connect to another node, the label is company and name is Silicon Cloud International. So, this Cypher is equal to this code snippet. So, I just define Eric and SCI and the relationship and SQ. For search, the Python API also provides a search one function and you can search the specific label and with specific property and value. Okay. So, if you want to return the result in Python, in most of case, you have to using a for loop to bring the result. It's very special and important. So, without the for loop, you cannot return all of the result. And compare with web console. If you're using Python, low limitation. The default limitation in web console is 1,000 low. But in Python, you're just using the command and you just print it. Yeah. So, this result equals, is that comparable to in Mongo that I think that returns a cursor? Is that the same thing? Basically. Okay. Yes. Okay. Okay. Later. Because if you want to using, sorry, let me jump to another slide first. Although the Python will support this API and you can just know the focus on the node and relationship, you still can submit your cyber query by this command. So, if I want to put some boolean, and I'm using this command to submit my query syntax with query condition, and I can put the boolean in the query statement. So, the result is like this. Bring a label for you. This, without a for loop, the return type is like this one. So, if you want to program your result, you may create another object and the object for the result and using the for loop to bring the elements. So, practice also. De-eat. Oh, by the way, this command is very useful and dangerous and important. So, how do I remove all of the data inside Neo4j? It's this one. Match. N is for one node, another node, any node, any relationship, and another node connect with this relationship. You just match these three types of data and delete and you can remove all of the data inside Neo4j. Sorry? It's also removed from the unconnected nodes. Connected nodes and unconnected nodes. Yes. So, or you can use this Python command. Sorry, Python Neo API. I'm sure it's work. Or combine with the fine one command and delete using a delete method. Eric equals graph fine one. Is that function returning the node ID? Return node ID. I will return the object, including the ID. Because if you're using this API, the return result is the ID, the node ID, and node ID or property ID with their property and labels. What happens to all the relations if you delete that particular node? That is just a node, right? With a return for delete? Single delete? Single delete. So what happens to all the relations? Okay, so if you delete it and connect with nodes with relationship, arrow, so you must delete it with the relationship together. So please use maybe where condition to find a specific node and it's connected relationship and nodes to delete it together. And about uniqueness, I think using the command is easy to understand. So you just define the constraint at first slide. Because I already tell you there is no primary key, so you have to set some ID about primary key. For example, in my case maybe traditionally, employee ID is a unique key. So in the database, I don't want the duplicate employee ID, so I just set this constraint to avoid the database engine generate a duplicate node with the duplicate employee ID. Okay, so I'm using the code to tell you some principle. Just like about the unique page, if you didn't define the unique, if you execute the command again, although the user node is already exist, it will create another user again. So it will create duplicate data. So you must using uniqueness inside your code. For example, just like here is a node called Moji and Eric. So if I didn't define the uniqueness and I know Moji already exist in database and Eric already exist in Neo4j. Okay, so without the uniqueness, I execute this command again. The database will create another Moji and another Eric, so cause the duplicate nodes. Okay, it's a semi-cruising text, but sometimes this command is usable if I'm not familiar with Python's APIs, so I will using this one with a for loop to pass the data. Okay, it's a reference and I will share my slides later. So I hope you enjoy my lecture today. Thank you. If you want to change name card or have some internet, please find me. Thank you.