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

Notes on graph navigation #1

Open
tpetricek opened this issue May 29, 2019 · 0 comments
Open

Notes on graph navigation #1

tpetricek opened this issue May 29, 2019 · 0 comments

Comments

@tpetricek
Copy link
Member

Assuming we have

  • Yoda : hero
  • Luke : hero
  • Obi Wan : hero
  • Darth Wader : enemy
  • Tatooine : planet
  • Dagobath : planet

And relations:

  • Luke -(fights)-> Darth Wader
  • Luke -(lives on)-> Tatooine

We are creating tree like this one:

starwars
  - hero
      - Luke
      - Yoda
  - planet
      - Tatooine
      - Dagobath

And if you select starwars.hero.Luke then you get sub-tree:

  - fights
      - Darth Wader
  - lives on
      - Tatooine

Different requests

/starwars -- list all types of nodes

[ { "name":"hero",
    "returns":{"kind":"nested","endpoint":"/nodes_of_type/hero"} },
  { "name":"planet",
    "returns":{"kind":"nested","endpoint":"/nodes_of_type/planet"} } ]

/starwars/nodes_of_type/ -- list all nodes of type

[ { "name":"Luke",
    "returns":{"kind":"nested","endpoint":"/links_from_node/1"} },
  { "name":"Yoda",
    "returns":{"kind":"nested","endpoint":"/links_from_node/2"} } ]

/starwars/links_from_node/
-- list all relations linking node with with something

[ { "name":"fights",
    "returns":{"kind":"nested","endpoint":"/linked_from_node/1/figthts" } },
  { "name":"lives on",
    "returns":{"kind":"nested","endpoint":"/linked_from_node/2/lives on"} } ]

/starwars/linked_from_node//
-- list all nodes connected to by relation

[ { "name":"Darth Wader",
    "returns":{"kind":"nested","endpoint":"/links_from_node/3" } }]

Eventually, we get to something like:

{ "name":"get properties",
  "returns":
    { "kind":"primitive",
      "type": {"name":"seq","params":[{"name":"tuple","params":["string","float"]}]},
      "endpoint":"/data" } }

We need to handle the following requests (here :thing is a variable):

  • /starwars -- list all types of nodes
  • /starwars/nodes_of_type/:type -- list all nodes of type
  • /starwars/links_from_node/:node-id -- list all relations linking node with with something
  • /starwars/linked_from_node/:node-id/:relation -- list all nodes connected to by relation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant