From d57895bc8f65b691d536fd2da8d1994cd5461240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Szeremeta?= Date: Fri, 14 Dec 2018 22:57:06 +0100 Subject: [PATCH] Add ido --- yarspg/YARSpg.g4 | 14 ++++++++--- ...ith-properties-multiple-node-labels.yarspg | 10 -------- ...tion-with-relations-with-properties.yarspg | 10 -------- .../declaration-with-relations.yarspg | 10 -------- yarspg/examples/example.yarspg | 24 +++++++++---------- .../examples/vertex-declaration-values.yarspg | 5 ---- 6 files changed, 23 insertions(+), 50 deletions(-) delete mode 100644 yarspg/examples/declaration-with-relations-with-properties-multiple-node-labels.yarspg delete mode 100644 yarspg/examples/declaration-with-relations-with-properties.yarspg delete mode 100644 yarspg/examples/declaration-with-relations.yarspg delete mode 100644 yarspg/examples/vertex-declaration-values.yarspg diff --git a/yarspg/YARSpg.g4 b/yarspg/YARSpg.g4 index 42fda5f..a48b639 100644 --- a/yarspg/YARSpg.g4 +++ b/yarspg/YARSpg.g4 @@ -1,6 +1,8 @@ /* [The "BSD licence"] Copyright (c) 2018, Ɓukasz Szeremeta (@ University of Bialystok, http://www.uwb.edu.pl/) + Copyright (c) 2018, Dominik Tomaszuk (@ University of Bialystok, http://www.uwb.edu.pl/) + Copyright (c) 2018, Karol Litman (@ University of Bialystok, http://www.uwb.edu.pl/) All rights reserved. Based on YARS grammar @@ -38,7 +40,7 @@ declaration ; nodeDeclaration - : node_label (':' node_label)* ':' '{' prop (',' prop)* '}' + : ido ('[' node_label (':' node_label)* ']')? ':' '{' prop (',' prop)* '}' ; relationship @@ -47,17 +49,21 @@ relationship ; directed - : '(' node_label (':' node_label)* ')' '-' '[' relationship_label ('{' prop (',' prop)* '}')* ']' '->' '(' node_label (':' node_label)* ')' + : '(' ido ')' '-' '[' relationship_label ('{' prop (',' prop)* '}')* ']' '->' '(' ido ')' ; undirected - : '(' node_label (':' node_label)* ')' '-' '[' relationship_label ('{' prop (',' prop)* '}')* ']' '-' '(' node_label (':' node_label)* ')' + : '(' ido ')' '-' '[' relationship_label ('{' prop (',' prop)* '}')* ']' '-' '(' ido ')' ; relationship_label : ALNUM_PLUS ; +ido + : ALNUM_PLUS + ; + node_label : ALNUM_PLUS ; @@ -103,6 +109,8 @@ TRUE_FALSE | 'false' ; +/* FROM TURTLE ANTLR GRAMMAR */ + STRING_LITERAL_QUOTE : '"' (~ ["\\\r\n] | '\'' | '\\"')* '"' ; diff --git a/yarspg/examples/declaration-with-relations-with-properties-multiple-node-labels.yarspg b/yarspg/examples/declaration-with-relations-with-properties-multiple-node-labels.yarspg deleted file mode 100644 index a9523e6..0000000 --- a/yarspg/examples/declaration-with-relations-with-properties-multiple-node-labels.yarspg +++ /dev/null @@ -1,10 +0,0 @@ -a1d:x:{aa1a:true,a2aa:"text",aa3aa:null} -b:{value:5} -c:{value:"male",lang:"en",valid:false} -d:{key:442.1333} -e:y:v:{key44:[true,false,"some text", null, 11, 11.2231]} - -(a1d:x)-[aaa1a {key:"value", aab2bc:[44.22,"en",22]}]->(c) -(a1d:x)-[aaa2a]->(c) -(b)-[bbb23b]-(e:y:v) -(b)-[bbbb53b {bbbd32d:false, value:null}]-(e:y:v) diff --git a/yarspg/examples/declaration-with-relations-with-properties.yarspg b/yarspg/examples/declaration-with-relations-with-properties.yarspg deleted file mode 100644 index a1b8043..0000000 --- a/yarspg/examples/declaration-with-relations-with-properties.yarspg +++ /dev/null @@ -1,10 +0,0 @@ -a:{aa1a:true,a2aa:"text",aa3aa:null} -b:{value:5} -c:{value:"male",lang:"en",valid:false} -d:{key:442.1333} -e:{key44:[true,false,"some text", null, 11, 11.2231]} - -(a)-[aaa1a {key:"value", aab2bc:[44.22,"en",22]}]->(c) -(a)-[aaa2a]->(c) -(b)-[bbb23b]-(e) -(b)-[bbbb53b {bbbd32d:false, value:null}]-(e) diff --git a/yarspg/examples/declaration-with-relations.yarspg b/yarspg/examples/declaration-with-relations.yarspg deleted file mode 100644 index a26dc9a..0000000 --- a/yarspg/examples/declaration-with-relations.yarspg +++ /dev/null @@ -1,10 +0,0 @@ -a:{aa1a:true,a2aa:"text",aa3aa:null} -b:{value:5} -c:{value:"male",lang:"en",valid:false} -d:{key:442.1333} -e:{key44:[true,false,"some text", null, 11, 11.2231]} - -(a)-[aaa1a]->(c) -(a)-[aaa2a]->(c) -(b)-[bbb23b]-(e) -(b)-[bbbb53b]-(e) diff --git a/yarspg/examples/example.yarspg b/yarspg/examples/example.yarspg index 7e48ae9..257b480 100644 --- a/yarspg/examples/example.yarspg +++ b/yarspg/examples/example.yarspg @@ -1,13 +1,13 @@ -Author01:{fname:"Dominik",lname:"Tomaszuk"} -Author02:{fname:"Renzo",lname:"Angles"} -Entry01:InProceedings01:{title:"Serialization for...",numpages:10,keyword:"Graph database"} -Entry02:Article01:{title:"Property Graph...",numpages:10,keyword:["Query", "Graph"]} -Proceedings01:{title:"BDAS",year:2018,month:"May"} -Journal01:{title:"J. DB",year:2020,vol:30} +Author01[Author]:{fname:"John",lname:"Smith"} +Author02[Author]:{fname:"Alice",lname:"Brown"} +EI01[Entry:InProc]:{title:"Serialization for...", numpages:10,keyword:"Graph database"} +EA01[Entry:Article]:{title:"Property Graph...", numpages:10,keyword:["Query", "Graph"]} +Proc01[Proceedings]:{title:"BDAS",year:2018,month:"May"} +Jour01[Journal]:{title:"J. DB",year:2020,vol:30} -(Entry01:InProceedings01)-[has_author {order:1}]->(Author01) -(Entry01:InProceedings01)-[has_author {order:2}]->(Author02) -(Entry02:Article01)-[has_author {order:1}]->(Author02) -(Entry02:Article01)-[cites]->(Entry01:InProceedings01) -(Entry01:InProceedings01)-[booktitle {pages:"111-121"}]->(Proceedings01) -(Entry02:Article01)-[published_in {pages:"222-232"}]->(Journal01) +(EI01)-[has_author {order:1}]->(Author01) +(EI01)-[has_author {order:2}]->(Author02) +(EA01)-[has_author {order:1}]->(Author02) +(EA01)-[cites]->(EI01) +(EI01)-[booktitle {pages:"111-121"}]->(Proc01) +(EA01)-[published_in {pages:"222-232"}]->(Jour01) diff --git a/yarspg/examples/vertex-declaration-values.yarspg b/yarspg/examples/vertex-declaration-values.yarspg deleted file mode 100644 index d2d6b78..0000000 --- a/yarspg/examples/vertex-declaration-values.yarspg +++ /dev/null @@ -1,5 +0,0 @@ -a:{aa1a:true,a2aa:"text",aa3aa:null} -b:{value:5} -c:{value:"male",lang:"en",valid:false} -d:{key:442.1333} -e:{key44:[true,false,"some text", null, 11, 11.2231]}