From fb466c2fbbd6de14c294ac1cff63b7594fcad6c4 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 14 Mar 2017 11:11:03 +0000 Subject: [PATCH] Publication/Dataset Landing Pages: Categorize results in related research results tab by provenanceaction | Publication/DAtaset Landing Pages: small fix in query for Views Chart in metrics tab git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@46251 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../dataset/dataset.component.html | 20 +++-- .../landingPages/dataset/dataset.component.ts | 33 +++++--- .../landingPages/dataset/dataset.service.ts | 71 ++++++++++------ .../organization/organization.component.ts | 4 +- .../landingPages/person/person.component.ts | 2 +- .../publication/publication.component.html | 19 +++-- .../publication/publication.component.ts | 82 ++++++++++--------- .../publication/publication.service.ts | 36 ++++++-- .../src/app/utils/entities/datasetInfo.ts | 3 +- .../src/app/utils/entities/publicationInfo.ts | 3 +- 10 files changed, 168 insertions(+), 105 deletions(-) diff --git a/portal-2/src/app/landingPages/dataset/dataset.component.html b/portal-2/src/app/landingPages/dataset/dataset.component.html index d05741a8..3ed6de9f 100644 --- a/portal-2/src/app/landingPages/dataset/dataset.component.html +++ b/portal-2/src/app/landingPages/dataset/dataset.component.html @@ -42,9 +42,8 @@
  • Related Research Results - 0 - - {{datasetInfo.relatedResearchResults.length}} + + {{relatedResearchResultsNum}}
  • @@ -72,11 +71,16 @@ There are no related research results
    -

    - The results below are discovered through our pilot algorithms. - Let us know how we are doing! -

    - +
    +

    {{provenanceaction}}

    + +

    + The results below are discovered through our pilot algorithms. + Let us know how we are doing! +

    + + +
    diff --git a/portal-2/src/app/landingPages/dataset/dataset.component.ts b/portal-2/src/app/landingPages/dataset/dataset.component.ts index ee282ff7..14ec2cbd 100644 --- a/portal-2/src/app/landingPages/dataset/dataset.component.ts +++ b/portal-2/src/app/landingPages/dataset/dataset.component.ts @@ -27,6 +27,8 @@ export class DatasetComponent { private totalViews: number; private totalDownloads: number; + public relatedResearchResultsNum: number = 0; + public warningMessage = ""; public errorMessage = ""; public routerHelper:RouterHelper = new RouterHelper(); @@ -45,7 +47,8 @@ export class DatasetComponent { }); this.metricsClicked = false; - this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resOpenAIRETimeline", "resTitle":"'+this.datasetId+'", "table":"","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":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"resRepoTimeline", "resTitle":"'+this.datasetId+'", "table":"","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":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"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'; + //this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resOpenAIRETimeline", "resTitle":"'+this.datasetId+'", "table":"","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":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"resRepoTimeline", "resTitle":"'+this.datasetId+'", "table":"","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":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"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'; + this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.datasetId+'", "table":"","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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["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&persistent=false'; this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.datasetId+'", "table":"","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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["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(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'; } @@ -58,21 +61,27 @@ export class DatasetComponent { this.errorMessage="" this._datasetService.getDatasetInfo(id).subscribe( - data => { - this.datasetInfo = data; + data => { + this.datasetInfo = data; - this.result = [] - this.result = {id: id, type :"dataset", source : "openaire", title: this.datasetInfo.title,url: '', result: '', accessRights: this.datasetInfo.bestlicense, embargoEndDate: ''}; + this.result = [] + this.result = {id: id, type :"dataset", source : "openaire", title: this.datasetInfo.title,url: '', result: '', accessRights: this.datasetInfo.bestlicense, embargoEndDate: ''}; - }, - err => { - console.log(err) - console.info("error"); - - this.errorMessage = 'No dataset found'; + let relatedResearchResultsNum = 0; + if(this.datasetInfo.relatedResearchResults != undefined) { + this.datasetInfo.relatedResearchResults.forEach(function (value, key, map) { + relatedResearchResultsNum += value.length; + }); } - ); + this.relatedResearchResultsNum = relatedResearchResultsNum; + }, + err => { + console.log(err) + console.info("error"); + this.errorMessage = 'No dataset found'; + } + ); } showChange($event) { diff --git a/portal-2/src/app/landingPages/dataset/dataset.service.ts b/portal-2/src/app/landingPages/dataset/dataset.service.ts index 0f899279..fb21a8e2 100644 --- a/portal-2/src/app/landingPages/dataset/dataset.service.ts +++ b/portal-2/src/app/landingPages/dataset/dataset.service.ts @@ -148,6 +148,51 @@ export class DatasetService { } } } + } else if(mydata['to'].class == "isRelatedTo") { + let provenanceAction: string; + if(mydata.provenanceaction in this.datasetInfo.provenanceVocabulary) { + provenanceAction = this.datasetInfo.provenanceVocabulary[mydata.provenanceaction]; + } else { + provenanceAction = "Other" + } + /* + if(this.datasetInfo.relatedResearchResults == undefined) { + this.datasetInfo.relatedResearchResults = new Array<{ + "name": string, "id": string, "date": string, + "trust": string, "class": string}>(); + } + */ + if(this.datasetInfo.relatedResearchResults == undefined) { + this.datasetInfo.relatedResearchResults = + new Map(); + } + + if(!this.datasetInfo.relatedResearchResults.has(provenanceAction)) { + this.datasetInfo.relatedResearchResults.set(provenanceAction, + new Array<{ "name": string, "id": string, "date": string, + "trust": string, "class": string}>()); + } + + counter = this.datasetInfo.relatedResearchResults.get(provenanceAction).length; + this.datasetInfo.relatedResearchResults.get(provenanceAction)[counter] = {"name": "", "id": "", "date": "", "trust": "", "class": ""} + + //let url; + if(mydata['resulttype'].classname == "publication") { + //url = OpenaireProperties.getsearchLinkToPublication()+mydata['to'].content; + this.datasetInfo.relatedResearchResults.get(provenanceAction)[counter]['class'] = "publication"; + } else { + //url = OpenaireProperties.getsearchLinkToDataset()+mydata['to'].content; + this.datasetInfo.relatedResearchResults.get(provenanceAction)[counter]['class'] = "dataset"; + } + + this.datasetInfo.relatedResearchResults.get(provenanceAction)[counter]['id'] = mydata['to'].content; + //this.datasetInfo.relatedResearchResults[counter]['url'] = url; + let titleName = Array.isArray(mydata['title']) ? mydata['title'][0].content : mydata['title'].content; + this.datasetInfo.relatedResearchResults.get(provenanceAction)[counter]['name'] = titleName; + this.datasetInfo.relatedResearchResults.get(provenanceAction)[counter]['date'] = mydata.dateofacceptance.substring(0,4);; + this.datasetInfo.relatedResearchResults.get(provenanceAction)[counter]['trust'] = Math.round(mydata.trust*100)+"%"; + } else if(mydata['to'].class == "hasAmongTopNSimilarDocuments") { if(this.datasetInfo.similarResearchResults == undefined) { this.datasetInfo.similarResearchResults = new Array<{ @@ -175,32 +220,6 @@ export class DatasetService { this.datasetInfo.similarResearchResults[counter]['trust'] = Math.round(mydata.trust*100)+"%"; - } else if(mydata['to'].class == "isRelatedTo") { - if(this.datasetInfo.relatedResearchResults == undefined) { - this.datasetInfo.relatedResearchResults = new Array<{ - "name": string, "id": string, "date": string, - "trust": string, "class": string}>(); - } - - counter = this.datasetInfo.relatedResearchResults.length; - this.datasetInfo.relatedResearchResults[counter] = {"name": "", "id": "", "date": "", "trust": "", "class": ""} - - //let url; - if(mydata['resulttype'].classname == "publication") { - //url = OpenaireProperties.getsearchLinkToPublication()+mydata['to'].content; - this.datasetInfo.relatedResearchResults[counter]['class'] = "publication"; - } else { - //url = OpenaireProperties.getsearchLinkToDataset()+mydata['to'].content; - this.datasetInfo.relatedResearchResults[counter]['class'] = "dataset"; - } - - this.datasetInfo.relatedResearchResults[counter]['id'] = mydata['to'].content; - //this.datasetInfo.relatedResearchResults[counter]['url'] = url; - let titleName = Array.isArray(mydata['title']) ? mydata['title'][0].content : mydata['title'].content; - this.datasetInfo.relatedResearchResults[counter]['name'] = titleName; - this.datasetInfo.relatedResearchResults[counter]['date'] = mydata.dateofacceptance.substring(0,4);; - this.datasetInfo.relatedResearchResults[counter]['trust'] = Math.round(mydata.trust*100)+"%"; - } } } diff --git a/portal-2/src/app/landingPages/organization/organization.component.ts b/portal-2/src/app/landingPages/organization/organization.component.ts index dbc3a06e..cd44f726 100644 --- a/portal-2/src/app/landingPages/organization/organization.component.ts +++ b/portal-2/src/app/landingPages/organization/organization.component.ts @@ -195,9 +195,9 @@ export class OrganizationComponent { let url: string; if(index == 0) { - url = this.downloadURLAPI+"projects/"+project.id+"/publications?format=csv&size="+data; + url = this.downloadURLAPI+"projects/"+project.id+"/publications?format=csv-special&size="+data; } else { - url = this.downloadURLAPI+"projects/"+project.id+"/publications?format=csv-notitle&size="+data; + url = this.downloadURLAPI+"projects/"+project.id+"/publications?format=csv-special-notitle&size="+data; } this._reportsService.getCSVResponse(url).subscribe( diff --git a/portal-2/src/app/landingPages/person/person.component.ts b/portal-2/src/app/landingPages/person/person.component.ts index a48a4d04..0da71625 100644 --- a/portal-2/src/app/landingPages/person/person.component.ts +++ b/portal-2/src/app/landingPages/person/person.component.ts @@ -51,7 +51,7 @@ export class PersonComponent { this.searchPublications(); }else{ - this.warningMessage="No valid person id"; + this.warningMessage="No valid person id"; } }); diff --git a/portal-2/src/app/landingPages/publication/publication.component.html b/portal-2/src/app/landingPages/publication/publication.component.html index d2ebbc0c..08ffcd8a 100644 --- a/portal-2/src/app/landingPages/publication/publication.component.html +++ b/portal-2/src/app/landingPages/publication/publication.component.html @@ -73,9 +73,8 @@
  • Related Research Results - 0 - - {{publicationInfo.relatedResearchResults.length}} + + {{relatedResearchResultsNum}}
  • @@ -157,12 +156,16 @@ There are no related research results
    -

    - The results below are discovered through our pilot algorithms. - Let us know how we are doing! -

    +
    +

    {{provenanceaction}}

    - +

    + The results below are discovered through our pilot algorithms. + Let us know how we are doing! +

    + + +
    diff --git a/portal-2/src/app/landingPages/publication/publication.component.ts b/portal-2/src/app/landingPages/publication/publication.component.ts index 5b481abb..cd6b3be4 100644 --- a/portal-2/src/app/landingPages/publication/publication.component.ts +++ b/portal-2/src/app/landingPages/publication/publication.component.ts @@ -37,6 +37,7 @@ export class PublicationComponent { public showFundingDetails: boolean = false; public bioentitiesNum: number = 0; + public relatedResearchResultsNum: number = 0; private doi: string; @@ -63,55 +64,60 @@ export class PublicationComponent { // } }else{ console.info("Article id not found"); + this.warningMessage="No valid publication id"; } this.metricsClicked = false; - this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resOpenAIRETimeline", "resTitle":"'+this.articleId+'", "table":"","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":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"resRepoTimeline", "resTitle":"'+this.articleId+'", "table":"","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":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"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'; + //this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resOpenAIRETimeline", "resTitle":"'+this.articleId+'", "table":"","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":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]},{"query":"resRepoTimeline", "resTitle":"'+this.articleId+'", "table":"","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":"Repository","yaxisheaders":[""],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"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'; + this.viewsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resViewsTimeline", "resTitle":"'+this.articleId+'", "table":"","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":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["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&persistent=false'; this.downloadsFrameUrl = OpenaireProperties.getFramesAPIURL()+'merge.php?com=query&data=[{"query":"resRepoDownloadTimeline", "resTitle":"'+this.articleId+'", "table":"","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":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["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(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'; }); } - ngOnDestroy() { - this.sub.unsubscribe(); - } + ngOnDestroy() { + this.sub.unsubscribe(); + } - getPublicationInfo(id:string) { - this.warningMessage = ''; - this.errorMessage="" - if(this.articleId==null || this.articleId==''){ - this.warningMessage="No valid publication id"; - }else{ - this._publicationService.getPublicationInfo(this.articleId).subscribe( - data => { - this.publicationInfo = data; - // this.result = [] - // this.result = {id: id, type :"dataset", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestlicense, embargoEndDate: ''}; + getPublicationInfo(id:string) { + this.warningMessage = ''; + this.errorMessage="" - let bioentitiesNum = 0; - if(this.publicationInfo.bioentities != undefined) { - this.publicationInfo.bioentities.forEach(function (value, key, map) { - bioentitiesNum += value.size; - }); + this._publicationService.getPublicationInfo(this.articleId).subscribe( + data => { + this.publicationInfo = data; + // this.result = [] + // this.result = {id: id, type :"dataset", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestlicense, embargoEndDate: ''}; + + let bioentitiesNum = 0; + if(this.publicationInfo.bioentities != undefined) { + this.publicationInfo.bioentities.forEach(function (value, key, map) { + bioentitiesNum += value.size; + }); + } + this.bioentitiesNum = bioentitiesNum; + + let relatedResearchResultsNum = 0; + if(this.publicationInfo.relatedResearchResults != undefined) { + this.publicationInfo.relatedResearchResults.forEach(function (value, key, map) { + relatedResearchResultsNum += value.length; + }); + } + this.relatedResearchResultsNum = relatedResearchResultsNum; + + this.result = {id: this.articleId, type :"publication", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestlicense, embargoEndDate: ''}; + // this.result.push(result_); + + if(this.publicationInfo.identifiers != undefined && this.publicationInfo.identifiers.has('doi')) { + this.doi = this.publicationInfo.identifiers.get('doi')[0]; + } + }, + err => { + console.log(err); + console.info("error"); + + this.errorMessage = 'No publication found'; } - this.bioentitiesNum = bioentitiesNum; - - this.result = {id: this.articleId, type :"publication", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.bestlicense, embargoEndDate: ''}; - // this.result.push(result_); - - if(this.publicationInfo.identifiers != undefined && this.publicationInfo.identifiers.has('doi')) { - this.doi = this.publicationInfo.identifiers.get('doi')[0]; - } - - - }, - err => { - console.log(err); - console.info("error"); - - this.errorMessage = 'No publication found'; - } ); } - } showChange($event) { this.showAllReferences=$event.value; diff --git a/portal-2/src/app/landingPages/publication/publication.service.ts b/portal-2/src/app/landingPages/publication/publication.service.ts index d15ad46f..33f3fede 100644 --- a/portal-2/src/app/landingPages/publication/publication.service.ts +++ b/portal-2/src/app/landingPages/publication/publication.service.ts @@ -152,30 +152,50 @@ export class PublicationService { } } } else if(relation['to'].class == "isRelatedTo") { + let provenanceAction: string; + if(relation.provenanceaction in this.publicationInfo.provenanceVocabulary) { + provenanceAction = this.publicationInfo.provenanceVocabulary[relation.provenanceaction]; + } else { + provenanceAction = "Other"; + } + + if(this.publicationInfo.relatedResearchResults == undefined) { + this.publicationInfo.relatedResearchResults = + new Map(); + } + + if(!this.publicationInfo.relatedResearchResults.has(provenanceAction)) { + this.publicationInfo.relatedResearchResults.set(provenanceAction, + new Array<{ "name": string, "id": string, "date": string, + "trust": string, "class": string}>()); + } + /* if(this.publicationInfo.relatedResearchResults == undefined) { this.publicationInfo.relatedResearchResults = new Array<{ "name": string, "id": string, "date": string, "trust": string, "class": string}>(); } + */ - counter = this.publicationInfo.relatedResearchResults.length; - this.publicationInfo.relatedResearchResults[counter] = {"name": "", "id": "", "date": "", "trust": "", "class": ""} + counter = this.publicationInfo.relatedResearchResults.get(provenanceAction).length; + this.publicationInfo.relatedResearchResults.get(provenanceAction)[counter] = {"name": "", "id": "", "date": "", "trust": "", "class": ""} //let url; if(relation['resulttype'].classname == "publication") { //url = OpenaireProperties.getsearchLinkToPublication() + relation['to'].content; - this.publicationInfo.relatedResearchResults[counter]['class'] = "publication"; + this.publicationInfo.relatedResearchResults.get(provenanceAction)[counter]['class'] = "publication"; } else { //url = OpenaireProperties.getsearchLinkToDataset() + relation['to'].content; - this.publicationInfo.relatedResearchResults[counter]['class'] = "dataset"; + this.publicationInfo.relatedResearchResults.get(provenanceAction)[counter]['class'] = "dataset"; } - this.publicationInfo.relatedResearchResults[counter]['id'] = relation['to'].content; + this.publicationInfo.relatedResearchResults.get(provenanceAction)[counter]['id'] = relation['to'].content; //this.publicationInfo.relatedResearchResults[counter]['url'] = url; let titleName = Array.isArray(relation['title']) ? relation['title'][0].content : relation['title'].content; - this.publicationInfo.relatedResearchResults[counter]['name'] = titleName; - this.publicationInfo.relatedResearchResults[counter]['date'] = relation.dateofacceptance.substring(0,4);; - this.publicationInfo.relatedResearchResults[counter]['trust'] = Math.round(relation.trust*100)+"%"; + this.publicationInfo.relatedResearchResults.get(provenanceAction)[counter]['name'] = titleName; + this.publicationInfo.relatedResearchResults.get(provenanceAction)[counter]['date'] = relation.dateofacceptance.substring(0,4);; + this.publicationInfo.relatedResearchResults.get(provenanceAction)[counter]['trust'] = Math.round(relation.trust*100)+"%"; } else if(relation['to'].class == "hasAmongTopNSimilarDocuments") { if(this.publicationInfo.similarResearchResults == undefined) { diff --git a/portal-2/src/app/utils/entities/datasetInfo.ts b/portal-2/src/app/utils/entities/datasetInfo.ts index f4c38927..51556a1f 100644 --- a/portal-2/src/app/utils/entities/datasetInfo.ts +++ b/portal-2/src/app/utils/entities/datasetInfo.ts @@ -17,7 +17,8 @@ export class DatasetInfo { fundedByProjects: { "id": string, "acronym": string, "title": string, "funderShortname": string, "funderName": string, "funding": string, "inline": boolean}[]; - relatedResearchResults: { "name": string, "id": string, "date": string, "trust": string, "class": string}[]; + provenanceVocabulary: {"iis": string, "sysimport": string, "user": string} = {"iis": "Inferred", "sysimport": "Harvested", "user": "Claimed"}; + relatedResearchResults: Map; similarResearchResults: { "name": string, "id": string, "date": string, "trust": string, "class": string}[]; contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[]; } diff --git a/portal-2/src/app/utils/entities/publicationInfo.ts b/portal-2/src/app/utils/entities/publicationInfo.ts index a524027e..f22d86da 100644 --- a/portal-2/src/app/utils/entities/publicationInfo.ts +++ b/portal-2/src/app/utils/entities/publicationInfo.ts @@ -25,7 +25,8 @@ export class PublicationInfo { //relatedResearchData: { "name": string, "url": string, "date": string, "trust": string}[]; //similarPublications: {"name": string, "url": string, "date": string, "trust": string}[]; //similarDatasets: {"name": string, "url": string, "date": string, "trust": string}[]; - relatedResearchResults: { "name": string, "id": string, "date": string, "trust": string, "class": string}[]; + provenanceVocabulary: {"iis": string, "sysimport": string, "user": string} = {"iis": "Inferred", "sysimport": "Harvested", "user": "Claimed"}; + relatedResearchResults: Map; similarResearchResults: { "name": string, "id": string, "date": string, "trust": string, "class": string}[]; references: { "name": string, "url": string}[]; contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[];