Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

DAT646 SAP HANA Graph

DAT646 SAP HANA Graph

Presentation from DAT646 session "SAP HANA Graph" at SAP TechEd 2018

Vitaliy Rudnytskiy

December 21, 2018
Tweet

More Decks by Vitaliy Rudnytskiy

Other Decks in Programming

Transcript

  1. 3 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Let me introduce myself - Vitaliy Rudnytskiy (aka Witalij Rudnicki) @Sygyzmundovych - SAP’s Developers Center (developers.sap.com) - Based in Wrocław, Poland
  2. 5 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ The information in this presentation is confidential and proprietary to SAP and may not be disclosed without the permission of SAP. Except for your obligation to protect confidential information, this presentation is not subject to your license agreement or any other service or subscription agreement with SAP. SAP has no obligation to pursue any course of business outlined in this presentation or any related document, or to develop or release any functionality mentioned therein. This presentation, or any related document and SAP's strategy and possible future developments, products and or platforms directions and functionality are all subject to change and may be changed by SAP at any time for any reason without notice. The information in this presentation is not a commitment, promise or legal obligation to deliver any material, code or functionality. This presentation is provided without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. This presentation is for informational purposes and may not be incorporated into a contract. SAP assumes no responsibility for errors or omissions in this presentation, except if such damages were caused by SAP’s intentional or gross negligence. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, which speak only as of their dates, and they should not be relied upon in making purchasing decisions. Disclaimer
  3. 7 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Graph processing in SAP HANA Built-in algorithms Pattern Matching Graph Script Agenda
  4. 8 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ What is Graph? What is Graph? G = (V, E) https://www.cbs.com/shows/big_bang_theory/ Golden Valley Elite!!!
  5. 10 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Graph Theory The Knight’s Tour problem. The earliest known reference to it dates back to the 9th century AD CBS, Wikipedia It's a warm summer evening in XVIII c. city of Königsberg… Leonhard Euler is crossing a bridge over Pregel river…
  6. 11 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Graph Data Model in SAP HANA Property graph model The property graph model provides directed, attributed multi-relational graphs as the central data structure Wrocław Vitaliy Type=City Country=Poland Continent=Europe Type=Human Twitter=Sygyzmundovych Type=basedIn Type=hasTaxpayer SAP Type=worksFor Type=hasOnPayroll Type=Company
  7. 13 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ From DB Engines Ranking Source: https://db-engines.com/en/ranking_categories
  8. 14 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ The Forrester Wave™: Translytical Data Platforms, Q4 2017 “…Translytical data platforms, an emerging technology, deliver faster access to business data to support various workloads and use cases. EA pros can use them to drive new business initiatives…” source: https://reprints.forrester.com/#/assets/2/308/'RES134282'/reports “SAP crushes translytical workloads. SAP HANA is a shared-nothing, in-memory data platform, the core of SAP's translytical platform, which supports many use cases, including real- time applications, analytics, translytical apps, systems of insight, and advanced analytics…”
  9. 15 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ SAP HANA, Express edition developers.sap.com/sap-hana-express • targeted to run in resource-constrained environments and contains a rich set of capabilities for a developer to work with, including geospatial data types and algorithms • free productive use up to 32 GB of RAM, • comes as a binary installer, as a pre-configured virtual machine image (ova file), as a docker or cloud image Database management Web server JavaScript Graphic modeler Data virtualization Extract, load, transform and replication Columnar store – Transaction and analytical processing Multicore and parallelization Advanced compression Multitenancy Multitier storage Graph Predictive Search Series data Business functions Apache Hadoop and Apache Spark integration Streaming analytics Application lifecycle management High availability and disaster recovery Openness Data modeling Administration and security Spatial Text analytics SAP Fiori® user experience(UX) Application development Data integration and quality Advanced analytical processing Data quality Remote data sync
  10. 16 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ SAP HANA Graph SAP HANA provides a native graph engine ▪ Property graph model embedded in relational/SQL ▪ Full transactional (ACID) properties ▪ Built-in functions like shortest path ▪ Support for pattern matching, Cypher ▪ Custom graph algorithms via GraphScript ▪ Modeler support Benefits ▪ Store and analyze connected data in real-time ▪ Integrated in SAP HANA operations ▪ Combine text, spatial, and advanced analytics with graph intelligence S AP H AN A P L AT F O R M Graph Engine Graph Algorithms Pattern Matching
  11. 18 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Graph Data Model in SAP HANA CREATE GRAPH WORKSPACE [SCHEMA].[NAME] EDGE TABLE [SCHEMA].[EDGE TABLE/VIEW] SOURCE COLUMN source TARGET COLUMN target KEY COLUMN id VERTEX TABLE [SCHEMA].[NODE TABLE/VIEW] KEY COLUMN id; A GRAPH WORKSPACE exposes the data from tables or views to the graph engine ID TYPE NAME YEAR AUT-6841 Author Richardson, Fred H94-1009 Paper The Hub and Spoke Paradigm for CSR Evaluation 1994 ORG-523 Organization Boston University H92-1076 Paper Spontaneous Speech Collection for the CSR Corpus 1992 ID SOURCE TARGET TYPE 1 H94-1009 AUT-6841 isAuthoredBy 2 AUT-6841 ORG-523 isAffiliatedTo 3 H94-1009 H92-1076 citation
  12. 19 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Data
  13. 20 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Graph Processing Pattern matching ▪ Sequence with filters on vertex and edge properties ▪ Proximity of one or more start vertices ▪ Declarative, e.g. using “Cypher” ▪ “short”, high selectivity Graph analysis ▪ Algorithms, e.g. community detection, link prediction, shortest path, page rank ▪ Topological analysis of complete graph ▪ Imperative, using a “programming language” ▪ “long”, low selectivity ? B Fred A Doc citation isAuthoredBy Doc
  14. 21 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Graph processing in SAP HANA Built-in algorithms Pattern Matching Graph Script Agenda
  15. 22 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ SAP HANA graph provides a set of built-in algorithms as graph calculation nodes that can be used in calculation scenarios and calculation views. This allows you to execute an algorithm on the given graph workspace and provide results as table output. ▪ Neighborhood search ▪ Shortest path  1-to-1  1-to-all ▪ Strongly connected components Built-In Algorithms Overview
  16. 23 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Graph processing in SAP HANA Built-in algorithms Pattern Matching Graph Script Agenda
  17. 25 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Pattern Matching openCypher An openCypher query searches for subgraphs matching the topology specified in the MATCH clause and optional filter conditions in the WHERE clause, and returns a result table specified in the RETURN clause. MATCH clause MATCH (A)-[e1]->(P1), (P1)-[e2]->(P2) WHERE clause WHERE A.NAME = ‘Fred’ AND P1.TYPE = ‘Paper’ AND e2.TYPE = ‘citation’ RETURN clause RETURN P2.TITLE AS TITLE Fred citation Paper Title
  18. 26 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Pattern Matching openCypher example Find co-authors of Fred MATCH (P)-[e1]->(A1), (P)-[e2]->(A2) WHERE P.TYPE = 'Paper' AND e1.TYPE = 'isAuthoredBy' AND A1.NAME = 'Fred' AND e2.TYPE = 'isAuthoredBy' AND A2.TYPE = 'Author' RETURN A2.ID AS COAUTH_ID, A2.NAME AS COAUTH_NAME Paper Fred Author
  19. 27 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Pattern Matching SAP HANA Database Explorer
  20. 29 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Graph processing in SAP HANA Built-in algorithms Pattern Matching GraphScript Agenda
  21. 30 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ GraphScript is a high-level, powerful domain-specific language for native stored procedures in SAP HANA. It is specifically designed to ease the development and integration of custom graph algorithms into the existing data management workflows. CREATE PROCEDURE "[SCHEMA]"."[PROCEDURE NAME]" (OUT distance DOUBLE) LANGUAGE GRAPH READS SQL DATA AS BEGIN GRAPH g = GRAPH("[SCHEMA]"."[GRAPH WORKSPACE NAME]"); VERTEX v1 = VERTEX(:g, 1); VERTEX v2 = VERTEX(:g, 2); WEIGHTEDPATH<BIGINT> p = SHORTEST_PATH(:g, :v1, :v2); distance = LENGTH(:p); END; GraphScript Overview
  22. 31 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ SQLScript ▪ SQL-like language for definition of stored procedures and functions Relational ▪ SQL data types, functions, expressions, predicates Base objects ▪ Tables and views GraphScript GraphScript and SQLScript GraphScript ▪ Language for definition of graph-specific stored procedures Graph ▪ Graph-specific data types, functions, expressions, algorithms Base object ▪ Graph workspace relational numeric, text, spatial, etc. Table, View SQLScript procedure, function GraphScript procedure graph types, functions, algorithms Workspace
  23. 33 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ GraphScript Motivation: Kinght’s Tour problem https://blogs.sap.com/2018/10/29/solving-the-knights-tour-problem-with-hana-graph/
  24. 36 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Hands-on Exercises
  25. 37 PUBLIC © 2018 SAP SE or an SAP affiliate

    company. All rights reserved. ǀ Data
  26. © 2018 SAP SE or an SAP affiliate company. All

    rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP SE or an SAP affiliate company. The information contained herein may be changed without prior notice. Some software products marketed by SAP SE and its distributors contain proprietary software components of other software vendors. National product specifications may vary. These materials are provided by SAP SE or an SAP affiliate company for informational purposes only, without representation or warranty of any kind, and SAP or its affiliated companies shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP or SAP affiliate company products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty. In particular, SAP SE or its affiliated companies have no obligation to pursue any course of business outlined in this document or any related presentation, or to develop or release any functionality mentioned therein. This document, or any related presentation, and SAP SE’s or its affiliated companies’ strategy and possible future developments, products, and/or platforms, directions, and functionality are all subject to change and may be changed by SAP SE or its affiliated companies at any time for any reason without notice. The information in this document is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. All forward-looking statements are subject to various risks and uncertainties that could cause actual results to differ materially from expectations. Readers are cautioned not to place undue reliance on these forward-looking statements, and they should not be relied upon in making purchasing decisions. SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE (or an SAP affiliate company) in Germany and other countries. All other product and service names mentioned are the trademarks of their respective companies. See www.sap.com/copyright for additional trademark information and notices. www.sap.com/contactsap Follow us