Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
trivalent
dashboard-trivalent
Commits
49d58cef
Commit
49d58cef
authored
Nov 27, 2018
by
Daniel Suarez Souto
Browse files
Updated propaganda-chart
parent
a10fe50e
Changes
11
Hide whitespace changes
Inline
Side-by-side
dashboard-gsicrawler.env.html
View file @
49d58cef
...
...
@@ -152,20 +152,7 @@
</google-chart>
</div>
<div
class=
"col-md-6"
>
<entities-chart
field=
"entities.name"
data=
"{{data}}"
title=
"Organizations"
icon=
"icons:list"
param=
"{{param}}"
id=
"entitieschart"
filters=
"{{filters}}"
>
</entities-chart>
</div>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<google-chart
field=
"sentiment"
data=
"{{data}}"
...
...
@@ -176,7 +163,21 @@
icon=
'social:mood'
options=
'{"title": "Sentiments"}'
cols=
'[{"label": "Sentiment", "type": "string"},{"label": "Count", "type": "number"}]'
>
</google-chart>
</google-chart>
</div>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<entities-chart
field=
"entities.name"
data=
"{{data}}"
title=
"Organizations"
icon=
"icons:list"
param=
"{{param}}"
id=
"entitieschart"
filters=
"{{filters}}"
>
</entities-chart>
</div>
<div
class=
"col-md-6"
>
<people-chart
...
...
@@ -189,6 +190,7 @@
</people-chart>
</div>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<google-chart
...
...
@@ -267,7 +269,7 @@
</div>
<div>
<yasgui-ui
endpoint=
"http://
sefarad-fuseki.cluster.gsi.dit.upm.es
/gsicrawler/query"
endpoint=
"http://
localhost:13030
/gsicrawler/query"
queries=
"{{queries}}"
>
</yasgui-ui>
</div>
...
...
dashboard-gsicrawler.html
View file @
49d58cef
...
...
@@ -152,20 +152,7 @@
</google-chart>
</div>
<div
class=
"col-md-6"
>
<entities-chart
field=
"entities.name"
data=
"{{data}}"
title=
"Organizations"
icon=
"icons:list"
param=
"{{param}}"
id=
"entitieschart"
filters=
"{{filters}}"
>
</entities-chart>
</div>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<google-chart
field=
"sentiment"
data=
"{{data}}"
...
...
@@ -176,7 +163,21 @@
icon=
'social:mood'
options=
'{"title": "Sentiments"}'
cols=
'[{"label": "Sentiment", "type": "string"},{"label": "Count", "type": "number"}]'
>
</google-chart>
</google-chart>
</div>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<entities-chart
field=
"entities.name"
data=
"{{data}}"
title=
"Organizations"
icon=
"icons:list"
param=
"{{param}}"
id=
"entitieschart"
filters=
"{{filters}}"
>
</entities-chart>
</div>
<div
class=
"col-md-6"
>
<people-chart
...
...
@@ -189,6 +190,7 @@
</people-chart>
</div>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-md-12"
>
<google-chart
...
...
@@ -267,7 +269,7 @@
</div>
<div>
<yasgui-ui
endpoint=
"http://
sefarad-fuseki.cluster.gsi.dit.upm.es
/gsicrawler/query"
endpoint=
"http://
localhost:13030
/gsicrawler/query"
queries=
"{{queries}}"
>
</yasgui-ui>
</div>
...
...
@@ -334,7 +336,9 @@ H2020 RIA Action Grant No. 740934 under the call SEC-06-FCT-2016 — Developing
type
:
Array
,
value
:
function
()
{
return
[];
}
},
search
:{
type
:
Object
},
filters
:
{
type
:
Array
,
notify
:
true
,
...
...
@@ -408,12 +412,13 @@ H2020 RIA Action Grant No. 740934 under the call SEC-06-FCT-2016 — Developing
if
(
this
.
query
.
length
==
0
){
//console.log("default search fired")
this
.
filters
=
[]
this
.
search
=
{}
this
.
_query
()
}
else
{
console
.
log
(
"
Filter
"
)
this
.
push
(
'
filters
'
,
{
terms
:
{
'
schema:articleBody
'
:
[
this
.
query
]}});
//this.push('filters', {terms: {'schema:articleBody': [this.query]}});
this
.
search
=
{
"
schema:articleBody
"
:{
"
query
"
:
this
.
query
,
"
operator
"
:
"
and
"
}}
this
.
_query
()
}
...
...
@@ -434,7 +439,8 @@ H2020 RIA Action Grant No. 740934 under the call SEC-06-FCT-2016 — Developing
query
:
{
bool
:
{
must
:
this
.
filters
,
}
}
/*,
match: this.search*/
},
aggs
:
{
type
:
{
...
...
demo/elements/entities-chart/entities-chart.html
View file @
49d58cef
...
...
@@ -103,6 +103,10 @@
#tag-wrapper
{
margin
:
10px
10px
10px
20px
;
min-height
:
215px
;
visibility
:
visible
;
box-shadow
:
0
0
black
;
}
.content.paper-button
{
...
...
@@ -130,20 +134,20 @@
</style>
<!-- Shadow DOM -->
<paper-material
class=
"entities"
elevation=
"1"
style=
"min-height: 2
7
5px;"
>
<paper-material
class=
"entities"
elevation=
"1"
style=
"min-height:
3
25px;
display: flex; flex-direction: column; justify-content: space-between;
"
>
<div
class=
"top-bar"
>
<iron-icon
icon=
"{{icon}}"
></iron-icon>
<span>
{{title}}
</span>
</div>
<div
id=
"nodata"
>
No entries match the current filters
</div>
<div
id=
"nodata"
style=
"margin-top: 35px"
>
No entries match the current filters
</div>
<div
id=
"tagwrapper"
style=
"min-height: 215px;"
>
<br>
<template
is=
"dom-repeat"
items=
"{{entities}}"
as=
"entity"
>
<paper-button
class=
"tag active"
on-tap=
"filter"
><span>
{{entity.0}}
</span><span
class=
"number"
>
{{entity.1}}
</span></paper-button>
</template>
</div>
<div
style=
"float:right"
>
<small>
Clear Filters
</small>
<div
style=
"float:
right
; bottom: 10px; width: 100%; display: flex; flex-direction: row; justify-content: flex-end; align-content: center;
"
>
<small
style=
"align-self: center;"
>
Clear Filters
</small>
<paper-icon-button
icon=
"delete"
alt=
"menu"
class=
"green"
on-tap=
"removeFilters"
></paper-icon-button>
</div>
<div
style=
"width:100%; clear: both"
></div>
...
...
demo/elements/google-chart-elasticsearch/google-chart.html
View file @
49d58cef
...
...
@@ -299,11 +299,13 @@ Data can be provided in one of three ways:
var
field
=
this
.
field
var
sel
=
this
.
selection
[
0
].
row
var
object
=
{}
console
.
log
(
sel
)
if
(
!
sel
){
var
col
=
this
.
selection
[
0
].
column
var
param
=
arr
[
0
][
col
]
field
=
'
schema:author.keyword
'
if
(
sel
==
null
){
console
.
log
(
"
inside
"
)
var
col
=
this
.
selection
[
0
].
column
var
param
=
arr
[
0
][
col
]
field
=
'
schema:author.keyword
'
}
else
{
this
.
param
=
arr
[
sel
][
0
]
var
param
=
this
.
param
...
...
@@ -313,14 +315,15 @@ Data can be provided in one of three ways:
var
term1
=
{};
console
.
log
(
field
)
if
(
field
==
"
schema:author
"
){
/*
if (field == "schema:author"){
field = 'schema:author.keyword'
}
}
*/
if
(
field
==
"
sentiment
"
)
field
=
'
sentiments.marl:hasPolarity
'
if
(
field
==
"
emotion
"
)
field
=
'
emotions.onyx:hasEmotion.onyx:hasEmotionCategory
'
term1
[
field
]
=
param
.
toLowerCase
().
split
(
"
"
);
term1
[
field
]
=
param
.
toLowerCase
().
split
(
"
"
);
if
(
field
==
'
schema:author.keyword
'
){
var
sources
=
this
.
sources
...
...
@@ -339,7 +342,7 @@ Data can be provided in one of three ways:
console
.
log
(
term1
)
//console.log("param")
//console.log(param)
object
=
{
term
:
term1
}
object
=
{
term
s
:
term1
}
if
(
field
==
'
schema:datePublished
'
){
console
.
log
(
arr
)
param
=
arr
[
sel
+
1
][
0
]
...
...
@@ -348,7 +351,7 @@ Data can be provided in one of three ways:
var
term
=
date
[
1
]
+
'
-
'
+
date
[
0
]
+
'
-01
'
object
=
{
range
:
{
'
schema:datePublished
'
:
{
gte
:
term
,
boost
:
5
}}}
}
var
isInside
=
-
1
for
(
var
i
=
0
;
i
<
this
.
filters
.
length
;
i
++
){
if
(
JSON
.
stringify
(
this
.
filters
[
i
].
term
)
===
JSON
.
stringify
(
term1
))
...
...
@@ -356,7 +359,7 @@ Data can be provided in one of three ways:
}
if
(
isInside
==
-
1
){
console
.
log
(
"
Dentro
"
)
//
console.log("Dentro")
this
.
push
(
'
filters
'
,
object
)
this
.
isSelected
=
true
}
...
...
demo/elements/happymap/happymap-element.html
View file @
49d58cef
...
...
@@ -403,7 +403,7 @@
//console.log(that.data)
that
.
data
.
hits
.
hits
.
forEach
(
function
(
entry
)
{
entry
.
_source
.
entities
.
forEach
(
function
(
entity
){
if
(
entity
[
"
@type
"
]
==
"
schema:Place
"
){
if
(
entity
[
"
@type
"
]
[
0
]
==
"
schema:Place
"
){
happy_data
.
push
([
entity
[
"
schema:geo
"
][
"
schema:latitude
"
],
entity
[
"
schema:geo
"
][
"
schema:longitude
"
],
entry
.
valence
]);
intense_data
.
push
([
entity
[
"
schema:geo
"
][
"
schema:latitude
"
],
entity
[
"
schema:geo
"
][
"
schema:longitude
"
],
entry
.
arousal
]);
power_data
.
push
([
entity
[
"
schema:geo
"
][
"
schema:latitude
"
],
entity
[
"
schema:geo
"
][
"
schema:longitude
"
],
entry
.
dominance
]);
...
...
demo/elements/news-chart/news-chart.html
View file @
49d58cef
...
...
@@ -12,7 +12,7 @@
<!-- Shadow DOM -->
<paper-material
elevation=
"1"
>
<div
id=
"nodata"
>
No entries match the current filters
</div>
<div
style=
"height: 600px; overflow-x: hidden; overflow-y: auto;"
>
<template
is=
"dom-repeat"
items=
"{{data}}"
as=
"news"
>
...
...
@@ -192,8 +192,13 @@
//console.log(hits)
hits
.
forEach
(
function
(
entry
)
{
//console.log(entry._source)
if
(
entry
.
_source
[
'
@type
'
]
==
'
schema:NewsArticle
'
)
results
.
push
(
entry
.
_source
);
if
(
entry
.
_source
[
'
@type
'
]
==
'
schema:NewsArticle
'
)
results
.
push
(
entry
.
_source
);
});
if
(
results
.
length
==
0
){
this
.
$
.
nodata
.
style
.
visibility
=
'
visible
'
;
}
else
{
this
.
$
.
nodata
.
style
.
visibility
=
'
hidden
'
;
}
//console.log(results)
that
.
data
=
results
},
...
...
@@ -211,9 +216,9 @@
/*if(news['schema:author']=='cnn'){
text=text.replace(/[ ]{2,}/g,'\n')
}*/
//
text=text.replace(/[ ]{2,}/g,'\n')
text
=
text
.
replace
(
/
[
]{2,}
/g
,
'
\n
'
)
//else{
//
text=text.replace(/\n\n/g,'\n')
text
=
text
.
replace
(
/
\n\n
/g
,
'
\n
'
)
//}
//console.log(text)
...
...
@@ -231,11 +236,12 @@
return
fecha
[
2
].
split
(
"
T
"
)[
0
]
+
"
-
"
+
fecha
[
1
]
+
"
-
"
+
fecha
[
0
]
},
getBg
:
function
(
entity
){
//console.log(entity)
if
(
!
(
"
@type
"
in
entity
)){
return
"
background-color: brown;margin-bottom:5px;
"
}
else
if
(
entity
[
"
@type
"
]
==
"
schema:Place
"
)
{
}
else
if
(
entity
[
"
@type
"
]
[
0
]
==
"
schema:Place
"
)
{
return
"
background-color: #f90;margin-bottom:5px;
"
}
else
if
(
entity
[
"
@type
"
]
==
"
schema:Organization
"
)
{
}
else
if
(
entity
[
"
@type
"
]
[
0
]
==
"
schema:Organization
"
)
{
return
"
background-color: #dd4b39;margin-bottom:5px;
"
}
else
{
return
"
background-color: #00c0ef;margin-bottom:5px;
"
...
...
@@ -308,15 +314,24 @@
var
id
=
e
.
target
.
dataset
.
id
var
element
=
document
.
getElementById
(
id
)
var
text
=
e
.
target
.
dataset
.
text
var
text_highlighted
=
""
var
beginIndex
=
e
.
model
.
__data__
.
entity
[
"
nif:beginIndex
"
]
var
endIndex
=
e
.
model
.
__data__
.
entity
[
"
nif:endIndex
"
]
+
1
var
subtext
=
text
.
substring
(
0
,
beginIndex
)
var
endIndex
=
e
.
model
.
__data__
.
entity
[
"
nif:endIndex
"
]
console
.
log
(
beginIndex
)
console
.
log
(
endIndex
)
//var subtext = text.substring(0,beginIndex)
if
(
beginIndex
>=
0
)
{
text
=
text
.
substring
(
0
,
beginIndex
)
+
"
<span class='highlight' style='background-color:yellow'>
"
+
text
.
substring
(
beginIndex
,
endIndex
)
+
"
</span>
"
+
text
.
substring
(
endIndex
)
element
.
innerHTML
=
text
//console.log(text)
if
(
beginIndex
[
0
]
>=
0
)
{
text_highlighted
=
text
.
substring
(
0
,
beginIndex
[
0
])
+
"
<span class='highlight' style='background-color:yellow'>
"
+
text
.
substring
(
beginIndex
[
0
],
endIndex
[
0
]
+
1
)
+
"
</span>
"
for
(
var
i
=
1
;
i
<
beginIndex
.
length
;
i
++
){
text_highlighted
+=
text
.
substring
(
endIndex
[
i
-
1
]
+
1
,
beginIndex
[
i
])
text_highlighted
+=
"
<span class='highlight' style='background-color:yellow'>
"
text_highlighted
+=
text
.
substring
(
beginIndex
[
i
],
endIndex
[
i
]
+
1
)
text_highlighted
+=
"
</span>
"
}
text_highlighted
+=
text
.
substring
(
endIndex
[
endIndex
.
length
-
1
]
+
1
)
element
.
innerHTML
=
text_highlighted
//console.log(text_highlighted)
//console.log($('#'+element.parentElement.id+' span').position().top)
$
(
'
#
'
+
element
.
parentElement
.
id
).
animate
({
scrollTop
:
$
(
'
#
'
+
element
.
parentElement
.
id
).
scrollTop
()
+
$
(
'
#
'
+
element
.
parentElement
.
id
+
'
span
'
).
position
().
top
-
200
},
400
)
...
...
demo/elements/news-chart/tweet-chart.css
View file @
49d58cef
...
...
@@ -109,6 +109,12 @@ paper-icon-button.green:hover {
justify-content
:
center
;
align-content
:
center
;
}
#nodata
{
position
:
absolute
;
width
:
100%
;
line-height
:
35px
;
text-align
:
center
;
}
img
.style-scope.news-chart
{
object-fit
:
contain
;
max-height
:
55px
;
...
...
demo/elements/propaganda-chart/propaganda-chart.html
View file @
49d58cef
...
...
@@ -23,6 +23,7 @@
</tr>
</table> -->
<div
id=
"nodata"
>
No entries match the current filters
</div>
<div
style=
"height: 600px; overflow-x: hidden; overflow-y: auto;"
>
<template
is=
"dom-repeat"
items=
"{{data}}"
as=
"news"
>
...
...
@@ -41,12 +42,20 @@
</div>
</button>
<!-- Modal -->
<div
class=
"modal fade"
id
$="
article
[[
index
]]"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
aria-hidden=
"true"
>
<div
class=
"modal fade"
id
$="
article
[[
index
]]"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"myModalLabel"
aria-hidden=
"true"
style=
"overflow: hidden;"
>
<div
class=
"modal-dialog modal-lg"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
><span
aria-hidden=
"true"
>
×
</span></button>
<h4
class=
"modal-title"
id=
"myModalLabel"
>
{{getHeadline(news)}}
</h4>
<div
class=
"modal-content"
style=
"height: fit-content;"
>
<div
class=
"modal-header"
style=
"height:80px;background-color: #449DD5; box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.2); border-radius: 5px 5px 0 0;"
>
<!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> -->
<div
class=
"col-md-12"
style=
"display: flex;flex-direction: row;justify-content: space-around;align-content: center;"
>
<div
class=
"col-md-2 img-wrapper"
style=
"width:13%"
>
<img
src=
"{{checkSource(news)}}"
style=
"width: 100%; display:block; position: relative;"
align=
"left"
>
</div>
<div
class=
"col-md-10"
style=
"display: flex; flex-direction: row; justify-content: center; align-content: center;"
>
<h4
class=
"modal-title"
id=
"myModalLabel"
style=
"display: flex; justify-self: center; align-self: center; color: #fff;display:inline-block; vertical-align: middle;"
>
{{getHeadline(news)}}
</h4>
</div>
</div>
</div>
<div
class=
"modal-body"
style=
"height: 520px"
>
<div
class=
"col-md-5"
style=
" overflow-x: hidden; overflow-y: auto; height: 100%;"
>
...
...
@@ -208,10 +217,16 @@
var
hits
=
this
.
datos
.
hits
.
hits
;
var
results
=
[]
//console.log(hits)
hits
.
forEach
(
function
(
entry
)
{
//console.log(entry._source)
if
(
entry
.
_source
[
'
@type
'
]
==
"
schema:Article
"
)
results
.
push
(
entry
.
_source
);
});
if
(
results
.
length
==
0
){
this
.
$
.
nodata
.
style
.
visibility
=
'
visible
'
;
}
else
{
this
.
$
.
nodata
.
style
.
visibility
=
'
hidden
'
;
}
//console.log(results)
that
.
data
=
results
},
...
...
@@ -330,13 +345,21 @@
var
id
=
e
.
target
.
dataset
.
id
var
element
=
document
.
getElementById
(
id
)
var
text
=
e
.
target
.
dataset
.
text
var
text_highlighted
=
""
var
beginIndex
=
e
.
model
.
__data__
.
entity
[
"
nif:beginIndex
"
]
var
endIndex
=
e
.
model
.
__data__
.
entity
[
"
nif:endIndex
"
]
+
1
if
(
beginIndex
>=
0
)
{
text
=
text
.
substring
(
0
,
beginIndex
)
+
"
<span class='highlight' style='background-color:yellow'>
"
+
text
.
substring
(
beginIndex
,
endIndex
)
+
"
</span>
"
+
text
.
substring
(
endIndex
)
element
.
innerHTML
=
text
//console.log(text)
var
endIndex
=
e
.
model
.
__data__
.
entity
[
"
nif:endIndex
"
]
if
(
beginIndex
[
0
]
>=
0
)
{
text_highlighted
=
text
.
substring
(
0
,
beginIndex
[
0
])
+
"
<span class='highlight' style='background-color:yellow'>
"
+
text
.
substring
(
beginIndex
[
0
],
endIndex
[
0
]
+
1
)
+
"
</span>
"
for
(
var
i
=
1
;
i
<
beginIndex
.
length
;
i
++
){
text_highlighted
+=
text
.
substring
(
endIndex
[
i
-
1
]
+
1
,
beginIndex
[
i
])
text_highlighted
+=
"
<span class='highlight' style='background-color:yellow'>
"
text_highlighted
+=
text
.
substring
(
beginIndex
[
i
],
endIndex
[
i
]
+
1
)
text_highlighted
+=
"
</span>
"
}
text_highlighted
+=
text
.
substring
(
endIndex
[
endIndex
.
length
-
1
]
+
1
)
element
.
innerHTML
=
text_highlighted
//console.log(text_highlighted)
// Select the tab
$
(
'
#tabText a
'
).
tab
(
'
show
'
)
...
...
@@ -350,6 +373,7 @@
setPDF
:
function
(
news
,
index
)
{
function
loadPDF
()
{
var
uri
=
"
http://trivalent-resources.cluster.gsi.dit.upm.es/
"
+
news
[
'
magazine
'
].
toLowerCase
()
+
"
/
"
+
news
[
'
magazine
'
].
toLowerCase
()
+
news
[
'
number
'
]
+
"
.pdf#page=
"
+
news
[
'
schema:pageStart
'
];
console
.
log
(
uri
)
$
(
'
#article
'
+
index
).
off
();
$
(
'
#article
'
+
index
+
'
li#tabArticle a
'
).
on
(
'
shown.bs.tab
'
,
function
(
event
)
{
if
(
$
(
'
#article
'
+
index
+
'
iframe
'
).
length
===
0
)
{
...
...
demo/elements/propaganda-chart/tweet-chart.css
View file @
49d58cef
...
...
@@ -132,3 +132,9 @@ a.text.style-scope.propaganda-chart {
a
.text.style-scope.propaganda-chart
:first-letter
{
text-transform
:
uppercase
;
}
#nodata
{
position
:
absolute
;
width
:
100%
;
line-height
:
35px
;
text-align
:
center
;
}
\ No newline at end of file
demo/elements/tweet-chart/tweet-chart.css
View file @
49d58cef
...
...
@@ -107,4 +107,10 @@ paper-icon-button.green:hover {
display
:
inline-block
;
vertical-align
:
middle
;
color
:
white
;
}
#nodata
{
position
:
absolute
;
width
:
100%
;
line-height
:
35px
;
text-align
:
center
;
}
\ No newline at end of file
demo/elements/tweet-chart/tweet-chart.html
View file @
49d58cef
...
...
@@ -21,6 +21,7 @@
</tr>
</table> -->
<div
id=
"nodata"
>
No entries match the current filters
</div>
<div
style=
"height: 600px; overflow-x: hidden; overflow-y: auto;"
>
<template
is=
"dom-repeat"
items=
"{{data}}"
as=
"tweet"
>
<div
class
$="
tweet
{{
checkSentiment
(
tweet.sentiments
)}}
same-height
"
ident
$="
subitem
[[
index
]]"
style=
" text-align: center;"
>
...
...
@@ -130,10 +131,16 @@
var
hits
=
this
.
datos
.
hits
.
hits
;
var
results
=
[]
//console.log(hits)
hits
.
forEach
(
function
(
entry
)
{
//console.log(entry)
if
(
entry
.
_source
[
'
@type
'
]
==
'
schema:BlogPosting
'
)
results
.
push
(
entry
.
_source
);
});
if
(
results
.
length
==
0
){
this
.
$
.
nodata
.
style
.
visibility
=
'
visible
'
;
}
else
{
this
.
$
.
nodata
.
style
.
visibility
=
'
hidden
'
;
}
//console.log(results)
that
.
data
=
results
},
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment