Skip to content

Commit

Permalink
Metadata for all steatments
Browse files Browse the repository at this point in the history
  • Loading branch information
lszeremeta committed Nov 29, 2021
1 parent 84cec2f commit df6c1f3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
14 changes: 7 additions & 7 deletions other-notations/YARSpg.ebnf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
*/
yarspg ::= statement*
yarspg ::= (statement metadata?)*
statement
::= node
| edge
Expand Down Expand Up @@ -64,13 +64,13 @@ graphs_list
::= '/' graph_id (',' graph_id)* '/'
graph ::= '/' graph_id '/' ( '{' ( graph_label ( ',' graph_label )* )? '}' )? prop_list?
node
::= '(' node_id ( '{' ( node_label ( ',' node_label )* )? '}' )? prop_list? ')' graphs_list? metadata?
::= '(' node_id ( '{' ( node_label ( ',' node_label )* )? '}' )? prop_list? ')' graphs_list?
edge
::= directed
| undirected
directed ::= '(' node_id ')' '-' '(' edge_id? ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list? ')' '->' '(' node_id ')' graphs_list? metadata?
directed ::= '(' node_id ')' '-' '(' edge_id? ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list? ')' '->' '(' node_id ')' graphs_list?
undirected
::= '(' node_id ')' '-' '(' edge_id? ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list? ')' '-' '(' node_id ')' graphs_list? metadata?
::= '(' node_id ')' '-' '(' edge_id? ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list? ')' '-' '(' node_id ')' graphs_list?
node_id ::= ALNUMPLUS
node_label
::= STRING
Expand All @@ -93,7 +93,7 @@ set_value ::= '{' ( primitive_value | set_value ) meta_prop? ( ',' ( primit
list_value ::= '[' ( primitive_value | list_value ) meta_prop? ( ',' ( primitive_value | list_value ) meta_prop? )* ']'
struct_value ::= '{' key ':' ( primitive_value | struct_value ) meta_prop? ( ',' key ':' ( primitive_value | struct_value ) meta_prop? )* '}'
node_schema
::= 'S' '(' node_id_schema ( '{' ( node_label ( ',' node_label )* )? '}' )? prop_list_schema? ')' graphs_list? metadata?
::= 'S' '(' node_id_schema ( '{' ( node_label ( ',' node_label )* )? '}' )? prop_list_schema? ')' graphs_list?
node_id_schema
::= ALNUMPLUS
prop_list_schema
Expand Down Expand Up @@ -141,9 +141,9 @@ edge_schema
::= directed_schema
| undirected_schema
directed_schema
::= 'S' '(' node_id_schema ')' '-' ( '(' ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list_schema? ')' )? '->' '(' node_id_schema ')' graphs_list? metadata?
::= 'S' '(' node_id_schema ')' '-' ( '(' ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list_schema? ')' )? '->' '(' node_id_schema ')' graphs_list?
undirected_schema
::= 'S' '(' node_id_schema ')' '-' ( '(' ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list_schema? ')' )? '-' '(' node_id_schema1 ')' graphs_list? metadata?
::= 'S' '(' node_id_schema ')' '-' ( '(' ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list_schema? ')' )? '-' '(' node_id_schema1 ')' graphs_list?
graph_schema
::= 'S' '/' graph_id '/' prop_list_schema?
COMMENT ::= '#' [^#xd#xa#xc]*
Expand Down
14 changes: 7 additions & 7 deletions yarspg/YARSpg.g4
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
grammar YARSpg;

yarspg
: statement* EOF
: (statement metadata?)* EOF
;

statement
Expand Down Expand Up @@ -84,7 +84,7 @@ graph
;

node
: '(' node_id ( '{' ( node_label ( ',' node_label )* )? '}' )? prop_list? ')' graphs_list? metadata?
: '(' node_id ( '{' ( node_label ( ',' node_label )* )? '}' )? prop_list? ')' graphs_list?
;

edge
Expand All @@ -93,11 +93,11 @@ edge
;

directed
: '(' node_id ')' '-' '(' edge_id? ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list? ')' '->' '(' node_id ')' graphs_list? metadata?
: '(' node_id ')' '-' '(' edge_id? ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list? ')' '->' '(' node_id ')' graphs_list?
;

undirected
: '(' node_id ')' '-' '(' edge_id? ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list? ')' '-' '(' node_id ')' graphs_list? metadata?
: '(' node_id ')' '-' '(' edge_id? ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list? ')' '-' '(' node_id ')' graphs_list?
;

node_id
Expand Down Expand Up @@ -156,7 +156,7 @@ struct_value
;

node_schema
: 'S' '(' node_id_schema ( '{' ( node_label ( ',' node_label )* )? '}' )? prop_list_schema? ')' graphs_list? metadata?
: 'S' '(' node_id_schema ( '{' ( node_label ( ',' node_label )* )? '}' )? prop_list_schema? ')' graphs_list?
;

node_id_schema
Expand Down Expand Up @@ -241,11 +241,11 @@ edge_schema
;

directed_schema
: 'S' '(' node_id_schema ')' '-' ( '(' ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list_schema? ')' )? '->' '(' node_id_schema ')' graphs_list? metadata?
: 'S' '(' node_id_schema ')' '-' ( '(' ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list_schema? ')' )? '->' '(' node_id_schema ')' graphs_list?
;

undirected_schema
: 'S' '(' node_id_schema ')' '-' ( '(' ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list_schema? ')' )? '-' '(' node_id_schema ')' graphs_list? metadata?
: 'S' '(' node_id_schema ')' '-' ( '(' ( '{' ( edge_label ( ',' edge_label )* )? '}' )? prop_list_schema? ')' )? '-' '(' node_id_schema ')' graphs_list?
;

graph_schema
Expand Down
10 changes: 5 additions & 5 deletions yarspg/examples/test-example.yarspg
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# GRAPH
S/default/["prop": Bool]
/default/{"graph_label"}["prop": "false"]
/default/{"graph_label"}["prop": "false"] +["metadata": "yes"]

S/graph1/["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>
$graph2_prop = "prop2": "Abc"@<"ok": "false">+ ["metadata": "yes"]
$graph2_prop_schema = "prop2": String @<"ok": Bool>+["metadata": "yes"]

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

# GRAPH
S/graph3/[]
S/graph3/[]+["metadata": "yes"]
/graph3/{}[]

# GRAPH
Expand All @@ -25,7 +25,7 @@ S/graph4/

# Metadata (with prefixes)
+[":dc": "<http://xmlns.com/dc/0.5/>"]
+[":foaf": "<http://xmlns.com/foaf/0.1/>"]
+[":foaf": "<http://xmlns.com/foaf/0.1/>"]+["metadata": "YES"]

# METADATA
+["foaf:maker": "Łukasz Szeremeta and Dominik Tomaszuk"]
Expand Down

0 comments on commit df6c1f3

Please sign in to comment.