aso2101 / satavahana-inscriptions

1 stars 0 forks source link

Visualizing relations between persons #66

Open aso2101 opened 7 years ago

aso2101 commented 7 years ago

@wsalesky my plan was to augment the current behavior on person.html (app:person-relations) with a visualization using d3.js, as we've discussed. In the vast majority of cases, there will be a relation with at most one other person, so it seems most straighforward to have two labelled nodes, with a labelled line connecting them. But in a few cases there will be more relations.

As far as I can remember, the most elaborate relations are found in the Kuḍā data (contextuals/Persons/Kuḍā/Ku-000-relations.xml). I have not yet converted the person records for Kuḍā into full TEI documents, but that shouldn't matter right now. The Kuḍā data should give you an idea of how complex the relations will get. The main relations are parent/child, spouse, sibling, and teacher/student. There are a few more that I will add when we import another set of inscriptions soon...

wsalesky commented 7 years ago

Okay, rough draft is up using dTree. Let me know what you think. It might be nice to add more interactivity to the tree, perhaps links to the other persons. Also, perhaps you would like more information?

Also, currently the tree only shows descendants, should I try to add in ancestors as well? I would think that would be useful.

aso2101 commented 7 years ago

I think ancestors would be useful, too.

I couldn't install the issue66 branch because apparently the d3xquery namespace is not defined:

Error found while processing repo.xml: err:XPST0081 Error while loading module xmldb:exist:///db/apps/SAI/modules/sai-html.xql: error found while loading module app: Error while loading module app.xql: No namespace defined for prefix d3xquery [at line 188, column 18] In function: (item()*) [200:38:/home/andrew/applications/eXistDB3/webapp/WEB-INF/data/expathrepo/tei-publisher-lib-2.0.3/content/model.xql] pm:load-modules(array) [54:24:/home/andrew/applications/eXistDB3/webapp/WEB-INF/data/expathrepo/tei-publisher-lib-2.0.3/content/model.xql] pm:parse(element(), array, xs:string*) [126:31:/home/andrew/applications/eXistDB3/webapp/WEB-INF/data/expathrepo/tei-publisher-lib-2.0.3/content/model.xql] pmu:process-odd(document-node(), xs:string, xs:string, xs:string, element()?) [27:18:/home/andrew/applications/eXistDB3/webapp/WEB-INF/data/expathrepo/tei-publisher-lib-2.0.3/content/util.xql] local:generate-code(xs:string) [58:1:/home/andrew/applications/eXistDB3/webapp/WEB-INF/data/expathrepo/SAI-0.1/post-install.xql]
wsalesky commented 7 years ago

Ahh, sorry about that. I will try to get it fixed this weekend, and I will add ancestors as well.

wsalesky commented 7 years ago

I fixed the bug. Will look into adding ancestors today.

wsalesky commented 7 years ago

Latest version includes ancestors. Does not render siblings when there is no parent. This is a dTree rendering issue. I can look into it more, just not sure how much time you want devoted to this.

Example of sibling issue: http://localhost:8080/exist/apps/SAI/person/Sa-Arik%C4%81

This also does not render any non familial relationships, I think a force-directed graph would probably be a better option for that. Do you want to be able to see these other relationships as well?

aso2101 commented 7 years ago

This is great. I'll merge it into master and play around with the display.

Is there an easy-ish solution available for a force-directed graph? In that case we could label the nodes by their relationship (family or teacher-student) to the context node.

wsalesky commented 7 years ago

Yes, I have a version with force directed graphs also. Do you want it on a different branch, or a toggle button that allows toggle between views?

aso2101 commented 7 years ago

let's try it on a different branch for now, and I'll decide if we should keep both.

2017-09-12 17:02 GMT-04:00 Winona Salesky notifications@github.com:

Yes, I have a version with force directed graphs also. Do you want it on a different branch, or a toggle button that allows toggle between views?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aso2101/satavahana-inscriptions/issues/66#issuecomment-328983401, or mute the thread https://github.com/notifications/unsubscribe-auth/AA85r5trxFpME3Vrs82nhoVWnGUK6bWXks5shvFQgaJpZM4O8U0M .

aso2101 commented 7 years ago

by the way, this seems to be the biggest family tree we have so far:

http://localhost:8080/exist/apps/SAI/person/Ku-%C5%9Aivabh%C5%ABti

it doesn't fit, as i've currently laid it out on the page (although that's not such a problem since one can drag the family tree around), but most other examples will fit without a problem i think.

wsalesky commented 7 years ago

I added an option with the force directed graphs, branch: issue66-alt

It only shows direct relationships. If you want to add indirect relationships we can also do that, I tried both and was not sure which I preferred.

To view indirect relationships you can change: https://github.com/aso2101/satavahana-inscriptions/blob/8f9c72a6bd3fe4783073466d6fbc1d6ea117a09e/modules/lib/d3xquery.xqm#L238 to: var json = {d3xquery:build-json-force(d3xquery:get-expanded-data(d3xquery:get-related($id)))};

aso2101 commented 7 years ago

Oddly it is not drawing the graph on issue66-alt. (It is building the data fine, but nothing gets put into #graph.) There seem to be some missing dependencies on my side: the console complains that d3.scaleOrdinal is not a function.

wsalesky commented 6 years ago

Please try now. I updated the javascript.