Skip to content

Commit

Permalink
Add features-overview.yarspg example
Browse files Browse the repository at this point in the history
  • Loading branch information
lszeremeta committed May 30, 2021
1 parent 56bcff0 commit 8b7df25
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions yarspg/examples/features-overview.yarspg
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Comment

%GRAPH # section declaration mainly for canonical version

# Graph schema with graph id and optional labels and properties
S/graph1/{"graph_label", "graphlabel2"}["prop": Bool, "prop2": String]4

# Graph with graph id and optional labels and properties
/graph1/{"graph_label", "graphlabel2"}["prop": true, "prop2": "Abc"]

# Variables (can store properties; @ - meta properties)
$graph2_prop = "prop2": "Abc"@"ok": false
$graph2_prop_schema = "prop2": String @"ok": Bool

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

# Prefix declaration
:dc: <http://xmlns.com/dc/0.5/>
:foaf: <http://xmlns.com/foaf/0.1/>

# Metadata
-foaf:maker: "Łukasz Szeremeta"

# Node schema with node id and optional: node labels, properties, graphs and local metadata
# MIN, MAX, OPTIONAL
S(NS1 {"Author"}["fname": String, "lname": String])
S(NS2 {"Entry", "InProceedings"}["title": String, "numpages": Integer, "keyword": String OPTIONAL])
S(NS3 {"Entry", "Article"}["title": String, "numpages": Integer, "keyword": List(String MIN 1 MAX 5) OPTIONAL])
S(NS4 {"Proceedings"}["title": String, "year": Integer, "month": String OPTIONAL])
S(NS5 {"Journal"}["title": String, "year": Integer, "vol": Integer])

# Local metadata
S(NS1 {"Author"}["fname": String, "lname": String])+[foaf:maker: "Łukasz Szeremeta", <http://xmlns.com/dc/0.5/zyz>: "Test metadata"]

# UNIQUE
S(NS3 {"label333","c"}["value": String,"lang": String,"valid": Bool UNIQUE])/graph2/

# NULL
S(NS16 {"1ad32"}["list": List(String NULL)])

# List of List of String
S(NS18 {"ad3"}["list": List(List(String))])

# Edge schema with node ids and optional: edge labels, properties
S(NS2)-({"has_author"}["order": Integer])->(NS1)
S(NS3)-({"cities"})->(NS2)
S(NS2)-({"booktitle"}["pages": String])->(NS4)
S(NS3)-({"published_in"}["pages": String])->(NS5)

# Node with node id and optional: node labels, properties, graphs and local metadata
(Author01 {"Author"}["fname": "John", "lname": "Smith"]) #Author01
(Author02 {"Author"}["fname": "Alice", "lname": "Brown"])
(EI01 {"Entry", "InProceedings"}["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])

# Edge with node ids and optional: edge id, edge labels, properties, graphs, local metadata
(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)

0 comments on commit 8b7df25

Please sign in to comment.