Schema validation and evolution for PGs Eugenia Oshurko (ENS Lyon) - - PowerPoint PPT Presentation

schema validation and evolution for pgs
SMART_READER_LITE
LIVE PREVIEW

Schema validation and evolution for PGs Eugenia Oshurko (ENS Lyon) - - PowerPoint PPT Presentation

Schema validation and evolution for PGs Eugenia Oshurko (ENS Lyon) 7 March 2019 Main ideas Schema as a PG Schema validation via graph homomorphisms Schema nodes define node types Schema relations define relations allowed between


slide-1
SLIDE 1

Schema validation and evolution for PGs

Eugenia Oshurko (ENS Lyon) 7 March 2019

slide-2
SLIDE 2

1/7

Main ideas

  • Schema as a PG
  • Schema validation via graph homomorphisms
  • Schema nodes define node types
  • Schema relations define relations allowed between types
  • Properties on schema elements define sets of allowed properties
  • Schema/instance homomorphism allows to use existing tools

from the graph transformation community

slide-3
SLIDE 3

2/7

Update semantics

  • Sesqui-pushout (SqPO) rewriting approach
  • Rewriting given a rule and a matching of its left-hand side
  • Two phases
  • restrictive update: delete node/edge/property + clone node
  • expansive update: add node/edge/property + merge nodes

L P R G G− G+

slide-4
SLIDE 4

3/7

Schema/instance coupled updates

Prescriptive updates

  • Deletion of schema elements can be propagated to data
  • We can clone schema nodes (split concepts) clone of data

nodes Descriptive updates

  • Creation of data elements can be propagated to schema
  • We can merge nodes of different types merge of schema

concepts Result: instance respects schema at all times

slide-5
SLIDE 5

4/7

Prescriptive updates: example

L

Message imageFile: STRING type: {post, comment}

P

Post imageFile: STRING type: post Comment type: comment

S

Person Message

G

n1

firstName: Bryn lastName: Davies

n2

imageFile: photo33711.jpg creationDate: 2010-10-16 browserUsed: Firefox type: post

n3

firstName: Jose lastName: Alonso

n8

creationDate: 2010-10-30 browserUsed: {Firefox, Safari }

n5

firstName: Jane lastName: Murray

n6

creationDate: 2010-10-30 browserUsed: Safari type: comment LIKES K N O W S K N O W S LIKES HAS CREATOR H A S C R E A T O R HAS CREATOR REPLY OF

m h l−

slide-6
SLIDE 6

4/7

Prescriptive updates: example

L

Message imageFile: STRING type: {post, comment}

P

Post imageFile: STRING type: post Comment type: comment

S

Person Message

G

n1

firstName: Bryn lastName: Davies

n2

imageFile: photo33711.jpg creationDate: 2010-10-16 browserUsed: Firefox type: post

n3

firstName: Jose lastName: Alonso

n8

creationDate: 2010-10-30 browserUsed: {Firefox, Safari }

n5

firstName: Jane lastName: Murray

n6

creationDate: 2010-10-30 browserUsed: Safari type: comment LIKES K N O W S K N O W S LIKES HAS CREATOR H A S C R E A T O R HAS CREATOR REPLY OF

m h l−

Person

firstName: STRING lastName: STRING gender: STRING birthday: DATE

... Post

imageFile: STRING? creationDate: STRING browserUsed: STRING

... Comment

creationDate: STRING browserUsed: STRING

...

KNOWS HAS CREATOR H A S C R E A T O R LIKES LIKES R E P L Y O F R E P L Y O F

slide-7
SLIDE 7

4/7

Prescriptive updates: example

L

Message imageFile: STRING type: {post, comment}

P

Post imageFile: STRING type: post Comment type: comment

S

Person Message

G

n1

firstName: Bryn lastName: Davies

n2

imageFile: photo33711.jpg creationDate: 2010-10-16 browserUsed: Firefox type: post

n3

firstName: Jose lastName: Alonso

n8

creationDate: 2010-10-30 browserUsed: {Firefox, Safari }

n5

firstName: Jane lastName: Murray

n6

creationDate: 2010-10-30 browserUsed: Safari type: comment LIKES K N O W S K N O W S LIKES HAS CREATOR H A S C R E A T O R HAS CREATOR REPLY OF

m h l−

Person

firstName: STRING lastName: STRING gender: STRING birthday: DATE

... Post

imageFile: STRING? creationDate: STRING browserUsed: STRING

... Comment

creationDate: STRING browserUsed: STRING

...

KNOWS HAS CREATOR H A S C R E A T O R LIKES LIKES R E P L Y O F R E P L Y O F

n1

firstName: Bryn lastName: Davies

n2

imageFile: photo33711.jpg creationDate: 2010-10-16 browserUsed: Firefox type: post

n3

firstName: Jose lastName: Alonso

n8

creationDate: 2010-10-30 browserUsed: {Firefox, Safari }

n9

creationDate: 2010-10-30 browserUsed: {Firefox, Safari }

n5

firstName: Jane lastName: Murray

n6

creationDate: 2010-10-30 browserUsed: Safari type: comment LIKES K N O W S K N O W S LIKES LIKES HAS CREATOR HAS CREATOR H A S C R E A T O R HAS CREATOR REPLY OF REPLY OF

slide-8
SLIDE 8

5/7

Descriptive updates: example

P

a b

G

n1

firstName: Bryn lastName: Davies

n2

imageFile: photo33711.jpg creationDate: 2010-10-16 browserUsed: Firefox

n3

firstName: Jose lastName: Alonso

n4

creationDate: 2010-10-30 browserUsed: Firefox

n5

firstName: Jane lastName: Murray

n6

creationDate: 2010-10-30 browserUsed: Safari

n7

creationDate: 2010-10-30 browserUsed: Safari LIKES K N O W S K N O W S LIKES HAS CREATOR H A S C R E A T O R HAS CREATOR LIKES REPLY OF H A S C R E A T O R REPLY OF

m− R

ab

G+

n1

firstName: Bryn lastName: Davies

n2

imageFile: photo33711.jpg creationDate: 2010-10-16 browserUsed: Firefox

n3

firstName: Jose lastName: Alonso

n8

creationDate: 2010-10-30 browserUsed: {Firefox, Safari }

n5

firstName: Jane lastName: Murray

n6

creationDate: 2010-10-30 browserUsed: Safari LIKES K N O W S K N O W S LIKES HAS CREATOR H A S C R E A T O R HAS CREATOR L I K E S REPLY OF HAS CREATOR REPLY OF

m+

Person

firstName: STRING lastName: STRING gender: STRING birthday: DATE

... Post

imageFile: STRING? creationDate: STRING browserUsed: STRING

... Comment

creationDate: STRING browserUsed: STRING

...

KNOWS HAS CREATOR H A S C R E A T O R LIKES LIKES R E P L Y O F R E P L Y O F

slide-9
SLIDE 9

5/7

Descriptive updates: example

P

a b

G

n1

firstName: Bryn lastName: Davies

n2

imageFile: photo33711.jpg creationDate: 2010-10-16 browserUsed: Firefox

n3

firstName: Jose lastName: Alonso

n4

creationDate: 2010-10-30 browserUsed: Firefox

n5

firstName: Jane lastName: Murray

n6

creationDate: 2010-10-30 browserUsed: Safari

n7

creationDate: 2010-10-30 browserUsed: Safari LIKES K N O W S K N O W S LIKES HAS CREATOR H A S C R E A T O R HAS CREATOR LIKES REPLY OF H A S C R E A T O R REPLY OF

m− R

ab

G+

n1

firstName: Bryn lastName: Davies

n2

imageFile: photo33711.jpg creationDate: 2010-10-16 browserUsed: Firefox

n3

firstName: Jose lastName: Alonso

n8

creationDate: 2010-10-30 browserUsed: {Firefox, Safari }

n5

firstName: Jane lastName: Murray

n6

creationDate: 2010-10-30 browserUsed: Safari LIKES K N O W S K N O W S LIKES HAS CREATOR H A S C R E A T O R HAS CREATOR L I K E S REPLY OF HAS CREATOR REPLY OF

m+

Person

firstName: STRING lastName: STRING gender: STRING birthday: DATE

... Post

imageFile: STRING? creationDate: STRING browserUsed: STRING

... Comment

creationDate: STRING browserUsed: STRING

...

KNOWS HAS CREATOR H A S C R E A T O R LIKES LIKES R E P L Y O F R E P L Y O F

Person

firstName: STRING lastName: STRING gender: STRING birthday: DATE

... Message

language: STRING? imageFile: STRING? creationDate: STRING lastName: TIMESTAMP browserUsed: STRING locationIP: DATE

...

KNOWS HAS CREATOR LIKES REPLY OF

slide-10
SLIDE 10

6/7

Prototype

  • Prototype system implemented in the regraph Python library

(based on Neo4j PGs, see on GitHub https://github.com/Kappa-Dev/ReGraph)

  • We convert rules + matchings to openCypher queries
  • regraph generalizes schema/data relation to hierarchies of

graphs.

regraph

slide-11
SLIDE 11

7/7

Remarks

Couple of technical issues:

  • no native support for node cloning and node merge (we wrote

huge unreadable queries);

  • no way to set properties by dynamic keys (we use APOC).

Pre-print available: Angela Bonifati (UCBL1), Peter Furniss (Neo4j), Alastair Green (Neo4j), Russ Harmer (CNRS), Eugenia Oshurko (ENSL), Hannes Voigt (Neo4j), Schema Validation and Evolution for Graph Databases, https://arxiv.org/abs/1902.06427