people.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. // Raccatto i parametri dall'URL -- mi aspetto un parametro di nome 'link'!
  2. thisUrlParams = {};
  3. window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
  4. thisUrlParams[key] = value;
  5. });
  6. console.log('URL get params: ', thisUrlParams);
  7. // Funzioni per eseguire le queries
  8. function prepareQueryURL(query){
  9. sparqlEndpoint = 'http://dev.restore.ovi.cnr.it:8890/sparql/';
  10. sparqlUrlParams = '?default-graph-uri=&query=' + encodeURIComponent(query) + '&output=json&callback=?';
  11. return sparqlEndpoint + sparqlUrlParams;
  12. }
  13. function doJsonQuery(query){
  14. queryURL = prepareQueryURL(query);
  15. response = $.ajax({//OGGETTO
  16. url: queryURL,
  17. dataType: "json",
  18. success: function (data){},
  19. error: function (e) {}
  20. });
  21. return response;
  22. }
  23. // Funzioni per raccattare + stringhificare l'output
  24. queryStringOutput = "";
  25. function stringifyResponse(val){
  26. resultArray = val['results']['bindings'];
  27. out = "";
  28. for(i = 0; i < resultArray.length; i++){
  29. out = out + JSON.stringify(resultArray[i])
  30. }
  31. queryStringOutput = (queryStringOutput + out).replace("}{",",");
  32. }
  33. prefixes = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \
  34. PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \
  35. PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/> \
  36. PREFIX owl: <http://www.w3.org/2002/07/owl#> \
  37. PREFIX schema: <http://schema.org/> \
  38. PREFIX foaf: <http://xmlns.com/foaf/0.1/> \
  39. PREFIX person: <http://www.w3.org/ns/person#>"
  40. query = prefixes + " SELECT DISTINCT ?place ?label ?coordinates \
  41. WHERE { \
  42. {?pc crm:P02_has_range <" + thisUrlParams.link + "> . \
  43. ?event_from crm:P01_has_domain ?pc ; \
  44. rdf:type crm:EL3_Receive_Letter; \
  45. crm:P26_moved_to ?place_from . \
  46. ?place_from rdf:type crm:E53_Place ; \
  47. owl:sameAs ?place . \
  48. ?place rdfs:label ?label ; \
  49. crm:P168_place_is_defined_by ?coordinates . \
  50. } UNION { \
  51. ?pc crm:P02_has_range <" + thisUrlParams.link + "> . \
  52. ?event_from crm:P01_has_domain ?pc ; \
  53. rdf:type crm:EL2_Send_Letter; \
  54. crm:P27_moved_from ?place_from . \
  55. ?place_from rdf:type crm:E53_Place ; \
  56. owl:sameAs ?place . \
  57. ?place rdfs:label ?label ; \
  58. crm:P168_place_is_defined_by ?coordinates . \
  59. } \
  60. }"
  61. queryInfo = prefixes + " SELECT DISTINCT ?graph ?label ?identifier ?name ?givenName ?familyName ?gender ?Birth_Date ?Birth_Place ?Death_Date ?Death_Place ?patronymic ?occupation (group_concat(distinct ?relative1 ;separator=', ') as ?relatives) ?qualification ?group \
  62. WHERE { \
  63. VALUES ?uri {<" + thisUrlParams.link + ">} \
  64. GRAPH ?graph {?uri rdfs:label ?label} \
  65. ?uri foaf:name ?name . \
  66. OPTIONAL {?uri crm:P1_is_identified_by ?id . \
  67. ?id rdfs:label ?identifier } \
  68. OPTIONAL {?uri foaf:givenName ?givenName} \
  69. OPTIONAL {?uri foaf:familyName ?familyName} \
  70. OPTIONAL {?uri foaf:gender ?gender} \
  71. OPTIONAL {?uri person:patronymicName ?patronymic } \
  72. OPTIONAL {?uri schema:hasOccupation ?uriOccupation . \
  73. ?uriOccupation rdf:type schema:Occupation; \
  74. rdfs:label ?occupation } \
  75. OPTIONAL {?uri schema:honorificPrefix ?qualification} \
  76. OPTIONAL {?uri schema:relatedTo ?uriRel1 . \
  77. ?uriRel1 rdfs:label ?relative1} \
  78. OPTIONAL {?uri crm:P100i_died_in ?Death . \
  79. ?Death crm:P4_has_time-span ?Death_TS; \
  80. crm:P7_took_place_at ?Place_D .\
  81. ?Death_TS rdfs:label ?Death_Date . \
  82. ?Place_D rdfs:label ?Death_Place } \
  83. OPTIONAL {?uri crm:P98i_was_born ?Birth . \
  84. ?Birth crm:P4_has_time-span ?Birth_TS; \
  85. crm:P7_took_place_at ?Place_B . \
  86. ?Birth_TS rdfs:label ?Birth_Date . \
  87. ?Place_B rdfs:label ?Birth_Place } \
  88. OPTIONAL {?uri crm:P107i_is_current_or_former_member_of ?uriGroup . \
  89. ?uriGroup rdfs:label ?group } \
  90. } \
  91. GROUP BY ?graph ?label ?identifier ?name ?givenName ?familyName ?gender ?Birth_Date ?Birth_Place ?Death_Date ?Death_Place ?patronymic ?occupation ?qualification ?group "
  92. queryLetters = prefixes + " SELECT DISTINCT ?type ?document_uri ?document_name \
  93. WHERE {?pc crm:P02_has_range <" + thisUrlParams.link + "> . \
  94. ?ev_send crm:P01_has_domain ?pc ; \
  95. rdfs:label ?type ; \
  96. rdfs:subClassOf ?event . \
  97. ?document_uri crm:P25i_moved_by ?event ; \
  98. rdfs:label ?document_name . \
  99. }"
  100. queryNetwork = prefixes + " SELECT DISTINCT ?uri ?label ?uri2 ?label2 \
  101. WHERE { \
  102. {?event rdf:type crm:EL1_Exchange_Letters . \
  103. ?event_to rdfs:subClassOf ?event; \
  104. rdf:type crm:EL2_Send_Letter ; \
  105. crm:P01_has_domain ?pc_to . \
  106. ?pc_to crm:P02_has_range ?uri . \
  107. ?uri rdfs:label ?label . \
  108. ?event_from rdfs:subClassOf ?event; \
  109. rdf:type crm:EL3_Receive_Letter; \
  110. crm:P01_has_domain ?pc_from . \
  111. ?pc_from crm:P02_has_range ?uri2 . \
  112. ?uri2 rdfs:label ?label2 . \
  113. FILTER (?uri = <" + thisUrlParams.link + ">) \
  114. } UNION { \
  115. ?event rdf:type crm:EL1_Exchange_Letters . \
  116. ?event_to rdfs:subClassOf ?event; \
  117. rdf:type crm:EL3_Receive_Letter ; \
  118. crm:P01_has_domain ?pc_from . \
  119. ?pc_from crm:P02_has_range ?uri . \
  120. ?uri rdfs:label ?label . \
  121. ?event_from rdfs:subClassOf ?event; \
  122. rdf:type crm:EL2_Send_Letter; \
  123. crm:P01_has_domain ?pc_to . \
  124. ?pc_to crm:P02_has_range ?uri2 . \
  125. ?uri2 rdfs:label ?label2 . \
  126. FILTER (?uri = <" + thisUrlParams.link + ">) \
  127. } \
  128. } LIMIT 30"
  129. queryURL = prepareQueryURL(query);
  130. queryNet = prepareQueryURL(queryNetwork);
  131. query = prepareQueryURL(queryInfo);
  132. queryEx = prepareQueryURL(queryLetters);
  133. response = $.ajax({
  134. url: query,
  135. dataType: "json",
  136. success: function (data){
  137. handle_data(data);
  138. },
  139. error: function (e) {}
  140. });
  141. response = $.ajax({
  142. url: queryURL,
  143. dataType: "json",
  144. success: function (data){
  145. handle_map(data);
  146. },
  147. error: function (e) {}
  148. });
  149. responseNet = $.ajax({
  150. url: queryNet,
  151. dataType: "json",
  152. success: function (data){
  153. handle_network(data);
  154. },
  155. error: function (e) {}
  156. });
  157. responseLet = $.ajax({
  158. url: queryEx,
  159. dataType: "json",
  160. success: function (data){
  161. handle_Letters(data);
  162. },
  163. error: function (e) {}
  164. });
  165. function handle_data(json) {
  166. console.log(json['results']['bindings']);
  167. var graph = "";
  168. var label = "";
  169. if ("givenName" in json.results.bindings) {
  170. givenName = value['givenName']['value'];
  171. alert(givenName);
  172. }
  173. $.each(
  174. json['results']['bindings'],
  175. function (index, value) {
  176. var graph = value['graph']['value'];
  177. var label = value['label']['value'];
  178. var name = value['name']['value'];
  179. var givenName = "";
  180. var familyName = "";
  181. var gender = "";
  182. var patronymic = "";
  183. var occupation = "";
  184. var relative = "";
  185. var identifier = "";
  186. var birth_date = "";
  187. var birth_place = "";
  188. var death_date = "";
  189. var death_place = "";
  190. var qualification = "";
  191. var group = "";
  192. if (value.hasOwnProperty('givenName')) {
  193. $("#givenName").css("display", "flex");
  194. givenName = value['givenName']['value'];
  195. }
  196. if (value.hasOwnProperty('familyName')) {
  197. $("#familyName").css("display", "flex");
  198. familyName = value['familyName']['value'];
  199. }
  200. if (value.hasOwnProperty('gender')) {
  201. $("#gender").css("display", "flex");
  202. gender = value['gender']['value'];
  203. }
  204. if (value.hasOwnProperty('patronymic')) {
  205. $("#patronymic").css("display", "flex");
  206. patronymic = value['patronymic']['value'];
  207. }
  208. if (value.hasOwnProperty('occupation')) {
  209. $("#occupation").css("display", "flex");
  210. occupation = value['occupation']['value'];
  211. }
  212. if (value.hasOwnProperty('relatives')) {
  213. if (value['relatives']['value'] != "") {
  214. $("#relatives").css("display", "flex");
  215. relative = value['relatives']['value'];
  216. }
  217. }
  218. if (value.hasOwnProperty('qualification')) {
  219. $("#honorific").css("display", "flex");
  220. qualification = value['qualification']['value'];
  221. }
  222. if (value.hasOwnProperty('Birth_Date')) {
  223. $("#BirthDate").css("display", "flex");
  224. birth_date = value['Birth_Date']['value'];
  225. }
  226. if (value.hasOwnProperty('Birth_Place')) {
  227. $("#BirthPlace").css("display", "flex");
  228. birth_place = value['Birth_Place']['value'];
  229. }
  230. if (value.hasOwnProperty('Death_Date')) {
  231. $("#DeathDate").css("display", "flex");
  232. death_date = value['Death_Date']['value'];
  233. }
  234. if (value.hasOwnProperty('Death_Place')) {
  235. $("#DeathPlace").css("display", "flex");
  236. death_place = value['Death_Place']['value'];
  237. }
  238. if (value.hasOwnProperty('group')) {
  239. $("#groups").css("display", "flex");
  240. group = value['group']['value'];
  241. }
  242. document.getElementById("grafo").innerHTML = graph;
  243. document.getElementById("nome_persona").innerHTML = label;
  244. document.getElementById("nome").innerHTML = name;
  245. document.getElementById("genere").innerHTML = gender;
  246. document.getElementById("nome_proprio").innerHTML = givenName;
  247. document.getElementById("nome_famiglia").innerHTML = familyName;
  248. document.getElementById("patronimico").innerHTML = patronymic;
  249. document.getElementById("avi").innerHTML = relative;
  250. document.getElementById("qualifica").innerHTML = qualification;
  251. document.getElementById("occupazione").innerHTML = occupation;
  252. document.getElementById("data_nascita").innerHTML = birth_date;
  253. document.getElementById("data_morte").innerHTML = death_date;
  254. document.getElementById("luogo_nascita").innerHTML = birth_place;
  255. document.getElementById("luogo_morte").innerHTML = death_place;
  256. document.getElementById("gruppi_appartenenza").innerHTML = group;
  257. document.getElementById("nome1").innerHTML = label;
  258. document.getElementById("nome2").innerHTML = label;
  259. document.getElementById("nome_au").innerHTML = label;
  260. document.getElementById("nome_ap").innerHTML = label;
  261. document.getElementById("nome_al").innerHTML = label;
  262. });
  263. }
  264. function handle_Letters(json) {
  265. console.log(json);
  266. const send = {};
  267. const receive = {};
  268. var i=0;
  269. var j=0;
  270. $.each(
  271. json['results']['bindings'],
  272. function (index, value) {
  273. type = value['type']['value'];
  274. uri = value['document_uri']['value'];
  275. title = value['document_name']['value'];
  276. if (type == "Invio") {
  277. send[uri] = title;
  278. i++;
  279. } else {
  280. receive[uri] = title;
  281. j++;
  282. }
  283. });
  284. var Send_Letters = "";
  285. var Receive_Letters = "";
  286. for (var key in send) {
  287. Send_Letters += "<div class='row'><div class='col-10'>" + send[key] + "</div><div class='col'><a href='" + key + "'><i class='fas fa-external-link-alt' aria-hidden='true'></i></a></div></div>";
  288. }
  289. for (var key in receive) {
  290. Receive_Letters += "<div class='row'><div class='col-10'>" + receive[key] + "</div><div class='col'><a href='" + key + "'><i class='fas fa-external-link-alt' aria-hidden='true'></i></a></div></div>";
  291. }
  292. document.getElementById("l_send").innerHTML = i;
  293. document.getElementById("l_receive").innerHTML = j;
  294. document.getElementById("letters_send").innerHTML = Send_Letters;
  295. document.getElementById("letters_receive").innerHTML = Receive_Letters;
  296. if (i==0) {
  297. var messaggio = "<p>Nessun risultato trovato</p>";
  298. document.getElementById("letters_send").innerHTML = messaggio;
  299. }
  300. if (j==0) {
  301. var messaggio = "<p>Nessun risultato trovato</p>";
  302. document.getElementById("letters_receive").innerHTML = messaggio;
  303. }
  304. }
  305. function handle_map(json) {
  306. console.log(json);
  307. const locations = [];
  308. const place_names = [];
  309. var lat = 0;
  310. var long = 0;
  311. var i=0;
  312. var myPlaces = "";
  313. $.each(
  314. json['results']['bindings'],
  315. function (index, value) {
  316. const loc = []
  317. var uri = value['place']['value'];
  318. var label = value['label']['value'];
  319. var coord = value['coordinates']['value'];
  320. const coordinates = coord.split(", ");
  321. loc.push(label);
  322. myPlaces += "<div class='row'><div class='clickPlace col-10' data-point='"+ coordinates + "'>" + label + "</div><div class='luogo col' id='" +
  323. uri + "'><i class='far fa-map' style='cursor:pointer'></i></div></div>";
  324. loc.push(coordinates[0]);
  325. lat += parseInt(coordinates[0]);
  326. loc.push(coordinates[1]);
  327. long += parseInt(coordinates[1].replace(/^(\.)/,"0.").replace("-.", "-0."));
  328. locations.push(loc);
  329. i++;
  330. });
  331. var latitude = lat/i;
  332. var longitude = long/i;
  333. document.getElementById("list_places_person").innerHTML = myPlaces;
  334. var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
  335. cloudmadeAttribution = 'Map data &copy; 2011 OpenStreetMap contributors, Imagery &copy; 2011 CloudMade, Points &copy 2012 LINZ',
  336. cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 17, attribution: cloudmadeAttribution}),
  337. latlng = new L.LatLng(latitude, longitude);
  338. var map = new L.Map('map', {center: latlng, zoom: 5, layers: [cloudmade]});
  339. mapLink = '<a href="https://openstreetmap.org">OpenStreetMap</a>';
  340. var markers = new L.MarkerClusterGroup();
  341. var markerList = [];
  342. var geo = new L.tileLayer(
  343. 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  344. attribution: '&copy; ' + mapLink + ' Contributors',
  345. maxZoom: 18,
  346. }).addTo(map);
  347. function populate() {
  348. for (var i = 0; i < locations.length; i++) {
  349. var a = locations[i];
  350. var title = a[0];
  351. var marker = new L.Marker(new L.LatLng(a[1], a[2]), { title: title });
  352. marker.bindPopup(title);
  353. markers.addLayer(marker);
  354. markerList.push(marker);
  355. }
  356. }
  357. populate();
  358. map.addLayer(markers);
  359. $('.clickPlace').on('click', function(){
  360. // parse lat and lng from the divs data attribute
  361. var latlng = $(this).data().point.split(',');
  362. var lat = latlng[0];
  363. var lng = latlng[1];
  364. var zoom = 10;
  365. // set the view
  366. map.setView([lat, lng], zoom);
  367. });
  368. }
  369. //out = "";
  370. //for(i = 0; i < resultArray.length; i++){
  371. // out = out + JSON.stringify(resultArray[i])
  372. //}
  373. //queryStringOutput = (queryStringOutput + out).replace("}{",",");
  374. /*
  375. var locations = [
  376. ["LOCATION_1", 11.8166, 122.0942],
  377. ["LOCATION_2", 11.9804, 121.9189],
  378. ["LOCATION_3", 10.7202, 122.5621],
  379. ["LOCATION_4", 11.3889, 122.6277],
  380. ["LOCATION_5", 10.5929, 122.6325]
  381. ];
  382. var map = L.map('map').setView([11.206051, 122.447886], 8);
  383. mapLink =
  384. '<a href="http://openstreetmap.org">OpenStreetMap</a>';
  385. L.tileLayer(
  386. 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
  387. attribution: '&copy; ' + mapLink + ' Contributors',
  388. maxZoom: 18,
  389. }).addTo(map);
  390. for (var i = 0; i < locations.length; i++) {
  391. marker = new L.marker([locations[i][1], locations[i][2]])
  392. .bindPopup(locations[i][0])
  393. .addTo(map);
  394. }
  395. */
  396. function handle_network(json) {
  397. console.log(json);
  398. const myArray = {};
  399. const myLinks = [];
  400. var listNodes = "";
  401. var listLinks = "";
  402. var ArrayNames = "";
  403. var max = 0;
  404. $.each(
  405. json['results']['bindings'],
  406. function (index, value) {
  407. const topo = [];
  408. var id = value['uri']['value'];
  409. var name = value['label']['value'];
  410. var id2 = value['uri2']['value'];
  411. var name2 = value['label2']['value'];
  412. ArrayNames += "<div class='row'><div class='col-9'>" +
  413. name2 + "</div><div class='col'><a target='_blank' href='" +
  414. id2 + "'><i class='fas fa-external-link-alt' aria-hidden='true'></i></a></div><div class='persona col' id='" +
  415. id2 + "'><i class='fa fa-user' style='cursor:pointer'></i></div></div></div>";
  416. myArray[id] = name;
  417. myArray[id2] = name2;
  418. myLinks.push([id, id2]);
  419. });
  420. document.getElementById("list_person_network").innerHTML = ArrayNames;
  421. for (var key in myArray) {
  422. listNodes += '{ "id": \"' + key + '\", "name": \"' + myArray[key] + '\"},';
  423. }
  424. for (var i in myLinks) {
  425. var source = myLinks[i][0]
  426. var target = myLinks[i][1]
  427. listLinks += '{ "source": \"' + source + '\", "target": \"' + target + '\"},';
  428. }
  429. console.log(myLinks);
  430. let listN = ('[' + listNodes + ']').replace(',]', ']');
  431. let listL = ('[' + listLinks + ']').replace(',]', ']');
  432. const nodes = JSON.parse(listN);
  433. const links = JSON.parse(listL);
  434. console.log(nodes);
  435. console.log(links);
  436. var svg = d3.select("svg"),
  437. width = +svg.attr("width"),
  438. height = +svg.attr("height");
  439. var simulation = d3.forceSimulation()
  440. .force("link", d3.forceLink().id(function(d) { return d.id; }))
  441. //.force("charge", d3.forceManyBody().strength(-200))
  442. .force('charge', d3.forceManyBody()
  443. .strength(-500)
  444. .theta(0.8)
  445. .distanceMax(300)
  446. )
  447. // .force('collide', d3.forceCollide()
  448. // .radius(d => 40)
  449. // .iterations(2)
  450. // )
  451. .force("center", d3.forceCenter(width / 4, height / 3));
  452. links.forEach(function(d){
  453. // d.source = d.source_id;
  454. // d.target = d.target_id;
  455. });
  456. var link = svg.append("g")
  457. .style("stroke", "#aaa")
  458. .selectAll("line")
  459. .data(links)
  460. .enter().append("line");
  461. var node = svg.append("g")
  462. .attr("class", "nodes")
  463. .selectAll("circle")
  464. .data(nodes)
  465. .enter().append("circle")
  466. .attr("r", 2)
  467. .attr("id", function (d) { return d.id; })
  468. .call(d3.drag()
  469. .on("start", dragstarted)
  470. .on("drag", dragged)
  471. .on("end", dragended));
  472. var label = svg.append("g")
  473. .attr("class", "labels")
  474. .selectAll("text")
  475. .data(nodes)
  476. .enter().append("text")
  477. .attr("class", "label")
  478. .call(d3.drag()
  479. .on("start", dragstarted)
  480. .on("drag", dragged)
  481. .on("end", dragended))
  482. .text(function(d) { return d.name; });
  483. simulation
  484. .nodes(nodes)
  485. .on("tick", ticked);
  486. simulation.force("link")
  487. .links(links);
  488. function ticked() {
  489. link
  490. .attr("x1", function(d) { return d.source.x; })
  491. .attr("y1", function(d) { return d.source.y; })
  492. .attr("x2", function(d) { return d.target.x; })
  493. .attr("y2", function(d) { return d.target.y; });
  494. node
  495. .attr("r", 5)
  496. .style("fill", "#efefef")
  497. .style("stroke", "#424242")
  498. .style("stroke-width", "1px")
  499. .attr("cx", function (d) { return d.x+5; })
  500. .attr("cy", function(d) { return d.y-3; });
  501. label
  502. .attr("x", function(d) { return d.x+12; })
  503. .attr("y", function (d) { return d.y+1; })
  504. .style("font-size", "10px").style("fill", "#333");
  505. }
  506. function dragstarted(d) {
  507. if (!d3.event.active) simulation.alphaTarget(0.3).restart()
  508. d.fx = d.x
  509. d.fy = d.y
  510. // simulation.fix(d);
  511. }
  512. function dragged(d) {
  513. d.fx = d3.event.x
  514. d.fy = d3.event.y
  515. // simulation.fix(d, d3.event.x, d3.event.y);
  516. }
  517. function dragended(d) {
  518. d.fx = d3.event.x
  519. d.fy = d3.event.y
  520. if (!d3.event.active) simulation.alphaTarget(0);
  521. //simulation.unfix(d);
  522. }
  523. }
  524. $(document).on("click", ".luogo", function (ev) {
  525. var link = this.id;
  526. //alert(nome_autore);
  527. //$('#myModal').text("");
  528. window.open("Luogo.html?link="+this.id);
  529. });
  530. $(document).on("click", ".persona", function (ev) {
  531. var link = this.id;
  532. //alert(nome_autore);
  533. //$('#myModal').text("");
  534. window.open("Persona.html?link="+this.id);
  535. });