Project

General

Profile

« Previous | Next » 

Revision 59152

[Library|Trunk]

JSONLD:
-Home page:
-Add description in Website with search action
-In every search page add description based on the filters
-In (project, content provider, organization) landing add description if available otherwise use the title
-In project add id in funder entity

Autocomplete: create event emitter to update entity or refine result label (used in jsonld)

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/find/searchAll.component.html
31 31
  </div>
32 32
</div>
33 33
<schema2jsonld *ngIf="name && logoURL" [URL]="properties.baseLink+'/search/find'"
34
               [logoURL]="properties.baseLink+logoURL" type="search" [name]=name></schema2jsonld>
34
               [logoURL]="properties.baseLink+logoURL" type="search" [name]=name
35
               description="Search for research outcomes (publications, datasets, software, other research products), projects, organizations, content providers in the OpenAIRE Research Graph.  "></schema2jsonld>
35 36
<div class="uk-container-large uk-container">
36 37

  
37 38
  <ul class=" portalTabs uk-tab  uk-width-1-1 " uk-tab="animation: uk-animation-fade">
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/advancedSearchForm.component.html
63 63
                               [selectedValue]=selectedField.value [showSelected]=true
64 64
                               [placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name"
65 65
                               [multipleSelections]=false (selectedValueChanged)="valueChanged($event,i)"
66
                               (listUpdated)="listUpdated($event,selectedField.id)"></static-autocomplete>
66
                               (listUpdated)="listUpdated($event,selectedField.id)"
67
                               (updateValueLabel)="updatedValueLabel($event, i)"></static-autocomplete>
67 68
        </td>
68 69
        <td *ngIf="selectedField.type == 'entity'">
69 70
          <entities-autocomplete [properties]=properties [fieldId]=selectedField.id [entityType]=selectedField.param
......
71 72
                                 [placeHolderMessage]="'Search for '+selectedField.name" [title]="selectedField.name"
72 73
                                 [multipleSelections]=false
73 74
                                 (selectedValueChanged)="valueChanged($event,i)"
74
                                 (listUpdated)="listUpdated($event,selectedField.id)">
75
                                 (updateValueLabel)="updatedValueLabel($event, i)">
75 76
          </entities-autocomplete>
76 77
        </td>
77 78

  
......
98 99
        <td class=" ">
99 100
                <span type="button" class="uk-icon-button portal-button-reverse clickable "
100 101
                      (click)="removeField(i)">
101
                  <span uk-icon="minus"> </span>
102
                  <span  class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20"
103
                                              xmlns="http://www.w3.org/2000/svg" data-svg="minus"><rect height="1" width="18" y="9" x="1"></rect></svg></span>
102 104
                </span>
103 105
          <div *ngIf="i == selectedFields.length-1 " class="uk-margin-small-top">
104 106
          <span  type="button"
105 107
                class="uk-icon-button   portal-button clickable "
106 108
                (click)="addField()">
107
                 <span uk-icon="plus">
108
                 </span>
109
                 <span  class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20"
110
                                             xmlns="http://www.w3.org/2000/svg" data-svg="plus"><rect x="9" y="1" width="1" height="17"></rect><rect x="1" y="9" width="17" height="1"></rect></svg></span>
109 111
              </span>
110 112
          </div>
111 113
        </td>
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/advancedSearchForm.component.ts
150 150
    valueChanged($event,index:number){
151 151
      this.selectedFields[index].value = $event.value;
152 152
    }
153
    updatedValueLabel($event,index:number){
154
      this.selectedFields[index].valueLabel = $event.value;
155
    }
153 156
    listUpdated($event,fieldId:number){
154 157
      this.fieldList[fieldId] = $event.value;
155 158
    }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/searchHelperClasses.class.ts
25 25
    public name: string; //
26 26
    public type: string = "keyword"; //keyword, static or dynamic
27 27
    public value: string = '';
28
    public valueLabel: string = '';
28 29
    public operatorId: string;
29 30
    public operatorName: string ="";
30 31
    public valid: boolean = true;
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.html
178 178
  </div>
179 179
</div>
180 180
<schema2jsonld *ngIf="!includeOnlyResultsAndFilter && url" [URL]="url" type="search" [name]=pageTitle
181
               [searchAction]=false></schema2jsonld>
181
               [searchAction]=false [description]="metaDescription" ></schema2jsonld>
182 182

  
183 183

  
184 184
<div id="tm-main" class="   tm-middle">
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/newSearchPage.component.ts
57 57
  @Input() rangeFilters: RangeFilter[] = [];
58 58
  @Input() rangeFields: string[][] = [];
59 59
  @Input() refineFields = [];
60
  @Input() filters = [];
60
  @Input() filters:Filter[] = [];
61 61
  selectedFilters: number = 0;
62 62
  selectedRangeFilters: number = 0;
63 63
  private searchFieldsHelper: SearchFields = new SearchFields();
......
101 101
  public errorCodes: ErrorCodes = new ErrorCodes();
102 102
  breadcrumbs:Breadcrumb[] = [];
103 103
  url = null;
104

  
104
  metaDescription = "";
105 105
  @Input() entitiesSelection:boolean = true;
106 106
  @Input() showAdvancedSearchLink:boolean = true;
107 107

  
......
128 128
        this.resultsPerPage = data.envSpecific.resultsPerPage;
129 129
        this.csvLimit = data.envSpecific.csvLimit;
130 130
        this.isPiwikEnabled = data.envSpecific.enablePiwikTrack;
131
        if (typeof window !== 'undefined') {
132
          this.updateUrl(data.envSpecific.baseLink + location.pathname);
133
          this.url = data.envSpecific.baseLink + location.pathname
134
        }
131
        this.updateUrl(data.envSpecific.baseLink +this.router.url);
132
        this.url = data.envSpecific.baseLink + this.router.url;
135 133
        if (typeof document !== 'undefined' && this.isPiwikEnabled) {
136 134
          this.piwiksub = this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe();
137 135
        }
......
142 140
      }
143 141
      this.customFilterEnabled = params['cf'] && params['cf'] == "true";
144 142
    });
145
    var description = "Openaire, search, repositories, open access, type, content provider, funder, project, " + this.pageTitle;
143
    this.metaDescription = this.pageTitle;
146 144

  
147 145
    this.updateTitle(this.pageTitle);
148
    this.updateDescription(description);
146
    this.updateDescription();
149 147

  
150 148
    this.searchUtils.baseUrl = "/" + this.searchUtils.baseUrl;
151 149
    this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this.router.url, false);
......
179 177
    }
180 178
  }
181 179

  
182
  updateDescription(description: string) {
183
    this._meta.updateTag({content: description}, "name='description'");
184
    this._meta.updateTag({content: description}, "property='og:description'");
180
  updateDescription() {
181
    this.metaDescription = "Search results for ";
182
    if(this.resultTypes){
183
      let array = [];
184
      for(let type of this.resultTypeOptions){
185
        if(this.resultTypes[type.id]== true){
186
          array.push(type.name);
187
        }
188
      }
189
      if(array.length == 0){
190
        this.metaDescription += "research outcomes ";
191
      }else{
192
        this.metaDescription += array.join(", ") + " ";
193
      }
194
    }else{
195
      this.metaDescription = this.pageTitle + " ";
196
    }
197
    let filterArray = [];
198
    for(let filter of this.filters){
199
      if(filter.countSelectedValues> 0){
200
       for(let value of filter.values){
201
         if(value.selected) {
202
           filterArray.push(value.name);
203
         }
204
        }
205
      }
206
    }
207
    for(let field of this.selectedFields){
208
      if((field.type == "entity" || field.type == "refine") && field.valueLabel.length > 0 && filterArray.indexOf(field.valueLabel)==-1){
209
        filterArray.push(field.valueLabel)
210
      }else if(!(field.type == "entity" || field.type == "refine")  && field.value.length > 0 && filterArray.indexOf(field.value)==-1) {
211
        filterArray.push(field.value);
212
      }
213
    }
214
    this.metaDescription+= (filterArray.length > 0?" filtered for: ":"") + filterArray.join(", ") + " ";
215
    this._meta.updateTag({content: this.metaDescription}, "name='description'");
216
    this._meta.updateTag({content: this.metaDescription}, "property='og:description'");
185 217
  }
186 218

  
187 219
  updateTitle(title: string) {
......
375 407
      }
376 408
    }
377 409
    this.filterFilterValues(this.filters);
410
    this.updateDescription();
378 411
    return filters;
379 412
  }
380 413

  
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/entitiesAutoComplete/entitiesAutoComplete.component.ts
56 56
    @Input() title = "Autocomplete";
57 57
    @Output() addItem = new EventEmitter(); // when selected list  changes update parent component
58 58
    @Output() selectedValueChanged = new EventEmitter(); // when changed  a method for filtering will be called
59
    @Output() updateValueLabel = new EventEmitter(); //when the value is id sends  an event to update the value (for meta tags)
59 60
    @Input() public list = []; // the entries resulted after filtering function
60 61
    @Input() public selected = []; // the entries selected from user
61 62
    @Input() public keywordlimit = 3; // the minimum length of keyword
......
181 182
        this.selectedValueChanged.emit({
182 183
            value: this.selectedValue
183 184
        });
185
        this.updateValueLabel.emit({
186
          value:""
187
        });
184 188

  
185 189

  
186 190
      }
......
213 217
        this.selectedValueChanged.emit({
214 218
            value: this.selectedValue
215 219
        });
220
        this.updateValueLabel.emit({
221
          value:this.showItem(item)
222
        });
216 223
        this.focus=false;
217 224

  
218 225
      }
......
267 274
      this.sub = this._search.fetchByType(this.selectedValue,this.entityType, this.properties).subscribe(
268 275
        data => {
269 276
          this.selected.push( data[0]);
277
          this.updateValueLabel.emit({
278
            value:this.showItem(this.selected[0])
279
          });
270 280
          this.showInput = false;
271 281
         },
272 282
        err => {
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/staticAutoComplete/staticAutoComplete.component.ts
46 46
    @Input() title = "Autocomplete";
47 47
    @Output() addItem = new EventEmitter(); // when selected list  changes update parent component
48 48
    @Output() selectedValueChanged = new EventEmitter(); // when changed  a method for filtering will be called
49
    @Output() updateValueLabel = new EventEmitter(); //when the value is id sends  an event to update the value (for meta tags)
49 50
    @Output() listUpdated = new EventEmitter(); // when changed  a method for filtering will be called
50 51
    @Input() public list = []; // the entries resulted after filtering function
51 52
    @Input() public filtered = []; // the entries resulted after filtering function
......
197 198
        this.selectedValueChanged.emit({
198 199
            value: this.selectedValue
199 200
        });
201
        this.updateValueLabel.emit({
202
          value:""
203
        });
200 204

  
201

  
202 205
      }
203 206
    }
204 207
    select(item:any){
......
229 232
        this.selectedValueChanged.emit({
230 233
            value: this.selectedValue
231 234
        });
232

  
235
          this.updateValueLabel.emit({
236
            value:this.showItem(item)
237
          });
233 238
      }
234 239

  
235 240
    }
......
279 284
          this.selectedValue = this.list[i].label;
280 285
          this.selected.push(this.list[i]);
281 286
          this.showInput = false;
287
          this.updateValueLabel.emit({
288
            value:this.showItem(this.list[i])
289
          });
282 290
          return;
283 291

  
284 292
        }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/deposit/depositFirstPage.component.ts
23 23
          </div>
24 24

  
25 25
          <div class="uk-container uk-container-large uk-margin-medium-top">
26
            <div class="uk-grid-divider" uk-grid>
26
            <div class="uk-grid-divider uk-grid" uk-grid>
27 27
              <div class="uk-width-1-2@m uk-width-1-1@s">
28 28
<!--                <p class="uk-margin-auto uk-text-large">How to <span class="uk-text-bold">deposit</span> your research...</p>-->
29 29
                <span class="uk-grid">
......
136 136
      </div>
137 137
    </div>
138 138
    <div class="">
139
      <schema2jsonld *ngIf="url" [URL]="url" [name]="title" type="other"></schema2jsonld>
139
      <schema2jsonld *ngIf="url" [URL]="url" [name]="title" type="other" description=" Find the appropriate repository to deposit your research products of any type (publication, data, software, other) or to include in your data management plan. Search and browse for OpenAIRE compliant repositories registered in OpenDOAR and re3data. "></schema2jsonld>
140 140
    <div class="uk-section tm-middle uk-container uk-container-large uk-margin-small-top uk-padding-remove-top uk-padding-remove-bottom ">
141 141
      <div class="uk-container uk-container-large uk-margin-bottom uk-margin-medium-top">
142 142
        <div class="uk-grid uk-padding">
modules/uoa-services-library/trunk/ng-openaire-library/src/app/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts
36 36
		searchPage["name"] = name;
37 37
		searchPage["url"] = properties.baseLink+"/search/find/";
38 38
		searchPage["logo"] = logoURL;
39
		if(description){
40
			searchPage["description"] = description;
41
		}
39 42
		const action ={};
40 43
		action["@type"]= "SearchAction";
41 44
		action["@id"]= properties.baseLink+"/#search-action";
......
53 56
		buffer["url"] = URL;
54 57
		if(description){
55 58
			buffer["description"] = description;
56
		}		buffer["@id"] = URL;
59
		}else{
60
			buffer["description"] = name;
61
		}
62
		buffer["@id"] = URL;
57 63
		return buffer;
58 64
	}
59 65
	createSearchPage(name, URL, logoURL, searchAction:boolean = true, description:string = null): any {
......
88 94
		doc.issn = this.getISSN(result);
89 95
		doc.description = this.getDescription(result);
90 96
		doc.identifier = this.getIdentifier(result);
91
		doc.id = URL
97
		doc.id = URL;
92 98
		doc.url = URL;
93 99
		doc.sameAs = this.getSameAs(result);
94 100
		doc.creator = this.getCreator(result);
......
99 105
		return doc;
100 106
	}
101 107

  
102
	convertProject(project: any, URL, otherUrl): Organization {
108
	convertProject(project: any, URL): Organization {
103 109
		const doc = new Organization();
104 110
		doc.title = (project.title)?project.title:project.acronym;
105 111
		doc.identifier = new Array<Identifier>();
106 112
		doc.identifier.push({id:project.funding.code, schema: "grantid"});
107
		var funder = new Organization();
108
		funder.title = project.funding.funderShortName;
113
		let funder = new Organization();
114
		funder.id = properties.baseLink+"#funder-"+project.funding.funderShortName;
115
		funder.title = project.funding.funderName;
109 116
		doc.funder = funder;
110 117
		doc.url = URL;
118
		doc.id = URL;
119
		doc["description"] = [];
120
		doc["description"].push((project.title)?project.title:project.acronym);
111 121
		doc.sameAs =[project.url];
112 122
		return doc;
113 123
}
114 124

  
115
convertOrganization(organization: any, URL): Organization {
125
convertOrganization(organization: any, URL, description:string = null): Organization {
116 126
	const doc = new Organization();
117 127

  
118 128
	doc.title =  organization.title.name ;
119 129
	doc.legalName = organization.name;
120 130
	doc.areaServed = organization.country;
121 131
	doc.url = URL;
122

  
132
	doc.id = URL;
133
	doc["description"] = [];
134
	doc["description"].push(((organization.title.name?organization.title.name:"") + " - " + (organization.name?organization.name:"")));
123 135
	return doc;
124 136
}
125 137

  
126 138
convertDatasource(datasource: any, URL, otherUrl): Organization {
127 139
	const doc = new Organization();
128 140

  
129
	doc.title = datasource.title.name;
141
	doc.title = datasource.title.name?datasource.title.name:datasource.officialName;
130 142
	//doc.identifier = datasource.contractNum;
131 143
	doc.legalName = datasource.officialName;
132 144
	if(datasource.countries && datasource.countries.length > 0){
133 145
		doc.areaServed = datasource.countries[0];
134 146
	}
135 147
	doc.url = URL;
148
	doc.id = URL;
149
	doc["description"] = [];
150
	doc["description"].push(datasource.description?datasource.description:datasource.title.name?datasource.title.name:datasource.officialName);
151

  
136 152
	if(datasource.oaiPmhURL || otherUrl || datasource.title.url){
137 153
		doc.sameAs = [];
138 154
		if(otherUrl){
modules/uoa-services-library/trunk/ng-openaire-library/src/app/sharedComponents/schema2jsonld/schema2jsonld.component.ts
1
import {Component, Input} from '@angular/core';
1
import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core';
2 2
import {OpenAireJsonldConverterService} from './service/open-aire-jsonld-converter.service';
3 3
import {JsonldDocumentSerializerService} from './service/jsonld-document-serializer.service';
4 4

  
......
8 8
    <ngx-json-ld [json]="json"></ngx-json-ld>
9 9
  `
10 10
})
11
export class Schema2jsonldComponent {
11
export class Schema2jsonldComponent  implements OnInit, OnChanges  {
12 12
  @Input() data; // for project, organization, datasource
13 13
  @Input() URL;
14 14
  @Input() logoURL; // for home, search
......
23 23
              private documentSerializer: JsonldDocumentSerializerService) {
24 24
    
25 25
  }
26
  
26
  ngOnChanges(changes: SimpleChanges): void {
27
    if (changes.description) {
28
      this.createJson();
29
    }
30
  }
27 31
  ngOnInit() {
32
    this.createJson();
33
  }
34

  
35
  createJson(){
28 36
    var docOvject;
29 37
    if (this.type == 'project') {
30
      docOvject = this.documentParser.convertProject(this.data, this.URL, this.otherURL);
38
      docOvject = this.documentParser.convertProject(this.data, this.URL);
31 39
      this.json = this.documentSerializer.serializeOrganization(docOvject);
32 40
    } else if (this.type == 'organization') {
33
      docOvject = this.documentParser.convertOrganization(this.data, this.URL);
41
      docOvject = this.documentParser.convertOrganization(this.data, this.URL, this.description);
34 42
      this.json = this.documentSerializer.serializeOrganization(docOvject);
35 43
    } else if (this.type == 'datasource') {
36 44
      docOvject = this.documentParser.convertDatasource(this.data, this.URL, this.otherURL);

Also available in: Unified diff