mshd / wikitree

Tree structure of Wikidata entities (previous version here
https://mshd.github.io/wikitree/public/
GNU General Public License v3.0
8 stars 5 forks source link

Change the data structure to support Siblings and Spouses/Partner #23

Closed mshd closed 4 years ago

mshd commented 4 years ago

Subissue of #6

result2.zip see basic-example.js

I have found someone to update TreantJS, attached is an example. The new data structure has a new element called "spouse". We can get the property spouse, but this will not be enough, as some people have children with other people :) Basically we need to get the children first and see what their other father/mother for an element has. Addition recursive functions are needed.

  1. change Treant.js to TreantSpouse.js (file already in Rep) only for testing
  2. see example zip for the new data structure,
  3. !!!! first level cannot have a spouse, so please start after the second level
  4. if you get stuck, continue another Issue.

The Plugin might still be buggy, but we need to test it with our tool

edwinindrajayas commented 4 years ago

Hi @mshd . I don't know if that's is correct. After i get the id for the spouse, i call the api through Axios, but the curly bracket that usually change into value is not working

mshd commented 4 years ago

Yes, that is certainly not correct, first of all: don't use axios.get(), we already have a function for this that does the same "wikidataController.wikidataApi" As you can see in the page, it's not showing anything. A spouse can have children, a spouse can not have another spouse. Further, these are callback functions so you need some new function/structure.

edwinindrajayas commented 4 years ago

Capture

Okay, i'll remove the axios tomorrow, i just realized that wikidatacontroller.wikidataApi after pushed. So, in the screenshot that i attached, so later every entity either the husband or the wife have their own children, is that what you mean?

mshd commented 4 years ago

Yes that looks good, but keep in mind, that there can be multiple spouses. The children always go down from the spouse, your added hand-drawing is not necessary. Please push these chaanges

mshd commented 4 years ago

Please keep, in mind that data structure is only for descendants, for ancestors, nothing should be changed

mshd commented 4 years ago

Idea: first just work on descandants without spouses, save all spouses in an array. In all children add "mother" and "father" value to the array. Remove existing ids from the spouses (becuase either mother or father is already within the tree). Reconstruct the tree hierarchy. Add spouses or other parent to the structure, the unflatten function may also be moved to the backend

mshd commented 4 years ago

@edwinindrajayas for siblings you need to add a pseudo node JSON data structure guide.docx maybe this will help, so iff siblings is selected you need to add another pseudo node to support (add another hierarchy)

mshd commented 4 years ago

Screenshot from 2020-05-31 13-30-37