|
@@ -9,26 +9,26 @@ let queryNetwork = prefixes + " SELECT COUNT(?event1) AS ?count1 COUNT(?event2)
|
|
|
WHERE { \
|
|
|
{?event1 rdf:type crm:EL1_Exchange_Letters . \
|
|
|
?event_to rdfs:subClassOf ?event1; \
|
|
|
-rdf:type crm:EL2_Send_Letter ; \
|
|
|
+ rdf:type crm:EL2_Send_Letter ; \
|
|
|
crm:P01_has_domain ?pc_to . \
|
|
|
?pc_to crm:P02_has_range ?uri . \
|
|
|
?uri rdfs:label ?label . \
|
|
|
?event_from rdfs:subClassOf ?event1; \
|
|
|
-rdf:type crm:EL3_Receive_Letter; \
|
|
|
-crm:P01_has_domain ?pc_from . \
|
|
|
+ rdf:type crm:EL3_Receive_Letter; \
|
|
|
+ crm:P01_has_domain ?pc_from . \
|
|
|
?pc_from crm:P02_has_range ?uri2 . \
|
|
|
?uri2 rdfs:label ?label2 . \
|
|
|
FILTER (?uri = <" + thisUrlParams.link + ">) \
|
|
|
} UNION { \
|
|
|
?event2 rdf:type crm:EL1_Exchange_Letters . \
|
|
|
?event_to rdfs:subClassOf ?event2; \
|
|
|
-rdf:type crm:EL3_Receive_Letter ; \
|
|
|
-crm:P01_has_domain ?pc_from . \
|
|
|
+ rdf:type crm:EL3_Receive_Letter ; \
|
|
|
+ crm:P01_has_domain ?pc_from . \
|
|
|
?pc_from crm:P02_has_range ?uri . \
|
|
|
?uri rdfs:label ?label . \
|
|
|
?event_from rdfs:subClassOf ?event2; \
|
|
|
-rdf:type crm:EL2_Send_Letter; \
|
|
|
-crm:P01_has_domain ?pc_to . \
|
|
|
+ rdf:type crm:EL2_Send_Letter; \
|
|
|
+ crm:P01_has_domain ?pc_to . \
|
|
|
?pc_to crm:P02_has_range ?uri2 . \
|
|
|
?uri2 rdfs:label ?label2 . \
|
|
|
FILTER (?uri = <" + thisUrlParams.link + ">) \
|
|
@@ -46,6 +46,9 @@ $.ajax({
|
|
|
});
|
|
|
|
|
|
|
|
|
+// queryLetters defined in people.js
|
|
|
+console.log(queryLetters);
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* COMPONENT CREATION SECTION
|
|
@@ -87,18 +90,19 @@ function processQuery(json) {
|
|
|
|
|
|
|
|
|
// Create formatted list of people in the network
|
|
|
-function doListPersonNetwork(tempArray){
|
|
|
+function doListPersonNetwork(words){
|
|
|
|
|
|
let ArrayNames = "";
|
|
|
|
|
|
- tempArray.forEach(element => {
|
|
|
+ words.forEach(element => {
|
|
|
+ filteredText = element['text'].replace('"', '').replace("'", '');
|
|
|
ArrayNames +=
|
|
|
"<div class='item-place-person'>"+
|
|
|
- "<div class='item-place-person-label' id='list-" + element['text'].replace('"', '').replace("'", '') + "'>" +
|
|
|
+ "<div class='item-place-person-label' id='list-" + filteredText + "'>" +
|
|
|
element['text'] +
|
|
|
"<br /><span class='num_occ'>[Lettere inviate: " + element['sent'] + "]</span>" +
|
|
|
"<br /><span class='num_occ'>[Lettere ricevute: " + element['received'] + "]</span>" +
|
|
|
- "<br /><span class='num_occ'>[Totale corrispondenza: " + element['count'] + "]</span>" +
|
|
|
+ "<br /><span id='tot-"+filteredText+"' class='num_occ'>[Totale corrispondenza: " + element['count'] + "]</span>" +
|
|
|
"</div>" +
|
|
|
"<div class='item-place-person-action'>" +
|
|
|
"<div class='persona' id='" + element['hlink'] +"'>" +
|
|
@@ -110,9 +114,49 @@ function doListPersonNetwork(tempArray){
|
|
|
|
|
|
document.getElementById("list_person_network").innerHTML = ArrayNames;
|
|
|
|
|
|
+ addEventsToNameList(words);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+function addEventsToNameList(words){
|
|
|
+
|
|
|
+ let counter = 0
|
|
|
+ for(let word of words){
|
|
|
+ if(counter>0) break;
|
|
|
+ let listElem = document.getElementById('tot-' + word.text.replace('"', '').replace("'", ''));
|
|
|
+ if(listElem!=null){
|
|
|
+ listElem.addEventListener("click", filterLetters);
|
|
|
+ listElem.addEventListener("mouseover", highlightWord);
|
|
|
+ listElem.addEventListener("mouseout", unHighlightWord);
|
|
|
+ }
|
|
|
+ counter++;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function filterLetters(e){
|
|
|
+
|
|
|
+ try{
|
|
|
+ let preText = e.target.parentNode.textContent;
|
|
|
+ console.log('text content', preText);
|
|
|
+ let name = preText.split("[")[0];
|
|
|
+ console.log('name', name);
|
|
|
+
|
|
|
+ // responseLet defined in people.js
|
|
|
+ responseLet.then(data => {
|
|
|
+
|
|
|
+ let lettersJson = data.results.bindings;
|
|
|
+ console.log('AH!', lettersJson[0]);
|
|
|
+ });
|
|
|
+
|
|
|
+ } catch{
|
|
|
+ console.log("Couldn't get the name");
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
// Create the word cloud
|
|
|
function doWordCloud(words){
|
|
|
|
|
@@ -161,7 +205,7 @@ function doWordCloud(words){
|
|
|
let wordCloudText = createWordCloud(words, wcParameters);
|
|
|
svg.innerHTML = wordCloudText;
|
|
|
|
|
|
- addEvents(words);
|
|
|
+ addEventsToWordCloud(words);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -311,15 +355,16 @@ function checkBorder(rect, minX, maxX, minY, maxY){
|
|
|
}
|
|
|
|
|
|
|
|
|
-function addEvents(words){
|
|
|
+function addEventsToWordCloud(words){
|
|
|
|
|
|
for(let word of words){
|
|
|
let wcElem = document.getElementById('word-' + word.text.replace('"', '').replace("'", ''));
|
|
|
- wcElem.addEventListener("click", focusPersonInList);
|
|
|
- wcElem.addEventListener("mouseover", highlightWord);
|
|
|
- wcElem.addEventListener("mouseout", unHighlightWord);
|
|
|
+ if(wcElem!=null){
|
|
|
+ wcElem.addEventListener("click", focusPersonInList);
|
|
|
+ wcElem.addEventListener("mouseover", highlightWord);
|
|
|
+ wcElem.addEventListener("mouseout", unHighlightWord);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
function focusPersonInList(e){
|
|
@@ -334,4 +379,5 @@ function highlightWord(e){
|
|
|
}
|
|
|
function unHighlightWord(e){
|
|
|
e.target.style['text-decoration'] = "";
|
|
|
-}
|
|
|
+}
|
|
|
+
|