tree editing with zippers
DESCRIPTION
A quick talk on how to use Clojure zippers over trees made from records and build a tree pattern matching / mutation facility over that.TRANSCRIPT
![Page 1: Tree Editing with Zippers](https://reader033.vdocuments.site/reader033/viewer/2022052315/555c25fad8b42a0b418b4ce2/html5/thumbnails/1.jpg)
Tree Editing with Zippers
Alex MillerRevelytix
aka @puredangeraka “Dr. Strange Loop”
![Page 2: Tree Editing with Zippers](https://reader033.vdocuments.site/reader033/viewer/2022052315/555c25fad8b42a0b418b4ce2/html5/thumbnails/2.jpg)
Zipper node protocol
![Page 3: Tree Editing with Zippers](https://reader033.vdocuments.site/reader033/viewer/2022052315/555c25fad8b42a0b418b4ce2/html5/thumbnails/3.jpg)
Some records
![Page 4: Tree Editing with Zippers](https://reader033.vdocuments.site/reader033/viewer/2022052315/555c25fad8b42a0b418b4ce2/html5/thumbnails/4.jpg)
Two “child” variants
seq of records
fields holding records
![Page 5: Tree Editing with Zippers](https://reader033.vdocuments.site/reader033/viewer/2022052315/555c25fad8b42a0b418b4ce2/html5/thumbnails/5.jpg)
Use the record zipperComparison
:op := :left :right
ScalarFunction
:f :+ :exprs
ScalarFunction
:f :- :exprs
2 3 6 1
“(2 + 3) = (6 - 1)”
![Page 6: Tree Editing with Zippers](https://reader033.vdocuments.site/reader033/viewer/2022052315/555c25fad8b42a0b418b4ce2/html5/thumbnails/6.jpg)
Use the record zipperComparison
:op := :left :right
ScalarFunction
:f :+ :exprs
ScalarFunction
:f :- :exprs
2 3 6 1
“(2 + 3) = (6 - 1)”
![Page 7: Tree Editing with Zippers](https://reader033.vdocuments.site/reader033/viewer/2022052315/555c25fad8b42a0b418b4ce2/html5/thumbnails/7.jpg)
Use the record zipperComparison
:op := :left :right
ScalarFunction
:f :+ :exprs
ScalarFunction
:f :- :exprs
2 3 6 1
“(2 + 3) = (6 - 1)”
![Page 8: Tree Editing with Zippers](https://reader033.vdocuments.site/reader033/viewer/2022052315/555c25fad8b42a0b418b4ce2/html5/thumbnails/8.jpg)
Use the record zipperComparison
:op := :left :right
ScalarFunction
:f :+ :exprs
ScalarFunction
:f :- :exprs
2 3 6 1
“(2 + 3) = (6 - 1)”
![Page 9: Tree Editing with Zippers](https://reader033.vdocuments.site/reader033/viewer/2022052315/555c25fad8b42a0b418b4ce2/html5/thumbnails/9.jpg)
Tree pattern mutator
![Page 10: Tree Editing with Zippers](https://reader033.vdocuments.site/reader033/viewer/2022052315/555c25fad8b42a0b418b4ce2/html5/thumbnails/10.jpg)
Apply evaluation ruleComparison
:op := :left :right
ScalarFunction
:f :- :exprs
5
6 1
Comparison
:op := :left :right
5 5
![Page 11: Tree Editing with Zippers](https://reader033.vdocuments.site/reader033/viewer/2022052315/555c25fad8b42a0b418b4ce2/html5/thumbnails/11.jpg)
Revelytix
• Data integration using semantic web
• SPARQL -> SQL translation
• SPARQL federation
• Business rules engine
• Emergent analytics
![Page 12: Tree Editing with Zippers](https://reader033.vdocuments.site/reader033/viewer/2022052315/555c25fad8b42a0b418b4ce2/html5/thumbnails/12.jpg)
SPARQL to SQL Parse, translate to SPARQL algebra
Plan using mappingOptimize plan
Generate SQL
SELECT ?Person ?NameWHERE { ?Person <http://domain/Person/Name> ?name }
SPARQL algebra tree
SQL query plan
SELECT 'http://domain/Person/' || ID, NameFROM People
SQL query plan
tree rules