Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add yaml v1 #15

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ NOTE: `.json` examples are formatter using https://jsonformatter.curiousconcept.
## v1

* [example graph](v1/examples/create_example.cypher)
* [example schema](v1/examples/schema_example.json)
* [example json schema](v1/examples/schema_example.json)
* [example yaml schema](v1/examples/schema_example.yaml)
129 changes: 129 additions & 0 deletions v1/examples/schema_example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# LPG YAML Schema Options - examples

# Version 1 - simple
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple version is for interoperability (sharing info between different domains, e.g., business and research)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

USA-CASE: Share the understanding as quickly as possible

---
Nodes:
Person:
- id: STRING
- first_name: STRING
- last_name: STRING
- years_of_age: INT
- date_of_birth: DATETIME
Address:
- id: STRING
- address_line_1: STRING
- address_line_2: STRING
- city: STRING
- post_code: STRING
EDGES:
LIVES_AT:
- directed: BOOLEAN
- multiedge: BOOLEAN
- from_node_type: Person
- to_node_type: Address
- start_date: DATETIME
- end_date: DATETIME
WORKS_AT:
- directed: BOOLEAN
- multiedge: BOOLEAN
- from_node_type: Person
- to_node_type: Address
- start_date: DATETIME
- end_date: DATETIME
...

# Version 2 - extensible
---
Nodes:
Person:
attributes:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How to add "label aliases" (under Person or attributes)?

- id:
type: STRING
mandatory: BOOLEAN
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unique: BOOLEAN is an extension on the attribute

- first_name:
type: STRING
mandatory: BOOLEAN
indexed: BOOLEAN
default: STRING
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the type of the default value?

- last_name:
type: STRING
mandatory: BOOLEAN
indexed: BOOLEAN
default: STRING
- years_of_age:
type: INT
mandatory: BOOLEAN
indexed: BOOLEAN
default: STRING
- date_of_birth:
type: DATETIME
mandatory: BOOLEAN
indexed: BOOLEAN
default: STRING
extension:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be anything, such as information about the information or metadata about the label node.

- count: INT
- filling_factor: FLOAT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

N/A

Address:
attributes:
- id:
type: STRING
mandatory: BOOLEAN
indexed: BOOLEAN
default: STRING
- address_line_1:
type: STRING
mandatory: BOOLEAN
indexed: BOOLEAN
default: STRING
- address_line_2:
type: STRING
mandatory: BOOLEAN
indexed: BOOLEAN
default: STRING
- city:
type: STRING
mandatory: BOOLEAN
indexed: BOOLEAN
default: STRING
- post_code:
type: STRING
mandatory: BOOLEAN
indexed: BOOLEAN
default: STRING
extension:
- count: INT
- filling_factor: FLOAT
EDGES:
LIVES_AT:
properties:
- directed: BOOLEAN
- multiedge: BOOLEAN
- from_node_type: Person
- to_node_type: Address
attributes:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"properties are the properties of the edge type"
"attributes are properties of the edges"

properties (properties of the edges) vs attributes

- start_date:
type: DATETIME
mandatory: BOOLEAN
- end_date:
type: DATETIME
mandatory: BOOLEAN
extension:
- count: INT
- filling_factor: FLOAT
WORKS_AT:
properties:
- directed: BOOLEAN
- multiedge: BOOLEAN
- from_node_type: Person
- to_node_type: Address
attributes:
- start_date:
type: DATETIME
mandatory: BOOLEAN
- end_date:
type: DATETIME
mandatory: BOOLEAN
extension:
- count: INT
- filling_factor: FLOAT
...
127 changes: 127 additions & 0 deletions v1/spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# LPG YAML Schema Options

# See "examples" folder for examples of the simple and extensible versions

# Version 1 - simple
# PROS:
# - Simple
# - Very human readable
# CONS:
# - Not extensible

---
Nodes: # Reserved
LabelOne:
- id: STRING # Reserved
- attribute_1: <TYPE>
- attribute_2: <TYPE>
- attribute_3: <TYPE>
LabelTwo:
- id: STRING # Reserved
- attribute_1: <TYPE>
- attribute_2: <TYPE>
- attribute_3: <TYPE>
EDGES: # Reserved
LABEL_THREE:
- directed: BOOLEAN # Reserved
- multiedge: BOOLEAN # Reserved
- from_node_type: <NODE> # Reserved
- to_node_type: <NODE> # Reserved
- attribute_1: <TYPE>
- attribute_2: <TYPE>
LABEL_FOUR:
- directed: BOOLEAN # Reserved
- multiedge: BOOLEAN # Reserved
- from_node_type: <NODE> # Reserved
- to_node_type: <NODE> # Reserved
- attribute_1: <TYPE>
- attribute_2: <TYPE>
...

# Version 2 - extensible
# PROS:
# - Edge-type properties distinct from attributes
# - Extensible
# CONS:
# - Extra levels of indenting / complexity
# - Less human readable

---
Nodes: # Reserved
LabelOne:
attributes:
- id: # Reserved
type: <TYPE> # Reserved
extension_1: <TYPE>
extension_2: <TYPE>
- attribute_1:
type: STRING # Reserved
extension_1: <TYPE>
extension_2: <TYPE>
- attribute_2:
type: STRING # Reserved
extension_1: <TYPE>
extension_2: <TYPE>
extension:
- extension_1: <TYPE>
- extension_2: <TYPE>
LabelTwo:
attributes:
- id: # Reserved
type: <TYPE> # Reserved
extension_1: <TYPE>
extension_2: <TYPE>
- attribute_1:
type: STRING # Reserved
extension_1: <TYPE>
extension_2: <TYPE>
- attribute_2:
type: STRING # Reserved
extension_1: <TYPE>
extension_2: <TYPE>
extension:
- extension_1: <TYPE>
- extension_2: <TYPE>
EDGES: # Reserved
LABEL_THREE:
properties: # Reserved
- directed: <TYPE> # Reserved
- multiedge: <TYPE> # Reserved
- from_node_type: <NODE> # Reserved
- to_node_type: <NODE> # Reserved
attributes: # Reserved
- attribute_1:
type: <TYPE> # Reserved
extension_1: <TYPE>
extension_2: <TYPE>
- attribute_2:
type: <TYPE> # Reserved
extension_1: <TYPE>
extension_2: <TYPE>
extension:
- extension_1: <TYPE>
- extension_2: <TYPE>
LABEL_FOUR:
properties: # Reserved
- directed: <TYPE> # Reserved
- multiedge: <TYPE> # Reserved
- from_node_type: <NODE> # Reserved
- to_node_type: <NODE> # Reserved
attributes: # Reserved
- attribute_1:
type: <TYPE> # Reserved
extension_1: <TYPE>
extension_2: <TYPE>
- attribute_2:
type: <TYPE> # Reserved
extension_1: <TYPE>
extension_2: <TYPE>
extension:
- extension_1: <TYPE>
- extension_2: <TYPE>
...

# Open question(s)
# 1. How best to represent single edge types that go between multiple node types?
# e.g. Person KNOWS Person AND Person KNOWS Pet
# i.e. KNOWS is the same edge type whether it's Person self-edge or Person to Pet