Charts added in project and publication landing pages

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@44987 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2016-12-16 10:55:59 +00:00
parent 706b03b384
commit 0710e8883c
7 changed files with 162 additions and 257 deletions

View File

@ -102,6 +102,7 @@ export class PersonComponent {
this.personInfo = data;
},
err => {
console.log(err)
console.info("error");

View File

@ -2,7 +2,8 @@
<div class="container person">
<div class="container-header" >
<div *ngIf="projectInfo != null">
<h3 class="sc39" title="Special Clause 39">{{projectInfo.acronym}}</h3>
<h3 *ngIf="projectInfo.acronym != undefined && projectInfo.acronym != ''">{{projectInfo.acronym}}</h3>
<h3 *ngIf="projectInfo.acronym == undefined || projectInfo.acronym == ''">{{projectInfo.title}}</h3>
</div>
<div *ngIf="warningMessage.length > 0" class="alert alert-warning" role="alert">{{warningMessage}}</div>
<div *ngIf="errorMessage.length > 0" class="alert alert-danger" role="alert">{{errorMessage}}</div>
@ -136,6 +137,7 @@
<div class="well">
<b>Views: </b>{{metrics}}
</div>
<i-frame *ngIf="metricsClicked" [url]=viewsFrameUrl width="100%" height="350"></i-frame>
</div>
</div>
</div>

View File

@ -23,6 +23,8 @@ export class ProjectComponent{
private projectId : string ;
public projectInfo: ProjectInfo;
private metrics: string;
private metricsClicked: boolean;
private viewsFrameUrl: string;
private project ;
@ -53,6 +55,8 @@ export class ProjectComponent{
}
ngOnInit() {
this.metricsClicked = false;
this.sub = this.route.queryParams.subscribe(params => {
this.projectId = params['projectId'];
console.info("Id is :"+this.projectId);
@ -126,6 +130,10 @@ export class ProjectComponent{
}
getMetrics() {
this.metricsClicked = true;
let projectName: string = (this.projectInfo.acronym != undefined && this.projectInfo.acronym != '') ? this.projectInfo.acronym : this.projectInfo.title;
this.viewsFrameUrl = ('http://vaggelas.athenarc.gr/stats/merge.php?com=query&data=[{"table":"project_stats_monthly","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Number of views for project '+projectName+'","yaxisheaders":["sum of views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"id","values":["'+this.projectId+'"],"to":"-1"}]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true');
console.info("getProjectMetrics: component");
this._projectService.getMetrics(this.projectId).subscribe(
data => {

View File

@ -257,6 +257,8 @@
</tr>
</tbody>
</table>
<!--i-frame *ngIf="metricsClicked" [url]=viewsFrameUrl width="100%" height="250"></i-frame-->
<i-frame *ngIf="metricsClicked" [url]=openaireViewsFrameUrl width="100%" height="250"></i-frame>
</div>
</div>
</div>
@ -330,7 +332,7 @@
</dd>
</dl>
</li>
<li class="list-group-item" *ngIf="publicationInfo.publishedIn != undefined && publicationInfo.publishedIn.length > 0">
<li class="list-group-item" *ngIf="publicationInfo.publishedIn != undefined && publicationInfo.publishedIn.size > 0">
<dl class="functionsSection">
<dt class="title">Published in</dt>
<dd *ngIf="showAllPublishedIn" class="text-right">
@ -411,7 +413,7 @@
</li>
<li class="list-group-item">
<dl class="functionsSection" *ngIf="publicationInfo.contexts != undefined">
<dt class="title">Related to </dt>
<dt class="title">Related to</dt>
<dd class="line" *ngFor="let item of publicationInfo.contexts">
<span *ngIf = "!item['inline']" >
<span>{{item['labelContext']}}</span>

View File

@ -24,6 +24,8 @@ export class PublicationComponent {
constructor (private _publicationService: PublicationService, private route: ActivatedRoute) {
}
ngOnInit() {
this.metricsClicked = false;
this.sub = this.route.queryParams.subscribe(data => {
this.articleId = data['articleId'];
console.info("Article id is :"+this.articleId);
@ -48,6 +50,9 @@ ngAfterContentInit() {
articleId: string;
public publicationInfo: PublicationInfo;
private metrics: Metrics;
private metricsClicked: boolean;
private viewsFrameUrl: string;
private openaireViewsFrameUrl: string;
public showAllReferences: boolean = false;
public showAllRelResData: boolean = false;
@ -106,6 +111,10 @@ ngAfterContentInit() {
}
getMetrics() {
this.metricsClicked = true;
//this.viewsFrameUrl = 'http://vaggelas.athenarc.gr/stats/merge.php?com=query&data=[{"table":"result_stats_monthly","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":0,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Number of views for '+this.publicationInfo.title.name+'","yaxisheaders":["sum of views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"result_stats_monthly(id)-(id)result-id","values":["'+this.articleId+'"],"to":"-1"}]}]&info_types=["spline"]&stacking=&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
this.openaireViewsFrameUrl = 'http://vaggelas.athenarc.gr/stats/merge.php?com=query&data=[{"table":"result_stats_monthly_charts","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":-30,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"OpenAIRE","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"result_stats_monthly_charts(id)-(id)result-id","values":["'+this.articleId+'"],"to":"-1"}]},{"table":"repo_view_stats_monthly_charts","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":"repo_view_stats_monthly_charts(source)-(piwik_id)datasource_piwik(openaire_id)-(id)datasource-name","color":"","type":"chart","size":30,"sort":"xaxis","xStyle":{"r":0,"s":"0","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"repo_view_stats_monthly_charts(id)-(orid)result_oids(id)-(id)result-id","values":["'+this.articleId+'"],"to":"-1"}]}]&info_types=["column","column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(124, 181, 236, 1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true';
console.info("getPublicationMetrics: component");
this._publicationService.getMetrics(this.articleId).subscribe(
data => {

View File

@ -64,9 +64,10 @@ export class ProjectService {
}
return this.http.get(url)
.map(res => <any> res.json())
.map(res => [res['result']['metadata']['oaf:entity']['oaf:project'],
res['result']['metadata']['oaf:entity']['oaf:project']['fundingtree'],
res['result']['metadata']['oaf:entity']['oaf:project']['rels']['rel']])
.map(res => res['result']['metadata']['oaf:entity']['oaf:project'])
.map(res => [res,
res['fundingtree'],
res['rels']['rel']])
.do(res => {
this._cache.set(key, res);
})

View File

@ -21,7 +21,7 @@ export class PublicationService {
let url = OpenaireProperties. getSearchAPIURLLast() + 'publications/' +id+"?format=json";
let key = url;
if (this._cache.has(key)) {
return Observable.of(this._cache.get(key)).map(res => this.parsePublicationInfo(res))
return Observable.of(this._cache.get(key)).map(res => this.parsePublicationInfo(res));
}
return this.http.get(url)
.map(res => <any> res.json())
@ -140,22 +140,22 @@ export class PublicationService {
}
if(data[2] != null) {
let mydata;
let relation;
let counter = 0;
let length = data[2].length!=undefined ? data[2].length : 1;
let length = Array.isArray(data[2]) ? data[2].length : 1;
for(let i=0; i<length; i++) {
mydata = data[2].length!=undefined ? data[2][i] : data[2];
if(mydata.hasOwnProperty("to")) {
if(mydata['to'].class == "hasAuthor") {
relation = Array.isArray(data[2]) ? data[2][i] : data[2];
if(relation.hasOwnProperty("to")) {
if(relation['to'].class == "hasAuthor") {
if(this.publicationInfo.authors == undefined) {
this.publicationInfo.authors = new Array<{"name": string, "url": string}>();
}
this.publicationInfo.authors[mydata.ranking-1] = {"name": "", "url": ""};
this.publicationInfo.authors[mydata.ranking-1]['name'] = mydata.fullname;
this.publicationInfo.authors[mydata.ranking-1]['url'] = OpenaireProperties.getsearchLinkToPerson() +mydata['to'].content;
} else if(mydata['to'].class == "isProducedBy") {
this.publicationInfo.authors[relation.ranking-1] = {"name": "", "url": ""};
this.publicationInfo.authors[relation.ranking-1]['name'] = relation.fullname;
this.publicationInfo.authors[relation.ranking-1]['url'] = OpenaireProperties.getsearchLinkToPerson() + relation['to'].content;
} else if(relation['to'].class == "isProducedBy") {
if(this.publicationInfo.fundedByProjects == undefined) {
this.publicationInfo.fundedByProjects = new Array<
{ "url": string, "acronym": string, "title": string,
@ -173,29 +173,29 @@ export class PublicationService {
}
this.publicationInfo.fundedByProjects[counter]['url'] =
OpenaireProperties.getsearchLinkToProject() + mydata['to'].content;
this.publicationInfo.fundedByProjects[counter]['acronym'] = mydata.acronym;
this.publicationInfo.fundedByProjects[counter]['title'] = mydata.title;
this.publicationInfo.fundedByProjects[counter]['code'] = mydata.code;
OpenaireProperties.getsearchLinkToProject() + relation['to'].content;
this.publicationInfo.fundedByProjects[counter]['acronym'] = relation.acronym;
this.publicationInfo.fundedByProjects[counter]['title'] = relation.title;
this.publicationInfo.fundedByProjects[counter]['code'] = relation.code;
if(mydata.hasOwnProperty("funding")) {
let length1 = Array.isArray(mydata['funding']) ? mydata['funding'].length : 1;
if(relation.hasOwnProperty("funding")) {
let length1 = Array.isArray(relation['funding']) ? relation['funding'].length : 1;
for(let j=0; j<length1; j++) {
let funding;
let mydata1 = Array.isArray(mydata['funding']) ? mydata['funding'][j] : mydata['funding'];
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][j] : relation['funding'];
if(mydata1.hasOwnProperty("funder")) {
this.publicationInfo.fundedByProjects[counter]['funderShortname'] = mydata1['funder'].shortname;
this.publicationInfo.fundedByProjects[counter]['funderName'] = mydata1['funder'].name;
if(fundingData.hasOwnProperty("funder")) {
this.publicationInfo.fundedByProjects[counter]['funderShortname'] = fundingData['funder'].shortname;
this.publicationInfo.fundedByProjects[counter]['funderName'] = fundingData['funder'].name;
}
if(mydata1.hasOwnProperty("funding_level_2")) {
funding = mydata1['funding_level_2'].content;
} else if(mydata1.hasOwnProperty("funding_level_1")) {
funding = mydata1['funding_level_1'].content;
} else if(mydata1.hasOwnProperty("funding_level_0")) {
funding = mydata1['funding_level_0'].content;
if(fundingData.hasOwnProperty("funding_level_2")) {
funding = fundingData['funding_level_2'].content;
} else if(fundingData.hasOwnProperty("funding_level_1")) {
funding = fundingData['funding_level_1'].content;
} else if(fundingData.hasOwnProperty("funding_level_0")) {
funding = fundingData['funding_level_0'].content;
}
if(funding != undefined) {
@ -212,7 +212,7 @@ export class PublicationService {
}
}
}
} else if(mydata['to'].class == "isRelatedTo") {
} else if(relation['to'].class == "isRelatedTo") {
if(this.publicationInfo.relatedResearchResults == undefined) {
this.publicationInfo.relatedResearchResults = new Array<{
"name": string, "url": string, "date": string,
@ -223,20 +223,20 @@ export class PublicationService {
this.publicationInfo.relatedResearchResults[counter] = {"name": "", "url": "", "date": "", "trust": "", "class": ""}
let url;
if(mydata['resulttype'].classname == "publication") {
url = OpenaireProperties.getsearchLinkToPublication() + mydata['to'].content;
if(relation['resulttype'].classname == "publication") {
url = OpenaireProperties.getsearchLinkToPublication() + relation['to'].content;
this.publicationInfo.relatedResearchResults[counter]['class'] = "publication";
} else {
url = OpenaireProperties.getsearchLinkToDataset() + mydata['to'].content;
url = OpenaireProperties.getsearchLinkToDataset() + relation['to'].content;
this.publicationInfo.relatedResearchResults[counter]['class'] = "dataset";
}
this.publicationInfo.relatedResearchResults[counter]['url'] = url;
this.publicationInfo.relatedResearchResults[counter]['name'] = mydata['title'].content;
this.publicationInfo.relatedResearchResults[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
this.publicationInfo.relatedResearchResults[counter]['trust'] = Math.round(mydata.trust*100)+"%";
this.publicationInfo.relatedResearchResults[counter]['name'] = relation['title'].content;
this.publicationInfo.relatedResearchResults[counter]['date'] = relation.dateofacceptance.substring(0,4);;
this.publicationInfo.relatedResearchResults[counter]['trust'] = Math.round(relation.trust*100)+"%";
} else if(mydata['to'].class == "hasAmongTopNSimilarDocuments") {
} else if(relation['to'].class == "hasAmongTopNSimilarDocuments") {
if(this.publicationInfo.similarResearchResults == undefined) {
this.publicationInfo.similarResearchResults = new Array<{
"name": string, "url": string, "date": string,
@ -247,18 +247,18 @@ export class PublicationService {
this.publicationInfo.similarResearchResults[counter] = {"name": "", "url": "", "date": "", "trust": "", "class": ""}
let url;
if(mydata['resulttype'].classname == "publication") {
url = OpenaireProperties.getsearchLinkToPublication() + mydata['to'].content;
if(relation['resulttype'].classname == "publication") {
url = OpenaireProperties.getsearchLinkToPublication() + relation['to'].content;
this.publicationInfo.similarResearchResults[counter]['class'] = "publication";
} else {
url = OpenaireProperties.getsearchLinkToDataset() + mydata['to'].content;
url = OpenaireProperties.getsearchLinkToDataset() + relation['to'].content;
this.publicationInfo.similarResearchResults[counter]['class'] = "dataset";
}
this.publicationInfo.similarResearchResults[counter]['url'] = url;
this.publicationInfo.similarResearchResults[counter]['name'] = mydata['title'].content;
this.publicationInfo.similarResearchResults[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
this.publicationInfo.similarResearchResults[counter]['trust'] = Math.round(mydata.trust*100)+"%";
this.publicationInfo.similarResearchResults[counter]['name'] = relation['title'].content;
this.publicationInfo.similarResearchResults[counter]['date'] = relation.dateofacceptance.substring(0,4);;
this.publicationInfo.similarResearchResults[counter]['trust'] = Math.round(relation.trust*100)+"%";
}
}
}
@ -277,53 +277,53 @@ export class PublicationService {
this.publicationInfo.types = new Array<string>();
let length = data[3]['instance'].length!=undefined ? data[3]['instance'].length : 1;
let length = Array.isArray(data[3]['instance']) ? data[3]['instance'].length : 1;
let types = new Set<string>();
let counter = 0;
let counter1 = 0;
let counter2 = 0;
let mydata;
let instance;
for(let i=0; i<length; i++) {
mydata = data[3]['instance'].length!=undefined ? data[3]['instance'][i] : data[3]['instance'];
instance = Array.isArray(data[3]['instance']) ? data[3]['instance'][i] : data[3]['instance'];
if(mydata.hasOwnProperty("instancetype")) {
if(!types.has(mydata['instancetype'].classname)) {
this.publicationInfo.types[counter] = mydata['instancetype'].classname;
types.add(mydata['instancetype'].classname);
if(instance.hasOwnProperty("instancetype")) {
if(!types.has(instance['instancetype'].classname)) {
this.publicationInfo.types[counter] = instance['instancetype'].classname;
types.add(instance['instancetype'].classname);
counter++;
}
}
if(mydata.hasOwnProperty("webresource")) {
if(instance.hasOwnProperty("webresource")) {
let url;
if(mydata['webresource'].length == undefined) {
url = mydata['webresource'].url;
if(!Array.isArray(instance['webresource'])) {
url = instance['webresource'].url;
} else{
url = mydata['webresource'][0].url;
url = instance['webresource'][0].url;
}
if(mydata.hasOwnProperty("hostedby")) {
if(mydata['hostedby'].name != "other resources" && mydata['hostedby'].name != "Unknown Repository") {
if(!this.publicationInfo.downloadFrom.has(mydata['hostedby'].name)) {
this.publicationInfo.downloadFrom.set(mydata['hostedby'].name, {"url": null, "accessMode": null});
if(instance.hasOwnProperty("hostedby")) {
if(instance['hostedby'].name != "other resources" && instance['hostedby'].name != "Unknown Repository") {
if(!this.publicationInfo.downloadFrom.has(instance['hostedby'].name)) {
this.publicationInfo.downloadFrom.set(instance['hostedby'].name, {"url": null, "accessMode": null});
}
if(this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'] == null) {
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'] = new Array<string>();
if(this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['url'] == null) {
this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['url'] = new Array<string>();
}
counter2 = this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'].length;
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['url'][counter2] = url;
counter2 = this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['url'].length;
this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['url'][counter2] = url;
if(this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'] == null) {
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'] = new Array<string>();
if(this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['accessMode'] == null) {
this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['accessMode'] = new Array<string>();
}
if(mydata.hasOwnProperty("licence")) {
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'][counter2] = mydata['licence'].classid;
if(instance.hasOwnProperty("licence")) {
this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['accessMode'][counter2] = instance['licence'].classid;
} else {
this.publicationInfo.downloadFrom.get(mydata['hostedby'].name)['accessMode'][counter2] = "";
this.publicationInfo.downloadFrom.get(instance['hostedby'].name)['accessMode'][counter2] = "";
}
} else {
if(data[0] != null && data[0].hasOwnProperty("source")) {
@ -344,15 +344,14 @@ export class PublicationService {
this.publicationInfo.publishedIn.get(key)['url'] = new Array<string>();
}
counter2 = this.publicationInfo.publishedIn.get(key)['url'].length;
this.publicationInfo.publishedIn.get(key)['url'][counter2] = url;
this.publicationInfo.publishedIn.get(key)['url'].push(url);
if(this.publicationInfo.publishedIn.get(key)['accessMode'] == null) {
this.publicationInfo.publishedIn.get(key)['accessMode'] = new Array<string>();
}
if(mydata.hasOwnProperty("licence")) {
this.publicationInfo.publishedIn.get(key)['accessMode'][counter2] = mydata['licence'].classid;
if(instance.hasOwnProperty("licence")) {
this.publicationInfo.publishedIn.get(key)['accessMode'][counter2] = instance['licence'].classid;
} else {
this.publicationInfo.publishedIn.get(key)['accessMode'][counter2] = "";
}
@ -366,27 +365,27 @@ export class PublicationService {
switch (this.publicationInfo.title['accessMode']) {
case undefined:
this.publicationInfo.title['accessMode'] = mydata['accessMode'].classid;
this.publicationInfo.title['accessMode'] = instance['accessMode'].classid;
this.publicationInfo.title['url'] = url;
break;
case "CLOSED":
if(mydata['licence'].classid == "OPEN" ||
mydata['licence'].classid == "EMBARGO" ||
mydata['licence'].classid == "RESTRICTED") {
this.publicationInfo.title['accessMode'] = mydata['licence'].classid;
if(instance['licence'].classid == "OPEN" ||
instance['licence'].classid == "EMBARGO" ||
instance['licence'].classid == "RESTRICTED") {
this.publicationInfo.title['accessMode'] = instance['licence'].classid;
this.publicationInfo.title['url'] = url;
}
break;
case "RESTRICTED":
if(mydata['licence'].classid == "OPEN" ||
mydata['licence'].classid == "EMBARGO") {
this.publicationInfo.title['accessMode'] = mydata['licence'].classid;
if(instance['licence'].classid == "OPEN" ||
instance['licence'].classid == "EMBARGO") {
this.publicationInfo.title['accessMode'] = instance['licence'].classid;
this.publicationInfo.title['url'] = url;
}
break;
case "EMBARGO":
if(mydata['licence'].classid == "OPEN") {
this.publicationInfo.title['accessMode'] = mydata['licence'].classid;
if(instance['licence'].classid == "OPEN") {
this.publicationInfo.title['accessMode'] = instance['licence'].classid;
this.publicationInfo.title['url'] = url;
}
break;
@ -400,29 +399,29 @@ export class PublicationService {
if(data[3].hasOwnProperty("externalreference")) {
let length = Array.isArray(data[3]['externalreference']) ? data[3]['externalreference'].length : 1;
let mydata;
let externalreference;
for(let i=0; i<length; i++) {
mydata = Array.isArray(data[3]['externalreference']) ? data[3]['externalreference'][i] : data[3]['externalreference'];
externalreference = Array.isArray(data[3]['externalreference']) ? data[3]['externalreference'][i] : data[3]['externalreference'];
if(mydata.hasOwnProperty("qualifier")) {
if(mydata['qualifier'].classid == "accessionNumber") {
if(externalreference.hasOwnProperty("qualifier")) {
if(externalreference['qualifier'].classid == "accessionNumber") {
if(this.publicationInfo.bioentities == undefined) {
this.publicationInfo.bioentities = new Map<string, Map<string, string>>();
}
if(!this.publicationInfo.bioentities.has(mydata.sitename)) {
this.publicationInfo.bioentities.set(mydata.sitename, new Map<string, string>());
if(!this.publicationInfo.bioentities.has(externalreference.sitename)) {
this.publicationInfo.bioentities.set(externalreference.sitename, new Map<string, string>());
}
this.publicationInfo.bioentities.get(mydata.sitename).set(mydata.refidentifier, mydata.url);
this.publicationInfo.bioentities.get(externalreference.sitename).set(externalreference.refidentifier, externalreference.url);
} else if(mydata['qualifier'].classid == "software") {
} else if(externalreference['qualifier'].classid == "software") {
if(this.publicationInfo.software == undefined) {
this.publicationInfo.software = new Array<{"name": string, "url": string}>();
}
this.publicationInfo.software.push({"name": mydata.sitename, "url": mydata.url});
this.publicationInfo.software.push({"name": externalreference.sitename, "url": externalreference.url});
}
}
}
@ -430,7 +429,6 @@ export class PublicationService {
}
if(data[4] != null) {
let counter = 0;
this.publicationInfo.identifiers = new Map<string, string[]>();
if(data[4].hasOwnProperty("classname") && data[4]['classname'] != "") {
@ -438,8 +436,7 @@ export class PublicationService {
if(!this.publicationInfo.identifiers.has(data[4].classname)) {
this.publicationInfo.identifiers.set(data[4].classname, new Array<string>());
}
counter = this.publicationInfo.identifiers.get(data[4].classname).length;
this.publicationInfo.identifiers.get(data[4].classname)[counter] = data[4].content;
this.publicationInfo.identifiers.get(data[4].classname).push(data[4].content);
}
} else {
for(let i=0; i<data[4].length; i++) {
@ -447,8 +444,7 @@ export class PublicationService {
if(!this.publicationInfo.identifiers.has(data[4][i].classname)) {
this.publicationInfo.identifiers.set(data[4][i].classname, new Array<string>());
}
counter = this.publicationInfo.identifiers.get(data[4][i].classname).length;
this.publicationInfo.identifiers.get(data[4][i].classname)[counter] = data[4][i].content;
this.publicationInfo.identifiers.get(data[4][i].classname).push(data[4][i].content);
}
}
}
@ -475,39 +471,39 @@ export class PublicationService {
}
if(data[7] != null) {
let mydata;
let length = data[7].length!=undefined ? data[7].length : 1;
let subject;
let length = Array.isArray(data[7]) ? data[7].length : 1;
for(let i=0; i<length; i++) {
mydata = data[7].length!=undefined ? data[7][i] : data[7];
subject = Array.isArray(data[7]) ? data[7][i] : data[7];
if(mydata.classid != "") {
if(mydata.inferred == true) {
if(subject.classid != "") {
if(subject.inferred == true) {
if(this.publicationInfo.classifiedSubjects == undefined) {
this.publicationInfo.classifiedSubjects = new Map<string, string[]>();
}
if(!this.publicationInfo.classifiedSubjects.has(mydata.classname)) {
this.publicationInfo.classifiedSubjects.set(mydata.classname, new Array<string>());
if(!this.publicationInfo.classifiedSubjects.has(subject.classname)) {
this.publicationInfo.classifiedSubjects.set(subject.classname, new Array<string>());
}
this.publicationInfo.classifiedSubjects.get(mydata.classname).push(mydata.content);
this.publicationInfo.classifiedSubjects.get(subject.classname).push(subject.content);
} else {
if(mydata.classid == "keyword") {
if(subject.classid == "keyword") {
if(this.publicationInfo.subjects == undefined) {
this.publicationInfo.subjects = new Array<string>();
}
this.publicationInfo.subjects.push(mydata.content);
this.publicationInfo.subjects.push(subject.content);
} else {
if(this.publicationInfo.otherSubjects == undefined) {
this.publicationInfo.otherSubjects = new Map<string, string[]>();
}
if(!this.publicationInfo.otherSubjects.has(mydata.classname)) {
this.publicationInfo.otherSubjects.set(mydata.classname, new Array<string>());
if(!this.publicationInfo.otherSubjects.has(subject.classname)) {
this.publicationInfo.otherSubjects.set(subject.classname, new Array<string>());
}
this.publicationInfo.otherSubjects.get(mydata.classname).push(mydata.content);
this.publicationInfo.otherSubjects.get(subject.classname).push(subject.content);
}
}
}
@ -521,14 +517,14 @@ export class PublicationService {
if(data[9] != null) {
this.publicationInfo.collectedFrom = new Array<{"name": string, "url": string}>();
let mydata;
let length = data[9].length!=undefined ? data[9].length : 1;
let collectedFrom;
let length = Array.isArray(data[9]) ? data[9].length : 1;
for(let i=0; i<length; i++) {
mydata = data[9].length!=undefined ? data[9][i] : data[9];
collectedFrom = Array.isArray(data[9]) ? data[9][i] : data[9];
let link = OpenaireProperties.getsearchLinkToDataProvider();
this.publicationInfo.collectedFrom[i] = {"name": "", "url": ""};
this.publicationInfo.collectedFrom[i]['name'] = mydata.name;
this.publicationInfo.collectedFrom[i]['url'] = link+mydata.id;
this.publicationInfo.collectedFrom[i]['name'] = collectedFrom.name;
this.publicationInfo.collectedFrom[i]['url'] = link + collectedFrom.id;
}
}
@ -564,27 +560,27 @@ export class PublicationService {
if(data[10] != null) {
this.publicationInfo.references = new Array<{"name": string, "url": string}>();
let mydata;
let length = data[10].length!=undefined ? data[10].length : 1;
let citation;
let length = Array.isArray(data[10]) ? data[10].length : 1;
for(let i=0; i<length; i++) {
mydata = data[10].length!=undefined ? data[10][i] : data[10];
citation = Array.isArray(data[10]) ? data[10][i] : data[10];
let url;
if(mydata.hasOwnProperty("id")) {
let mydata1;
let length1 = mydata['id'].length!=undefined ? mydata['id'].length : 1;
if(citation.hasOwnProperty("id")) {
let citationId;
let length1 = Array.isArray(citation['id']) ? citation['id'].length : 1;
for(let j=0; j<length1; j++) {
mydata1 = length1 > 1 ? mydata['id'][j] : mydata['id'];
citationId = Array.isArray(citation['id']) ? citation['id'][j] : citation['id'];
if(mydata1.type == "pmid") {
url = OpenaireProperties.getPmidURL()+mydata1.value;
if(citationId.type == "pmid") {
url = OpenaireProperties.getPmidURL()+citationId.value;
}
}
}
this.publicationInfo.references[mydata.position-1] = { "name": "", "url": ""};
this.publicationInfo.references[mydata.position-1]['name'] = mydata.rawText;
this.publicationInfo.references[mydata.position-1]['url'] = url;
this.publicationInfo.references[citation.position-1] = { "name": "", "url": ""};
this.publicationInfo.references[citation.position-1]['name'] = citation.rawText;
this.publicationInfo.references[citation.position-1]['url'] = url;
}
}
@ -594,35 +590,35 @@ export class PublicationService {
let position = 0;
let labels = "";
let mydata;
let length = data[11].length!=undefined ? data[11].length : 1;
let context;
let length = Array.isArray(data[11]) ? data[11].length : 1;
for(let i=0; i<length; i++) {
mydata = data[11].length!=undefined ? data[11][i] : data[11];
context = Array.isArray(data[11]) ? data[11][i] : data[11];
if(mydata.hasOwnProperty("type") && mydata['type'] == "community") {
if(mydata.hasOwnProperty("category")) {
if(mydata['category'].hasOwnProperty("concept")) {
let mydata1;
let length1 = mydata['category']['concept'].length!=undefined ? mydata['category']['concept'].length : 1;
if(context.hasOwnProperty("type") && context['type'] == "community") {
if(context.hasOwnProperty("category")) {
if(context['category'].hasOwnProperty("concept")) {
let categoryConcept;
let length1 = Array.isArray(context['category']['concept']) ? context['category']['concept'].length : 1;
for(let j=0; j<length1; j++) {
mydata1 = length1 > 1 ? mydata['category']['concept'][j] : mydata['category']['concept'];
categoryConcept = Array.isArray(context['category']['concept']) ? context['category']['concept'][j] : context['category']['concept'];
this.publicationInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false };
this.publicationInfo.contexts[position]['labelContext'] = mydata.label;
this.publicationInfo.contexts[position]['labelCategory'] = mydata['category'].label;;
this.publicationInfo.contexts[position]['labelConcept'] = mydata1.label;
this.publicationInfo.contexts[position]['labelContext'] = context.label;
this.publicationInfo.contexts[position]['labelCategory'] = context['category'].label;
this.publicationInfo.contexts[position]['labelConcept'] = categoryConcept.label;
position++;
}
} else {
this.publicationInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false};
this.publicationInfo.contexts[position]['labelContext'] = mydata.label;
this.publicationInfo.contexts[position]['labelCategory'] = mydata['category'].label;;
this.publicationInfo.contexts[position]['labelContext'] = context.label;
this.publicationInfo.contexts[position]['labelCategory'] = context['category'].label;
this.publicationInfo.contexts[position]['labelConcept'] = null;
}
} else {
this.publicationInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false};
this.publicationInfo.contexts[position]['labelContext'] = mydata.label;
this.publicationInfo.contexts[position]['labelContext'] = context.label;
this.publicationInfo.contexts[position]['labelCategory'] = null;
this.publicationInfo.contexts[position]['labelConcept'] = null;
this.publicationInfo.contexts[position]['new'] = false;
@ -631,120 +627,6 @@ export class PublicationService {
}
}
//this.printPublicationInfo();
return this.publicationInfo;
}
printPublicationInfo() {
console.info("DATE: "+this.publicationInfo.date);
console.info("PUBLISHER: "+this.publicationInfo.publisher);
console.info("DESCRIPTION: "+this.publicationInfo.description);
console.info("TITLE: "+this.publicationInfo.title);
console.info("AUTHORS: "+this.publicationInfo.authors);
console.info("\nFUNDED BY PROJECTS:");
if(this.publicationInfo.fundedByProjects != undefined) {
this.publicationInfo.fundedByProjects.forEach(function (value, key, map) {
console.info(key + " = " + value);
});
} else {
console.info("undefined");
}
console.info("\n");
/*
console.info("\nRELATED RESEARCH DATA:");
if(this.publicationInfo.relatedResearchData != undefined) {
this.publicationInfo.relatedResearchData.forEach(function (value, key, map) {
console.info(key + " = " + value);
});
} else {
console.info("undefined");
}
console.info("\n");
console.info("\nSIMILAR PUBLICATIONS:");
if(this.publicationInfo.similarPublications != undefined) {
this.publicationInfo.similarPublications.forEach(function (value, key, map) {
console.info(key + " = " + value);
});
} else {
console.info("undefined");
}
console.info("\n");
*/
console.info("TYPES: "+this.publicationInfo.types);
console.info("\nDOWNLOAD FROM:");
if(this.publicationInfo.downloadFrom != undefined) {
this.publicationInfo.downloadFrom.forEach(function (value, key, map) {
console.info(key + " = " + value);
});
} else {
console.info("undefined");
}
console.info("\n");
console.info("\nBIOENTITIES:");
if(this.publicationInfo.bioentities != undefined) {
this.publicationInfo.bioentities.forEach(function (value, key, map) {
value.forEach(function (value1, key1, map1) {
console.info(key + " = " + key1 + " = " + value1);
})
})
} else {
console.info("undefined");
}
console.info("\n");
console.info("\nIDENTIFIERS:");
if(this.publicationInfo.identifiers != undefined) {
this.publicationInfo.identifiers.forEach(function (value, key, map) {
console.info(key + " = " + value);
});
} else {
console.info("undefined");
}
console.info("\n");
console.info("JOURNAL: "+this.publicationInfo.journal);
console.info("LANGUAGES: "+this.publicationInfo.languages);
console.info("SUBJECTS: "+this.publicationInfo.subjects);
console.info("\nCLASSIFIED OBJECTS:");
if(this.publicationInfo.classifiedSubjects != undefined) {
this.publicationInfo.classifiedSubjects.forEach(function (value, key, map) {
console.info(key + " = " + value);
});
} else {
console.info("undefined");
}
console.info("\n");
console.info("BEST LICENSE: "+this.publicationInfo.bestlicense);
console.info("\nCOLLECTED FROM:");
if(this.publicationInfo.collectedFrom != undefined) {
this.publicationInfo.collectedFrom.forEach(function (value, key, map) {
console.info(key + " = " + value);
});
} else {
console.info("undefined");
}
console.info("\n");
console.info("\nREFERENCES:");
if(this.publicationInfo.references != undefined) {
for(let i in this.publicationInfo.references) {
for(let key in this.publicationInfo.references[i]) {
console.info(key+" : "+this.publicationInfo.references[i][key]);
}
}
} else {
console.info("undefined");
}
}
}