0
Technical Seminar<br />April, 2011<br />Sergio Gómez<br />
Index<br /><ul><li>Introduction
Basic Concepts
Database construction
Validate construction
Query database
Graph algorithms
Script loaders
Tips & tricks </li></li></ul><li>Index<br /><ul><li>Introduction
Basic Concepts
Database construction
Validate construction
Query database
Graph algorithms
Script loaders
Tips & tricks </li></li></ul><li>Introduction<br />Graph database<br /><ul><li>Graph databases focus on the structure of t...
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.</li></li></ul><li>Introduction<br />DEX Definition<br /><ul><li>Persistent and temporar...
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</li></li></ul><li>Introduction<br />Graph Model<br />
Index<br /><ul><li>Introduction
Basic Concepts
Database construction
Validate construction
Query database
Graph algorithms
Script loaders
Tips & tricks </li></li></ul><li>Basic Concepts<br /><ul><li>Java library: jdex.jar public API
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</li></li></ul><li>Basic Concepts<br />Class Diagram<br />Graphfactory<br />Persistent DB<br />Sess...
Basic Concepts<br />Main methods<br />GraphPool<br />newSession()  Session<br />Session<br />getDbGraph()  DbGraph<br />...
Index<br /><ul><li>Introduction
Basic Concepts
Upcoming SlideShare
Loading in...5
×

Dex Technical Seminar (April 2011)

608

Published on

Dex Technical Seminar (April 2011):
- Introduction
- Database construction
- Query operations
- Graph algorithms

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
608
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Dex Technical Seminar (April 2011)"

  1. 1. Technical Seminar<br />April, 2011<br />Sergio Gómez<br />
  2. 2. Index<br /><ul><li>Introduction
  3. 3. Basic Concepts
  4. 4. Database construction
  5. 5. Validate construction
  6. 6. Query database
  7. 7. Graph algorithms
  8. 8. Script loaders
  9. 9. Tips & tricks </li></li></ul><li>Index<br /><ul><li>Introduction
  10. 10. Basic Concepts
  11. 11. Database construction
  12. 12. Validate construction
  13. 13. Query database
  14. 14. Graph algorithms
  15. 15. Script loaders
  16. 16. Tips & tricks </li></li></ul><li>Introduction<br />Graph database<br /><ul><li>Graph databases focus on the structure of the model.
  17. 17. Nodes and edges instead of tables.
  18. 18. Implicit relation in the model.
  19. 19. DEX is a programming librarywhich allows to manage agraph database.
  20. 20. Very large datasets.
  21. 21. High performance query processing.</li></li></ul><li>Introduction<br />DEX Definition<br /><ul><li>Persistent and temporary graph management programming library.
  22. 22. Data model: Typed and attributed directed multigraph.
  23. 23. Typed:Node and edge instances belong to a type (label).
  24. 24. Attributed: Node and edge instances may have attribute values.
  25. 25. Directed: Edge can be directed or undirected.
  26. 26. Multigraph: Multiple edges between two nodes.
  27. 27. Type of edges:
  28. 28. Materialized: directed and undirected.
  29. 29. Virtual: constrained by the values of two attributes (foreign keys)
  30. 30. Just for navigation</li></li></ul><li>Introduction<br />Graph Model<br />
  31. 31. Index<br /><ul><li>Introduction
  32. 32. Basic Concepts
  33. 33. Database construction
  34. 34. Validate construction
  35. 35. Query database
  36. 36. Graph algorithms
  37. 37. Script loaders
  38. 38. Tips & tricks </li></li></ul><li>Basic Concepts<br /><ul><li>Java library: jdex.jar public API
  39. 39. Native library
  40. 40. Linux: libjdex.so
  41. 41. Windows: jdex.dll
  42. 42. System requirements:
  43. 43. Java Runtime Environment, v1.5 or higher.
  44. 44. Operative system:
  45. 45. Windows – 32 bits (64 bits to be supported in new release)
  46. 46. Linux – 32 and 64 bits
  47. 47. Soon to announce Mac OS</li></li></ul><li>Basic Concepts<br />Class Diagram<br />Graphfactory<br />Persistent DB<br />Session<br />GraphPool<br />DbGraph<br />1<br />N<br />DEX<br />1<br />1<br />N<br />1<br />Graph<br />1<br />1<br />RGraph<br />N<br />N<br />Objects<br />Set of OIDs<br />Temporary<br />
  48. 48. Basic Concepts<br />Main methods<br />GraphPool<br />newSession()  Session<br />Session<br />getDbGraph()  DbGraph<br />newGraph()  Rgraph<br />close()<br />DEX<br />open(filename)  GraphPool<br />create(filename)  GraphPool<br />close()<br />Objects<br />add(long)<br />exists(long)<br />copy(objs)<br />union(objs)<br />Intersection(objs)<br />difference(objs)<br />Graph<br />newNodeType(name)  int<br />newEdgeType(name)  int<br />newNode(type)  long<br />newEdge(type)  long<br />newAttribute(type, name)  long<br />setAttribute(oid, attr, value)<br />getAttribute(oid, attr)  value<br />select(type)  Objects<br />select(attr, op, value)  Objects<br />explode(oid, type)  Objects<br />Objects.Iterator<br />hasNext()  boolean<br />next()  long<br />
  49. 49. Index<br /><ul><li>Introduction
  50. 50. Basic Concepts
  51. 51. Database construction
  52. 52. Validate construction
  53. 53. Query database
  54. 54. Graph algorithms
  55. 55. Script loaders
  56. 56. Tips & tricks </li></li></ul><li>Database construction<br /><ul><li>Graph
  57. 57. DEX: Loads library and manages graph db instances.
  58. 58. Graph Pool: Manages a graph db instance.
  59. 59. Session: Manages a set of queries and temporary data.
  60. 60. Nodes & Edges
  61. 61. Type:
  62. 62. DEX identifier (integer)
  63. 63. Public identifier (string)
  64. 64. Instance:
  65. 65. DEX identifier (long) – OID
  66. 66. belongsto a type
  67. 67. Attributes
  68. 68. Attribute:
  69. 69. DEX identifier (long)
  70. 70. public identifier (string)
  71. 71. Scope: type or global</li></li></ul><li>Databaseconstruction<br />Create a graph database<br />GraphPoolDEX#create(String name)<br />Creates a new graph database instance.<br />Returns the GraphPool instance to manage the new graph database instance.<br />GraphPool DEX#open(String name)<br />Opens an existing graph database instance.<br />Returns the GraphPool instance to manage the existing graph database instance.<br />Session GraphPool#newSession()<br />Initiates a new user Session.<br />DbGraph Session#getDbGraph()<br />Gets the Graph instance representing the persistent graph database.<br />
  72. 72. Database construction<br />Create a graph database example<br />import edu.upc.dama.dex.core.*;<br />…<br />DEX dex = new DEX();<br />GraphPoolgpool = dex.create(“C:/image.dex”);<br />Session s = gpool.newSession();<br />…<br />…<br />s.close();<br />gpool.close();<br />dex.close();<br />
  73. 73. Databaseconstruction<br />Add nodes<br />intGraph#newNodeType(String name)<br />Creates a new node type with the given unique name.<br />Returns the DEX node type identifier.<br />long Graph#newNode(intnodeType)<br />Creates a new node belonging to the given node type. Returns the DEX object identifier.<br />
  74. 74. Databaseconstruction<br />Add edges<br />intGraph#newEdgeType(String name, bool directed)<br />Creates a new edge type with the given unique name. Directed or undirected edge type. <br />Returns the DEX edge type identifier.<br />intGraph#newRestrictedEdgeType(String name, intsrcNodeType, intdstNodeType)<br />Creates a new directed edge type with the given unique name.<br />(Integrity restriction) Source and destionation of the edge instances are restricted to the given node types.<br />Returns the DEX edge type identifier.<br />long Graph#newEdge(long tail, long head, intedgeType)<br />Creates a new edge belonging to the given edge type. <br />Tail is the source and head is the target (iff directed).<br />Returns the DEX edge identifier.<br />
  75. 75. Databaseconstruction<br />Add nodes and edges example<br />…<br />DbGraphdbg = s.getDbGraph();<br />intperson = dbg.newNodeType(“PERSON”);<br />long p1 = dbg.newNode(person);<br />long p2 = dbg.newNode(person);<br />long p3 = dbg.newNode (person);<br />intfriend = dbg.newUndirectedEdgeType(“FRIEND”);<br />long e1 = dbg.newEdge(p1, p2, friend);<br />long e2 = dbg.newEdge(p2, p3, friend);<br />intloves = dbg.newEdgeType(“LOVES”);<br />long e3 = dbg.newEdge(p1, p3, loves);<br />…<br />p1<br />p2<br />p3<br />p1<br />p2<br />p3<br />
  76. 76. Databaseconstruction<br />Manage attributes<br />classValue<br />Encapsulates a value and itsdomain (data type): String, Integer, Long, Double, Boolean, Timestamp. <br />Use themto set and getattributevaluesfortheobjects.<br />longGraph#newAttribute(inttype, Stringname, short dataType, short kind)<br />Creates a new attributewiththegivenuniquenameforthegivennodeoredgetype. <br />Returnsthe DEX attributeidentifier.<br />“dataType” can be: Value#STRING, Value#INT, Value#LONG, Value#DOUBLE, Value#BOOL, Value#TIMESTAMP.<br />“kind” can be:<br />Graph#ATTR_KIND_BASIC. Basic attribute (just set and getvalues).<br />Grahp#ATTR_KIND_INDEXED. Indexedattribute (set and getvalues as well as selectoperations)<br />Graph#ATTR_KINDUNIQUE. Indexedattribute. Unique (PK).<br />
  77. 77. Databaseconstruction<br />Manage attributes<br />Graph#setAttribute(longoid, longattr, Value v)<br />Sets thegivenValueforthegivenattributetothegivenobjectidentifier. <br />Givenattributemustbedefinedfortheobject’stype. <br />Value ‘s data typemust match attribute’s data typeor NULL.<br />Graph#getAttribute(longoid, longattr, Value v)<br />GetstheValueforthegivenattribute and forthegivenobjectidentifier. <br />Givenattributemustbedefinedfortheobject’stype. <br />
  78. 78. Databaseconstruction<br />Manage attributes example<br />…<br />longname = dbg.newAttribute(person, “NAME”, Value.STRING);<br />longage= dbg.newAttribute(person, “AGE”, Value.INT);<br />Value v = new Value();<br />dbg.setAttribute(p1, age, v.setInt(18));<br />dbg.setAttribute(p2, name, v.setString(“KELLY"));<br />dbg.setAttribute(p3, name, v.setString(“MARY"));<br />…<br />longsince = dbg.newAttribute(friend, “SINCE”, Value.INT);<br />dbg.setAttribute(e1, since, v.setInt(2000));<br />dbg.setAttribute(e2, since, v.setInt(1995));<br />…<br />JOHN<br />18<br />KELLY<br />MARY<br />JOHN<br />18<br />2000<br />KELLY<br />MARY<br />1995<br />
  79. 79. Databaseconstruction<br />Manage attributes example<br />…<br />int phones = dbg.newEdgeType("phones");<br />long when = dbg.newAttribute(phones, "when", Value.STRING);<br />long e4 = dbg.newEdge(p1, p3, phones);<br />dbg.setAttribute(e4, when, v.setString("4pm")));<br />long e5 = dbg.newEdge(p1, p3, phones);<br />dbg.setAttribute(e5, when, v.setString("5pm"));<br />long e6 = dbg.newEdge(p3, p2, phones);<br />dbg.setAttribute(e6, when, v.setString("6pm"));<br />…<br />System.out.println(dbg.getAttribute(p1, name));<br />System.out.println(dbg.getAttribute(e4, when));<br />System.out.println(dbg.getAttribute(e5, when));<br />JOHN<br />18<br />2000<br />KELLY<br />4pm<br />5pm<br />MARY<br />1995<br />6pm<br />
  80. 80. Index<br /><ul><li>Introduction
  81. 81. Basic Concepts
  82. 82. Database construction
  83. 83. Validate construction
  84. 84. Query database
  85. 85. Graph algorithms
  86. 86. Script loaders
  87. 87. Tips & tricks </li></li></ul><li>Validateconstruction<br />GraphPool#dumpData(File f)<br />Dumps a summary of thelogicalcontent of thegraphdatabase.<br />GraphPool#dumpStorage(File f)<br />Dumpsinternalinformationaboutstoragecontent of thegraphdatabase.<br />Graph#export(PrintWriterpw, short kind, Export e)<br />Exportsthegraphtoanexternalformat.<br />“kind” can be: GRAPHVIZ or YGRAPHML.<br />Export defines thevisualization (ifnull, default export).<br />
  88. 88. Validateconstruction<br />Validate construction example<br />import java.io.PrintWriter;<br />import java.io.FileWriter;<br />…<br />//Default Export is used in the example by stating null. <br />//Personalized export can be created implementing class Export PrintWriterstdOut = new PrintWriter(<br /> new FileWriter("out.graphml"));<br />dbg.export(stdOut, Type.YGRAPHML, null);<br />pw.close();<br />//Dump data file<br />gpool.dumpData(“out.data”);<br />//Dump internal storage file<br />gpool.dumpStorage(“out.storage”);<br />
  89. 89. Validateconstruction<br />Data file example<br />Edgetypes<br />-- 1:2 = Friend<br />-- 2:3 = Loves<br />-- 3:4 = phones<br />edgetypes = 3<br />-- 4:1 = Person<br />------- #00000400 [Person]<br /> ATTR=1 //Person//age{18}<br /> TO [Friend]<br /> #00000401 [Person] ATTR=1 //Person//name{kelly}<br /> TO [Loves]<br /> #00000402 [Person] ATTR=1 //Person//name{mary}<br /> TO [phones]<br /> #00000402 [Person] ATTR=1 //Person//name{mary}<br /> #00000402 [Person] ATTR=1 //Person//name{mary}<br />…<br />------- 3 nodes.<br />node types = 4<br /># of edgetypes<br />Node of typeperson<br />Valuefor “age” attribute<br />“Phones” out-goingedges<br /># of nodetypes<br />
  90. 90. Validateconstruction<br />Internal storage file example<br />Number of nodes<br />2011-02-09 12:12:45.330 <br />...<br />SIZE: 262KB / 2688KB <br />NODES: 3 <br />EDGES: 6 <br />...<br /> - NODES Person : N=3<br />...<br /> ATTR DATA: 4 ...<br /> - //Friend//since[INDEXED|INDEXED LINK] 2/2...<br /> [1995] - [2000]<br /> - //Person//age[INDEXED|INDEXED LINK] 1/1<br /> [18] - [18]<br />...<br />Number of edges<br />Number of “Person”s<br />Number of attributes<br />Name and kind of theattribute<br />Minimum and maximumvalue<br /># differentvalues / # values<br />
  91. 91. Validateconstruction<br />Export file example, yEd Graph Editor<br /><?xmlversion="1.0" encoding="ISO-8859-1"?><br /><graphmlxmlns="http://graphml.graphdrawing.org/xmlns/graphml" <br />xmlns:y="http://www.yworks.com/xml/graphml" <br />xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <br />xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns/graphml <br /> http://www.yworks.com/xml/schema/graphml/1.0/ygraphml.xsd"><br /> <key id="d0" for="node" yfiles.type="nodegraphics"/><br /> <key id="d1" for="edge" yfiles.type="edgegraphics"/><br /> <graph id="DB" edgedefault="undirected"><br /> <node id="0"><br /> <data key="d0" ><br /> <y:ShapeNode><br /> <y:Geometry height="19.0" width="20"/><br /> <y:Fill color="#a5c3f6"/><br /> <y:BorderStyle color="#a5c3f6"/><br /> <y:NodeLabel fontSize="10" textColor="#000000">1024</y:NodeLabel><br /> <y:Shape type="rectangle"/> </y:ShapeNode></data><br /> </node><br />…<br /> </graph><br /></graphml><br />
  92. 92. Index<br /><ul><li>Introduction
  93. 93. Basic Concepts
  94. 94. Database construction
  95. 95. Validate construction
  96. 96. Query database
  97. 97. Graph algorithms
  98. 98. Script loaders
  99. 99. Tips & tricks </li></li></ul><li>QueryDatabase<br />Objects<br />classObjects<br />Unordered set of OIDsforlargecollections.<br />Implements Set<Long>, Iterable<Long>, Closeable.<br />booleanObjects#add(longoid)<br />Addsthegiven OID tothecollection.<br />Returns true ifadded, false ifthe OID wasalreadyintothecollection.<br />booleanObjects#exists(longoid)<br />Returns true ifthegiven OID existsintothecollection, false otherwise.<br />booleanObjects#remove(longoid)<br />Removesthegiven OID fromthecollection.<br />Returns true if removed or false ifthe OID wasnotintothecollection.<br />
  100. 100. QueryDatabase<br />Objects<br />longObjects#union(Objectsobjs)<br />this = this UNION objs<br />Returnsthe new size of thecollection.<br />longObjects#intersection(Objectsobjs)<br />this = this INTERSECTION objs<br />Returnsthe new size of thecollection.<br />longObjects#difference(Objectsobjs)<br />this = this DIFFERENCE objs<br />Returnsthe new size of thecollection.<br />
  101. 101. QueryDatabase<br />Retrieve data<br />ObjectsGraph#select(int t)<br />Retrievesobjectidentifiersbelongingtothegivennodeoredgetype.<br />ObjectsGraph#select(longattr, short op, Value v)<br />Retrievesobjectidentifierswhichsatisfaythequery.<br />“op” can be: Graph#OPERATION_{EQ|NE|GT|GE|LT|LE|LIKE|ERE}<br />longGraph#findObj(longattr, Value v)<br />Randomlyretrievesanobjectidentifierwhich has thegivenvalueforthegivenattribute (or INVALID_OID ifnotfound).<br />Usefulforunique atributes.<br />
  102. 102. QueryDatabase<br />Navigation<br />ObjectsGraph#explode(longoid, intedgeType, short direction)<br />Retrievesout-goingor in-goingedges (orboth) fromortothegivennodeidentifier and forthegivenedgetype.<br />“direction” can be: Graph#EDGES_IN, Graph#EDGES_OUT, Graph#EDGES_BOTH.<br />ObjectsGraph#neighbors(longoid, intedgeType, short direction)<br />Retrievesneighbornodestothegivennodeidentifierwhich can bereachedthroughthegivenedgetype and direction.<br />“direction” can be: Graph#EDGES_IN, Graph#EDGES_OUT, Graph#EDGES_BOTH.<br />
  103. 103. QueryDatabase<br />Retrieve data example<br />…<br />DbGraphdbg = s.getDbGraph();<br />Objectspersons = dbg.select(person);<br />Objects.Iteratorit = persons.iterator();<br />while (it.hasNext()) {<br />long p = it.next();<br />Stringname = dbg.getAttribute(p, name).toString();<br />}<br />it.close();<br />persons.close();<br />…<br />JOHN<br />18<br />JOHN<br />18<br />2000<br />5pm<br />KELLY<br />KELLY<br />4pm<br />1995<br />MARY<br />MARY<br />6pm<br />
  104. 104. QueryDatabase<br />Navigation & Objects operations example<br />…<br />Objects objs1 = dbg.select(when, >=, 5pm);<br />// objs1 = { e5, e6 }<br />Objects objs2 = dbg.explode(p1, phones, OUT);<br />// objs2 = { e4, e5 }<br />Objectsobjs = objs1.intersection(objs2);<br />// objs = { e5, e6 } ∩ { e4, e5 } = { e5 }<br />…<br />objs.close();<br />objs1.close();<br />objs2.close();<br />…<br />JOHN<br />18<br />JOHN<br />18<br />2000<br />5pm<br />KELLY<br />KELLY<br />4pm<br />1995<br />MARY<br />MARY<br />6pm<br />
  105. 105. Index<br /><ul><li>Introduction
  106. 106. Basic Concepts
  107. 107. Database construction
  108. 108. Validate construction
  109. 109. Query database
  110. 110. Graph algorithms
  111. 111. Script loaders
  112. 112. Tips & tricks </li></li></ul><li>GraphAlgorithms<br />Traversals<br />classTraversal<br />ImplementsIterator<Long>: hasNext(), next().<br />Traversesthegraphfrom a givennodeidentifier.<br />Node and edgetypes can befilteredout.<br />ClassTraversalBFS<br />Uses a BFS (breadth-firstsearch ) algorithm.<br />ClassTraversalDFS<br />Uses a DFS (depth-firstsearch ) algorithm.<br />
  113. 113. GraphAlgorithms<br />Traversals example<br />Graphgraph = … // graphinstance<br />long idsource= … // sourcenode<br />TraversalBFSbfs = new TraversalBFS(graph, idsource);<br />// Addingtheallowededgetypes for traversingthegraph<br />fs.addEdge(graph.findType("street"), Algorithm.NAVIGATION_FORWARD);<br />bfs.addEdge(graph.findType("road"), Algorithm.NAVIGATION_FORWARD);<br />// Addingtheallowed node types for traversingthegraph<br />bfs.addAllNodes();<br />// Runningthealgorithm<br />long idnode;<br />while(bfs.hasNext()) {<br />idnode= bfs.next();<br />}<br />// Closingthetraversal<br />bfs.close();<br />
  114. 114. GraphAlgorithms<br />Shortest paths<br />classSinglePairShortestPath<br />Findstheshortestpathbetweentwogivennodeidentifiers.<br />Node and edgetypes can befilteredout.<br />ClassSinglePairShortestPathBFS<br />Uses a BFS traversaltofindtheshortestpath.<br />For un-weightededges.<br />ClassSinglePairShortestPathDijkstra<br />Uses a Dijkstraalgorithmtofindtheshortestpath.<br />Forweightededges.<br />
  115. 115. GraphAlgorithms<br />ShortestPath example<br />Graphgraph = … // graphinstance<br />long idsource = … // sourcenode<br />longiddestination = … // destinationnode<br />SinglePairShortestPathBFSsp=<br />new SinglePairShortestPathBFS(graph, idsource, iddestination);<br />// Addingtheallowededgetypes for traversingthegraph<br />sp.addEdge(graph.findType("street"), Algorithm.NAVIGATION_FORWARD);<br />sp.addEdge(graph.findType("road"), Algorithm.NAVIGATION_UNDIRECTED);<br />// Settingthemaximumhops<br />sp.setMaximumHops(7);<br />// Runningthealgorithm<br />sp.run();<br />// Retrievingthegeneratedresults<br />if(sp.existsShortestPath()) {<br />long[] spAsNodes= sp.getPathAsNodes();<br />long[] spAsEdges= sp.getPathAsEdges();<br />inthopsDone= sp.getCost();<br />}<br />// Closingtheinstance<br />sp.close();<br />
  116. 116. GraphAlgorithms<br />Connected components<br />classConnectivity<br />Retrievesconnectedcomponents of thegivengraph.<br />Node and edgetypes can befilteredout.<br />Connectedcomponents can bematerializedintoanattribute.<br />classStrongConnectivityGabow<br />Retrievesstrongconnectedcomponents in a directedgraph.<br />Uses theGabowalgorithm.<br />classWeakConnectivityDFS<br />Retrievesweaklyconnectedcomponents in a undirectedgraphor in a directedgraph (ignoringdirections).<br />Uses a DFS algorithm.<br />
  117. 117. Index<br /><ul><li>Introduction
  118. 118. Basic Concepts
  119. 119. Database construction
  120. 120. Validate construction
  121. 121. Query database
  122. 122. Graph algorithms
  123. 123. Script loaders
  124. 124. Tips & tricks </li></li></ul><li>Script loaders<br />Schema definition<br />CREATE DBGRAPH alias INTO filename<br />CREATE NODE node_type_name "(“<br /> [attribute_name<br /> (INT|LONG|DOUBLE|STRING|BOOLEAN|TIMESTAMP|TEXT)<br /> [INDEXED|UNIQUE|BASIC]<br /> , ...]<br />")“<br />CREATE [UNDIRECTED|VIRTUAL] EDGE edge_type_name<br />[FROM node_type_name[.attribute_name] <br />TO node_type_name[.attribute_name]] "(“<br /> [attribute_name<br /> (INT|LONG|DOUBLE|STRING|BOOLEAN|TIMESTAMP|TEXT)<br /> [INDEXED|UNIQUE|BASIC]<br /> , ...]<br />") [MATERIALIZE NEIGHBORS]"<br />
  125. 125. Script loaders<br />Load nodes<br />LOAD NODES file_name<br /> COLUMNS attribute_name [alias_name], …<br /> INTO node_type_name<br /> [IGNORE (attribute_name|alias_name), …]<br /> [FIELDS<br /> [TERMINATED char]<br /> [ENCLOSED char]<br /> [ALLOW_MULTILINE]]<br /> [FROM num]<br /> [MAX num]<br /> [MODE (ROWS|COLUMNS [SPLIT [PARTITIONS num]])]<br />
  126. 126. Script loaders<br />Load edges<br />LOAD EDGES file_name<br /> COLUMNS attribute_name [alias_name], …<br /> INTO node_type_name<br /> [IGNORE (attribute_name|alias_name), …]<br /> WHERE<br />TAIL (attribute_name|alias_name) = node_type_name.attribute_name<br /> HEAD (attribute_name|alias_name) = node_type_name.attribute_name<br /> [FIELDS<br /> [TERMINATED char]<br /> [ENCLOSED char]<br /> [ALLOW_MULTILINE]]<br /> [FROM num]<br /> [MAX num]<br /> [MODE (ROWS|COLUMNS [SPLIT [PARTITIONS num]])]<br />
  127. 127. Index<br /><ul><li>Introduction
  128. 128. Basic Concepts
  129. 129. Database construction
  130. 130. Validate construction
  131. 131. Query database
  132. 132. Graph algorithms
  133. 133. Script loaders
  134. 134. Tips & tricks </li></li></ul><li>Tips & tricks<br /><ul><li>Shell
  135. 135. java –cp jdex.jaredu.upc.dama.dex.shell.Shell
  136. 136. Explore database:
  137. 137. Schema
  138. 138. Instances
  139. 139. Execute basic queries:
  140. 140. Select
  141. 141. Explode
  142. 142. Neighbors</li></li></ul><li>Tips & tricks<br /><ul><li>Index or not?
  143. 143. Attributes:
  144. 144. Attributes used at select operations must be indexed.
  145. 145. Optionally, index once the attribute has been created/loaded.
  146. 146. Neighbors:
  147. 147. Edge types used at neighbors operations it is recommended to be indexed.</li></li></ul><li>Tips & tricks<br /><ul><li>String attributes
  148. 148. String
  149. 149. Maximum length = 2048.
  150. 150. Indexed or not.
  151. 151. Select [==, !=, >, >=, <, <=, ERE]
  152. 152. Text (Character large object)
  153. 153. Unlimited length.
  154. 154. Not Indexed.
  155. 155. Just get and set.
  156. 156. Streaming read and write operations.</li></li></ul><li>Tips & tricks<br /><ul><li>Others:
  157. 157. DB cross-platform format.
  158. 158. 32 – 64 bits, OS independent.
  159. 159. Justconsidere platform endianess.
  160. 160. Read only mode.
  161. 161. Configuration:
  162. 162. edu.upc.dama.dex.utils.DEXConfig
  163. 163. Set the maximum memory usage.
  164. 164. 0 means unlimited.
  165. 165. License.
  166. 166. No license means evaluation version.</li></li></ul><li>Thanks for your<br />attention<br />Any questions?<br />SPARSITY-TECHNOLOGIES<br />Jordi Girona, 1-3, Edifici K2M 08034 Barcelona<br />info@sparsity-technologies.com<br />http://www.sparsity-technologies.com<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×