Skip to content

Commit 42264bb

Browse files
committed
Sub-Graph Packs: data model extensibility
Related to: #2 #4 Signed-off-by: Matt Young <[email protected]>
1 parent 20000a3 commit 42264bb

File tree

23 files changed

+138
-2
lines changed

23 files changed

+138
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ Here's how it all fits together in the context of a movie search app:
103103
_TODO: [#27](https://github.com/cncf/landscape-graph/issues/27)_
104104

105105
| **Component** | **What it is**
106-
| --- | ---
106+
| --- | ---
107107
| Neo4j GraphQL Library | [{neo}/product/graphql-library](<https://neo4j.com/product/graphql-library>), ([dev blog](https://neo4j.com/developer-blog/announcing-the-release-of-the-neo4j-graphql-library-3-0-0/))
108108
| Neo4j Streams | [{neo}/labs/kafka](<https://neo4j.com/labs/kafka>), [{gh}/neo4j-contrib/neo4j-streams](https://github.com/neo4j-contrib/neo4j-streams)
109109
| gitbase | Git history as MySQL, [src-d/gitbase](https://github.com/src-d/gitbase)
@@ -120,7 +120,7 @@ Using the [data][seeddata] underlying the existing landscape as input, a Labeled
120120
[neo]: https://neo4j.com
121121
[cypherdev]: https://neo4j.com/developer/cypher/
122122

123-
![landscape-graph-data-model](db/model/Landscape-CNCF-GM.png)
123+
![landscape-graph-data-model](db/core/generated/landscape-graph-core.png)
124124

125125
## Graph Data Science Algorithms ("Why Neo4j?")
126126

db/README.md

+115
Original file line numberDiff line numberDiff line change
@@ -1 +1,116 @@
11
# Graph Data Model
2+
3+
## Core Data Model
4+
5+
![core-png](core/generated/landscape-graph-core.png)
6+
7+
### Entities
8+
9+
ctx->allTheThings.ToMarkdown();
10+
11+
## Sub-Graph Packs (SGP)
12+
13+
Each pack will have the following:
14+
15+
* GraphQL Schema, deriving from the base type.
16+
* png, svg, .json (arrows.app :))
17+
* Description / Documentation covering entities
18+
19+
```shell
20+
.
21+
├── blogs
22+
│ └── sgp-blogcncf
23+
├── boards
24+
│ ├── sgp-ghdiscuss
25+
│ └── sgp-stackoverflow
26+
├── core
27+
│ └── generated
28+
├── corp
29+
│ ├── sgp-crunchbase
30+
│ └── sgp-yahoofinance
31+
├── email
32+
├── packages
33+
│ ├── sgp-brew
34+
│ ├── sgp-choco
35+
│ ├── sgp-crate
36+
│ ├── sgp-deb
37+
│ ├── sgp-deno
38+
│ ├── sgp-go
39+
│ ├── sgp-maven
40+
│ ├── sgp-npm
41+
│ ├── sgp-pip
42+
│ └── sgp-rpm
43+
├── rtc
44+
│ ├── sgp-discord
45+
│ └── sgp-slack
46+
├── social
47+
│ ├── sgp-linkedin
48+
│ └── sgp-twitter
49+
├── threats
50+
│ └── sgp-nist
51+
└── videos
52+
└── sgp-youtube
53+
54+
```
55+
56+
## How Interfaces Work
57+
58+
https://neo4j.com/docs/graphql-manual/current/type-definitions/interfaces/#_directive_inheritance
59+
60+
> Any directives present on an interface or its fields will be "inherited" by any object types implementing it. For example, the type definitions above could be refactored to have the @relationship directive on the actors field in the Production interface instead of on each implementing type as it is currently:
61+
62+
```graphql
63+
interface Production {
64+
title: String!
65+
actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN, properties: "ActedIn")
66+
}
67+
68+
type Movie implements Production {
69+
title: String!
70+
actors: [Actor!]!
71+
runtime: Int!
72+
}
73+
74+
type Series implements Production {
75+
title: String!
76+
actors: [Actor!]!
77+
episodes: Int!
78+
}
79+
80+
interface ActedIn @relationshipProperties {
81+
role: String!
82+
}
83+
84+
type Actor {
85+
name: String!
86+
actedIn: [Production!]! @relationship(type: "ACTED_IN", direction: OUT, properties: "ActedIn")
87+
}
88+
```
89+
90+
<https://neo4j.com/docs/graphql-manual/current/type-definitions/interfaces/#_overriding>
91+
92+
> In addition to inheritance, directives can be overridden on a per-implementation basis. Say you had an interface defining some Content, with some basic authorization rules:
93+
94+
```graphql
95+
interface Content
96+
@auth(rules: [{ operations: [CREATE, UPDATE, DELETE], allow: { author: { username: "$jwt.sub" } } }]) {
97+
title: String!
98+
author: [Author!]! @relationship(type: "HAS_CONTENT", direction: IN)
99+
}
100+
101+
type User {
102+
username: String!
103+
content: [Content!]! @relationship(type: "HAS_CONTENT", direction: OUT)
104+
}
105+
106+
type PublicContent implements Content {
107+
title: String!
108+
author: [Author!]!
109+
}
110+
111+
type PrivateContent implements Content
112+
@auth(rules: [{ operations: [CREATE, READ, UPDATE, DELETE], allow: { author: { username: "$jwt.sub" } } }]) {
113+
title: String!
114+
author: [Author!]!
115+
}
116+
```

db/blogs/sgp-blogcncf/README.md

Whitespace-only changes.

db/boards/sgp-ghdiscuss/README.md

Whitespace-only changes.

db/boards/sgp-stackoverflow/README.md

Whitespace-only changes.

db/corp/sgp-crunchbase/README.md

Whitespace-only changes.

db/corp/sgp-yahoofinance/README.md

Whitespace-only changes.

db/packages/sgp-brew/README.md

Whitespace-only changes.

db/packages/sgp-choco/README.md

Whitespace-only changes.

db/packages/sgp-crate/README.md

Whitespace-only changes.

db/packages/sgp-deb/README.md

Whitespace-only changes.

db/packages/sgp-deno/README.md

Whitespace-only changes.

db/packages/sgp-go/README.md

Whitespace-only changes.

db/packages/sgp-maven/README.md

Whitespace-only changes.

db/packages/sgp-npm/README.md

Whitespace-only changes.

db/packages/sgp-pip/README.md

Whitespace-only changes.

db/packages/sgp-rpm/README.md

Whitespace-only changes.

db/rtc/sgp-discord/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# sgp-discord

db/rtc/sgp-slack/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# sgp-slack

db/social/sgp-linkedin/README.md

Whitespace-only changes.

db/social/sgp-twitter/README.md

Whitespace-only changes.

db/threats/sgp-nist/README.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Sub-Graph Pack: sgp-nist
2+
3+
https://www.cve.org
4+
https://github.com/CVEProject/cve-schema
5+
https://www.cve.org/ResourcesSupport/Glossary?activeTerm=glossaryRecord
6+
https://www.cve.org/About/Process#CVERecordLifecycle
7+
8+
9+
https://nvd.nist.gov/products/nvd
10+
https://nvd.nist.gov/products/cpe
11+
https://nvd.nist.gov/vuln/vulnerability-detail-pages
12+
https://nvd.nist.gov/vuln/vulnerability-status
13+
https://www.cvedetails.com/
14+
15+
https://www.cve.org/Media/News/item/news/2022/01/11/Changes-Coming-to-CVE-Record
16+
https://www.cve.org/Media/News/item/podcast/2021/07/13/How-the-New-CVE-Record
17+
18+

db/videos/sgp-youtube/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# sgp-youtube

0 commit comments

Comments
 (0)