240 likes | 253 Views
Understand data design challenges and learn how to solve them using Azure Cosmos DB Gremlin API. Explore graphs for data modeling and infrastructure monitoring. Navigate LAX terminals efficiently.
E N D
Common graph data problems And how to solve them using Azure Cosmos DB Gremlin API THR2053 Luis Bosquez Program Manager 2 lbosq@microsoft.com @_lbosq
What’s the most important aspect of a new app? Technology platforms are fairly equivalent. Tooling and frameworks can be worked around. Application architecture challenges can evolve. But what about data?
Data Design • Adapt our interpretation of reality in iterations. • Incremental approaches to an optimal data design for the business requirements. • But requirements aren’t static. • Ongoing balance of functionality, scalability, complexity and efficiency. • Database options provide various functionality to adapt to these requirements.
Example 1 Fundamentals of Apache Tinkerpop
Graph databases for data modellingFind out more at BRK3183 Luis vertex id: Luis label: person properties: • age: 26 edge id: edgeId label: worksAt properties: • distance: 2554miles objects language
New England Patriots vertex label: team properties: - cheaters: true edge label: isPartOf National Football League vertex label: league properties: - country: USA - playersUseFeet: false edge label: cheatedOnYear Formation gate 2014 Deflategate 2015 PEDS 2016 IR-gate 2013 vertex label: event properties: - Severity: 2 vertex label: event properties: - Severity: 1 vertex label: event properties: - Severity: 3 vertex label: event properties: - Severity: 3
New England Patriots vertex label: team properties: - cheaters: true edge label: isPartOf National Football League vertex label: league properties: - country: USA - playersUseFeet: false edge label: cheatedOnYear Formation gate 2014 Deflategate 2015 PEDS 2016 IR-gate 2013 vertex label: event properties: - Severity: 2 vertex label: event properties: - Severity: 1 vertex label: event properties: - Severity: 3 vertex label: event properties: - Severity: 3 edge label: ledTo Super Bowl 2014 vertex label: event properties: - tainted: true
Example 2 Use case: Infrastructure Monitoring
App Server (read) OLTP Database Monitoringservice Traffic Manager Data aggr. service App Server (write) ReportingDatabase Reports
Example 3 Random Use Case: Six Degrees of Kevin Bacon
No Way Out in Gene Hackman knows Sean Young knows https://github.com/cjoakim/travel
Answers to business (?) questions What all actors have been in X given movie? g.V(['n41','nm0001742']).repeat(out().simplePath()) .until(hasId('nm0205626')).path().limit(3) g.V('tt9000001').in('in').values('name') How do you get from person X to person Y? Who is the most connected person? g.V().hasLabel('person').outE('knows').groupCount() .by(outV().values('name')).order(local).by(values, decr)
Example 4 Random Use Case: Navigating LAX
Counter clock-wise. • 1, 2, 3, B, 4, 5, 6, 7, 8. • Shuttles are always late. Running is usually really tempting. • From Arrival, change to upper level. • Go through security to get into Terminal for connecting flight. https://www.flylax.com/LAX-Terminal-Maps
You have landed at LAX for your layover • You need to get from any given gate A to any given gate B, potentially switching terminals. • … but you’re hungry. So you need to stop at a restaurant first to get food to go. • … but you’re picky, so your restaurant selection has to comply with a minimum Yelp review. • But you still have to get to your destination gate within 30 minutes to board your next flight on time (hopefully to a better airport).
T1 T2 T3 TB T8 T7 T6 T5 T4
Cost (t) Terminal adjacency T2 T1 Terminals Contains Contains Cost (t) to from G4 G5 G6 G1 G2 G3 Gates Gate Adjacency Adjacency Restaurant proximity Restaurant proximity R4 R5 R6 R1 R2 R3 Restaurants Cost ($) Inefficient Airport V1
Case 1: Stop at a restaurant in the terminal, then switch terminals, then get to your gate. g.V('g1') // Start from the gate you’ve arrived at. .out('toRestaurant’) // Pick a restaurant... .has('rating', gt(0.3)) // With at least 3 stars. .out('toTerminal').out('toNextTerminal') // Then, go to terminal 2. .out('toGate').has('id', 'g4') // Go to your destination Gate. .path().by('name') // Return the path and select all the names.
Case 2: Switch terminals first, then stop at a restaurant and get to your gate. g.V('g1') // Start from the gate you’ve arrived at. .out('toTerminal').out('toNextTerminal') // Leave the terminal and go to the next one. .out('toRestaurant') // Pick a restaurant... .has('rating', gt(0.8)) // With at least 8/10 rating. .out('toTerminal') // Change terminals .has('id', 'g4') // Go to Gate 4. .path().by('name') // Return the entire path.
Please evaluate this sessionYour feedback is important to us! Please evaluate this session through MyEvaluations on the mobile appor website. Download the app:https://aka.ms/ignite.mobileApp Go to the website: https://myignite.techcommunity.microsoft.com/evaluations