Skip to content

Commit

Permalink
Sub-Graph Packs: data model extensibility
Browse files Browse the repository at this point in the history
Related to:

#2
#4

Signed-off-by: Matt Young <[email protected]>
  • Loading branch information
halcyondude committed Aug 4, 2022
1 parent 49798b2 commit a355788
Show file tree
Hide file tree
Showing 23 changed files with 138 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Here's how it all fits together in the context of a movie search app:
_TODO: [#27](https://github.com/cncf/landscape-graph/issues/27)_

| **Component** | **What it is**
| --- | ---
| --- | ---
| 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/))
| Neo4j Streams | [{neo}/labs/kafka](<https://neo4j.com/labs/kafka>), [{gh}/neo4j-contrib/neo4j-streams](https://github.com/neo4j-contrib/neo4j-streams)
| gitbase | Git history as MySQL, [src-d/gitbase](https://github.com/src-d/gitbase)
Expand All @@ -120,7 +120,7 @@ Using the [data][seeddata] underlying the existing landscape as input, a Labeled
[neo]: https://neo4j.com
[cypherdev]: https://neo4j.com/developer/cypher/

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

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

Expand Down
115 changes: 115 additions & 0 deletions db/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,116 @@
# Graph Data Model

## Core Data Model

![core-png](core/generated/landscape-graph-core.png)

### Entities

ctx->allTheThings.ToMarkdown();

## Sub-Graph Packs (SGP)

Each pack will have the following:

* GraphQL Schema, deriving from the base type.
* png, svg, .json (arrows.app :))
* Description / Documentation covering entities

```shell
.
├── blogs
│ └── sgp-blogcncf
├── boards
│ ├── sgp-ghdiscuss
│ └── sgp-stackoverflow
├── core
│ └── generated
├── corp
│ ├── sgp-crunchbase
│ └── sgp-yahoofinance
├── email
├── packages
│ ├── sgp-brew
│ ├── sgp-choco
│ ├── sgp-crate
│ ├── sgp-deb
│ ├── sgp-deno
│ ├── sgp-go
│ ├── sgp-maven
│ ├── sgp-npm
│ ├── sgp-pip
│ └── sgp-rpm
├── rtc
│ ├── sgp-discord
│ └── sgp-slack
├── social
│ ├── sgp-linkedin
│ └── sgp-twitter
├── threats
│ └── sgp-nist
└── videos
└── sgp-youtube

```

## How Interfaces Work

https://neo4j.com/docs/graphql-manual/current/type-definitions/interfaces/#_directive_inheritance

> 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:
```graphql
interface Production {
title: String!
actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN, properties: "ActedIn")
}

type Movie implements Production {
title: String!
actors: [Actor!]!
runtime: Int!
}

type Series implements Production {
title: String!
actors: [Actor!]!
episodes: Int!
}

interface ActedIn @relationshipProperties {
role: String!
}

type Actor {
name: String!
actedIn: [Production!]! @relationship(type: "ACTED_IN", direction: OUT, properties: "ActedIn")
}
```

<https://neo4j.com/docs/graphql-manual/current/type-definitions/interfaces/#_overriding>

> 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:

```graphql
interface Content
@auth(rules: [{ operations: [CREATE, UPDATE, DELETE], allow: { author: { username: "$jwt.sub" } } }]) {
title: String!
author: [Author!]! @relationship(type: "HAS_CONTENT", direction: IN)
}

type User {
username: String!
content: [Content!]! @relationship(type: "HAS_CONTENT", direction: OUT)
}

type PublicContent implements Content {
title: String!
author: [Author!]!
}

type PrivateContent implements Content
@auth(rules: [{ operations: [CREATE, READ, UPDATE, DELETE], allow: { author: { username: "$jwt.sub" } } }]) {
title: String!
author: [Author!]!
}
```
Empty file added db/blogs/sgp-blogcncf/README.md
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file added db/packages/sgp-brew/README.md
Empty file.
Empty file added db/packages/sgp-choco/README.md
Empty file.
Empty file added db/packages/sgp-crate/README.md
Empty file.
Empty file added db/packages/sgp-deb/README.md
Empty file.
Empty file added db/packages/sgp-deno/README.md
Empty file.
Empty file added db/packages/sgp-go/README.md
Empty file.
Empty file added db/packages/sgp-maven/README.md
Empty file.
Empty file added db/packages/sgp-npm/README.md
Empty file.
Empty file added db/packages/sgp-pip/README.md
Empty file.
Empty file added db/packages/sgp-rpm/README.md
Empty file.
1 change: 1 addition & 0 deletions db/rtc/sgp-discord/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# sgp-discord
1 change: 1 addition & 0 deletions db/rtc/sgp-slack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# sgp-slack
Empty file.
Empty file added db/social/sgp-twitter/README.md
Empty file.
18 changes: 18 additions & 0 deletions db/threats/sgp-nist/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Sub-Graph Pack: sgp-nist

https://www.cve.org
https://github.com/CVEProject/cve-schema
https://www.cve.org/ResourcesSupport/Glossary?activeTerm=glossaryRecord
https://www.cve.org/About/Process#CVERecordLifecycle


https://nvd.nist.gov/products/nvd
https://nvd.nist.gov/products/cpe
https://nvd.nist.gov/vuln/vulnerability-detail-pages
https://nvd.nist.gov/vuln/vulnerability-status
https://www.cvedetails.com/

https://www.cve.org/Media/News/item/news/2022/01/11/Changes-Coming-to-CVE-Record
https://www.cve.org/Media/News/item/podcast/2021/07/13/How-the-New-CVE-Record


1 change: 1 addition & 0 deletions db/videos/sgp-youtube/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# sgp-youtube

0 comments on commit a355788

Please sign in to comment.