dashboard-gsicrawler.env.html 19.2 KB
Newer Older
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<link rel="import" href="/bower_components/polymer/polymer.html">
<link rel="import" href="/bower_components/material-search/material-search.html">
<link rel="import" href="/bower_components/paper-material/paper-material.html">
<link rel="import" href="/elements/google-chart-elasticsearch/google-chart.html">
<link rel="import" href="/bower_components/paper-tabs/paper-tabs.html">
<link rel="import" href="/bower_components/paper-tabs/paper-tab.html">
<link rel="import" href="/elements/number-chart/number-chart.html">
<link rel="import" href="/bower_components/comment-chart/comment-chart.html">
<link rel="import" href="/bower_components/paper-tabs/paper-tabs.html">
<link rel="import" href="/bower_components/yasgui-polymer/yasgui.html">
<link rel="import" href="/bower_components/iron-pages/iron-pages.html">
<link rel="import" href="/bower_components/paper-item/paper-item.html">
<link rel="import" href="/bower_components/paper-menu/paper-menu.html">
<link rel="import" href="/bower_components/paper-autocomplete/paper-autocomplete.html">
<link rel="import" href="/elements/entities-chart/entities-chart.html">
<link rel="import" href="/elements/people-chart/people-chart.html">
<link rel="import" href="/elements/news-chart/news-chart.html">
<link rel="import" href="/elements/propaganda-chart/propaganda-chart.html">
<link rel="import" href="/elements/tweet-chart/tweet-chart.html">
<link rel="import" href="/elements/annotate-view/annotate-view.html">
<link rel="import" href="/elements/happymap/happymap-element.html">

23
24
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/js/bootstrap.min.js"></script>

Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
25
26
27

<!--<script src="https://hypothes.is/embed.js" async></script>-->

28
29


Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
30
31
32
33
34
35
<dom-module id="dashboard-gsicrawler">


  <link rel="import" type="css" href="dashboard-gsicrawler.css" type="css">
  <link rel="import" href="/styles/app-theme.html" type="css">

Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
36
  
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
37
  <template>
Daniel Suarez's avatar
Daniel Suarez committed
38
39
    <iron-ajax auto
        url="/queries.json"
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
40
        handle-as="json"
Daniel Suarez's avatar
Daniel Suarez committed
41
        last-response="{{queries}}"></iron-ajax> 
42
43
44
45
46
    <iron-ajax auto
        url="/sources.json"
        handle-as="json"
        on-response="sourceResponse"></iron-ajax> 

Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
47
48
49
50
51
    <!--
    <div style="width:10%; padding: 1em; display:inline-block">
      <img style="width: 100%;"src="/images/trivalent.jpg">
    </div>
    -->
52
    <div class="container">
53
    <div style="width:100%; padding-bottom: 20px 0; text-align:center; display:inline-block">
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
54
55
56
      <img style="width: 20%;  margin:0 auto;"src="/images/trivalent.jpg">
    </div>

57
    <paper-tabs selected="{{selected}}" style="margin: 0 60px;">
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
58
59
60
61
62
      <paper-tab>Dashboard</paper-tab>
      <paper-tab>Sparql Editor</paper-tab>
      <paper-tab>About</paper-tab>
    </paper-tabs>

Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
63
   <iron-pages selected="{{selected}}">
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
64
65
      <div>
        <div class="row">
66
        <material-search active="true" search-value="{{query}}" style="margin: 0 15px;"></material-search>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
67
        <br>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
68
      
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
69
70
71

        </div>
        <br>  
Daniel Suarez's avatar
Daniel Suarez committed
72
        <!-- <div class="row">
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
73
74
75
76
77
78
79
80
81
82
83
          <div class="col-md-4">
            <number-chart 
              icon="/images/news.ico"
              stylebg="bg-white"
              title="Selected elements"
              data="{{data}}">
            </number-chart>
          </div>
          <div class="col-md-4">
            <number-chart 
              data="{{data}}"
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
84
              object="http://dbpedia.org/resource/CNN"
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
85
86
              aggKey="schema:author"
              title="CNN"
87
              icon="/images/cnn_blanco.svg"
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
88
89
90
91
92
93
              stylebg="bg-red">
            </number-chart>
          </div>
          <div class="col-md-4">
             <number-chart  
               data="{{data}}" 
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
94
               object="http://dbpedia.org/resource/The_New_York_Times"
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
95
96
97
98
99
100
101
102
103
104
105
               aggKey="schema:author"
               title="The New York Times" 
               icon="/images/times1.png"
               stylebg="bg-green"> 
             </number-chart>
           </div>
           </div>
           <div class="row">
           <div class="col-md-4">
             <number-chart  
               data="{{data}}" 
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
106
               object="http://dbpedia.org/resource/Al_Jazeera"
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
107
108
               aggKey="schema:author"
               title="Al Jazeera" 
109
               icon="/images/Aljazeera_blanco.svg"
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
110
111
112
113
114
115
116
               subtitle="Total"
               stylebg="bg-yellow"> 
             </number-chart>
           </div>
            <div class="col-md-4">
             <number-chart  
               data="{{data}}" 
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
117
               object="http://dbpedia.org/resource/Twitter"
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
118
119
               aggKey="schema:author"
               title="Twitter" 
120
               icon="/images/twitter.svg"
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
121
122
123
124
125
126
127
               subtitle="Total"
               stylebg="bg-aqua"> 
             </number-chart>
           </div>
           <div class="col-md-4">
             <number-chart  
               data="{{data}}" 
128
129
               aggKey="type"
               object="schema:Article"
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
130
               title="Magazines" 
131
               icon="/images/magazine.svg"
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
132
               subtitle="Total"
133
               stylebg="bg-purple"> 
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
134
135
             </number-chart>
           </div>
Daniel Suarez's avatar
Daniel Suarez committed
136
         </div> -->
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
137
        <div class="row">
Daniel Suarez's avatar
Daniel Suarez committed
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
          <div class="col-md-6">
            <number-chart 
              data="{{data}}"
              object="http://dbpedia.org/resource/CNN"
              aggKey="schema:author"
              title="CNN"
              icon="/images/cnn_blanco.svg"
              stylebg="bg-red">
            </number-chart>
            <number-chart  
               data="{{data}}" 
               object="http://dbpedia.org/resource/The_New_York_Times"
               aggKey="schema:author"
               title="The New York Times" 
               icon="/images/times1.png"
               stylebg="bg-green"> 
             </number-chart>
          </div>
          <div class="col-md-6">
            <number-chart  
               data="{{data}}" 
               object="http://dbpedia.org/resource/Al_Jazeera"
               aggKey="schema:author"
               title="Al Jazeera" 
               icon="/images/Aljazeera_blanco.svg"
               subtitle="Total"
               stylebg="bg-yellow"> 
             </number-chart>
             <number-chart  
               data="{{data}}" 
               aggKey="type"
               object="schema:Article"
               title="Magazines" 
               icon="/images/magazine.svg"
               subtitle="Total"
               stylebg="bg-purple"> 
             </number-chart>
          </div>
        </div>
         <br> 
        <!-- <div class="row">
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
179
180
181
          <div class="col-md-6">
            <google-chart
              field="schema:author"
182
183
              data="{{data}}"
              sources="{{sources}}"            
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
184
185
186
187
188
189
              id='pie-chart3'
              extra-id='pie-chart3'
              type='pie'
              filters="{{filters}}"
              icon='icons:reorder'
              options='{"title": "Source"}'
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
190
              cols='[{"label": "type", "type": "string"},{"label": "Count", "type": "number"}]'>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
191
192
193
            </google-chart>            
          </div>
          <div class="col-md-6">
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
194
            
195
            <google-chart
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
196
197
198
199
200
201
202
203
              field="sentiment"
              data="{{data}}"             
              id='barsentiment'
              extra-id='1'
              type='column'
              filters="{{filters}}"
              icon='social:mood'
              options='{"title": "Sentiments"}'
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
204
              cols='[{"label": "Sentiment", "type": "string"},{"label": "Count", "type": "number"}]'>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
205
206
207
            </google-chart>  
          </div>
        </div>
Daniel Suarez's avatar
Daniel Suarez committed
208
        <br>  -->
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
209
210
211
212
213
214
215
216
217
218
219
     <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>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
220
         </div>  
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
221
222
          <div class="col-md-6">
            <people-chart
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
223
                data="{{data}}"
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
224
225
226
227
228
229
230
231
                title="People"
                icon="maps:person-pin"
                param="{{param}}"
                id="entitieschart"
                filters="{{filters}}">
            </people-chart>
          </div>
      </div>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
232
      <br>
233
      <div class="row">
Daniel Suarez's avatar
Daniel Suarez committed
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
        <div class="col-md-6">
          <google-chart
              field="schema:author"
              data="{{data}}"
              sources="{{sources}}"            
              id='pie-chart3'
              extra-id='pie-chart3'
              type='pie'
              filters="{{filters}}"
              icon='icons:reorder'
              options='{"title": "Source"}'
              cols='[{"label": "type", "type": "string"},{"label": "Count", "type": "number"}]'>
            </google-chart>  
        </div>
        <div class="col-md-6">
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
          <google-chart
            field="schema:datePublished"
            data="{{data}}"             
            id='line-chart'
            extra-id='line-chart'
            type='line'
            filters="{{filters}}"
            sources="{{sources}}"
            icon='icons:trending-up'
            options='{"title": "Temporal Trends"}'
            optionsbi='{"legend": { "position": "bottom"}}'>
          </google-chart>
        </div>
      </div>
      <br>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
264
265
      <div class="row">
      <div class="col-md-6">
266
        <paper-tabs selected="{{selectedpage}}" style="height: 38px">
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
267
          <paper-tab><iron-icon icon="icons:receipt"></iron-icon> List of news</paper-tab>
Daniel Suarez's avatar
Daniel Suarez committed
268
269
<!--           <paper-tab><iron-icon icon="icons:speaker-notes"></iron-icon> Social Media</paper-tab>
 -->          <paper-tab><iron-icon icon="icons:speaker-notes"></iron-icon> Magazines</paper-tab>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
270
271
272
273
274
275
276
277
278
279
        </paper-tabs>
        <iron-pages class="lists" selected="{{selectedpage}}">
        <div>
          <news-chart 
            datos = "{{data}}"
            title="List of news"
            filters="{{filters}}"
            icon='icons:receipt'>
          </news-chart>
        </div>
Daniel Suarez's avatar
Daniel Suarez committed
280
        <!-- <div>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
281
282
283
284
285
          <tweet-chart 
            datos = "{{data}}"
            title="List of tweets"
            filters="{{filters}}"
            icon='communication:comment'>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
286
          </tweet-chart>
Daniel Suarez's avatar
Daniel Suarez committed
287
        </div> -->
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
288
        <div>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
289
290
291
292
293
294
          
          <propaganda-chart 
            datos = "{{data}}"
            title="List of propaganda"
            filters="{{filters}}"
            icon='communication:comment'>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
295
296
          </propaganda-chart>
        </div>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
297
298
299
300
301
302
          
        </iron-pages>
       </div>
       <div class="col-md-6">
        <div class="top-bar">
        <iron-icon icon="maps:my-location"></iron-icon>
Daniel Suarez's avatar
Daniel Suarez committed
303
          <span>Geolocated News</span>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
304
305
306
307
308
309
310
311
312
313
314
        </div>
        <!--
        <leaflet-map fit-to-markers>
          <template is="dom-repeat" items="[[getPlaces(data)]]" as="place">
                <leaflet-marker latitude="{{place.lat}}" longitude="{{place.lng}}" title="{{place.name}}"> 
                    <b>Headline:</b>
                    <span>{{place.name}}</span>
                </leaflet-marker>
              </template>
        </leaflet-map>
        -->
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
315
316
317
318
        <happymap-element 
          data="{{data}}",
          '<!-- visalized data in case of connection error -->'>
            
319
        </happymap-element>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
320
321
322
323
324
       </div>
      </div>
    </div>
    <div>
        <yasgui-ui
325
       endpoint="http://sefarad-fuseki.cluster.gsi.dit.upm.es/gsicrawler/query"
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
326
       queries="{{queries}}">
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
        </yasgui-ui>
    </div>
    <div>
    

This demo shows GSI-Crawler functionalities in the context of the project Trivalent. The system is aimed at crawling from a variety of data sources including news web sites such as CNN and New York Times, as well as social media platforms, like Twitter. The presented demo is the result of the ingest of the crawled online data and posterior analysis and semantic augmentation of said data. The resulting information is stored in both ElastiSearch and Fuseki databases, which allows the user to consult the data is a variety of forms, as showed.

<br><br>
For a quick overview of the funtionalities of the demo, please watch the following video:
<br><br>
<iframe width="560" height="315" src="https://www.youtube.com/embed/3s894sjevBQ" frameborder="0" allowfullscreen></iframe>
<br><br>
To discover more, please consult the documentation at <a href="http://gsicrawler.readthedocs.io" target="_blank">Read The Docs</a>
<br><br>
H2020 RIA Action Grant No. 740934 under the call SEC-06-FCT-2016 — Developing a comprehensive approach to violent radicalization in the EU from early understanding to improving protection.
<br><br> 
    </div>
      <annotate-view name="annotate-view"></annotate-view>
    </iron-pages>
346
    </div>
347
348
349
350
         <div style="background-color:#ccc; padding: 1%; margin: -16px;margin-top: 20px;">
        <div style="display: flex; flex-direction: column; justify-content: center; align-content: center; margin: 0 65px;">
          <img style="width: 100%; height: 50px; object-fit: contain; margin-bottom: 5px;" src="/images/gsi.png">   
          <div style="display: flex; flex-direction: column; justify-content: center; font-size: 12px; text-align: center;">© 2018 Grupo de Sistemas Inteligentes GSI-UPM </div>
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
351
352
353
354
355
        </div>
       </div>



356

Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
  </template>
   

  <script>
  var ready = false;
    Polymer({
      is: 'dashboard-gsicrawler',
      properties: {
        selected: {
          type: Number,
          value: 0
        }, 
        selectedpage: {
          type: Number,
          value: 0
        }, 
        query: {
          type: String,
        },
        ids:{
          type: Array
           
        },
        data:{
          type: Object
        },
        client: {
          type: Object,
          notify: true,
          observer: '_clientChanged'              
        },
        fields: {
          type: Array,
          value: function() { return []; }
        },
392
393
394
        search:{
          type:Object
        },
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
        filters: {
          type: Array,
          notify: true,
          value: function() { return []; }
        }
      },
    
      observers: [
      '_filtersChange(filters.*)',
      'entityselection(selectedentity)'
      ],
      behaviors: [
        Polymer.IronA11yKeysBehavior
      ],
      keyBindings: {
        'enter': '_search'
      },

      ready: function(){
        //console.log("ready");
      },

      _clientChanged: function() {
        //console.log("ClientChanged");
        ready = true;
        this._query();
      },
      
      getEntities: function(datos){
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
424
425
426
427
428
429
430
431
432
433
434
            console.log("getEntities")
            if(this.entityselection){
              var entities = []
              var hits = this.data.aggregations['entities.name'].buckets;
              console.log(hits)
              hits.forEach(function(entry){
                entities.push(entry.key.split('/')[4]);
              });
              console.log(entities)
              return entities
            } 
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
435
436
437
438
439
440
441
          },
      
      entityselection: function(entity){
        console.log("entityselection")
        console.log(entity)
        if(entity == null){
          this.filters = [];
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
442
        } else this.push('filters', { terms: { 'entities.schema:name': entity.toLowerCase().split(" ")}})
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
443
444
445
446
      },
      
      getPlaces: function(data){
        var places = []
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
447
        console.log("getPlace")
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
448
449
450
451
452
453
454
455
456
        data.hits.hits.forEach( function (entry){
          entry._source.entities.forEach(function(entity){
            if ('latitude' in entity) {
              places.push({'lat': entity.latitude, 'lon': entity.longitude, 'name': entry._source['http://schema.org/headline'][0]['@value']})
            }
          })
        })
        return places
      },
457
458
459
460
461
      sourceResponse:function(e){
        //console.log(e.detail.response[0])
        this.sources=e.detail.response[0]
        //console.log(this.sources)
      },
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
462
      _search: function(){
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
463
464
465
        console.log("search fired")
        console.log(this.selectedentity)
        
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
466
467
        if (this.query.length == 0){
          //console.log("default search fired")
Daniel Suarez's avatar
Daniel Suarez committed
468
          this.filters = []
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
469
470
471
          this._query()
        }
        else {
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
472
          console.log("Filter")
Daniel Suarez's avatar
Daniel Suarez committed
473
474
          this.push('filters', {terms: {'schema:articleBody': [this.query]}});
          //this.search={"schema:articleBody":{"query":this.query,"operator":"and"}}
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
475
476
          this._query()
        }
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
477
        
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
      },
      _filtersChange: function() {
        this._query();
       },
       _query: function() {
        //console.log("_query")
        var that = this;
        //console.log("Ready?: ", ready);
        if(ready){
          this.client.search({
          // undocumented params are appended to the query string
          index: "gsicrawler",
          body: {
            size: 200,
            query: {
              bool: {
                must: this.filters,
495
496
              }/*,
              match: this.search*/
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
497
498
499
500
501
502
503
504
505
506
507
508
            },
            aggs: {
             type: {
               terms: {
                 field: "@type.keyword",
                 order: {
                   _count: "desc"
                 }
               }
             },
             'schema:author': {
               terms: {
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
509
                 field: "schema:author.keyword",
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
510
511
512
513
514
                 order: {
                   _count: "desc"
                 }
               }
             },
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
515
516
517
             'entities.type': {
               terms: {
                 field: "entities.@type.keyword",
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
518
519
520
521
522
523
                 order: {
                   _count: "desc"
                 } 
               }
             },

Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
524
             'entities.name': {
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
525
               terms: {
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
526
                 field: "entities.schema:name.keyword",
527
                 size : 16,
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
528
529
530
531
532
                 order: {
                   _count: "desc"
                 } 
               }
             },
533
534

             sentiment: {
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
535
               terms: {
536
                 field: "sentiments.marl:hasPolarity.keyword",
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
537
538
                 order: {
                   _count: "desc"
539
                   }
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
540
               }
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
              },
              'schema:datePublished': {
                date_histogram : {
                  field : "schema:datePublished",
                  format: "MM-yyyy",
                  interval : "month"
                },
                aggs:{
                  source:{
                    terms: {
                     field: "schema:author.keyword",
                     order: {
                       _count: "desc"
                     }
                    }
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
556
                  }
557
558
                }
              }
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
559
560
561
562
563
564
          }
        } 
        }).then(function (resp) {
          var myids = []
          resp.hits.hits.forEach(function(entry){myids.push(entry._id)})
          that.ids = myids;
565
          //console.log(that.sources)
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
566
          /*var sources=that.sources
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
567
          for (var i=0; i<resp['aggregations']['schema:author']['buckets'].length;i++) {
568
569
570
571
572
573
            var key=resp['aggregations']['schema:author']['buckets'][i]["key"] 
            console.log(key)
            if(key in sources)
              console.log(sources)
              resp['aggregations']['schema:author']['buckets'][i]["key"]=sources[key]

Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
574
          }*/
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
575
576
577
578
579
580
581
          //resp['aggregations']['schema:author']['buckets'][1]["key"]="Dabiq"
          //resp['aggregations']['schema:author']['buckets'][2]["key"]="Rumiyah"
          that.data = resp;
         
          //console.log(that.data);
          
          });
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
582
583
584
        }
      }
    });
Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
585
586
  

Daniel Suarez Souto's avatar
Daniel Suarez Souto committed
587
588
589
  </script>

</dom-module>