Skip to content

Commit

Permalink
Change node_id and rel_id to STRING & apply changes to EBNF
Browse files Browse the repository at this point in the history
  • Loading branch information
lszeremeta committed Feb 28, 2019
1 parent 2aae4fe commit 75df8db
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 72 deletions.
28 changes: 3 additions & 25 deletions other-notations/YARSpg.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ declaration
::= nodeDeclaration
| relationship
nodeDeclaration
::= node_id '{' node_label ( ',' node_label )+ '}' ( '[' node_prop ( ',' node_prop )+ ']' )?
::= '<' node_id '>' '{' node_label ( ',' node_label )+ '}' ( '[' node_prop ( ',' node_prop )+ ']' )?
relationship
::= directed
| undirected
directed ::= '(' node_id ')' '-' ('<' rel_id '>')? '{' rel_label '}' ( '[' rel_prop ( ',' rel_prop )+ ']' )? '->' '(' node_id ')'
undirected
::= '(' node_id ')' '-' ('<' rel_id '>')? '{' rel_label '}' ( '[' rel_prop ( ',' rel_prop )+ ']' )? '-' '(' node_id ')'
node_id ::= ALNUM_PLUS
node_id ::= STRING
node_label
::= STRING
node_prop
::= key ':' value
rel_id ::= ALNUM_PLUS
rel_id ::= STRING
rel_label
::= STRING
rel_prop
Expand All @@ -74,27 +74,5 @@ TRUE_FALSE
::= 'true' | 'false'
STRING_LITERAL_QUOTE
::= '"' ( [^#x0022#x005C#x000A#x000D] | "'" | '\"' )* '"' /* #x0022=" #x005C=\ #x000A=new line #x000D=carriage return */
ALNUM_PLUS
::= PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)?
PN_CHARS ::= PN_CHARS_U | '-' | [0-9] | #x00B7 | [#x0300-#x036F] | [#x203F-#x2040]
PN_CHARS_U
::= PN_CHARS_BASE | '_'
UCHAR ::= '\u' HEX HEX HEX HEX | '\U' HEX HEX HEX HEX HEX HEX HEX HEX
PN_CHARS_BASE
::= [A-Z]
| [a-z]
| [0-9]
| [#x00C0-#x00D6]
| [#x00D8-#x00F6]
| [#x00F8-#x02FF]
| [#x0370-#x037D]
| [#x037F-#x1FFF]
| [#x200C-#x200D]
| [#x2070-#x218F]
| [#x2C00-#x2FEF]
| [#x3001-#xD7FF]
| [#xF900-#xFDCF]
| [#xFDF0-#xFFFD]
HEX ::= [0-9] | [A-F] | [a-f]
SP ::= [#x0020#x0009]+ /* #x0020=space #x0009=character tabulation */
NL ::= #x000D #x000A /* #x000D=carriage return #x000A=new line */
28 changes: 2 additions & 26 deletions yarspg/YARSpg.g4
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ undirected
;

node_id
: ALNUM_PLUS
: STRING
;

node_label
Expand All @@ -69,7 +69,7 @@ node_prop
;

rel_id
: ALNUM_PLUS
: STRING
;

rel_label
Expand Down Expand Up @@ -119,30 +119,6 @@ STRING_LITERAL_QUOTE
: '"' (~ ["\\\r\n] | '\'' | '\\"')* '"'
;
ALNUM_PLUS
: PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)?
;
PN_CHARS
: PN_CHARS_U | '-' | [0-9] | '\u00B7' | [\u0300-\u036F] | [\u203F-\u2040]
;
PN_CHARS_U
: PN_CHARS_BASE | '_'
;
UCHAR
: '\\u' HEX HEX HEX HEX | '\\U' HEX HEX HEX HEX HEX HEX HEX HEX
;
PN_CHARS_BASE
: 'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '\u00C0' .. '\u00D6' | '\u00D8' .. '\u00F6' | '\u00F8' .. '\u02FF' | '\u0370' .. '\u037D' | '\u037F' .. '\u1FFF' | '\u200C' .. '\u200D' | '\u2070' .. '\u218F' | '\u2C00' .. '\u2FEF' | '\u3001' .. '\uD7FF' | '\uF900' .. '\uFDCF' | '\uFDF0' .. '\uFFFD'
;
HEX
: [0-9] | [A-F] | [a-f]
;
/* FROM TURTLE ANTLR GRAMMAR */
SP
Expand Down
24 changes: 12 additions & 12 deletions yarspg/examples/real-example.yarspg
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<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]
<"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]

(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)
("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")
18 changes: 9 additions & 9 deletions yarspg/examples/test-example.yarspg
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<a>{"a1d","x"}["aa1a":true,"a2aa":"text","aa3aa":null]
<b43b>{"label1"}["value":5]
<c>{"label333","c"}["value":"male","lang":"en","valid":false]
<d>{"label546"}["key":442.1333]
<e>{"ef22","y","v"}["key44":[true,false,"some text", null, 11, 11.2231]]
<"a">{"a1d","x"}["aa1a":true,"a2aa":"text","aa3aa":null]
<"b43b">{"label1"}["value":5]
<"c">{"label333","c"}["value":"male","lang":"en","valid":false]
<"d">{"label546"}["key":442.1333]
<"e">{"ef22","y","v"}["key44":[true,false,"some text", null, 11, 11.2231]]

(a)-<ferf>{"aaa1a"}["key":"value", "aab2bc":[44.22,"en",22]]->(c)
(a)-<id341>{"aaa2a"}->(c)
(b43b)-{"bbb23b"}-(e)
(b43b)-{"bbbb53b"}["bbbd32d":false, "value":null]-(e)
("a")-<"ferf">{"aaa1a"}["key":"value", "aab2bc":[44.22,"en",22]]->("c")
("a")-<"id341">{"aaa2a"}->("c")
("b43b")-{"bbb23b"}-("e")
("b43b")-{"bbbb53b"}["bbbd32d":false, "value":null]-("e")

0 comments on commit 75df8db

Please sign in to comment.