SlideShare a Scribd company logo
1 of 50
Technical Seminar April, 2011 Sergio Gómez
Index ,[object Object]
Basic Concepts
Database construction
Validate construction
Query database
Graph algorithms
Script loaders
Tips & tricks ,[object Object]
Basic Concepts
Database construction
Validate construction
Query database
Graph algorithms
Script loaders
Tips & tricks ,[object Object]
Nodes and edges instead of tables.
Implicit relation in the model.
DEX is a programming librarywhich allows to manage agraph database.
Very large datasets.
High performance query processing.,[object Object]
Data model: Typed and attributed directed multigraph.
Typed:Node and edge instances belong to a type (label).
Attributed: Node and edge instances may have attribute values.
Directed: Edge can be directed or undirected.
Multigraph: Multiple edges between two nodes.
Type of edges:
Materialized: directed and undirected.
Virtual: constrained by the values of two attributes (foreign keys)
Just for navigation,[object Object]
Index ,[object Object]
Basic Concepts
Database construction
Validate construction
Query database
Graph algorithms
Script loaders
Tips & tricks ,[object Object]
Native library
Linux: libjdex.so
Windows: jdex.dll
System requirements:
Java Runtime Environment, v1.5 or higher.
Operative system:
Windows – 32 bits (64 bits to be supported in new release)
Linux – 32 and 64 bits
Soon to announce Mac OS,[object Object]
Basic Concepts Main methods GraphPool newSession()  Session Session getDbGraph()  DbGraph newGraph()  Rgraph close() DEX open(filename)  GraphPool create(filename)  GraphPool close() Objects add(long) exists(long) copy(objs) union(objs) Intersection(objs) difference(objs) Graph newNodeType(name)  int newEdgeType(name)  int newNode(type)  long newEdge(type)  long newAttribute(type, name)  long setAttribute(oid, attr, value) getAttribute(oid, attr)  value select(type)  Objects select(attr, op, value)  Objects explode(oid, type)  Objects Objects.Iterator hasNext()  boolean next()  long
Index ,[object Object]
Basic Concepts

More Related Content

What's hot

Introduction to couch_db
Introduction to couch_dbIntroduction to couch_db
Introduction to couch_db
Romain Testard
 
10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data Modeling10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data Modeling
DATAVERSITY
 
Aggregation Framework
Aggregation FrameworkAggregation Framework
Aggregation Framework
MongoDB
 

What's hot (20)

Xtext Eclipse Con
Xtext Eclipse ConXtext Eclipse Con
Xtext Eclipse Con
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation Framework
 
MongoDB World 2016 : Advanced Aggregation
MongoDB World 2016 : Advanced AggregationMongoDB World 2016 : Advanced Aggregation
MongoDB World 2016 : Advanced Aggregation
 
Webinar: Exploring the Aggregation Framework
Webinar: Exploring the Aggregation FrameworkWebinar: Exploring the Aggregation Framework
Webinar: Exploring the Aggregation Framework
 
Joins and Other Aggregation Enhancements Coming in MongoDB 3.2
Joins and Other Aggregation Enhancements Coming in MongoDB 3.2Joins and Other Aggregation Enhancements Coming in MongoDB 3.2
Joins and Other Aggregation Enhancements Coming in MongoDB 3.2
 
wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?
 
Aggregation Framework in MongoDB Overview Part-1
Aggregation Framework in MongoDB Overview Part-1Aggregation Framework in MongoDB Overview Part-1
Aggregation Framework in MongoDB Overview Part-1
 
360|iDev
360|iDev360|iDev
360|iDev
 
Aggregation Framework MongoDB Days Munich
Aggregation Framework MongoDB Days MunichAggregation Framework MongoDB Days Munich
Aggregation Framework MongoDB Days Munich
 
Avro introduction
Avro introductionAvro introduction
Avro introduction
 
Introduction to couch_db
Introduction to couch_dbIntroduction to couch_db
Introduction to couch_db
 
Learning from other's mistakes: Data-driven code analysis
Learning from other's mistakes: Data-driven code analysisLearning from other's mistakes: Data-driven code analysis
Learning from other's mistakes: Data-driven code analysis
 
Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...
 
10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data Modeling10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data Modeling
 
Understanding Connected Data through Visualization
Understanding Connected Data through VisualizationUnderstanding Connected Data through Visualization
Understanding Connected Data through Visualization
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDB
 
Embedding a language into string interpolator
Embedding a language into string interpolatorEmbedding a language into string interpolator
Embedding a language into string interpolator
 
Mongodb Aggregation Pipeline
Mongodb Aggregation PipelineMongodb Aggregation Pipeline
Mongodb Aggregation Pipeline
 
Aggregation Framework
Aggregation FrameworkAggregation Framework
Aggregation Framework
 
Erlang for data ops
Erlang for data opsErlang for data ops
Erlang for data ops
 

Viewers also liked (8)

Technical seminar on chevron nozzles
Technical seminar on chevron nozzlesTechnical seminar on chevron nozzles
Technical seminar on chevron nozzles
 
Technical seminar report on
Technical seminar report onTechnical seminar report on
Technical seminar report on
 
Presentation on iOS
Presentation on iOSPresentation on iOS
Presentation on iOS
 
Eye gaze communication
Eye gaze communicationEye gaze communication
Eye gaze communication
 
Apple iOS
Apple iOSApple iOS
Apple iOS
 
Technical Seminar PPT
Technical Seminar PPTTechnical Seminar PPT
Technical Seminar PPT
 
Introduction to Amazon Web Services
Introduction to Amazon Web ServicesIntroduction to Amazon Web Services
Introduction to Amazon Web Services
 
Google I/O 2011, Android Accelerated Rendering
Google I/O 2011, Android Accelerated RenderingGoogle I/O 2011, Android Accelerated Rendering
Google I/O 2011, Android Accelerated Rendering
 

Similar to Dex Technical Seminar (April 2011)

the productive programer: mechanics
the productive programer: mechanicsthe productive programer: mechanics
the productive programer: mechanics
elliando dias
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
Lars Albertsson
 
Structured web programming
Structured web programmingStructured web programming
Structured web programming
ahfast
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
intelliyole
 

Similar to Dex Technical Seminar (April 2011) (20)

DEX: Seminar Tutorial
DEX: Seminar TutorialDEX: Seminar Tutorial
DEX: Seminar Tutorial
 
Your Database Cannot Do this (well)
Your Database Cannot Do this (well)Your Database Cannot Do this (well)
Your Database Cannot Do this (well)
 
Slickdemo
SlickdemoSlickdemo
Slickdemo
 
Green dao
Green daoGreen dao
Green dao
 
Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)
 
Dart, unicorns and rainbows
Dart, unicorns and rainbowsDart, unicorns and rainbows
Dart, unicorns and rainbows
 
Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!Data access 2.0? Please welcome: Spring Data!
Data access 2.0? Please welcome: Spring Data!
 
the productive programer: mechanics
the productive programer: mechanicsthe productive programer: mechanics
the productive programer: mechanics
 
COLLADA & WebGL
COLLADA & WebGLCOLLADA & WebGL
COLLADA & WebGL
 
d3sparql.js demo at SWAT4LS 2014 in Berlin
d3sparql.js demo at SWAT4LS 2014 in Berlind3sparql.js demo at SWAT4LS 2014 in Berlin
d3sparql.js demo at SWAT4LS 2014 in Berlin
 
mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introduction
 
Web Development Study Jam #2 _ Basic JavaScript.pptx
Web Development Study Jam #2 _ Basic JavaScript.pptxWeb Development Study Jam #2 _ Basic JavaScript.pptx
Web Development Study Jam #2 _ Basic JavaScript.pptx
 
Angular JS2 Training Session #1
Angular JS2 Training Session #1Angular JS2 Training Session #1
Angular JS2 Training Session #1
 
Dart structured web apps
Dart   structured web appsDart   structured web apps
Dart structured web apps
 
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
Structured web programming
Structured web programmingStructured web programming
Structured web programming
 
Smoothing Your Java with DSLs
Smoothing Your Java with DSLsSmoothing Your Java with DSLs
Smoothing Your Java with DSLs
 
Spark - Philly JUG
Spark  - Philly JUGSpark  - Philly JUG
Spark - Philly JUG
 
Having Fun with Play
Having Fun with PlayHaving Fun with Play
Having Fun with Play
 

Recently uploaded

Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
FIDO Alliance
 
Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdf
Overkill Security
 

Recently uploaded (20)

Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Navigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi DaparthiNavigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi Daparthi
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
 
Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdf
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 

Dex Technical Seminar (April 2011)

  • 1. Technical Seminar April, 2011 Sergio Gómez
  • 2.
  • 9.
  • 16.
  • 17. Nodes and edges instead of tables.
  • 18. Implicit relation in the model.
  • 19. DEX is a programming librarywhich allows to manage agraph database.
  • 21.
  • 22. Data model: Typed and attributed directed multigraph.
  • 23. Typed:Node and edge instances belong to a type (label).
  • 24. Attributed: Node and edge instances may have attribute values.
  • 25. Directed: Edge can be directed or undirected.
  • 26. Multigraph: Multiple edges between two nodes.
  • 29. Virtual: constrained by the values of two attributes (foreign keys)
  • 30.
  • 31.
  • 38.
  • 43. Java Runtime Environment, v1.5 or higher.
  • 45. Windows – 32 bits (64 bits to be supported in new release)
  • 46. Linux – 32 and 64 bits
  • 47.
  • 48. Basic Concepts Main methods GraphPool newSession()  Session Session getDbGraph()  DbGraph newGraph()  Rgraph close() DEX open(filename)  GraphPool create(filename)  GraphPool close() Objects add(long) exists(long) copy(objs) union(objs) Intersection(objs) difference(objs) Graph newNodeType(name)  int newEdgeType(name)  int newNode(type)  long newEdge(type)  long newAttribute(type, name)  long setAttribute(oid, attr, value) getAttribute(oid, attr)  value select(type)  Objects select(attr, op, value)  Objects explode(oid, type)  Objects Objects.Iterator hasNext()  boolean next()  long
  • 49.
  • 56.
  • 57. DEX: Loads library and manages graph db instances.
  • 58. Graph Pool: Manages a graph db instance.
  • 59. Session: Manages a set of queries and temporary data.
  • 61. Type:
  • 71.
  • 72. Database construction Create a graph database example import edu.upc.dama.dex.core.*; … DEX dex = new DEX(); GraphPoolgpool = dex.create(“C:/image.dex”); Session s = gpool.newSession(); … … s.close(); gpool.close(); dex.close();
  • 73. Databaseconstruction Add nodes intGraph#newNodeType(String name) Creates a new node type with the given unique name. Returns the DEX node type identifier. long Graph#newNode(intnodeType) Creates a new node belonging to the given node type. Returns the DEX object identifier.
  • 74. Databaseconstruction Add edges intGraph#newEdgeType(String name, bool directed) Creates a new edge type with the given unique name. Directed or undirected edge type. Returns the DEX edge type identifier. intGraph#newRestrictedEdgeType(String name, intsrcNodeType, intdstNodeType) Creates a new directed edge type with the given unique name. (Integrity restriction) Source and destionation of the edge instances are restricted to the given node types. Returns the DEX edge type identifier. long Graph#newEdge(long tail, long head, intedgeType) Creates a new edge belonging to the given edge type. Tail is the source and head is the target (iff directed). Returns the DEX edge identifier.
  • 75. Databaseconstruction Add nodes and edges example … DbGraphdbg = s.getDbGraph(); intperson = dbg.newNodeType(“PERSON”); long p1 = dbg.newNode(person); long p2 = dbg.newNode(person); long p3 = dbg.newNode (person); intfriend = dbg.newUndirectedEdgeType(“FRIEND”); long e1 = dbg.newEdge(p1, p2, friend); long e2 = dbg.newEdge(p2, p3, friend); intloves = dbg.newEdgeType(“LOVES”); long e3 = dbg.newEdge(p1, p3, loves); … p1 p2 p3 p1 p2 p3
  • 76. Databaseconstruction Manage attributes classValue Encapsulates a value and itsdomain (data type): String, Integer, Long, Double, Boolean, Timestamp. Use themto set and getattributevaluesfortheobjects. longGraph#newAttribute(inttype, Stringname, short dataType, short kind) Creates a new attributewiththegivenuniquenameforthegivennodeoredgetype. Returnsthe DEX attributeidentifier. “dataType” can be: Value#STRING, Value#INT, Value#LONG, Value#DOUBLE, Value#BOOL, Value#TIMESTAMP. “kind” can be: Graph#ATTR_KIND_BASIC. Basic attribute (just set and getvalues). Grahp#ATTR_KIND_INDEXED. Indexedattribute (set and getvalues as well as selectoperations) Graph#ATTR_KINDUNIQUE. Indexedattribute. Unique (PK).
  • 77. Databaseconstruction Manage attributes Graph#setAttribute(longoid, longattr, Value v) Sets thegivenValueforthegivenattributetothegivenobjectidentifier. Givenattributemustbedefinedfortheobject’stype. Value ‘s data typemust match attribute’s data typeor NULL. Graph#getAttribute(longoid, longattr, Value v) GetstheValueforthegivenattribute and forthegivenobjectidentifier. Givenattributemustbedefinedfortheobject’stype.
  • 78. Databaseconstruction Manage attributes example … longname = dbg.newAttribute(person, “NAME”, Value.STRING); longage= dbg.newAttribute(person, “AGE”, Value.INT); Value v = new Value(); dbg.setAttribute(p1, age, v.setInt(18)); dbg.setAttribute(p2, name, v.setString(“KELLY")); dbg.setAttribute(p3, name, v.setString(“MARY")); … longsince = dbg.newAttribute(friend, “SINCE”, Value.INT); dbg.setAttribute(e1, since, v.setInt(2000)); dbg.setAttribute(e2, since, v.setInt(1995)); … JOHN 18 KELLY MARY JOHN 18 2000 KELLY MARY 1995
  • 79. Databaseconstruction Manage attributes example … int phones = dbg.newEdgeType("phones"); long when = dbg.newAttribute(phones, "when", Value.STRING); long e4 = dbg.newEdge(p1, p3, phones); dbg.setAttribute(e4, when, v.setString("4pm"))); long e5 = dbg.newEdge(p1, p3, phones); dbg.setAttribute(e5, when, v.setString("5pm")); long e6 = dbg.newEdge(p3, p2, phones); dbg.setAttribute(e6, when, v.setString("6pm")); … System.out.println(dbg.getAttribute(p1, name)); System.out.println(dbg.getAttribute(e4, when)); System.out.println(dbg.getAttribute(e5, when)); JOHN 18 2000 KELLY 4pm 5pm MARY 1995 6pm
  • 80.
  • 87.
  • 88. Validateconstruction Validate construction example import java.io.PrintWriter; import java.io.FileWriter; … //Default Export is used in the example by stating null. //Personalized export can be created implementing class Export PrintWriterstdOut = new PrintWriter( new FileWriter("out.graphml")); dbg.export(stdOut, Type.YGRAPHML, null); pw.close(); //Dump data file gpool.dumpData(“out.data”); //Dump internal storage file gpool.dumpStorage(“out.storage”);
  • 89. Validateconstruction Data file example Edgetypes -- 1:2 = Friend -- 2:3 = Loves -- 3:4 = phones edgetypes = 3 -- 4:1 = Person ------- #00000400 [Person] ATTR=1 //Person//age{18} TO [Friend] #00000401 [Person] ATTR=1 //Person//name{kelly} TO [Loves] #00000402 [Person] ATTR=1 //Person//name{mary} TO [phones] #00000402 [Person] ATTR=1 //Person//name{mary} #00000402 [Person] ATTR=1 //Person//name{mary} … ------- 3 nodes. node types = 4 # of edgetypes Node of typeperson Valuefor “age” attribute “Phones” out-goingedges # of nodetypes
  • 90. Validateconstruction Internal storage file example Number of nodes 2011-02-09 12:12:45.330 ... SIZE: 262KB / 2688KB NODES: 3 EDGES: 6 ... - NODES Person : N=3 ... ATTR DATA: 4 ... - //Friend//since[INDEXED|INDEXED LINK] 2/2... [1995] - [2000] - //Person//age[INDEXED|INDEXED LINK] 1/1 [18] - [18] ... Number of edges Number of “Person”s Number of attributes Name and kind of theattribute Minimum and maximumvalue # differentvalues / # values
  • 91. Validateconstruction Export file example, yEd Graph Editor <?xmlversion="1.0" encoding="ISO-8859-1"?> <graphmlxmlns="http://graphml.graphdrawing.org/xmlns/graphml" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns/graphml http://www.yworks.com/xml/schema/graphml/1.0/ygraphml.xsd"> <key id="d0" for="node" yfiles.type="nodegraphics"/> <key id="d1" for="edge" yfiles.type="edgegraphics"/> <graph id="DB" edgedefault="undirected"> <node id="0"> <data key="d0" > <y:ShapeNode> <y:Geometry height="19.0" width="20"/> <y:Fill color="#a5c3f6"/> <y:BorderStyle color="#a5c3f6"/> <y:NodeLabel fontSize="10" textColor="#000000">1024</y:NodeLabel> <y:Shape type="rectangle"/> </y:ShapeNode></data> </node> … </graph> </graphml>
  • 92.
  • 99.
  • 100. QueryDatabase Objects longObjects#union(Objectsobjs) this = this UNION objs Returnsthe new size of thecollection. longObjects#intersection(Objectsobjs) this = this INTERSECTION objs Returnsthe new size of thecollection. longObjects#difference(Objectsobjs) this = this DIFFERENCE objs Returnsthe new size of thecollection.
  • 101. QueryDatabase Retrieve data ObjectsGraph#select(int t) Retrievesobjectidentifiersbelongingtothegivennodeoredgetype. ObjectsGraph#select(longattr, short op, Value v) Retrievesobjectidentifierswhichsatisfaythequery. “op” can be: Graph#OPERATION_{EQ|NE|GT|GE|LT|LE|LIKE|ERE} longGraph#findObj(longattr, Value v) Randomlyretrievesanobjectidentifierwhich has thegivenvalueforthegivenattribute (or INVALID_OID ifnotfound). Usefulforunique atributes.
  • 102. QueryDatabase Navigation ObjectsGraph#explode(longoid, intedgeType, short direction) Retrievesout-goingor in-goingedges (orboth) fromortothegivennodeidentifier and forthegivenedgetype. “direction” can be: Graph#EDGES_IN, Graph#EDGES_OUT, Graph#EDGES_BOTH. ObjectsGraph#neighbors(longoid, intedgeType, short direction) Retrievesneighbornodestothegivennodeidentifierwhich can bereachedthroughthegivenedgetype and direction. “direction” can be: Graph#EDGES_IN, Graph#EDGES_OUT, Graph#EDGES_BOTH.
  • 103. QueryDatabase Retrieve data example … DbGraphdbg = s.getDbGraph(); Objectspersons = dbg.select(person); Objects.Iteratorit = persons.iterator(); while (it.hasNext()) { long p = it.next(); Stringname = dbg.getAttribute(p, name).toString(); } it.close(); persons.close(); … JOHN 18 JOHN 18 2000 5pm KELLY KELLY 4pm 1995 MARY MARY 6pm
  • 104. QueryDatabase Navigation & Objects operations example … Objects objs1 = dbg.select(when, >=, 5pm); // objs1 = { e5, e6 } Objects objs2 = dbg.explode(p1, phones, OUT); // objs2 = { e4, e5 } Objectsobjs = objs1.intersection(objs2); // objs = { e5, e6 } ∩ { e4, e5 } = { e5 } … objs.close(); objs1.close(); objs2.close(); … JOHN 18 JOHN 18 2000 5pm KELLY KELLY 4pm 1995 MARY MARY 6pm
  • 105.
  • 112.
  • 113. GraphAlgorithms Traversals example Graphgraph = … // graphinstance long idsource= … // sourcenode TraversalBFSbfs = new TraversalBFS(graph, idsource); // Addingtheallowededgetypes for traversingthegraph fs.addEdge(graph.findType("street"), Algorithm.NAVIGATION_FORWARD); bfs.addEdge(graph.findType("road"), Algorithm.NAVIGATION_FORWARD); // Addingtheallowed node types for traversingthegraph bfs.addAllNodes(); // Runningthealgorithm long idnode; while(bfs.hasNext()) { idnode= bfs.next(); } // Closingthetraversal bfs.close();
  • 114. GraphAlgorithms Shortest paths classSinglePairShortestPath Findstheshortestpathbetweentwogivennodeidentifiers. Node and edgetypes can befilteredout. ClassSinglePairShortestPathBFS Uses a BFS traversaltofindtheshortestpath. For un-weightededges. ClassSinglePairShortestPathDijkstra Uses a Dijkstraalgorithmtofindtheshortestpath. Forweightededges.
  • 115. GraphAlgorithms ShortestPath example Graphgraph = … // graphinstance long idsource = … // sourcenode longiddestination = … // destinationnode SinglePairShortestPathBFSsp= new SinglePairShortestPathBFS(graph, idsource, iddestination); // Addingtheallowededgetypes for traversingthegraph sp.addEdge(graph.findType("street"), Algorithm.NAVIGATION_FORWARD); sp.addEdge(graph.findType("road"), Algorithm.NAVIGATION_UNDIRECTED); // Settingthemaximumhops sp.setMaximumHops(7); // Runningthealgorithm sp.run(); // Retrievingthegeneratedresults if(sp.existsShortestPath()) { long[] spAsNodes= sp.getPathAsNodes(); long[] spAsEdges= sp.getPathAsEdges(); inthopsDone= sp.getCost(); } // Closingtheinstance sp.close();
  • 116. GraphAlgorithms Connected components classConnectivity Retrievesconnectedcomponents of thegivengraph. Node and edgetypes can befilteredout. Connectedcomponents can bematerializedintoanattribute. classStrongConnectivityGabow Retrievesstrongconnectedcomponents in a directedgraph. Uses theGabowalgorithm. classWeakConnectivityDFS Retrievesweaklyconnectedcomponents in a undirectedgraphor in a directedgraph (ignoringdirections). Uses a DFS algorithm.
  • 117.
  • 124.
  • 125. Script loaders Load nodes LOAD NODES file_name COLUMNS attribute_name [alias_name], … INTO node_type_name [IGNORE (attribute_name|alias_name), …] [FIELDS [TERMINATED char] [ENCLOSED char] [ALLOW_MULTILINE]] [FROM num] [MAX num] [MODE (ROWS|COLUMNS [SPLIT [PARTITIONS num]])]
  • 126. Script loaders Load edges LOAD EDGES file_name COLUMNS attribute_name [alias_name], … INTO node_type_name [IGNORE (attribute_name|alias_name), …] WHERE TAIL (attribute_name|alias_name) = node_type_name.attribute_name HEAD (attribute_name|alias_name) = node_type_name.attribute_name [FIELDS [TERMINATED char] [ENCLOSED char] [ALLOW_MULTILINE]] [FROM num] [MAX num] [MODE (ROWS|COLUMNS [SPLIT [PARTITIONS num]])]
  • 127.
  • 134.
  • 137. Schema
  • 140. Select
  • 142.
  • 144. Attributes used at select operations must be indexed.
  • 145. Optionally, index once the attribute has been created/loaded.
  • 147.
  • 148. String
  • 151. Select [==, !=, >, >=, <, <=, ERE]
  • 155. Just get and set.
  • 156.
  • 158. 32 – 64 bits, OS independent.
  • 163. Set the maximum memory usage.
  • 166.