SlideShare una empresa de Scribd logo
1 de 41
Descargar para leer sin conexión
#SAISDD9
Neo4j Morpheus: Interweaving Documents,
Tables and Graph Data in Spark
Alastair Green, Mats Rydberg
Neo4j
#SAISDD9
1
#SAISDD9
Introduction
Mats Rydberg Engineering Lead for Cypher for Apache Spark and Neo4j
Morpheus, Cypher Language Group
Alastair Green Lead, Neo4j Query Languages team, PM for Cypher for Apache
Spark/Neo4j Morpheus and Cypher for Gremlin
Neo4j Morpheus
A product in gestation, based on Cypher for Apache Spark
Enriching Spark’s graph capability
Combining Spark SQL with Spark graph querying
Interweaving graph, table and nested/document data
Integrating Spark analytics and Neo4j operational data
Advancing graph query language (GQL) features
#SAISDD9
Property Graphs meet Big Data
The Property Graph data model is becoming increasingly mainstream
Cloud graph data services like Azure CosmosDB or Amazon Neptune
Simple graph features in SQLServer 2017, multiple new graph DB products
Read-only graph queries coming in the SQL:2020 standard
Neo4j becoming common operational store in retail, finance, telcos … and more
Increasing interest in graph algorithms over graph data as a basis for AI
Apache® Spark is the leading scale-out clustered memory solution for Big Data
Spark 2: Data viewed as tables (DataFrames), processed by SQL,
in function chains, using queries and user functions,
transforming immutable tabular data sets
#SAISDD9
Property Graphs Nodes (Entities)
Node
● Represents an entity within the graph
● Can have labels
4
#SAISDD9
Property Graphs Relationships
5
Node
● Represents an entity within the graph
● Can have labels
Relationship
● Connects a start node with an end node
● Has one type
#SAISDD9
Property Graphs
Properties
6
Node
● Represents an entity within the graph
● Can have labels
Relationship
● Connects a start node with an end node
● Has one type
Property
● Describes a node/relationship: e.g. name, age, weight etc
● Key-value pair: String key; typed value (string, number, bool, list, ...)
#SAISDD9
Graph patterns
7
#SAISDD9
Searching For Graph Patterns
8
#SAISDD9
Operational Tables and Graphs → Analytics
#SAISDD9
Spark: SQL and Cypher
Apache® Spark is the leading scale-out clustered memory solution for Big Data
Spark2: Data viewed as tables (Dataframes)
With StructType schema to describe the type
Processed by SQL and custom functions in function chains
transforming input immutable Dataframes into output tables
Cypher for Apache Spark (CAPS) mirrors the capabilities of Spark SQL
Data viewed as graphs (made up of Dataframes)
With PropertyGraph.schema to describe the graph type
Processed by Cypher and user functions in function chains ,
transforming input immutable PropertyGraphs into output graphs
#SAISDD9
Cypher
for Apache Spark
Neo4j Graph DB + Cypher for Apache Spark
CypherSession
PropertyGraph
PropertyGraphCatalog
Cypher Queries
for CRUD
Graph Algorithms
Neo4j
Neo4j
Database
Cypher Queries
for CR[no UD]
Property Graph
Data Sources
as Plugins
Graphs of
Dataframes
Spark Cypher
Engine
#SAISDD9
Cypher
for Apache Spark
Cypher Property Graph Data Sources
CypherSession
PropertyGraph
PropertyGraphCatalog
Cypher Property
Graph Data Sources
Cypher Queries
for CRUD
Graph Algorithms
Neo4j
Neo4j
Database Spark Cypher
Engine
Cypher Queries
for CR[no UD]
Property Graph
Data Sources
as Plugins
Graphs of
Dataframes
Neo4j
Morpheus
#SAISDD9
Cypher
for Apache Spark
SQL Property Graph Data Source
CypherSession
PropertyGraph
PropertyGraphCatalog
Cypher Property
Graph Data Sources
Cypher Queries
for CRUD
Graph Algorithms
Neo4j
Neo4j
Database Spark Cypher
Engine
Cypher Queries
for CR[no UD]
Property Graph
Data Sources
as Plugins
Graphs of
Dataframes
Neo4j
Morpheus
SQL
Property Graph
Data Sources
Hive,
Oracle, MySQL,
SQLServer
Cypher Schema
SQL Graph DDL
#SAISDD9
Cypher
for Apache Spark
FS Property Graph Data Source
CypherSession
PropertyGraph
PropertyGraphCatalog
Cypher Property
Graph Data Sources
Cypher Queries
for CRUD
Graph Algorithms
Neo4j
Neo4j
Database
Filesystem
Property Graph
Data Sources
LFS, HDFS,
S3, GFS, DBFS
Text, ORC, Parquet
Spark Cypher
Engine
Cypher Queries
for CR[no UD]
Property Graph
Data Sources
as Plugins
Graphs of
Dataframes
Neo4j
Morpheus
SQL
Property Graph
Data Sources
Hive,
Oracle, MySQL,
SQLServer
Cypher Schema
SQL Graph DDL
#SAISDD9
Cypher
for Apache Spark
Future Property Graph Data Sources
CypherSession
PropertyGraph
PropertyGraphCatalog
Cypher Property
Graph Data Sources
Cypher Queries
for CRUD
Graph Algorithms
Neo4j
Gremlin
Databases
Neo4j
Database
Filesystem
Property Graph
Data Sources
LFS, HDFS,
S3, GFS, DBFS
Text, ORC, Parquet
Spark Cypher
Engine
Cypher Queries
for CR[no UD]
Property Graph
Data Sources
as Plugins
Graphs of
Dataframes
Neo4j
Morpheus
SQL
Property Graph
Data Sources
Hive,
Oracle, MySQL,
SQLServer
Cypher Schema
SQL Graph DDL
#SAISDD9
Graphs and
Views in the
Catalog
// named graph session.people
// view function session.peopleByCountry()
#SAISDD9
Querying (multiple) named graphs
// Session
implicit val session: CAPSSession = CAPSSession.local()
...
// Query
val result = session.cypher(
"""|FROM GRAPH socialNetwork
|MATCH (p:Person)
|FROM GRAPH products
|MATCH (c:Customer)-[:ORDERED]->(i:Item) WHERE p.name = c.name
|RETURN p.name, c.id, count(i.price) AS amount
""".stripMargin)
result.show()
#SAISDD9
Cypher DB
ODS
SQL DB
ODSFILE SYSTEM
SPARK Analytics Platform
HIVE
Turning Tables into Graphs
Graph
DDL for
schema
and table
mappings
Cypher
Graph
Queries
Bolt JDBCSparkSQL/Hive
#SAISDD9
“Tables for Labels”
In Cypher for Apache Spark graphs have a schema (graph type)
The schema defines
The properties that belong to a label
The node types and relationship types that occur in the graph
Node type is a label set (one or more labels → node type)
Relationship triplets that permit node and relationship type combinations
A graph instance is made up of tables, one per node type/relationship type
#SAISDD9
Mapping SQL tables into a Property Graph
#SAISDD9
Cypher DB
ODS
SQL DB
ODS
SPARK Analytics Platform
Delta
views
Synchronizing SQL data source with Neo4j
SQL
PGDS
map delta
graph into
Spark
Neo4j
Graph
Merge
delta
graph
Bolt
FILE SYSTEM
HIVE
JDBC
SparkSQL/Hive
#SAISDD9
Demo: Customer360 incremental merge
22
Seed
2017-01-01
Delta
2017-01-02
Delta
2017-01-03
Delta
...
SQL (Hive)
Neo4j
Operational
Store
SQL PGDS +
Neo4j Merge
#SAISDD9
Customer360 graph data model
23
#SAISDD9
Query
composition
#SAISDD9
Query composition: graphs in, graphs out
val graph = session.cypher("
// Let's query two graphs...
FROM GRAPH socialNetwork MATCH (p:Person)
FROM GRAPH products MATCH (c:Customer) WHERE p.email = c.email
// ...and construct a new graph from the result
CONSTRUCT ON socialNetwork, products
CREATE (p)-[:IS]->(c)
RETURN GRAPH
").graph
#SAISDD9
Graph construction
#SAISDD9
Query
composition
#SAISDD9
Cypher DDL to define schema objects
CATALOG CREATE GRAPH session.peopleUS {
FROM session.people
MATCH (us:Person)-[R*]-(n)
WHERE us.nationality = ‘USA’
RETURN GRAPH OF *
}
CATALOG CREATE VIEW session.peopleByCountry($countryCode, $peopleGraph) {
FROM $peopleGraph
MATCH (us:Person)-[:R*]-(n)
WHERE us.nationality = $countryCode
RETURN GRAPH OF *
}
#SAISDD9
// named graph
FROM session.peopleUS
MATCH (people:Person)
RETURN people.lastName
// view over graph
FROM session.peopleByCountry(‘USA’, teradata.europe.people)
MATCH (people:Person)
RETURN people.lastName
Using named graphs and view functions
#SAISDD9
Query composition: get data from new graph
// Let's query the graph we just constructed
val result = graph.cypher("
MATCH (person:Person)-[:FRIEND_OF]-(friend:Person),
(friend)-[:IS]->(customer:Customer),
(customer)-[:BOUGHT]->(product:Product)
RETURN DISTINCT product.title AS recommendation, person.name
ORDER BY recommendation
")
result.show()
#SAISDD9
SQL and Cypher working together
// Query with Cypher
val results = socialNetwork.cypher("
MATCH (a:Person)-[r:FRIEND_OF]->(b)
RETURN a.name AS friend1, b.name AS friend2, r.since AS since
")
// Extract DataFrame representing the query result and register
results.records.asDataFrame.createOrReplaceTempView("friends")
// Query with SQL
spark.sql("
SELECT friend1, friend2, since FROM friends ORDER BY since
").show()
#SAISDD9
Demo: Database snapshots for analytics
#SAISDD9
Cypher Graph Schema Labels and Properties
CREATE GRAPH snb WITH GRAPH SCHEMA (
LABEL (Company),
LABEL (Message {
creationDate : TIMESTAMP?,
locationIP : STRING?,
content : STRING?,
length : INTEGER?
}),
LABEL (LIKES {
creationDate : TIMESTAMP?
}),
...
#SAISDD9
Cypher Graph Schema Node/Edge Types
// allowed node label sets (node types)
(Message, Post),
(Company),
(Country),
(Person),
...
// allowed relationship (edge) types
[LIKES],
[KNOWS],
[IS_LOCATED_IN],
...
#SAISDD9
Cypher Graph Schema Relationship Triplets
// relationship triplets
(Message) <0 .. *> -[IS_LOCATED_IN]-> <1> (Country),
(Person) <1> -[LIKES]-> <0 .. *> (Message),
(Company) <0 .. *> -[IS_LOCATED_IN]-> <1> (Country),
(Person) <0 .. *> -[KNOWS]-> <0 .. *> (Person),
// end of pure graph schema
#SAISDD9
SQL Graph DDL Mapping “Tables to Labels”
RELATIONSHIP LABEL SETS (
(HAS_CREATOR)
FROM "postHasCreator" edge
START NODES
LABEL SET (Message, Post)
FROM "Post" start_nodes
JOIN ON start_nodes.ID = edge."post"
END NODES
LABEL SET (Person)
FROM "Person" end_nodes
JOIN ON end_nodes.ID = edge."creator"
...
))
Relationship Label Set → Relationship Type
SQL Relationship Source Table
Node Label Set → Node Type
SQL Node Source Table
#SAISDD9
SQL PGQ and GQL
Morpheus SQL Property Graph Data Source SQL Graph DDL
A prototype of SQL Property Graph Query (SQL/PGQ)
Will be part of ISO SQL:202x
Morpheus SQL PGDS Graph Schema and Composable Graph Queries
“Prequel to GQL”
GQL is an initiative to create an ISO international GQL standard alongside SQL
SQL PGQ planned as a (major) subset of a wider “native” full CRUD GQL
#SAISDD9
From Cypher GQL
#SAISDD9
Spark SQL and Cypher → Spark SQL and GQL
Cypher for Apache Spark developed by Neo4j
● Source code under Apache 2.0 license
● github.com/openCypher/cypher-for-apache-spark
Considering SPIP to bring enhanced graph support to Spark
● Ongoing discussion with Databricks Apache Spark/GraphFrames developers
● Concept: DataFrame-based graphs and Cypher graph queries
Directions
● Cypher → ISO GQL
● Cypher for Spark → Spark GQL + Spark SQL
spark.sql
spark.gql
#SAISDD9
Neo4j Morpheus planned timeline
Neo4j Morpheus a new product, complementing the Neo4j transactional DB
● Commercially supported Cypher for Apache Spark
● Certified for Spark distributions and for SQL data sources
Limited access Early Adopter release scheduled for end October
Sign up to join EA programme https://neo4j.com/morpheus/
Documentation: https://neo4j.com/docs/morpheus-user-guide/preview/
To come
● Cypher language feature expansion
● Performance and scale testing in Q4/Q1
H1 2019 1.0 release as an extension to Neo4j Enterprise
#SAISDD9
Questions?

Más contenido relacionado

La actualidad más candente

GraphX: Graph analytics for insights about developer communities
GraphX: Graph analytics for insights about developer communitiesGraphX: Graph analytics for insights about developer communities
GraphX: Graph analytics for insights about developer communities
Paco Nathan
 
Apache Spark GraphX highlights.
Apache Spark GraphX highlights. Apache Spark GraphX highlights.
Apache Spark GraphX highlights.
Doug Needham
 

La actualidad más candente (20)

GraphFrames: DataFrame-based graphs for Apache® Spark™
GraphFrames: DataFrame-based graphs for Apache® Spark™GraphFrames: DataFrame-based graphs for Apache® Spark™
GraphFrames: DataFrame-based graphs for Apache® Spark™
 
GraphFrames: Graph Queries in Spark SQL by Ankur Dave
GraphFrames: Graph Queries in Spark SQL by Ankur DaveGraphFrames: Graph Queries in Spark SQL by Ankur Dave
GraphFrames: Graph Queries in Spark SQL by Ankur Dave
 
Cypher and apache spark multiple graphs and more in open cypher
Cypher and apache spark  multiple graphs and more in  open cypherCypher and apache spark  multiple graphs and more in  open cypher
Cypher and apache spark multiple graphs and more in open cypher
 
ScalaTo July 2019 - No more struggles with Apache Spark workloads in production
ScalaTo July 2019 - No more struggles with Apache Spark workloads in productionScalaTo July 2019 - No more struggles with Apache Spark workloads in production
ScalaTo July 2019 - No more struggles with Apache Spark workloads in production
 
GraphX: Graph analytics for insights about developer communities
GraphX: Graph analytics for insights about developer communitiesGraphX: Graph analytics for insights about developer communities
GraphX: Graph analytics for insights about developer communities
 
Graph Analytics for big data
Graph Analytics for big dataGraph Analytics for big data
Graph Analytics for big data
 
GraphFrames: Graph Queries In Spark SQL
GraphFrames: Graph Queries In Spark SQLGraphFrames: Graph Queries In Spark SQL
GraphFrames: Graph Queries In Spark SQL
 
Neo4j-Databridge: Enterprise-scale ETL for Neo4j
Neo4j-Databridge: Enterprise-scale ETL for Neo4jNeo4j-Databridge: Enterprise-scale ETL for Neo4j
Neo4j-Databridge: Enterprise-scale ETL for Neo4j
 
Transforming AI with Graphs: Real World Examples using Spark and Neo4j
Transforming AI with Graphs: Real World Examples using Spark and Neo4jTransforming AI with Graphs: Real World Examples using Spark and Neo4j
Transforming AI with Graphs: Real World Examples using Spark and Neo4j
 
GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)
GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)
GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)
 
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin HuaiA Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
A Deep Dive into Spark SQL's Catalyst Optimizer with Yin Huai
 
A whirlwind tour of graph databases
A whirlwind tour of graph databasesA whirlwind tour of graph databases
A whirlwind tour of graph databases
 
Graph Analytics: Graph Algorithms Inside Neo4j
Graph Analytics: Graph Algorithms Inside Neo4jGraph Analytics: Graph Algorithms Inside Neo4j
Graph Analytics: Graph Algorithms Inside Neo4j
 
Practical Graph Algorithms with Neo4j
Practical Graph Algorithms with Neo4jPractical Graph Algorithms with Neo4j
Practical Graph Algorithms with Neo4j
 
New Directions for Spark in 2015 - Spark Summit East
New Directions for Spark in 2015 - Spark Summit EastNew Directions for Spark in 2015 - Spark Summit East
New Directions for Spark in 2015 - Spark Summit East
 
Interpreting Relational Schema to Graphs
Interpreting Relational Schema to GraphsInterpreting Relational Schema to Graphs
Interpreting Relational Schema to Graphs
 
Apache Spark GraphX highlights.
Apache Spark GraphX highlights. Apache Spark GraphX highlights.
Apache Spark GraphX highlights.
 
Building a modern Application with DataFrames
Building a modern Application with DataFramesBuilding a modern Application with DataFrames
Building a modern Application with DataFrames
 
Scotland Data Science Meetup Oct 13, 2015: Spark SQL, DataFrames, Catalyst, ...
Scotland Data Science Meetup Oct 13, 2015:  Spark SQL, DataFrames, Catalyst, ...Scotland Data Science Meetup Oct 13, 2015:  Spark SQL, DataFrames, Catalyst, ...
Scotland Data Science Meetup Oct 13, 2015: Spark SQL, DataFrames, Catalyst, ...
 
OracleCode_Berlin_Jun2018_AnalyzeBitcoinTransactionDataUsingAsGraph
OracleCode_Berlin_Jun2018_AnalyzeBitcoinTransactionDataUsingAsGraphOracleCode_Berlin_Jun2018_AnalyzeBitcoinTransactionDataUsingAsGraph
OracleCode_Berlin_Jun2018_AnalyzeBitcoinTransactionDataUsingAsGraph
 

Similar a Neo4j Morpheus: Interweaving Documents, Tables and and Graph Data in Spark with Alastair Green and Mats Rydberg

An Introduction to Spark
An Introduction to SparkAn Introduction to Spark
An Introduction to Spark
jlacefie
 

Similar a Neo4j Morpheus: Interweaving Documents, Tables and and Graph Data in Spark with Alastair Green and Mats Rydberg (20)

Apache spark - Architecture , Overview & libraries
Apache spark - Architecture , Overview & librariesApache spark - Architecture , Overview & libraries
Apache spark - Architecture , Overview & libraries
 
Morpheus - SQL and Cypher in Apache Spark
Morpheus - SQL and Cypher in Apache SparkMorpheus - SQL and Cypher in Apache Spark
Morpheus - SQL and Cypher in Apache Spark
 
A Tale of Three Apache Spark APIs: RDDs, DataFrames and Datasets by Jules Damji
A Tale of Three Apache Spark APIs: RDDs, DataFrames and Datasets by Jules DamjiA Tale of Three Apache Spark APIs: RDDs, DataFrames and Datasets by Jules Damji
A Tale of Three Apache Spark APIs: RDDs, DataFrames and Datasets by Jules Damji
 
Big data analysis using spark r published
Big data analysis using spark r publishedBig data analysis using spark r published
Big data analysis using spark r published
 
Introduction to Spark with Python
Introduction to Spark with PythonIntroduction to Spark with Python
Introduction to Spark with Python
 
Parallelizing Existing R Packages
Parallelizing Existing R PackagesParallelizing Existing R Packages
Parallelizing Existing R Packages
 
Intro to Spark and Spark SQL
Intro to Spark and Spark SQLIntro to Spark and Spark SQL
Intro to Spark and Spark SQL
 
Spark and scala course content | Spark and scala course online training
Spark and scala course content | Spark and scala course online trainingSpark and scala course content | Spark and scala course online training
Spark and scala course content | Spark and scala course online training
 
Learning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQLLearning spark ch09 - Spark SQL
Learning spark ch09 - Spark SQL
 
Building highly scalable data pipelines with Apache Spark
Building highly scalable data pipelines with Apache SparkBuilding highly scalable data pipelines with Apache Spark
Building highly scalable data pipelines with Apache Spark
 
spark interview questions & answers acadgild blogs
 spark interview questions & answers acadgild blogs spark interview questions & answers acadgild blogs
spark interview questions & answers acadgild blogs
 
A Data Frame Abstraction Layer for SparkR-(Chris Freeman, Alteryx)
A Data Frame Abstraction Layer for SparkR-(Chris Freeman, Alteryx)A Data Frame Abstraction Layer for SparkR-(Chris Freeman, Alteryx)
A Data Frame Abstraction Layer for SparkR-(Chris Freeman, Alteryx)
 
Big Data Processing with .NET and Spark (SQLBits 2020)
Big Data Processing with .NET and Spark (SQLBits 2020)Big Data Processing with .NET and Spark (SQLBits 2020)
Big Data Processing with .NET and Spark (SQLBits 2020)
 
Jump Start into Apache® Spark™ and Databricks
Jump Start into Apache® Spark™ and DatabricksJump Start into Apache® Spark™ and Databricks
Jump Start into Apache® Spark™ and Databricks
 
Composable Parallel Processing in Apache Spark and Weld
Composable Parallel Processing in Apache Spark and WeldComposable Parallel Processing in Apache Spark and Weld
Composable Parallel Processing in Apache Spark and Weld
 
Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...
Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...
Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...
 
An Introduction to Spark
An Introduction to SparkAn Introduction to Spark
An Introduction to Spark
 
An Introduct to Spark - Atlanta Spark Meetup
An Introduct to Spark - Atlanta Spark MeetupAn Introduct to Spark - Atlanta Spark Meetup
An Introduct to Spark - Atlanta Spark Meetup
 
DASK and Apache Spark
DASK and Apache SparkDASK and Apache Spark
DASK and Apache Spark
 
Big data processing with Apache Spark and Oracle Database
Big data processing with Apache Spark and Oracle DatabaseBig data processing with Apache Spark and Oracle Database
Big data processing with Apache Spark and Oracle Database
 

Más de Databricks

Democratizing Data Quality Through a Centralized Platform
Democratizing Data Quality Through a Centralized PlatformDemocratizing Data Quality Through a Centralized Platform
Democratizing Data Quality Through a Centralized Platform
Databricks
 
Stage Level Scheduling Improving Big Data and AI Integration
Stage Level Scheduling Improving Big Data and AI IntegrationStage Level Scheduling Improving Big Data and AI Integration
Stage Level Scheduling Improving Big Data and AI Integration
Databricks
 
Simplify Data Conversion from Spark to TensorFlow and PyTorch
Simplify Data Conversion from Spark to TensorFlow and PyTorchSimplify Data Conversion from Spark to TensorFlow and PyTorch
Simplify Data Conversion from Spark to TensorFlow and PyTorch
Databricks
 
Raven: End-to-end Optimization of ML Prediction Queries
Raven: End-to-end Optimization of ML Prediction QueriesRaven: End-to-end Optimization of ML Prediction Queries
Raven: End-to-end Optimization of ML Prediction Queries
Databricks
 
Processing Large Datasets for ADAS Applications using Apache Spark
Processing Large Datasets for ADAS Applications using Apache SparkProcessing Large Datasets for ADAS Applications using Apache Spark
Processing Large Datasets for ADAS Applications using Apache Spark
Databricks
 

Más de Databricks (20)

DW Migration Webinar-March 2022.pptx
DW Migration Webinar-March 2022.pptxDW Migration Webinar-March 2022.pptx
DW Migration Webinar-March 2022.pptx
 
Data Lakehouse Symposium | Day 1 | Part 1
Data Lakehouse Symposium | Day 1 | Part 1Data Lakehouse Symposium | Day 1 | Part 1
Data Lakehouse Symposium | Day 1 | Part 1
 
Data Lakehouse Symposium | Day 1 | Part 2
Data Lakehouse Symposium | Day 1 | Part 2Data Lakehouse Symposium | Day 1 | Part 2
Data Lakehouse Symposium | Day 1 | Part 2
 
Data Lakehouse Symposium | Day 2
Data Lakehouse Symposium | Day 2Data Lakehouse Symposium | Day 2
Data Lakehouse Symposium | Day 2
 
Data Lakehouse Symposium | Day 4
Data Lakehouse Symposium | Day 4Data Lakehouse Symposium | Day 4
Data Lakehouse Symposium | Day 4
 
5 Critical Steps to Clean Your Data Swamp When Migrating Off of Hadoop
5 Critical Steps to Clean Your Data Swamp When Migrating Off of Hadoop5 Critical Steps to Clean Your Data Swamp When Migrating Off of Hadoop
5 Critical Steps to Clean Your Data Swamp When Migrating Off of Hadoop
 
Democratizing Data Quality Through a Centralized Platform
Democratizing Data Quality Through a Centralized PlatformDemocratizing Data Quality Through a Centralized Platform
Democratizing Data Quality Through a Centralized Platform
 
Learn to Use Databricks for Data Science
Learn to Use Databricks for Data ScienceLearn to Use Databricks for Data Science
Learn to Use Databricks for Data Science
 
Why APM Is Not the Same As ML Monitoring
Why APM Is Not the Same As ML MonitoringWhy APM Is Not the Same As ML Monitoring
Why APM Is Not the Same As ML Monitoring
 
The Function, the Context, and the Data—Enabling ML Ops at Stitch Fix
The Function, the Context, and the Data—Enabling ML Ops at Stitch FixThe Function, the Context, and the Data—Enabling ML Ops at Stitch Fix
The Function, the Context, and the Data—Enabling ML Ops at Stitch Fix
 
Stage Level Scheduling Improving Big Data and AI Integration
Stage Level Scheduling Improving Big Data and AI IntegrationStage Level Scheduling Improving Big Data and AI Integration
Stage Level Scheduling Improving Big Data and AI Integration
 
Simplify Data Conversion from Spark to TensorFlow and PyTorch
Simplify Data Conversion from Spark to TensorFlow and PyTorchSimplify Data Conversion from Spark to TensorFlow and PyTorch
Simplify Data Conversion from Spark to TensorFlow and PyTorch
 
Scaling your Data Pipelines with Apache Spark on Kubernetes
Scaling your Data Pipelines with Apache Spark on KubernetesScaling your Data Pipelines with Apache Spark on Kubernetes
Scaling your Data Pipelines with Apache Spark on Kubernetes
 
Scaling and Unifying SciKit Learn and Apache Spark Pipelines
Scaling and Unifying SciKit Learn and Apache Spark PipelinesScaling and Unifying SciKit Learn and Apache Spark Pipelines
Scaling and Unifying SciKit Learn and Apache Spark Pipelines
 
Sawtooth Windows for Feature Aggregations
Sawtooth Windows for Feature AggregationsSawtooth Windows for Feature Aggregations
Sawtooth Windows for Feature Aggregations
 
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen SinkRedis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
Redis + Apache Spark = Swiss Army Knife Meets Kitchen Sink
 
Re-imagine Data Monitoring with whylogs and Spark
Re-imagine Data Monitoring with whylogs and SparkRe-imagine Data Monitoring with whylogs and Spark
Re-imagine Data Monitoring with whylogs and Spark
 
Raven: End-to-end Optimization of ML Prediction Queries
Raven: End-to-end Optimization of ML Prediction QueriesRaven: End-to-end Optimization of ML Prediction Queries
Raven: End-to-end Optimization of ML Prediction Queries
 
Processing Large Datasets for ADAS Applications using Apache Spark
Processing Large Datasets for ADAS Applications using Apache SparkProcessing Large Datasets for ADAS Applications using Apache Spark
Processing Large Datasets for ADAS Applications using Apache Spark
 
Massive Data Processing in Adobe Using Delta Lake
Massive Data Processing in Adobe Using Delta LakeMassive Data Processing in Adobe Using Delta Lake
Massive Data Processing in Adobe Using Delta Lake
 

Último

➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
amitlee9823
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
JoseMangaJr1
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
amitlee9823
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
amitlee9823
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
amitlee9823
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
amitlee9823
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
amitlee9823
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
amitlee9823
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
amitlee9823
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men  🔝Thrissur🔝   Escor...
➥🔝 7737669865 🔝▻ Thrissur Call-girls in Women Seeking Men 🔝Thrissur🔝 Escor...
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
 
Thane Call Girls 7091864438 Call Girls in Thane Escort service book now -
Thane Call Girls 7091864438 Call Girls in Thane Escort service book now -Thane Call Girls 7091864438 Call Girls in Thane Escort service book now -
Thane Call Girls 7091864438 Call Girls in Thane Escort service book now -
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Bommasandra Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men  🔝Bangalore🔝   Esc...
➥🔝 7737669865 🔝▻ Bangalore Call-girls in Women Seeking Men 🔝Bangalore🔝 Esc...
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics Program
 
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
Mg Road Call Girls Service: 🍓 7737669865 🍓 High Profile Model Escorts | Banga...
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
 
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Predicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectPredicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science Project
 

Neo4j Morpheus: Interweaving Documents, Tables and and Graph Data in Spark with Alastair Green and Mats Rydberg

  • 1. #SAISDD9 Neo4j Morpheus: Interweaving Documents, Tables and Graph Data in Spark Alastair Green, Mats Rydberg Neo4j #SAISDD9 1
  • 2. #SAISDD9 Introduction Mats Rydberg Engineering Lead for Cypher for Apache Spark and Neo4j Morpheus, Cypher Language Group Alastair Green Lead, Neo4j Query Languages team, PM for Cypher for Apache Spark/Neo4j Morpheus and Cypher for Gremlin Neo4j Morpheus A product in gestation, based on Cypher for Apache Spark Enriching Spark’s graph capability Combining Spark SQL with Spark graph querying Interweaving graph, table and nested/document data Integrating Spark analytics and Neo4j operational data Advancing graph query language (GQL) features
  • 3. #SAISDD9 Property Graphs meet Big Data The Property Graph data model is becoming increasingly mainstream Cloud graph data services like Azure CosmosDB or Amazon Neptune Simple graph features in SQLServer 2017, multiple new graph DB products Read-only graph queries coming in the SQL:2020 standard Neo4j becoming common operational store in retail, finance, telcos … and more Increasing interest in graph algorithms over graph data as a basis for AI Apache® Spark is the leading scale-out clustered memory solution for Big Data Spark 2: Data viewed as tables (DataFrames), processed by SQL, in function chains, using queries and user functions, transforming immutable tabular data sets
  • 4. #SAISDD9 Property Graphs Nodes (Entities) Node ● Represents an entity within the graph ● Can have labels 4
  • 5. #SAISDD9 Property Graphs Relationships 5 Node ● Represents an entity within the graph ● Can have labels Relationship ● Connects a start node with an end node ● Has one type
  • 6. #SAISDD9 Property Graphs Properties 6 Node ● Represents an entity within the graph ● Can have labels Relationship ● Connects a start node with an end node ● Has one type Property ● Describes a node/relationship: e.g. name, age, weight etc ● Key-value pair: String key; typed value (string, number, bool, list, ...)
  • 9. #SAISDD9 Operational Tables and Graphs → Analytics
  • 10. #SAISDD9 Spark: SQL and Cypher Apache® Spark is the leading scale-out clustered memory solution for Big Data Spark2: Data viewed as tables (Dataframes) With StructType schema to describe the type Processed by SQL and custom functions in function chains transforming input immutable Dataframes into output tables Cypher for Apache Spark (CAPS) mirrors the capabilities of Spark SQL Data viewed as graphs (made up of Dataframes) With PropertyGraph.schema to describe the graph type Processed by Cypher and user functions in function chains , transforming input immutable PropertyGraphs into output graphs
  • 11. #SAISDD9 Cypher for Apache Spark Neo4j Graph DB + Cypher for Apache Spark CypherSession PropertyGraph PropertyGraphCatalog Cypher Queries for CRUD Graph Algorithms Neo4j Neo4j Database Cypher Queries for CR[no UD] Property Graph Data Sources as Plugins Graphs of Dataframes Spark Cypher Engine
  • 12. #SAISDD9 Cypher for Apache Spark Cypher Property Graph Data Sources CypherSession PropertyGraph PropertyGraphCatalog Cypher Property Graph Data Sources Cypher Queries for CRUD Graph Algorithms Neo4j Neo4j Database Spark Cypher Engine Cypher Queries for CR[no UD] Property Graph Data Sources as Plugins Graphs of Dataframes Neo4j Morpheus
  • 13. #SAISDD9 Cypher for Apache Spark SQL Property Graph Data Source CypherSession PropertyGraph PropertyGraphCatalog Cypher Property Graph Data Sources Cypher Queries for CRUD Graph Algorithms Neo4j Neo4j Database Spark Cypher Engine Cypher Queries for CR[no UD] Property Graph Data Sources as Plugins Graphs of Dataframes Neo4j Morpheus SQL Property Graph Data Sources Hive, Oracle, MySQL, SQLServer Cypher Schema SQL Graph DDL
  • 14. #SAISDD9 Cypher for Apache Spark FS Property Graph Data Source CypherSession PropertyGraph PropertyGraphCatalog Cypher Property Graph Data Sources Cypher Queries for CRUD Graph Algorithms Neo4j Neo4j Database Filesystem Property Graph Data Sources LFS, HDFS, S3, GFS, DBFS Text, ORC, Parquet Spark Cypher Engine Cypher Queries for CR[no UD] Property Graph Data Sources as Plugins Graphs of Dataframes Neo4j Morpheus SQL Property Graph Data Sources Hive, Oracle, MySQL, SQLServer Cypher Schema SQL Graph DDL
  • 15. #SAISDD9 Cypher for Apache Spark Future Property Graph Data Sources CypherSession PropertyGraph PropertyGraphCatalog Cypher Property Graph Data Sources Cypher Queries for CRUD Graph Algorithms Neo4j Gremlin Databases Neo4j Database Filesystem Property Graph Data Sources LFS, HDFS, S3, GFS, DBFS Text, ORC, Parquet Spark Cypher Engine Cypher Queries for CR[no UD] Property Graph Data Sources as Plugins Graphs of Dataframes Neo4j Morpheus SQL Property Graph Data Sources Hive, Oracle, MySQL, SQLServer Cypher Schema SQL Graph DDL
  • 16. #SAISDD9 Graphs and Views in the Catalog // named graph session.people // view function session.peopleByCountry()
  • 17. #SAISDD9 Querying (multiple) named graphs // Session implicit val session: CAPSSession = CAPSSession.local() ... // Query val result = session.cypher( """|FROM GRAPH socialNetwork |MATCH (p:Person) |FROM GRAPH products |MATCH (c:Customer)-[:ORDERED]->(i:Item) WHERE p.name = c.name |RETURN p.name, c.id, count(i.price) AS amount """.stripMargin) result.show()
  • 18. #SAISDD9 Cypher DB ODS SQL DB ODSFILE SYSTEM SPARK Analytics Platform HIVE Turning Tables into Graphs Graph DDL for schema and table mappings Cypher Graph Queries Bolt JDBCSparkSQL/Hive
  • 19. #SAISDD9 “Tables for Labels” In Cypher for Apache Spark graphs have a schema (graph type) The schema defines The properties that belong to a label The node types and relationship types that occur in the graph Node type is a label set (one or more labels → node type) Relationship triplets that permit node and relationship type combinations A graph instance is made up of tables, one per node type/relationship type
  • 20. #SAISDD9 Mapping SQL tables into a Property Graph
  • 21. #SAISDD9 Cypher DB ODS SQL DB ODS SPARK Analytics Platform Delta views Synchronizing SQL data source with Neo4j SQL PGDS map delta graph into Spark Neo4j Graph Merge delta graph Bolt FILE SYSTEM HIVE JDBC SparkSQL/Hive
  • 22. #SAISDD9 Demo: Customer360 incremental merge 22 Seed 2017-01-01 Delta 2017-01-02 Delta 2017-01-03 Delta ... SQL (Hive) Neo4j Operational Store SQL PGDS + Neo4j Merge
  • 25. #SAISDD9 Query composition: graphs in, graphs out val graph = session.cypher(" // Let's query two graphs... FROM GRAPH socialNetwork MATCH (p:Person) FROM GRAPH products MATCH (c:Customer) WHERE p.email = c.email // ...and construct a new graph from the result CONSTRUCT ON socialNetwork, products CREATE (p)-[:IS]->(c) RETURN GRAPH ").graph
  • 28. #SAISDD9 Cypher DDL to define schema objects CATALOG CREATE GRAPH session.peopleUS { FROM session.people MATCH (us:Person)-[R*]-(n) WHERE us.nationality = ‘USA’ RETURN GRAPH OF * } CATALOG CREATE VIEW session.peopleByCountry($countryCode, $peopleGraph) { FROM $peopleGraph MATCH (us:Person)-[:R*]-(n) WHERE us.nationality = $countryCode RETURN GRAPH OF * }
  • 29. #SAISDD9 // named graph FROM session.peopleUS MATCH (people:Person) RETURN people.lastName // view over graph FROM session.peopleByCountry(‘USA’, teradata.europe.people) MATCH (people:Person) RETURN people.lastName Using named graphs and view functions
  • 30. #SAISDD9 Query composition: get data from new graph // Let's query the graph we just constructed val result = graph.cypher(" MATCH (person:Person)-[:FRIEND_OF]-(friend:Person), (friend)-[:IS]->(customer:Customer), (customer)-[:BOUGHT]->(product:Product) RETURN DISTINCT product.title AS recommendation, person.name ORDER BY recommendation ") result.show()
  • 31. #SAISDD9 SQL and Cypher working together // Query with Cypher val results = socialNetwork.cypher(" MATCH (a:Person)-[r:FRIEND_OF]->(b) RETURN a.name AS friend1, b.name AS friend2, r.since AS since ") // Extract DataFrame representing the query result and register results.records.asDataFrame.createOrReplaceTempView("friends") // Query with SQL spark.sql(" SELECT friend1, friend2, since FROM friends ORDER BY since ").show()
  • 33. #SAISDD9 Cypher Graph Schema Labels and Properties CREATE GRAPH snb WITH GRAPH SCHEMA ( LABEL (Company), LABEL (Message { creationDate : TIMESTAMP?, locationIP : STRING?, content : STRING?, length : INTEGER? }), LABEL (LIKES { creationDate : TIMESTAMP? }), ...
  • 34. #SAISDD9 Cypher Graph Schema Node/Edge Types // allowed node label sets (node types) (Message, Post), (Company), (Country), (Person), ... // allowed relationship (edge) types [LIKES], [KNOWS], [IS_LOCATED_IN], ...
  • 35. #SAISDD9 Cypher Graph Schema Relationship Triplets // relationship triplets (Message) <0 .. *> -[IS_LOCATED_IN]-> <1> (Country), (Person) <1> -[LIKES]-> <0 .. *> (Message), (Company) <0 .. *> -[IS_LOCATED_IN]-> <1> (Country), (Person) <0 .. *> -[KNOWS]-> <0 .. *> (Person), // end of pure graph schema
  • 36. #SAISDD9 SQL Graph DDL Mapping “Tables to Labels” RELATIONSHIP LABEL SETS ( (HAS_CREATOR) FROM "postHasCreator" edge START NODES LABEL SET (Message, Post) FROM "Post" start_nodes JOIN ON start_nodes.ID = edge."post" END NODES LABEL SET (Person) FROM "Person" end_nodes JOIN ON end_nodes.ID = edge."creator" ... )) Relationship Label Set → Relationship Type SQL Relationship Source Table Node Label Set → Node Type SQL Node Source Table
  • 37. #SAISDD9 SQL PGQ and GQL Morpheus SQL Property Graph Data Source SQL Graph DDL A prototype of SQL Property Graph Query (SQL/PGQ) Will be part of ISO SQL:202x Morpheus SQL PGDS Graph Schema and Composable Graph Queries “Prequel to GQL” GQL is an initiative to create an ISO international GQL standard alongside SQL SQL PGQ planned as a (major) subset of a wider “native” full CRUD GQL
  • 39. #SAISDD9 Spark SQL and Cypher → Spark SQL and GQL Cypher for Apache Spark developed by Neo4j ● Source code under Apache 2.0 license ● github.com/openCypher/cypher-for-apache-spark Considering SPIP to bring enhanced graph support to Spark ● Ongoing discussion with Databricks Apache Spark/GraphFrames developers ● Concept: DataFrame-based graphs and Cypher graph queries Directions ● Cypher → ISO GQL ● Cypher for Spark → Spark GQL + Spark SQL spark.sql spark.gql
  • 40. #SAISDD9 Neo4j Morpheus planned timeline Neo4j Morpheus a new product, complementing the Neo4j transactional DB ● Commercially supported Cypher for Apache Spark ● Certified for Spark distributions and for SQL data sources Limited access Early Adopter release scheduled for end October Sign up to join EA programme https://neo4j.com/morpheus/ Documentation: https://neo4j.com/docs/morpheus-user-guide/preview/ To come ● Cypher language feature expansion ● Performance and scale testing in Q4/Q1 H1 2019 1.0 release as an extension to Neo4j Enterprise