getting your hands on graphs
TRANSCRIPT
![Page 1: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/1.jpg)
Getting Your Hands On Graphs
Nathan T FreemanChief Software Architect
![Page 2: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/2.jpg)
Why Framed Graphs• Performance• Flexibility• Ease of Use• Low Risk
![Page 3: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/3.jpg)
Today’s Mission• Help you understand the power of
GraphNSF• Show you concrete examples• Avoid making your brain hurt– But please understand, we’re drinking from a
firehose for two hours– This is all I’ve done since 2014
![Page 4: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/4.jpg)
Quick Graph Review• Graphs are collections of vertices & edges• Vertices are the entities of interest• Edges are the relationships between them• Vertices have whatever properties you
want to give them• So do Edges• There are no indices to define relationships• In fact there are no indices at all
![Page 5: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/5.jpg)
Quick Framed Graph Review• Framed Graphs map Java objects to
Vertices & Edges• No classes required; all implementation is
synthetic via interfaces• Uses @annotations to define model rules• Specific implementations are optional and
extensible• Best expressed with Vertices as nouns,
Edges as verbs
![Page 6: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/6.jpg)
What GraphNSF Does to Notes Data• Virtualization layer via Java plugin• All NSFs can be included in a contiguous
data set• On-demand• 4 models for all contents:– It’s a Document db– It’s a Map db– It’s a Graph db– It’s a Java object db (with schemas!)
![Page 7: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/7.jpg)
Framed Graph Example• Event vertex: MWLUG• Presentation vertex: Hands on
Graphs• Person vertex: Nathan T Freeman• Person vertex: Bob Kadrie• Person vertex: Devin Olson• HappensAt edge• Presents edge• Attends edge
MWLUG
Hands on Graphs
Bob Kadrie
Devin Olson
Nathan Freeman
![Page 8: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/8.jpg)
Movie vertex: Suicide SquadActor vertex: Will SmithActor vertex: Margot RobbieStarsIn edgeMovie vertex: FocusActor vertex: Jared LetoCharacter vertex: JokerPortrays edgeActor vertex: Heath LedgerCharacter vertex: Will SmithAppearsIn edge
r
![Page 9: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/9.jpg)
Today’s Plan – Org Chart Graph
EnterprisePerson
DepartmentPosition
EmployedAt
ReportsInto
DivisionOfAssignedTo
Manages
ReportsTo
![Page 10: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/10.jpg)
Enterprise Vertex• Name–@Property, @TypedProperty, @TypeValue
• Adjacent Departments–@Adjacent, @AdjacentUnique
• Adjacent Persons
![Page 11: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/11.jpg)
Person Vertex• First Name• Last Name• Email• Phone• Adjacent Enterprise• Adjacent Positions
![Page 12: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/12.jpg)
Department Vertex• Name• Adjacent Departments (sub-departments)• Adjacent Department (parent department)• Adjacent Positions• Adjacent Manager Position
![Page 13: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/13.jpg)
Position Vertex• Title• Description• Adjacent Department• Adjacent Persons (Reports)• Adjacent Person (Boss)
![Page 14: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/14.jpg)
A look back at edges• EmployedAt– Start date– End date–@InVertex, @OutVertex–@Incidence, @IncidenceUnique
• AssignedTo– Start date– End date
![Page 15: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/15.jpg)
Assembling the plugin• IGraphFactory interface• Extension point• Defining ElementStores• Naming our Graph
![Page 16: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/16.jpg)
We have a Graph. What next?
![Page 17: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/17.jpg)
Everything begins with a Vertex• Start at the top• Start with me• Start with a search
![Page 18: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/18.jpg)
From there we branch out• Given a vertex, iterate adjacency until you
get what you need• Example: Find X’s peers• Example: Find grandboss• Example: Find everyone in department
![Page 19: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/19.jpg)
ODA REST API• Based on DAS (Had to modify IBM’s code a
little)• Currently frames only• Other modes coming (or you can start
writing!)
![Page 20: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/20.jpg)
REST API Basics• Hey, I wrote some documentation!– https://wiki.openntf.org/display/ODA/How+to
+use+the+ODA+REST+API– Okay, Keith helped
• http://server/api/oda/frames/mwlug– Route to collections
• http://server/api/oda/frame/mwlug– Route to elements
![Page 21: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/21.jpg)
REST API Supported Methods• GET, POST, PUT, DELETE, PATCH• GETs use query parameters• DELETEs use query parameters• POST, PUT, PATCH use JSON payloads
![Page 22: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/22.jpg)
REST API Common GET params• /frames/– ?type=[namespace]– &key=[string]– &filterkey/filtervalue, &partialkey/partialvalue,
&startskey/startsvalue– &orderby=[property list (comma-separated)]
• /frame/– ?id=[identifier]– &edges– &label=[edge label list (comma-separated]– &orderby=[property list (comma-separated)]
– &vertices
![Page 23: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/23.jpg)
REST API Common POST params• /frames/ - none. Only payload• /frame/– ?id=[identifier]– Payload is one or more edges
![Page 24: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/24.jpg)
REST API Common PUT params• /frames/ - none• /frame/– ?id=[identifier]– Payload is complete vertex/edge contents
![Page 25: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/25.jpg)
REST API Common PATCH params• /frames/– Payload is JSON Array of updates
• /frame/– ?id=[identifier]– Payload is delta-only for vertex or edge
![Page 26: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/26.jpg)
REST API Common DELETE params• /frames/ - none• /frame/– ?id=[identifiers (comma-separated)]
![Page 27: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/27.jpg)
REST API Demos
![Page 28: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/28.jpg)
Advanced Stuff• We already have Persons• They are in the Directory!• Can we put the Directory in the graph?
![Page 29: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/29.jpg)
The Problem• When we create edges between vertices,
the vertices are modified.• This could mean a LOT of updates to the
Directory in an active graph• Lots of updates to the Directory is double
plus bad
![Page 30: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/30.jpg)
The Solution: Proxy Vertices• Proxies can be configured per Element
Store• Create mirror documents per vertex to hold
graph info• Non-graph properties are passed through
to original• DirPerson Vertex• BoundTo Edge
![Page 31: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/31.jpg)
Custom Key Resolvers• How would we like to find Persons?• Notes persons: canonical name• Create a Java implementation to discover
document vertex• Demo
![Page 32: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/32.jpg)
Now we have a directory (ho ho ho)• That means we have Views• Let’s use them!• Why? Because we can!
![Page 33: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/33.jpg)
View Vertices• All View Design notes are Framed Vertices• All View Categories are Framed Vertices• All ViewEntries are Framed Edges (View ->
Category, Category -> Document)
![Page 35: Getting your hands on graphs](https://reader036.vdocument.in/reader036/viewer/2022062823/5871abbe1a28abda6a8b592f/html5/thumbnails/35.jpg)