Skip to content

Commit

Permalink
Add graph_schema
Browse files Browse the repository at this point in the history
  • Loading branch information
lszeremeta committed Sep 22, 2020
1 parent c6818ed commit 8795d9e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions other-notations/YARSpg.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ statement
| var_declaration_schema
| section
| graph
| graphs_schema
prefix_directive
::= pname IRI
pname ::= ':' ALNUM_PLUS ':'
Expand Down Expand Up @@ -160,6 +161,8 @@ directed_schema
::= 'S' '(' node_id_schema ')' '-' '(' ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list_schema? ')' '->' '(' node_id_schema ')'
undirected_schema
::= 'S' '(' node_id_schema ')' '-' '(' ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list_schema? ')' '-' '(' node_id_schema1 ')'
graph_schema
::= 'S' '/' graph_id '/' ( '{' ( graph_label ( ',' graph_label )* )? '}' )? prop_list_schema?
number ::= UNSIGNED_INT
| SIGNED_INT
| DECIMAL
Expand Down
5 changes: 5 additions & 0 deletions yarspg/YARSpg.g4
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ statement
| var_declaration_schema
| section
| graph
| graph_schema
;

prefix_directive
Expand Down Expand Up @@ -284,6 +285,10 @@ undirected_schema
: 'S' '(' node_id_schema ')' '-' '(' ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list_schema? ')' '-' '(' node_id_schema ')'
;

graph_schema
: 'S' '/' graph_id '/' ( '{' ( graph_label ( ',' graph_label )* )? '}' )? prop_list_schema?
;

number
: UNSIGNED_INT
| SIGNED_INT
Expand Down
5 changes: 5 additions & 0 deletions yarspg/examples/test-example.yarspg
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
%GRAPH
S/graph1/{"graph_label", "graphlabel2"}["prop": Bool, "prop2": String]
/graph1/{"graph_label", "graphlabel2"}["prop": true, "prop2": "Abc"]

$graph2_prop = "prop2": "Abc"@"ok": false
$graph2_prop_schema = "prop2": String @"ok": Bool

%GRAPH
S/graph2/{"graph_label", "graphlabel2"}["prop": Bool, $graph2_prop_schema]
/graph2/{"graph_label", "graphlabel2"}["prop": true, $graph2_prop]

%GRAPH
S/graph3/{}[]
/graph3/{}[]

%GRAPH
S/graph4/
/graph4/

# This is test example
Expand Down

0 comments on commit 8795d9e

Please sign in to comment.