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

Can this be made to work with more complex graph? #2

Open
woodbri opened this issue Jan 16, 2019 · 0 comments
Open

Can this be made to work with more complex graph? #2

woodbri opened this issue Jan 16, 2019 · 0 comments

Comments

@woodbri
Copy link

woodbri commented Jan 16, 2019

I have family tree data in a levelgraph structured like:

{subject: INDI, predicate: 'child_of', object: FAMI}
{subject: FAMI, predicate: 'has_child', object: INDI}

{subject: INDI, predicate: 'marriage', object: FAMI}
{subject: FAMI, predicate: 'parent', object: INDI}

where INDI is a unique id for an individual and FAMI is a unique id for a family group the consists of 0..2 'parent' and 0..n 'has_child'.

So for example:
db.get({subject: 'I0169', predicate: 'child_of'}) returns the family group where 'I0169' is a child, say 'F0917'
db.get({subject: 'F0917', predicate: 'has_child'}) returns all the children of 'F0917'
db.get({subject: 'F0917', predicate: 'parent'}) returns the parents of this family group
db.get({subject: 'I0169', predicate: 'marriage'}) returns the family group id for each marriage of 'I0169'

I'm looking to get 3 things from the graph:

  1. list of descendants of an INDI
  2. list of ancestors of an INDI
  3. the shortest path relationship from INDI_A to INDI_B

for ancestor and descendants list if would be nice to also get the level that each result is at so level is incremented/decremented as you move up/down through the tree.

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