OrientDB & Node.js Overview - JS.Everywhere() KW

download OrientDB & Node.js Overview - JS.Everywhere() KW

If you can't read please download the document

description

OrientDB & Node.js Overview as presented at JS.Everywhere() in Kitchener - Waterloo Oct. 1/14

Transcript of OrientDB & Node.js Overview - JS.Everywhere() KW

  • 1. KW-JS.Everywhere()October 2014Node.js with OrientDBPresented by Greg McCarvellOrient Technologies www.orientdb.com

2. DISCLAIMERI am shallow.not Greg the presentationboth Node.js and OrientDB are full featured technologiesOrient Technologies www.orientdb.com 3. Why OrientDB?Understanding the landscapeOrient Technologies www.orientdb.com 4. NEW DATA REQUIREMENTSinterwebsOrient Technologies www.orientdb.comReach WEBACCESS SocialRelational Databasesi18nFrom 1970 until today, relationaldatabases have ruled the landscape.In 2009 the NoSQL movementgained traction due to theshortcomings of the relationalmodel. MANY FACTORS contributedto the need for new ideas.Its not 1970 anymorebroadbandmobile accesscultural changes 5. the minds of developers opened! Choices, choicesToday there are a variety ofchoices in DBMS. Each has their ownstrengths, evaluating your needs iscritical.NoSQL OPTIONSDocumentOrient Technologies www.orientdb.comColumn BasedKey/ValueObject Graph 6. WHAT ABOUT OrientDB?where do we fit in the scheme of things?Document GraphOrientDB is a document-graph databaseWe provide the flexibility and speed of a document store combinedwith the advanced relationship features of a graph databaseand lots moreOrient Technologies www.orientdb.com 7. RELATIONAL VS GRAPHwhat are the major differences?ID Name Employer10 Gary Weis 23212 Betty Crocker 89913 Bob Jones 23288 Tessa Virtue 12CompaniesID Name899 ABC Inc.232 Acme Corp.998 Z Industries12 BMOOrient Technologies www.orientdb.comPeopleRelational databases store data in tablesThey use a foreign key and a JOIN operation to determine relationships 8. RELATIONAL VS GRAPHwhat are the major differences?Company#14:15ABC Inc.Graph databases use direct links for relationshipsEdges allow for index free adjacency and tremendous FLEXIBILITY!Orient Technologies www.orientdb.comPerson#12:10Gary WeisPerson#12:10Gary WeisPerson#12:10Gary WeisCompany#14:15ABC Inc.Employeestatus: full-timeEmployeestatus: full-timeEmployeestatus: part-timeLOOK MA!I have two jobs!Customerlast order: today 9. RELATIONAL VS GRAPHwhat are the major differences?Relationshipsbased on contextPartnerownership: 1%Many to Many?Pie ce of cakeGraph databases make data modelling naturalBuild your model as you would think of the data intuitivelyOrient Technologies www.orientdb.comCompany#14:15ABC Inc.Person#12:10Gary Weis Employeestatus: full-timeCustomerlast order: todayTag#12:10SellerPerson#14:10BobTag#12:11BuyerTag#12:11Hot LeadPerson#14:12DavePerson#14:22RubyEmployee#12:10VPEmployee#12:10DirectorEmployee#12:10DirectorEmployee#12:10ManagerEmployee#12:10ManagerEmployee#12:10ManagerEmployee#12:10ManagerHierarch i cal data?C hilds play 10. MORE OrientDB FEATURESWe will cover these laterOrient Technologies www.orientdb.com"Schema-less, schema-ful or schema-mixedInheritance and polymorphism in your modelExtended SQL syntax, blueprints, gremlinMulti-master replication and sharding for horizontal scalabilityA wide selection of language APIsBrowser based development StudioEmbedded functions, record level security, REST, web server.Phew! Lets get to some hands on learning. 11. AN IMPORTANT ONEAPACHE 2.0A truly permissive license!!Use for free for ANY purpose - guaranteedwell pa ss o n GPL thanksOrient Technologies www.orientdb.com 12. InstallationNo worries, its easyOrient Technologies www.orientdb.com 13. $You only need a JVM installed to run the serverOrient Technologies www.orientdb.com#DownloadUnzip%RunTHREE STEPSand 5 minutes 14. Section 3 - Data Modelling Concepts& ConceptsThe moving partsOrient Technologies www.orientdb.com 15. LinksOrient Technologies www.orientdb.comDATA ENTITYThe primary storagecontainer of data. Alsoreferred to as a record.In Graph mode it iscalled a Vertex (or Node)RELATIONSHIPA direct connectionbetween two Vertices orDocuments. Edges andLinks are the relationshipsin OrientDB.DATA ATTRIBUTETyped or JSON dataembedded in Documents,Vertices or Edges. Usefulto query, sort and more!KEY ELEMENTSthe building blocksDocument& VertexfirstName: BoblastName: Barkerage: 102createdAt: 10/12/12EdgePro p ert ie smother: #22:187 16. Person CharacteristicsOrient Technologies www.orientdb.com'{!@rid: 20:12,!first: Bob,!last: Barker,!birth: 03/04/1920,!children: [!#22:123,!#20:776!]!}! Inherently unstructured Varied contents (schema-less) Can contain Links to other documents Can contain sub-documents Has a Class type Has an unique ID (graph wide) Are stored inside of a Cluster Record ID is composed of cluster &position (#13:1)DOCUMENTSFast, efficient and flexible storagePerson{!@rid: 20:23,!first: Wendy,!last: Smith,!birth: 06/02/1974,!children: [],!pet: {!name: Davis,!type: Dog,!color: Black!},!gender: female!}! 17. PROPERTIESA place to store your stuff Person{!@rid: 20:23,!first: Wendy,!last: Smith,!birth: 06/02/1974,!children: [],!pet: {!name: Davis,!type: Dog,!color: Black!},!gender: female!}!Orient Technologies www.orientdb.com)Characteristics Have an unique name Have a data type Can be indexed Schema-full restrictions Min/Max Mandatory Readonly Not Null Unique RegexpDATA TYPES Boolean Integer Short Long Float Double Datetime String Binary Embedded Embedded list Embedded set Embedded map Link Link list Link set Link map Byte Transient Date Custom Decimal LinkBag Any (non determined)* Tes t onTuesday! 18. VERTEXStorage for a graph Person{!@rid: 20:23,!first: Wendy,!last: Smith,!birth: 06/02/1974,!children: [],!in: [!#13:2, #13:45!],!out: [!#12:10, #14:33!]!}!Orient Technologies www.orientdb.com*Characteristics Similar to a document Can store data Has ID, cluster, links etc Has a collection of incoming edges outgoing edges Also called NodesThey are alsoALWAYS round 19. EDGEFast, efficient and flexible storage,CompanyOrient Technologies www.orientdb.comCharacteristics Stored as a document Can have properties Has ID, cluster Has a name (E by default) Has a direction (from & to) Incoming Vertex (Head) Outgoing Vertex (Tail)+ Employs Person{!@rid: 20:23,!first: Wendy,!last: Smith,!birth: 06/02/1974!}!+{!@rid: 18:99,!name: ACME,!volume: 980000,!: 06/02/1974!}!{!startDate: 2010-01-01!}! 20. CLASSTypes of DataOrient Technologies www.orientdb.com-Characteristics Each record must have one Can inherit from another class Still allows for schema-less data Can have multiple clusters Has a default cluster Can contain properties for aschema-ful or schema-mixed model Person{!superclass: V,!clusters: [12,14],!defaultCluster: 12,!properties: [!{!name: "lastName",!type: "STRING",!mandatory: false,!readonly: false,!notNull: false,!min: null,!max: null,!collate: "default"!}!]}! SuperHero{!superclass: Person,!clusters: [15],!defaultCluster: 15,!properties: [!{!name: "strength",!type: LONG",!mandatory: false,!readonly: false,!notNull: false,!min: 1,!max: 1000000,!collate: "default"!}!]}! 21. CLUSTERStorage flexibility. USA . Where a group of records are stored By default, one cluster per class Can have multiple clusters per class Useful for storage, scaling andarchiving purposes Can be used for optimized queries Person Person Person Person PersonOrient Technologies www.orientdb.comCharacteristics Person{!@rid: 20:23,!first: Wendy,!last: Smith,!country: USA!}! Person{!@rid: 20:18,!first: Bill,!last: Brown,!country: USA!}! Person{!@rid: 20:231,!first: Tammy,!last: Taylor,!country: USA!}! Person{!@rid: 20:881,!first: Tiffany,!last: Henry,!country: USA!}! Person{!@rid: 20:31,!first: Alex,!last: Chang,!country: USA!}!. Europe{!@rid: 22:23,!first: Jacques,!last: Revere,!country: France!}!{!@rid: 22:922,!first: Guilia,!last: Abruzzo,!country: Italy!}!{!@rid: 22:11,!first: Fabio,!last: Gilberti,!country: Italy!}!{!@rid: 22:313,!first: Laurent,!last: Biraghi,!country: France!}!{!@rid: 22:111,!first: Erwan,!last: Enault,!country: France!}! 22. CLUSTERStorage scalability Automatic Map/Reduce QueryDirected query to one cluster/ VPS: Dallas TX / VPS: San Jose CA / VPS: Paris FR. USA1 . USA2 . Europe1Orient Technologies www.orientdb.com 23. CLUSTERStorage replication/ VPS: Dallas TX / VPS: San Jose CA / VPS: New York NY. USA1 . USA2 . USA3. USA2 . USA3 . USA1Multi-Master Replication!Orient Technologies www.orientdb.com 24. Studio5 minute overviewOrient Technologies www.orientdb.com 25. Console ToolThere is one no time to demoOrient Technologies www.orientdb.com 26. Node.js & OrientDBThe HelloWorld of my worldOrient Technologies www.orientdb.com 27. SetupOrient Technologies www.orientdb.com 28. Lets see some examples& SQL APIGetting StartedOrient Technologies www.orientdb.com 29. Language Bindings& APIsChoose your platformOrient Technologies www.orientdb.com 30. EXAMPLESWorking with ClassesOrient Technologies www.orientdb.com123456789 31. EXAMPLESWorking with clustersOrient Technologies www.orientdb.com12345678 32. EXAMPLESWorking with propertiesOrient Technologies www.orientdb.com1234567 33. CREATING RECORDSC is for createOrient Technologies www.orientdb.com123456789 34. SELECTING RECORDSR is for readOrient Technologies www.orientdb.com12345678 35. UPDATING RECORDSU is for updateOrient Technologies www.orientdb.com123456 36. DELETING RECORDSD is for deleteOrient Technologies www.orientdb.com12 37. Contribute to build or improve a library! 38. The Document-Graph Databasewww.orientdb.comtwitter: @OrientDBGreg [email protected]: @mccarvell