Dataset landing: field 'type' renamed to 'types' and became an array of strings (now parsed and displayed like in publication landing) | Publication and Dataset landing: field 'bestlicense' removed (same as title.accessMode) and 'projectsProvenanceVocabulary' field added (for fundedBy section) | Publication landing Service: parsing for references, organizations, bioentities, software organized in separate functions in publication.service file | Publication and Dataset landing Services: parsing for fundedByProjects, collectedFrom, relatedResearchResults, similarResearchResults, identifiers, subjects, classifiedSubjects, otherSubjects, contexts, types organized in separate functions in parsingFunctions.class file
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@48458 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
70d980bce3
commit
6a5e1a9fae
|
@ -67,12 +67,9 @@ export class DataProviderService {
|
|||
|
||||
if(data[1].classid == "entityregistry" || data[1].classid == "entityregistry::projects" || data[1].classid == "entityregistry::repositories") {
|
||||
this.dataProviderInfo.registry = true;
|
||||
console.info("true");
|
||||
} else {
|
||||
this.dataProviderInfo.registry = false;
|
||||
console.info("false");
|
||||
}
|
||||
console.info(this.dataProviderInfo.type);
|
||||
|
||||
if(this.dataProviderInfo.tabs == undefined) {
|
||||
this.dataProviderInfo.tabs = new Array<{"name": string, "content": string}>();
|
||||
|
@ -164,13 +161,6 @@ export class DataProviderService {
|
|||
}
|
||||
}
|
||||
|
||||
//this.printPublicationInfo();
|
||||
return this.dataProviderInfo;
|
||||
|
||||
}
|
||||
|
||||
printDataProviderInfo() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<div *ngIf="datasetInfo != null" uk-grid>
|
||||
<div class="uk-width-3-4@l uk-width-3-4@xl uk-width-3-4@m uk-width-1-1@s">
|
||||
<showTitle [title]="datasetInfo.title"></showTitle>
|
||||
<span *ngIf="datasetInfo.type" class="uk-label custom-label label-blue " title="Type">{{datasetInfo.type}}</span>
|
||||
<span *ngIf="datasetInfo.types.length > 0"class="uk-label custom-label label-blue " title="Type">{{datasetInfo.types.join(", ")}}</span>
|
||||
<span class="uk-label custom-label label-green " ><!--span [class]="datasetInfo.title.accessMode" -->{{datasetInfo.title.accessMode}}<!--/span--></span>
|
||||
<span *ngIf="datasetInfo.underCurationMessage" class="uk-label custom-label label-yellow " >
|
||||
<span uk-tooltip="pos:right; delay:10"
|
||||
|
|
|
@ -100,7 +100,7 @@ export class DatasetComponent {
|
|||
this.updateTitle(this.datasetInfo.title.name);
|
||||
this.updateDescription("Dataset, search, repositories, open access,"+this.datasetInfo.title.name);
|
||||
this.result = []
|
||||
this.result = {id: id, type :"dataset", source : "openaire", title: this.datasetInfo.title,url: '', result: '', accessRights: this.datasetInfo.bestlicense, embargoEndDate: ''};
|
||||
this.result = {id: id, type :"dataset", source : "openaire", title: this.datasetInfo.title,url: '', result: '', accessRights: this.datasetInfo.title.accessMode, embargoEndDate: ''};
|
||||
|
||||
let relatedResearchResultsNum = 0;
|
||||
if(this.datasetInfo.relatedResearchResults != undefined) {
|
||||
|
|
|
@ -12,23 +12,23 @@ import { ParsingFunctions } from '../landing-utils/parsingFunctions.class';
|
|||
@Injectable()
|
||||
export class DatasetService {
|
||||
|
||||
constructor(private http: Http, public _cache: CacheService) {
|
||||
this.parsingFunctions = new ParsingFunctions();
|
||||
constructor(private http: Http, public _cache: CacheService) {
|
||||
this.parsingFunctions = new ParsingFunctions();
|
||||
}
|
||||
|
||||
public parsingFunctions: ParsingFunctions;
|
||||
datasetInfo: DatasetInfo;
|
||||
|
||||
getDatasetInfo (id: string):any {
|
||||
console.info("getDatasetInfo in service");
|
||||
|
||||
let url = OpenaireProperties. getSearchAPIURLLast()+'datasets/'+id+"?format=json";
|
||||
let key = url;
|
||||
if (this._cache.has(key)) {
|
||||
return Observable.of(this._cache.get(key)).map(res => this.parseDatasetInfo(res));
|
||||
}
|
||||
|
||||
public parsingFunctions: ParsingFunctions;
|
||||
datasetInfo: DatasetInfo;
|
||||
|
||||
getDatasetInfo (id: string):any {
|
||||
console.info("getDatasetInfo in service");
|
||||
|
||||
let url = OpenaireProperties. getSearchAPIURLLast()+'datasets/'+id+"?format=json";
|
||||
let key = url;
|
||||
if (this._cache.has(key)) {
|
||||
return Observable.of(this._cache.get(key)).map(res => this.parseDatasetInfo(res));
|
||||
}
|
||||
|
||||
return this.http.get(url)
|
||||
return this.http.get(url)
|
||||
.map(res => <any> res.json())
|
||||
.do(res => console.info(res['result']['metadata']['oaf:entity']))
|
||||
.map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity']['oaf:result']])
|
||||
|
@ -41,574 +41,175 @@ export class DatasetService {
|
|||
res[1]['bestlicense'],
|
||||
res[1]['collectedfrom'],
|
||||
res[1]['context'],
|
||||
res[1]['resulttype'],
|
||||
//res[1]['resulttype'],
|
||||
res[0]
|
||||
]).do(res => {
|
||||
this._cache.set(key, res);
|
||||
})
|
||||
.map(res => this.parseDatasetInfo(res));
|
||||
}
|
||||
|
||||
private handleError (error: Response) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.log(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
|
||||
parseDatasetInfo (data: any):any {
|
||||
this.datasetInfo = new DatasetInfo();
|
||||
|
||||
if(data[0] != null) {
|
||||
var date:string = (data[0].dateofacceptance)+""; // transform to string in case it is an integer
|
||||
this.datasetInfo.date = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date;
|
||||
this.datasetInfo.dateofacceptance = data[0].dateofacceptance;
|
||||
this.datasetInfo.publisher = data[0].publisher;
|
||||
if(!Array.isArray(data[0].description)) {
|
||||
this.datasetInfo.description = data[0].description;
|
||||
} else {
|
||||
this.datasetInfo.description = data[0].description[0];
|
||||
}
|
||||
this.datasetInfo.embargoEndDate = data[0].embargoenddate;
|
||||
}
|
||||
this.datasetInfo.title = {"name": "", "url": "", "accessMode": ""};
|
||||
if(data[0]['bestlicense'].hasOwnProperty("classid")) {
|
||||
this.datasetInfo.title.accessMode = data[0]['bestlicense'].classid;
|
||||
}
|
||||
if(data[1] != null) {
|
||||
if(Array.isArray(data[1])) {
|
||||
this.datasetInfo.title['name'] = data[1][0].content;
|
||||
} else {
|
||||
this.datasetInfo.title['name'] = data[1].content;
|
||||
}
|
||||
}
|
||||
|
||||
private handleError (error: Response) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.log(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
if(data[2] != null) {
|
||||
let relation;
|
||||
let length = data[2].length!=undefined ? data[2].length : 1;
|
||||
|
||||
parseDatasetInfo (data: any):any {
|
||||
this.datasetInfo = new DatasetInfo();
|
||||
for(let i=0; i<length; i++) {
|
||||
relation = data[2].length!=undefined ? data[2][i] : data[2];
|
||||
if(relation.hasOwnProperty("to")) {
|
||||
if(relation['to'].class == "hasAuthor") {
|
||||
if(this.datasetInfo.authors == undefined) {
|
||||
this.datasetInfo.authors = new Array<{"name": string, "id": string}>();
|
||||
}
|
||||
|
||||
if(data[0] != null) {
|
||||
var date:string = (data[0].dateofacceptance)+""; // transform to string in case it is an integer
|
||||
this.datasetInfo.date = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date;
|
||||
this.datasetInfo.dateofacceptance = data[0].dateofacceptance;
|
||||
this.datasetInfo.publisher = data[0].publisher;
|
||||
if(!Array.isArray(data[0].description)) {
|
||||
this.datasetInfo.description = data[0].description;
|
||||
this.datasetInfo.authors[relation.ranking-1] = {"name": "", "id": ""};
|
||||
this.datasetInfo.authors[relation.ranking-1]['name'] = relation.fullname;
|
||||
} else if(relation['to'].class == "isProducedBy") {
|
||||
this.datasetInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.datasetInfo.fundedByProjects, relation, this.datasetInfo.projectsProvenanceVocabulary);
|
||||
} else if(relation['to'].class == "isRelatedTo") {
|
||||
let provenanceAction: string;
|
||||
if(relation.provenanceaction in this.datasetInfo.researchResultsProvenanceVocabulary) {
|
||||
provenanceAction = this.datasetInfo.researchResultsProvenanceVocabulary[relation.provenanceaction];
|
||||
} else {
|
||||
this.datasetInfo.description = data[0].description[0];
|
||||
}
|
||||
this.datasetInfo.embargoEndDate = data[0].embargoenddate;
|
||||
}
|
||||
this.datasetInfo.title = {"name": "", "url": "", "accessMode": ""};
|
||||
if(data[0]['bestlicense'].hasOwnProperty("classid")) {
|
||||
this.datasetInfo.title.accessMode = data[0]['bestlicense'].classid;
|
||||
}
|
||||
if(data[1] != null) {
|
||||
if(Array.isArray(data[1])) {
|
||||
this.datasetInfo.title['name'] = data[1][0].content;
|
||||
} else {
|
||||
this.datasetInfo.title['name'] = data[1].content;
|
||||
}
|
||||
}
|
||||
|
||||
if(data[2] != null) {
|
||||
let mydata;
|
||||
let counter = 0;
|
||||
let length = data[2].length!=undefined ? 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") {
|
||||
if(this.datasetInfo.authors == undefined) {
|
||||
this.datasetInfo.authors = new Array<{"name": string, "id": string}>();
|
||||
}
|
||||
|
||||
this.datasetInfo.authors[mydata.ranking-1] = {"name": "", "id": ""};
|
||||
this.datasetInfo.authors[mydata.ranking-1]['name'] = mydata.fullname;
|
||||
/* this.datasetInfo.authors[mydata.ranking-1]['id'] = mydata['to'].content;*/
|
||||
} else if(mydata['to'].class == "isProducedBy") {
|
||||
if(this.datasetInfo.fundedByProjects == undefined) {
|
||||
this.datasetInfo.fundedByProjects = new Array<
|
||||
{ "id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"funding": string, "code": string,
|
||||
"provenanceAction": string, "inline": boolean
|
||||
}>();
|
||||
}
|
||||
|
||||
counter = this.datasetInfo.fundedByProjects.length;
|
||||
|
||||
this.datasetInfo.fundedByProjects[counter] = {
|
||||
"id": "", "acronym": "", "title": "",
|
||||
"funderShortname": "", "funderName": "",
|
||||
"funding": "", "code": "", "provenanceAction": "", "inline": false
|
||||
}
|
||||
|
||||
if(mydata.title != 'unidentified') {
|
||||
this.datasetInfo.fundedByProjects[counter]['id'] = mydata['to'].content;
|
||||
this.datasetInfo.fundedByProjects[counter]['acronym'] = mydata.acronym;
|
||||
this.datasetInfo.fundedByProjects[counter]['title'] = mydata.title;
|
||||
this.datasetInfo.fundedByProjects[counter]['code'] = mydata.code;
|
||||
let provenanceAction: string = mydata.provenanceaction;
|
||||
if( provenanceAction == "sysimport:crosswalk:repository"
|
||||
|| provenanceAction == "sysimport:crosswalk:entityregistry"
|
||||
|| provenanceAction == "sysimport:crosswalk:datasetarchive") {
|
||||
|
||||
this.datasetInfo.fundedByProjects[counter]['provenanceAction'] = "Repository";
|
||||
}
|
||||
else if( provenanceAction == "iis"
|
||||
|| provenanceAction == "sysimport:mining:repository") {
|
||||
this.datasetInfo.fundedByProjects[counter]['provenanceAction'] = "Algorithm";
|
||||
} else if( provenanceAction == "user:claim:pid"
|
||||
|| provenanceAction == "user:claim:search"
|
||||
|| provenanceAction == "user:claim:datacite") {
|
||||
this.datasetInfo.fundedByProjects[counter]['provenanceAction'] = "User";
|
||||
}
|
||||
} else {
|
||||
this.datasetInfo.fundedByProjects[counter]['id'] = "";
|
||||
this.datasetInfo.fundedByProjects[counter]['acronym'] = "";
|
||||
this.datasetInfo.fundedByProjects[counter]['title'] = "";
|
||||
this.datasetInfo.fundedByProjects[counter]['code'] = "";
|
||||
this.datasetInfo.fundedByProjects[counter]['provenanceAction'] = "";
|
||||
}
|
||||
|
||||
/*
|
||||
if(mydata.hasOwnProperty("funding")) {
|
||||
let length1 = Array.isArray(mydata['funding']) ? mydata['funding'].length : 1;
|
||||
|
||||
for(let j=0; j<length1; j++) {
|
||||
let funding;
|
||||
let mydata1 = Array.isArray(mydata['funding']) ? mydata['funding'][j] : mydata['funding'];
|
||||
|
||||
if(mydata1.hasOwnProperty("funder")) {
|
||||
this.datasetInfo.fundedByProjects[counter]['funderShortname'] = mydata1['funder'].shortname;
|
||||
this.datasetInfo.fundedByProjects[counter]['funderName'] = mydata1['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(funding != undefined) {
|
||||
funding = funding.split("::");
|
||||
|
||||
if(this.datasetInfo.fundedByProjects[counter]['funding'] != "") {
|
||||
this.datasetInfo.fundedByProjects[counter]['funding'] += ", "+funding[1];
|
||||
} else {
|
||||
this.datasetInfo.fundedByProjects[counter]['funding'] = funding[1];
|
||||
}
|
||||
for(let i=2; i<funding.length; i++) {
|
||||
this.datasetInfo.fundedByProjects[counter]['funding'] += " | " + funding[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
if(mydata.hasOwnProperty("funding")) {
|
||||
let funding: {"funderName": string, "funderShortname": string, "stream": string};
|
||||
funding = this.parsingFunctions.parseFundingTrees(mydata.funding);
|
||||
|
||||
if(funding.funderName) {
|
||||
this.datasetInfo.fundedByProjects[counter]['funderName'] = funding.funderName;
|
||||
}
|
||||
if(funding.funderShortname) {
|
||||
this.datasetInfo.fundedByProjects[counter]['funderShortname'] = funding.funderShortname;
|
||||
}
|
||||
if(funding.stream) {
|
||||
this.datasetInfo.fundedByProjects[counter]['funding'] = funding.stream;
|
||||
}
|
||||
}
|
||||
} 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": number, "class": string}>();
|
||||
}
|
||||
*/
|
||||
if(this.datasetInfo.relatedResearchResults == undefined) {
|
||||
this.datasetInfo.relatedResearchResults =
|
||||
new Map<string, { "name": string, "id": string, "date": string,
|
||||
"trust": number, "class": string}[]>();
|
||||
}
|
||||
|
||||
if(!this.datasetInfo.relatedResearchResults.has(provenanceAction)) {
|
||||
this.datasetInfo.relatedResearchResults.set(provenanceAction,
|
||||
new Array<{ "name": string, "id": string, "date": string,
|
||||
"trust": number, "class": string}>());
|
||||
}
|
||||
|
||||
counter = this.datasetInfo.relatedResearchResults.get(provenanceAction).length;
|
||||
this.datasetInfo.relatedResearchResults.get(provenanceAction)[counter] = {"name": "", "id": "", "date": "", "trust": null, "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<{
|
||||
"name": string, "id": string, "date": string,
|
||||
"trust": number, "class": string}>();
|
||||
}
|
||||
|
||||
counter = this.datasetInfo.similarResearchResults.length;
|
||||
this.datasetInfo.similarResearchResults[counter] = {"name": "", "id": "", "date": "", "trust": null, "class": ""}
|
||||
|
||||
//let url;
|
||||
if(mydata['resulttype'].classname == "publication") {
|
||||
//url = OpenaireProperties.getsearchLinkToPublication()+mydata['to'].content;
|
||||
this.datasetInfo.similarResearchResults[counter]['class'] = "publication";
|
||||
} else {
|
||||
//url = OpenaireProperties.getsearchLinkToDataset()+mydata['to'].content;
|
||||
this.datasetInfo.similarResearchResults[counter]['class'] = "dataset";
|
||||
}
|
||||
|
||||
this.datasetInfo.similarResearchResults[counter]['id'] = mydata['to'].content;
|
||||
//this.datasetInfo.similarResearchResults[counter]['url'] = url;
|
||||
let titleName = Array.isArray(mydata['title']) ? mydata['title'][0].content : mydata['title'].content;
|
||||
this.datasetInfo.similarResearchResults[counter]['name'] = titleName;
|
||||
this.datasetInfo.similarResearchResults[counter]['date'] = mydata.dateofacceptance.substring(0,4);;
|
||||
this.datasetInfo.similarResearchResults[counter]['trust'] = Math.round(mydata.trust*100);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
provenanceAction = "Other"
|
||||
}
|
||||
|
||||
if(this.datasetInfo.authors != undefined) {
|
||||
this.datasetInfo.authors = this.datasetInfo.authors.filter(function (item) {
|
||||
return (item != undefined);
|
||||
});
|
||||
}
|
||||
this.datasetInfo.relatedResearchResults = this.parsingFunctions.parseRelatedResearchResults(this.datasetInfo.relatedResearchResults, relation, provenanceAction);
|
||||
|
||||
} else if(relation['to'].class == "hasAmongTopNSimilarDocuments") {
|
||||
this.datasetInfo.similarResearchResults = this.parsingFunctions.parseSimilarResearchResults(this.datasetInfo.similarResearchResults, relation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[3] != null) {
|
||||
if(data[3].hasOwnProperty("instance")) {
|
||||
this.datasetInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>();
|
||||
this.datasetInfo.publishedIn = new Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>()
|
||||
|
||||
let length = data[3]['instance'].length!=undefined ? data[3]['instance'].length : 1;
|
||||
|
||||
let counter = 0;
|
||||
let counter1 = 0;
|
||||
let counter2 = 0;
|
||||
let mydata;
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = data[3]['instance'].length!=undefined ? data[3]['instance'][i] : data[3]['instance'];
|
||||
|
||||
if(this.datasetInfo.type == undefined) {
|
||||
if(mydata.hasOwnProperty("instancetype")) {
|
||||
if(mydata['instancetype'].classname != null
|
||||
&& mydata['instancetype'].classname != ""
|
||||
&& mydata['instancetype'].classname != "Unknown"){
|
||||
this.datasetInfo.type = mydata['instancetype'].classname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mydata.hasOwnProperty("webresource")) {
|
||||
let url;
|
||||
if(mydata['webresource'].length == undefined) {
|
||||
url = mydata['webresource'].url;
|
||||
} else{
|
||||
url = mydata['webresource'][0].url;
|
||||
}
|
||||
|
||||
if(mydata.hasOwnProperty("hostedby")) {
|
||||
if(mydata['hostedby'].name != "other resources" && mydata['hostedby'].name != "Unknown Repository") {
|
||||
this.parsingFunctions.parseDownloadFrom(this.datasetInfo.downloadFrom, mydata, url);
|
||||
} else {
|
||||
counter1 = this.parsingFunctions.parsePublishedIn(this.datasetInfo.publishedIn, mydata, data[0], url, counter1);
|
||||
}
|
||||
if(this.datasetInfo.title != undefined) {
|
||||
if(this.datasetInfo.title['url'] == undefined) {
|
||||
this.datasetInfo.title['url'] = url;
|
||||
}
|
||||
|
||||
switch (this.datasetInfo.title['licence']) {
|
||||
case undefined:
|
||||
this.datasetInfo.title['licence'] = mydata['licence'].classid;
|
||||
this.datasetInfo.title['url'] = url;
|
||||
break;
|
||||
case "CLOSED":
|
||||
if(mydata['licence'].classid == "OPEN" ||
|
||||
mydata['licence'].classid == "EMBARGO" ||
|
||||
mydata['licence'].classid == "RESTRICTED") {
|
||||
this.datasetInfo.title['licence'] = mydata['licence'].classid;
|
||||
this.datasetInfo.title['url'] = url;
|
||||
}
|
||||
break;
|
||||
case "RESTRICTED":
|
||||
if(mydata['licence'].classid == "OPEN" ||
|
||||
mydata['licence'].classid == "EMBARGO") {
|
||||
this.datasetInfo.title['licence'] = mydata['licence'].classid;
|
||||
this.datasetInfo.title['url'] = url;
|
||||
}
|
||||
break;
|
||||
case "EMBARGO":
|
||||
if(mydata['licence'].classid == "OPEN") {
|
||||
this.datasetInfo.title['licence'] = mydata['licence'].classid;
|
||||
this.datasetInfo.title['url'] = url;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[4] != null) {
|
||||
let counter = 0;
|
||||
this.datasetInfo.identifiers = new Map<string, string[]>();
|
||||
|
||||
if(data[4].hasOwnProperty("classname") && data[4]['classname'] != "") {
|
||||
if(data[4].classname == "doi" || data[4].classname == "pmc") {
|
||||
if(!this.datasetInfo.identifiers.has(data[4].classname)) {
|
||||
this.datasetInfo.identifiers.set(data[4].classname, new Array<string>());
|
||||
}
|
||||
counter = this.datasetInfo.identifiers.get(data[4].classname).length;
|
||||
this.datasetInfo.identifiers.get(data[4].classname)[counter] = data[4].content;
|
||||
}
|
||||
} else {
|
||||
for(let i=0; i<data[4].length; i++) {
|
||||
if(data[4][i].classname == "doi" || data[4][i].classname == "pmc") {
|
||||
if(!this.datasetInfo.identifiers.has(data[4][i].classname)) {
|
||||
this.datasetInfo.identifiers.set(data[4][i].classname, new Array<string>());
|
||||
}
|
||||
counter = this.datasetInfo.identifiers.get(data[4][i].classname).length;
|
||||
this.datasetInfo.identifiers.get(data[4][i].classname)[counter] = data[4][i].content;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[5] != null) {
|
||||
let mydata;
|
||||
let length = data[7].length!=undefined ? data[5].length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = data[7].length!=undefined ? data[5][i] : data[5];
|
||||
|
||||
if(mydata.classid != "") {
|
||||
if(mydata.inferred == true) {
|
||||
if(this.datasetInfo.classifiedSubjects == undefined) {
|
||||
this.datasetInfo.classifiedSubjects = new Map<string, string[]>();
|
||||
}
|
||||
|
||||
if(!this.datasetInfo.classifiedSubjects.has(mydata.classname)) {
|
||||
this.datasetInfo.classifiedSubjects.set(mydata.classname, new Array<string>());
|
||||
}
|
||||
|
||||
this.datasetInfo.classifiedSubjects.get(mydata.classname).push(mydata.content);
|
||||
} else {
|
||||
if(mydata.classid == "keyword") {
|
||||
if(this.datasetInfo.subjects == undefined) {
|
||||
this.datasetInfo.subjects = new Array<string>();
|
||||
}
|
||||
|
||||
this.datasetInfo.subjects.push(mydata.content);
|
||||
} else {
|
||||
if(this.datasetInfo.otherSubjects == undefined) {
|
||||
this.datasetInfo.otherSubjects = new Map<string, string[]>();
|
||||
}
|
||||
|
||||
if(!this.datasetInfo.otherSubjects.has(mydata.classname)) {
|
||||
this.datasetInfo.otherSubjects.set(mydata.classname, new Array<string>());
|
||||
}
|
||||
this.datasetInfo.otherSubjects.get(mydata.classname).push(mydata.content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[6] != null) {
|
||||
this.datasetInfo.bestlicense = data[6].classid;
|
||||
}
|
||||
|
||||
if(data[7] != null) {
|
||||
this.datasetInfo.collectedFrom = new Array<{"name": string, "id": string}>();
|
||||
|
||||
let mydata;
|
||||
let length = data[7].length!=undefined ? data[7].length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = data[7].length!=undefined ? data[7][i] : data[7];
|
||||
//let link = OpenaireProperties.getsearchLinkToDataProvider();
|
||||
this.datasetInfo.collectedFrom[i] = {"name": "", "id": ""};
|
||||
this.datasetInfo.collectedFrom[i]['name'] = mydata.name;
|
||||
this.datasetInfo.collectedFrom[i]['id'] = /*link+*/mydata.id;
|
||||
}
|
||||
}
|
||||
|
||||
if( this.datasetInfo.publisher != null
|
||||
&& this.datasetInfo.publisher != ""
|
||||
&& this.datasetInfo.identifiers != null
|
||||
&& this.datasetInfo.identifiers.has("doi")) {
|
||||
|
||||
if( this.datasetInfo.downloadFrom == null) {
|
||||
this.datasetInfo.downloadFrom = new Map<string,{"url": string[], "accessMode": string[], "bestAccessMode": string}>();
|
||||
}
|
||||
|
||||
this.datasetInfo.downloadFrom.set(this.datasetInfo.publisher, {"url": null, "accessMode": null, "bestAccessMode": null});
|
||||
|
||||
let url = OpenaireProperties.getDoiURL()+this.datasetInfo.identifiers.get("doi");
|
||||
this.datasetInfo.downloadFrom.get(this.datasetInfo.publisher)['url'] = new Array<string>();
|
||||
this.datasetInfo.downloadFrom.get(this.datasetInfo.publisher)['accessMode'] = new Array<string>();
|
||||
|
||||
this.datasetInfo.downloadFrom.get(this.datasetInfo.publisher)['url'][0] = url;
|
||||
this.datasetInfo.downloadFrom.get(this.datasetInfo.publisher)['accessMode'][0] = "";
|
||||
|
||||
if(this.datasetInfo.title != undefined && this.datasetInfo.title['url'] == "") {
|
||||
this.datasetInfo.title['url'] = url;
|
||||
}
|
||||
}
|
||||
|
||||
if(data[8] != null) {
|
||||
this.datasetInfo.contexts = new Array<
|
||||
{ "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}>();
|
||||
|
||||
let position = 0;
|
||||
let labels = "";
|
||||
let mydata;
|
||||
let length = data[8].length!=undefined ? data[8].length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
mydata = data[8].length!=undefined ? data[8][i] : data[8];
|
||||
|
||||
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;
|
||||
for(let j=0; j<length1; j++) {
|
||||
mydata1 = length1 > 1 ? mydata['category']['concept'][j] : mydata['category']['concept'];
|
||||
|
||||
this.datasetInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false};
|
||||
this.datasetInfo.contexts[position]['labelContext'] = mydata.label;
|
||||
this.datasetInfo.contexts[position]['labelCategory'] = mydata['category'].label;;
|
||||
this.datasetInfo.contexts[position]['labelConcept'] = mydata1.label;
|
||||
|
||||
position++;
|
||||
}
|
||||
} else {
|
||||
this.datasetInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false};
|
||||
this.datasetInfo.contexts[position]['labelContext'] = mydata.label;
|
||||
this.datasetInfo.contexts[position]['labelCategory'] = mydata['category'].label;;
|
||||
this.datasetInfo.contexts[position]['labelConcept'] = null;
|
||||
}
|
||||
} else {
|
||||
this.datasetInfo.contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false};
|
||||
this.datasetInfo.contexts[position]['labelContext'] = mydata.label;
|
||||
this.datasetInfo.contexts[position]['labelCategory'] = null;
|
||||
this.datasetInfo.contexts[position]['labelConcept'] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[9] != null && this.datasetInfo.type == undefined) {
|
||||
if(data[9].hasOwnProperty('classname')) {
|
||||
this.datasetInfo.type = data[9].classname;
|
||||
}
|
||||
}
|
||||
|
||||
if(data[10] != null && data[10] == "under curation") {
|
||||
this.datasetInfo.underCurationMessage = true;
|
||||
} else {
|
||||
this.datasetInfo.underCurationMessage = false;
|
||||
}
|
||||
//this.printdatasetInfo();
|
||||
return this.datasetInfo;
|
||||
|
||||
if(this.datasetInfo.authors != undefined) {
|
||||
this.datasetInfo.authors = this.datasetInfo.authors.filter(function (item) {
|
||||
return (item != undefined);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
printDatasetInfo() {
|
||||
console.info("DATE: "+this.datasetInfo.date);
|
||||
console.info("PUBLISHER: "+this.datasetInfo.publisher);
|
||||
console.info("DESCRIPTION: "+this.datasetInfo.description);
|
||||
if(data[3] != null) {
|
||||
if(data[3].hasOwnProperty("instance")) {
|
||||
this.datasetInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>();
|
||||
this.datasetInfo.publishedIn = new Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>()
|
||||
|
||||
console.info("TITLE: "+this.datasetInfo.title);
|
||||
this.datasetInfo.types = new Array<string>();
|
||||
let types = new Set<string>();
|
||||
|
||||
console.info("AUTHORS: "+this.datasetInfo.authors);
|
||||
console.info("\nFUNDED BY PROJECTS:");
|
||||
if(this.datasetInfo.fundedByProjects != undefined) {
|
||||
this.datasetInfo.fundedByProjects.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
/*
|
||||
console.info("\nRELATED RESEARCH DATA:");
|
||||
if(this.datasetInfo.relatedResearchData != undefined) {
|
||||
this.datasetInfo.relatedResearchData.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
let counter = 0;
|
||||
let instance;
|
||||
|
||||
console.info("\nSIMILAR datasetS:");
|
||||
if(this.datasetInfo.similarPublications != undefined) {
|
||||
this.datasetInfo.similarPublications.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
*/
|
||||
console.info("TYPE: "+this.datasetInfo.type);
|
||||
console.info("\nDOWNLOAD FROM:");
|
||||
if(this.datasetInfo.downloadFrom != undefined) {
|
||||
this.datasetInfo.downloadFrom.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
let length = data[3]['instance'].length!=undefined ? data[3]['instance'].length : 1;
|
||||
|
||||
console.info("\nIDENTIFIERS:");
|
||||
if(this.datasetInfo.identifiers != undefined) {
|
||||
this.datasetInfo.identifiers.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
for(let i=0; i<length; i++) {
|
||||
instance = data[3]['instance'].length!=undefined ? data[3]['instance'][i] : data[3]['instance'];
|
||||
|
||||
console.info("SUBJECTS: "+this.datasetInfo.subjects);
|
||||
console.info("\nCLASSIFIED OBJECTS:");
|
||||
if(this.datasetInfo.classifiedSubjects != undefined) {
|
||||
this.datasetInfo.classifiedSubjects.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
this.parsingFunctions.parseTypes(this.datasetInfo.types, types, instance);
|
||||
|
||||
console.info("BEST LICENSE: "+this.datasetInfo.bestlicense);
|
||||
if(instance.hasOwnProperty("webresource")) {
|
||||
let url;
|
||||
if(instance['webresource'].length == undefined) {
|
||||
url = instance['webresource'].url;
|
||||
} else{
|
||||
url = instance['webresource'][0].url;
|
||||
}
|
||||
|
||||
console.info("\nCOLLECTED FROM:");
|
||||
if(this.datasetInfo.collectedFrom != undefined) {
|
||||
this.datasetInfo.collectedFrom.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
}
|
||||
console.info("\n");
|
||||
if(instance.hasOwnProperty("hostedby")) {
|
||||
if(instance['hostedby'].name != "other resources" && instance['hostedby'].name != "Unknown Repository") {
|
||||
this.parsingFunctions.parseDownloadFrom(this.datasetInfo.downloadFrom, instance, url);
|
||||
} else {
|
||||
counter = this.parsingFunctions.parsePublishedIn(this.datasetInfo.publishedIn, instance, data[0], url, counter);
|
||||
}
|
||||
if(this.datasetInfo.title != undefined) {
|
||||
if(!this.datasetInfo.title['url']) {
|
||||
this.datasetInfo.title['url'] = url;
|
||||
}
|
||||
|
||||
console.info("\nDOWNLOAD FROM:");
|
||||
if(this.datasetInfo.downloadFrom != undefined) {
|
||||
this.datasetInfo.downloadFrom.forEach(function (value, key, map) {
|
||||
console.info(key + " = " + value);
|
||||
});
|
||||
} else {
|
||||
console.info("undefined");
|
||||
if(this.parsingFunctions.changeBestAccessMode(this.datasetInfo.title['accessMode'], instance['licence'].classid)) {
|
||||
this.datasetInfo.title['accessMode'] = instance['licence'].classid;
|
||||
this.datasetInfo.title['url'] = url;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.info("\n");
|
||||
}
|
||||
}
|
||||
|
||||
if(data[4] != null) {
|
||||
this.datasetInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[4]);
|
||||
}
|
||||
|
||||
if(data[5] != null) {
|
||||
let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>] = this.parsingFunctions.parseAllSubjects(data[5]);
|
||||
this.datasetInfo.subjects = subjectResults[0];
|
||||
this.datasetInfo.otherSubjects = subjectResults[1];
|
||||
this.datasetInfo.classifiedSubjects = subjectResults[2];
|
||||
}
|
||||
|
||||
// if(data[6] != null) {
|
||||
// this.datasetInfo.bestlicense = data[6].classid;
|
||||
// }
|
||||
|
||||
if(data[7] != null) {
|
||||
this.datasetInfo.collectedFrom = this.parsingFunctions.parseCollectedFrom(data[7]);
|
||||
}
|
||||
|
||||
// null argument is for journal
|
||||
this.datasetInfo.downloadFrom = this.parsingFunctions.addPublisherToDownloadFrom(
|
||||
this.datasetInfo.downloadFrom, this.datasetInfo.publisher,
|
||||
null, this.datasetInfo.identifiers, this.datasetInfo.title);
|
||||
|
||||
if(data[8] != null) {
|
||||
this.datasetInfo.contexts = this.parsingFunctions.parseContexts(data[8]);
|
||||
}
|
||||
|
||||
// if(data[9] != null && this.datasetInfo.type == undefined) {
|
||||
// if(data[9].hasOwnProperty('classname')) {
|
||||
// this.datasetInfo.type = data[9].classname;
|
||||
// }
|
||||
// }
|
||||
|
||||
if(data[9] != null && data[9] == "under curation") {
|
||||
this.datasetInfo.underCurationMessage = true;
|
||||
} else {
|
||||
this.datasetInfo.underCurationMessage = false;
|
||||
}
|
||||
|
||||
return this.datasetInfo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
|
||||
|
||||
export class ParsingFunctions {
|
||||
|
||||
|
@ -5,49 +6,112 @@ export class ParsingFunctions {
|
|||
|
||||
public ngOnDestroy() {}
|
||||
|
||||
public parseFundingByProjects(fundedByProjects: { "id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"funding": string, "code": string,
|
||||
"provenanceAction": string, "inline": boolean
|
||||
}[],
|
||||
relation: any, projectsProvenanceVocabulary: any):
|
||||
{ "id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"funding": string, "code": string,
|
||||
"provenanceAction": string, "inline": boolean
|
||||
}[] {
|
||||
if(fundedByProjects == undefined) {
|
||||
fundedByProjects = new Array<{"id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"funding": string, "code": string,
|
||||
"provenanceAction": string, "inline": boolean
|
||||
}>();
|
||||
}
|
||||
|
||||
let fundedByProject: { "id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"funding": string, "code": string,
|
||||
"provenanceAction": string, "inline": boolean
|
||||
} = { "id": "", "acronym": "", "title": "",
|
||||
"funderShortname": "", "funderName": "",
|
||||
"funding": "", "code": "", "provenanceAction": "", "inline": false
|
||||
};
|
||||
|
||||
if(relation.title != 'unidentified') {
|
||||
fundedByProject['id'] = relation['to'].content;
|
||||
fundedByProject['acronym'] = relation.acronym;
|
||||
fundedByProject['title'] = relation.title;
|
||||
fundedByProject['code'] = relation.code;
|
||||
|
||||
if(relation.provenanceaction in projectsProvenanceVocabulary) {
|
||||
fundedByProject['provenanceAction'] = projectsProvenanceVocabulary[relation.provenanceaction];
|
||||
}
|
||||
} else {
|
||||
fundedByProject['id'] = "";
|
||||
fundedByProject['acronym'] = "";
|
||||
fundedByProject['title'] = "";
|
||||
fundedByProject['code'] = "";
|
||||
fundedByProject['provenanceAction'] = "";
|
||||
}
|
||||
|
||||
if(relation.hasOwnProperty("funding")) {
|
||||
let funding: {"funderName": string, "funderShortname": string, "stream": string};
|
||||
funding = this.parseFundingTrees(relation.funding);
|
||||
|
||||
if(funding.funderName) {
|
||||
fundedByProject['funderName'] = funding.funderName;
|
||||
}
|
||||
if(funding.funderShortname) {
|
||||
fundedByProject['funderShortname'] = funding.funderShortname;
|
||||
}
|
||||
if(funding.stream) {
|
||||
fundedByProject['funding'] = funding.stream;
|
||||
}
|
||||
}
|
||||
fundedByProjects.push(fundedByProject);
|
||||
return fundedByProjects;
|
||||
}
|
||||
|
||||
// publication & dataset : for fundedByProjects | project landing : for funding
|
||||
public parseFundingTrees(fundingTree: any): {"funderName": string, "funderShortname": string, "stream": string} {
|
||||
let funding: {"funderName": string, "funderShortname": string, "stream": string} = {"funderName": "", "funderShortname": "", "stream": ""};
|
||||
let length = Array.isArray(fundingTree) ? fundingTree.length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
let fundingData = Array.isArray(fundingTree) ? fundingTree[i] : fundingTree;
|
||||
let fundingData = Array.isArray(fundingTree) ? fundingTree[i] : fundingTree;
|
||||
|
||||
if(fundingData.hasOwnProperty("funder")) {
|
||||
funding.funderShortname = fundingData['funder'].shortname;
|
||||
funding.funderName = fundingData['funder'].name;
|
||||
}
|
||||
if(fundingData.hasOwnProperty("funder")) {
|
||||
funding.funderShortname = fundingData['funder'].shortname;
|
||||
funding.funderName = fundingData['funder'].name;
|
||||
}
|
||||
|
||||
funding.stream = this.addFundingLevel0(fundingData, funding.stream);
|
||||
funding.stream = this.addFundingLevel0(fundingData, funding.stream);
|
||||
|
||||
funding.stream = this.addFundingLevel1(fundingData, funding.stream);
|
||||
funding.stream = this.addFundingLevel1(fundingData, funding.stream);
|
||||
|
||||
funding.stream = this.addFundingLevel2(fundingData, funding.stream);
|
||||
funding.stream = this.addFundingLevel2(fundingData, funding.stream);
|
||||
}
|
||||
return funding;
|
||||
}
|
||||
|
||||
addFundingLevel0(parent: string, fundingStream: string) : string {
|
||||
if(parent.hasOwnProperty("funding_level_0")) {
|
||||
let level0 = parent['funding_level_0'];
|
||||
let level0 = parent['funding_level_0'];
|
||||
|
||||
fundingStream += (fundingStream) ? " ; " : "";
|
||||
fundingStream += level0.name;
|
||||
fundingStream += (fundingStream) ? " ; " : "";
|
||||
fundingStream += level0.name;
|
||||
}
|
||||
return fundingStream;
|
||||
}
|
||||
|
||||
addFundingLevel1(parent: string, fundingStream: string): string {
|
||||
if(parent.hasOwnProperty("funding_level_1")) {
|
||||
let level1 = parent['funding_level_1'];
|
||||
let level1 = parent['funding_level_1'];
|
||||
|
||||
// For projects' parsing
|
||||
if(level1.hasOwnProperty("parent")) {
|
||||
fundingStream = this.addFundingLevel0(level1.parent, fundingStream);
|
||||
}
|
||||
// For projects' parsing
|
||||
if(level1.hasOwnProperty("parent")) {
|
||||
fundingStream = this.addFundingLevel0(level1.parent, fundingStream);
|
||||
}
|
||||
|
||||
fundingStream += (fundingStream) ? " | " : "";
|
||||
fundingStream += level1.name;
|
||||
fundingStream += (fundingStream) ? " | " : "";
|
||||
fundingStream += level1.name;
|
||||
}
|
||||
return fundingStream;
|
||||
}
|
||||
|
@ -67,6 +131,54 @@ export class ParsingFunctions {
|
|||
return fundingStream;
|
||||
}
|
||||
|
||||
// publication & dataset landing : for collectedFrom
|
||||
parseCollectedFrom(_collectedFrom: any): {"name": string, "id": string}[] {
|
||||
let collectedFrom = new Array<{"name": string, "id": string}>();
|
||||
|
||||
let collected;
|
||||
let length = Array.isArray(_collectedFrom) ? _collectedFrom.length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
collected = Array.isArray(_collectedFrom) ? _collectedFrom[i] : _collectedFrom;
|
||||
collectedFrom[i] = {"name": "", "id": ""};
|
||||
collectedFrom[i]['name'] = collected.name;
|
||||
collectedFrom[i]['id'] = collected.id;
|
||||
}
|
||||
|
||||
return collectedFrom;
|
||||
}
|
||||
|
||||
// publication & dataset landing : for downloadFrom
|
||||
addPublisherToDownloadFrom( downloadFrom: Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>,
|
||||
publisher: string, journal:{"journal": string, "issn": string, "lissn": string},
|
||||
identifiers: Map<string, string[]>, title: { "name": string, "url": string, "accessMode": string}) {
|
||||
if( publisher && identifiers != null && identifiers.has('doi')) {
|
||||
if( downloadFrom == null) {
|
||||
downloadFrom = new Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>();
|
||||
}
|
||||
|
||||
let key: string;
|
||||
if(journal && journal.journal) {
|
||||
key = publisher + "/ "+journal['journal'];
|
||||
} else {
|
||||
key = publisher;
|
||||
}
|
||||
downloadFrom.set(key, {"url": null, "accessMode": null, "bestAccessMode": null});
|
||||
|
||||
let url = OpenaireProperties.getDoiURL()+identifiers.get("doi")[0];
|
||||
|
||||
downloadFrom.get(key)['url'] = new Array<string>();
|
||||
downloadFrom.get(key)['accessMode'] = new Array<string>();
|
||||
|
||||
downloadFrom.get(key)['url'][0] = url;
|
||||
downloadFrom.get(key)['accessMode'][0] = "";
|
||||
|
||||
if(title != undefined && title['url'] == "") {
|
||||
title['url'] = url;
|
||||
}
|
||||
}
|
||||
return downloadFrom;
|
||||
}
|
||||
|
||||
// publication & dataset landing : for downloadFrom
|
||||
parseDownloadFrom(downloadFrom: Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>, instance: any, url: string)
|
||||
{
|
||||
|
@ -82,17 +194,17 @@ export class ParsingFunctions {
|
|||
if(result != null && result.hasOwnProperty("source")) {
|
||||
let key: string;
|
||||
if(Array.isArray(result.source)) {
|
||||
if(counter==result.source.length) {
|
||||
counter--;
|
||||
}
|
||||
key = result['source'][counter];
|
||||
if(counter==result.source.length) {
|
||||
counter--;
|
||||
}
|
||||
key = result['source'][counter];
|
||||
} else {
|
||||
key = result['source'];
|
||||
key = result['source'];
|
||||
}
|
||||
|
||||
if(key) {
|
||||
this.addUrlAndAccessMode(publishedIn, instance, key, url);
|
||||
counter++;
|
||||
this.addUrlAndAccessMode(publishedIn, instance, key, url);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
return counter;
|
||||
|
@ -101,11 +213,11 @@ export class ParsingFunctions {
|
|||
// publication & dataset landing : for downloadFrom and publishedIn
|
||||
addUrlAndAccessMode(mapStructure: Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>, instance: any, key: string, url: string) {
|
||||
if(!mapStructure.has(key)) {
|
||||
mapStructure.set(key, {"url": null, "accessMode": null, "bestAccessMode": null});
|
||||
mapStructure.set(key, {"url": null, "accessMode": null, "bestAccessMode": null});
|
||||
}
|
||||
|
||||
if(mapStructure.get(key)['url'] == null) {
|
||||
mapStructure.get(key)['url'] = new Array<string>();
|
||||
mapStructure.get(key)['url'] = new Array<string>();
|
||||
}
|
||||
|
||||
if(url) {
|
||||
|
@ -113,48 +225,223 @@ export class ParsingFunctions {
|
|||
}
|
||||
|
||||
if(mapStructure.get(key)['accessMode'] == null) {
|
||||
mapStructure.get(key)['accessMode'] = new Array<string>();
|
||||
mapStructure.get(key)['accessMode'] = new Array<string>();
|
||||
}
|
||||
|
||||
if(instance.hasOwnProperty("licence")) {
|
||||
if(url) {
|
||||
mapStructure.get(key)['accessMode'].push(instance['licence'].classid);
|
||||
}
|
||||
if(url) {
|
||||
mapStructure.get(key)['accessMode'].push(instance['licence'].classid);
|
||||
}
|
||||
|
||||
if(this.changeBestAccessMode(mapStructure.get(key)['bestAccessMode'], instance['licence'].classid)) {
|
||||
mapStructure.get(key)['bestAccessMode'] = instance['licence'].classid;
|
||||
}
|
||||
if(this.changeBestAccessMode(mapStructure.get(key)['bestAccessMode'], instance['licence'].classid)) {
|
||||
mapStructure.get(key)['bestAccessMode'] = instance['licence'].classid;
|
||||
}
|
||||
|
||||
} else if(url) {
|
||||
mapStructure.get(key)['accessMode'].push("");
|
||||
mapStructure.get(key)['accessMode'].push("");
|
||||
}
|
||||
}
|
||||
|
||||
// publication & dataset landing : for downloadFrom and publishedIn
|
||||
changeBestAccessMode(currentAccessMode: string, accessMode: string): boolean {
|
||||
switch (currentAccessMode) {
|
||||
case null:
|
||||
return true;
|
||||
case "CLOSED":
|
||||
if(accessMode == "OPEN" ||
|
||||
accessMode == "EMBARGO" ||
|
||||
accessMode == "RESTRICTED") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case "RESTRICTED":
|
||||
if(accessMode == "OPEN" ||
|
||||
accessMode == "EMBARGO") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case "EMBARGO":
|
||||
if(accessMode == "OPEN") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case null:
|
||||
return true;
|
||||
case "CLOSED":
|
||||
if( accessMode == "OPEN" ||
|
||||
accessMode == "EMBARGO" ||
|
||||
accessMode == "RESTRICTED") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case "RESTRICTED":
|
||||
if( accessMode == "OPEN" ||
|
||||
accessMode == "EMBARGO") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case "EMBARGO":
|
||||
if(accessMode == "OPEN") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// publication & dataset landing : for relatedResearchResults
|
||||
parseRelatedResearchResults(relatedResearchResults: Map<string, { "name": string, "id": string, "date": string,
|
||||
"trust": number, "class": string}[]>, relation: any, provenanceAction: string) :
|
||||
Map<string, { "name": string, "id": string, "date": string,
|
||||
"trust": number, "class": string}[]> {
|
||||
if(relatedResearchResults == undefined) {
|
||||
relatedResearchResults = new Map<string, {"name": string, "id": string, "date": string,
|
||||
"trust": number, "class": string }[]>();
|
||||
}
|
||||
|
||||
if(!relatedResearchResults.has(provenanceAction)) {
|
||||
relatedResearchResults.set(provenanceAction,
|
||||
new Array<{ "name": string, "id": string, "date": string,
|
||||
"trust": number, "class": string }>());
|
||||
}
|
||||
relatedResearchResults.get(provenanceAction).push(this.parseRelatedOrSimilarResearchResult(relation));
|
||||
|
||||
return relatedResearchResults;
|
||||
}
|
||||
|
||||
// publication & dataset landing : for similarResearchResults
|
||||
parseSimilarResearchResults(similarResearchResults: { "name": string, "id": string, "date": string,
|
||||
"trust": number, "class": string}[], relation: any) :
|
||||
{ "name": string, "id": string, "date": string, "trust": number, "class": string }[] {
|
||||
if(similarResearchResults == undefined) {
|
||||
similarResearchResults = new Array<{"name": string, "id": string, "date": string,
|
||||
"trust": number, "class": string}>();
|
||||
}
|
||||
similarResearchResults.push(this.parseRelatedOrSimilarResearchResult(relation));
|
||||
return similarResearchResults;
|
||||
}
|
||||
|
||||
// publication & dataset landing : for relatedResearchResults and similarResearchResults
|
||||
parseRelatedOrSimilarResearchResult(relation: any): {"name": string, "id": string, "date": string, "trust": number, "class": string} {
|
||||
let researchResult: {"name": string, "id": string, "date": string, "trust": number, "class": string}
|
||||
= {"name": "", "id": "", "date": "", "trust": null, "class": ""}
|
||||
|
||||
if(relation['resulttype'].classname == "publication") {
|
||||
researchResult['class'] = "publication";
|
||||
} else {
|
||||
researchResult['class'] = "dataset";
|
||||
}
|
||||
|
||||
researchResult['id'] = relation['to'].content;
|
||||
let titleName = Array.isArray(relation['title']) ? relation['title'][0].content : relation['title'].content;
|
||||
researchResult['name'] = titleName;
|
||||
researchResult['date'] = relation.dateofacceptance.substring(0,4);;
|
||||
researchResult['trust'] = Math.round(relation.trust*100);
|
||||
return researchResult;
|
||||
}
|
||||
|
||||
// publication & dataset landing : for identifiers
|
||||
parseIdentifiers(pid: any): Map<string, string[]> {
|
||||
let identifiers = new Map<string, string[]>();
|
||||
|
||||
if(pid.hasOwnProperty("classname") && pid['classname'] != "") {
|
||||
if(pid.classname == "doi" || pid.classname == "pmc") {
|
||||
if(!identifiers.has(pid.classname)) {
|
||||
identifiers.set(pid.classname, new Array<string>());
|
||||
}
|
||||
|
||||
identifiers.get(pid.classname).push(pid.content);
|
||||
}
|
||||
} else {
|
||||
for(let i=0; i<pid.length; i++) {
|
||||
if(pid[i].classname == "doi" || pid[i].classname == "pmc") {
|
||||
if(!identifiers.has(pid[i].classname)) {
|
||||
identifiers.set(pid[i].classname, new Array<string>());
|
||||
}
|
||||
identifiers.get(pid[i].classname).push(pid[i].content);
|
||||
}
|
||||
}
|
||||
}
|
||||
return identifiers;
|
||||
}
|
||||
|
||||
// publication & dataset landing : for subjects and otherSubjects and classifiedSubjects
|
||||
parseAllSubjects(_subjects: any): [string[], Map<string, string[]>, Map<string, string[]>] {
|
||||
let subjects: string[];
|
||||
let otherSubjects: Map<string, string[]>;
|
||||
let classifiedSubjects: Map<string, string[]>;
|
||||
|
||||
let subject;
|
||||
let length = Array.isArray(_subjects) ? _subjects.length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
subject = Array.isArray(_subjects) ? _subjects[i] : _subjects;
|
||||
|
||||
if(subject.classid != "") {
|
||||
if(subject.inferred == true) {
|
||||
if(classifiedSubjects == undefined) {
|
||||
classifiedSubjects = new Map<string, string[]>();
|
||||
}
|
||||
|
||||
if(classifiedSubjects.has(subject.classname)) {
|
||||
classifiedSubjects.set(subject.classname, new Array<string>());
|
||||
}
|
||||
|
||||
classifiedSubjects.get(subject.classname).push(subject.content);
|
||||
} else {
|
||||
if(subject.classid == "keyword") {
|
||||
if(subjects == undefined) {
|
||||
subjects = new Array<string>();
|
||||
}
|
||||
|
||||
subjects.push(subject.content);
|
||||
} else {
|
||||
if(otherSubjects == undefined) {
|
||||
otherSubjects = new Map<string, string[]>();
|
||||
}
|
||||
|
||||
if(!otherSubjects.has(subject.classname)) {
|
||||
otherSubjects.set(subject.classname, new Array<string>());
|
||||
}
|
||||
otherSubjects.get(subject.classname).push(subject.content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return [subjects, otherSubjects, classifiedSubjects];
|
||||
}
|
||||
|
||||
parseContexts(_contexts: any): {"labelContext": string, "labelCategory": string,
|
||||
"labelConcept": string, inline:boolean}[] {
|
||||
let contexts = new Array<{"labelContext": string, "labelCategory": string,
|
||||
"labelConcept": string, inline:boolean}>();
|
||||
|
||||
let position = 0;
|
||||
let labels = "";
|
||||
let context;
|
||||
let length = Array.isArray(_contexts) ? _contexts.length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
context = Array.isArray(_contexts) ? _contexts[i] : _contexts;
|
||||
|
||||
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++) {
|
||||
categoryConcept = Array.isArray(context['category']['concept']) ? context['category']['concept'][j] : context['category']['concept'];
|
||||
|
||||
contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false };
|
||||
contexts[position]['labelContext'] = context.label;
|
||||
contexts[position]['labelCategory'] = context['category'].label;
|
||||
contexts[position]['labelConcept'] = categoryConcept.label;
|
||||
|
||||
position++;
|
||||
}
|
||||
} else {
|
||||
contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false};
|
||||
contexts[position]['labelContext'] = context.label;
|
||||
contexts[position]['labelCategory'] = context['category'].label;
|
||||
contexts[position]['labelConcept'] = null;
|
||||
}
|
||||
} else {
|
||||
contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false};
|
||||
contexts[position]['labelContext'] = context.label;
|
||||
contexts[position]['labelCategory'] = null;
|
||||
contexts[position]['labelConcept'] = null;
|
||||
contexts[position]['new'] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return contexts;
|
||||
}
|
||||
|
||||
parseTypes(types: string[], uniqueTypes: Set<string>, instance: any) {
|
||||
if(instance.hasOwnProperty("instancetype")) {
|
||||
if(!uniqueTypes.has(instance['instancetype'].classname)) {
|
||||
types.push(instance['instancetype'].classname);
|
||||
uniqueTypes.add(instance['instancetype'].classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,8 +157,6 @@ export class ProjectService {
|
|||
if(funding.stream) {
|
||||
this.projectInfo['funding'] = funding.stream;
|
||||
}
|
||||
console.info("funder="+this.projectInfo.funder);
|
||||
console.info("stream="+this.projectInfo.funding);
|
||||
}
|
||||
|
||||
if(data[2] != null) {
|
||||
|
@ -175,7 +173,7 @@ export class ProjectService {
|
|||
}
|
||||
|
||||
if(data[2].hasOwnProperty("to") && name != "") {
|
||||
id = /*OpenaireProperties.getsearchLinkToOrganization()+*/data[2]['to'].content;
|
||||
id = data[2]['to'].content;
|
||||
}
|
||||
if(name != "") {
|
||||
this.projectInfo.organizations.push({"name": name, "id": id});
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<div *ngIf="publicationInfo != null" uk-grid>
|
||||
<div class="uk-width-3-4@l uk-width-3-4@xl uk-width-3-4@m uk-width-1-1@s">
|
||||
<showTitle [title]="publicationInfo.title"></showTitle>
|
||||
<span class="uk-label custom-label label-blue " title="Type">{{publicationInfo.types.join(", ")}}</span>
|
||||
<span *ngIf="publicationInfo.types.length > 0"class="uk-label custom-label label-blue " title="Type">{{publicationInfo.types.join(", ")}}</span>
|
||||
<span *ngIf="publicationInfo.languages.length > 0" class="uk-label custom-label label-grey " title="Language">{{publicationInfo.languages.join(", ")}}</span>
|
||||
<span class="uk-label custom-label label-green " ><!--span [class]="publicationInfo.title.accessMode" -->{{publicationInfo.title.accessMode}}<!--/span--></span>
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ export class PublicationComponent {
|
|||
}
|
||||
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 = {id: this.articleId, type :"publication", source : "openaire", title: this.publicationInfo.title,url: '', result: '', accessRights: this.publicationInfo.title.accessMode, embargoEndDate: ''};
|
||||
// this.result.push(result_);
|
||||
|
||||
if(this.publicationInfo.identifiers != undefined && this.publicationInfo.identifiers.has('doi')) {
|
||||
|
|
|
@ -13,596 +13,332 @@ import { ParsingFunctions } from '../landing-utils/parsingFunctions.class';
|
|||
@Injectable()
|
||||
export class PublicationService {
|
||||
|
||||
constructor(private http: Http, public _cache: CacheService) {
|
||||
this.parsingFunctions = new ParsingFunctions();
|
||||
constructor(private http: Http, public _cache: CacheService) {
|
||||
this.parsingFunctions = new ParsingFunctions();
|
||||
}
|
||||
|
||||
public parsingFunctions: ParsingFunctions;
|
||||
publicationInfo: PublicationInfo;
|
||||
|
||||
getPublicationInfo (id: string):any {
|
||||
console.info("getPublicationInfo in service");
|
||||
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 this.http.get(url)
|
||||
.map(res => <any> res.json())
|
||||
.map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity']])
|
||||
.map(res => [ res[1]['oaf:result'],
|
||||
res[1]['oaf:result']['title'],
|
||||
res[1]['oaf:result']['rels']['rel'],
|
||||
res[1]['oaf:result']['children'],
|
||||
res[1]['oaf:result']['pid'],
|
||||
res[1]['oaf:result']['journal'],
|
||||
res[1]['oaf:result']['language'],
|
||||
res[1]['oaf:result']['subject'],
|
||||
res[1]['oaf:result']['bestlicense'],
|
||||
res[1]['oaf:result']['collectedfrom'],
|
||||
(res[1]['extraInfo']!= undefined && res[1]['extraInfo']['citations']!= undefined)? res[1]['extraInfo']['citations']['citation']:null,
|
||||
res[1]['oaf:result']['context'],
|
||||
res[0]
|
||||
])
|
||||
.do(res => {
|
||||
this._cache.set(key, res);
|
||||
})
|
||||
.map(res => this.parsePublicationInfo(res));
|
||||
}
|
||||
|
||||
private handleError (error: Response) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.log(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
}
|
||||
|
||||
parsePublicationInfo (data: any):any {
|
||||
this.publicationInfo = new PublicationInfo();
|
||||
|
||||
if(data[0] != null) {
|
||||
var date:string = (data[0].dateofacceptance)+""; // transform to string in case it is an integer
|
||||
this.publicationInfo.date = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date;
|
||||
this.publicationInfo.dateofacceptance = data[0].dateofacceptance;
|
||||
this.publicationInfo.publisher = data[0].publisher;
|
||||
if(!Array.isArray(data[0].description)) {
|
||||
this.publicationInfo.description = data[0].description;
|
||||
} else {
|
||||
this.publicationInfo.description = data[0].description[0];
|
||||
}
|
||||
this.publicationInfo.embargoEndDate = data[0].embargoenddate;
|
||||
}
|
||||
|
||||
public parsingFunctions: ParsingFunctions;
|
||||
publicationInfo: PublicationInfo;
|
||||
|
||||
getPublicationInfo (id: string):any {
|
||||
console.info("getPublicationInfo in service");
|
||||
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 this.http.get(url)
|
||||
.map(res => <any> res.json())
|
||||
.map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity']])
|
||||
.map(res => [ res[1]['oaf:result'],
|
||||
res[1]['oaf:result']['title'],
|
||||
res[1]['oaf:result']['rels']['rel'],
|
||||
res[1]['oaf:result']['children'],
|
||||
res[1]['oaf:result']['pid'],
|
||||
res[1]['oaf:result']['journal'],
|
||||
res[1]['oaf:result']['language'],
|
||||
res[1]['oaf:result']['subject'],
|
||||
res[1]['oaf:result']['bestlicense'],
|
||||
res[1]['oaf:result']['collectedfrom'],
|
||||
(res[1]['extraInfo']!= undefined && res[1]['extraInfo']['citations']!= undefined)? res[1]['extraInfo']['citations']['citation']:null,
|
||||
res[1]['oaf:result']['context'],
|
||||
res[0]
|
||||
])
|
||||
.do(res => {
|
||||
this._cache.set(key, res);
|
||||
})
|
||||
.map(res => this.parsePublicationInfo(res));
|
||||
this.publicationInfo.title = {"name": "", "url": "", "accessMode": ""};
|
||||
if(data[0]['bestlicense'].hasOwnProperty("classid")) {
|
||||
this.publicationInfo.title.accessMode = data[0]['bestlicense'].classid;
|
||||
}
|
||||
|
||||
private handleError (error: Response) {
|
||||
// in a real world app, we may send the error to some remote logging infrastructure
|
||||
// instead of just logging it to the console
|
||||
console.log(error);
|
||||
return Observable.throw(error || 'Server error');
|
||||
if(data[1] != null) {
|
||||
if(Array.isArray(data[1])) {
|
||||
this.publicationInfo.title['name'] = data[1][0].content;
|
||||
} else {
|
||||
this.publicationInfo.title['name'] = data[1].content;
|
||||
}
|
||||
}
|
||||
|
||||
parsePublicationInfo (data: any):any {
|
||||
this.publicationInfo = new PublicationInfo();
|
||||
if(data[2] != null) {
|
||||
let relation;
|
||||
let length = Array.isArray(data[2]) ? data[2].length : 1;
|
||||
|
||||
if(data[0] != null) {
|
||||
var date:string = (data[0].dateofacceptance)+""; // transform to string in case it is an integer
|
||||
this.publicationInfo.date = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date;
|
||||
this.publicationInfo.dateofacceptance = data[0].dateofacceptance;
|
||||
this.publicationInfo.publisher = data[0].publisher;
|
||||
if(!Array.isArray(data[0].description)) {
|
||||
this.publicationInfo.description = data[0].description;
|
||||
for(let i=0; i<length; i++) {
|
||||
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, "id": string}>();
|
||||
}
|
||||
|
||||
this.publicationInfo.authors[relation.ranking-1] = {"name": "", "id": ""};
|
||||
this.publicationInfo.authors[relation.ranking-1]['name'] = relation.fullname;
|
||||
} else if(relation['to'].class == "isProducedBy") {
|
||||
this.publicationInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.publicationInfo.fundedByProjects, relation, this.publicationInfo.projectsProvenanceVocabulary);
|
||||
} else if(relation['to'].class == "isRelatedTo") {
|
||||
let provenanceAction: string;
|
||||
if(relation.provenanceaction in this.publicationInfo.researchResultsProvenanceVocabulary) {
|
||||
provenanceAction = this.publicationInfo.researchResultsProvenanceVocabulary[relation.provenanceaction];
|
||||
} else {
|
||||
this.publicationInfo.description = data[0].description[0];
|
||||
}
|
||||
this.publicationInfo.embargoEndDate = data[0].embargoenddate;
|
||||
}
|
||||
|
||||
this.publicationInfo.title = {"name": "", "url": "", "accessMode": ""};
|
||||
if(data[0]['bestlicense'].hasOwnProperty("classid")) {
|
||||
this.publicationInfo.title.accessMode = data[0]['bestlicense'].classid;
|
||||
}
|
||||
if(data[1] != null) {
|
||||
|
||||
if(Array.isArray(data[1])) {
|
||||
this.publicationInfo.title['name'] = data[1][0].content;
|
||||
} else {
|
||||
this.publicationInfo.title['name'] = data[1].content;
|
||||
}
|
||||
}
|
||||
|
||||
if(data[2] != null) {
|
||||
let relation;
|
||||
let counter = 0;
|
||||
let length = Array.isArray(data[2]) ? data[2].length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
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, "id": string}>();
|
||||
}
|
||||
|
||||
this.publicationInfo.authors[relation.ranking-1] = {"name": "", "id": ""};
|
||||
this.publicationInfo.authors[relation.ranking-1]['name'] = relation.fullname;
|
||||
/*this.publicationInfo.authors[relation.ranking-1]['id'] = relation['to'].content;*/
|
||||
} else if(relation['to'].class == "isProducedBy") {
|
||||
if(this.publicationInfo.fundedByProjects == undefined) {
|
||||
this.publicationInfo.fundedByProjects = new Array<
|
||||
{ "id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"funding": string, "code": string, "provenanceAction": string, "inline": boolean
|
||||
}>();
|
||||
}
|
||||
|
||||
counter = this.publicationInfo.fundedByProjects.length;
|
||||
|
||||
this.publicationInfo.fundedByProjects[counter] = {
|
||||
"id": "", "acronym": "", "title": "",
|
||||
"funderShortname": "", "funderName": "",
|
||||
"funding": "", "code": "", "provenanceAction": "", "inline": false
|
||||
}
|
||||
|
||||
if(relation.title != 'unidentified') {
|
||||
this.publicationInfo.fundedByProjects[counter]['id'] = relation['to'].content;
|
||||
this.publicationInfo.fundedByProjects[counter]['acronym'] = relation.acronym;
|
||||
this.publicationInfo.fundedByProjects[counter]['title'] = relation.title;
|
||||
this.publicationInfo.fundedByProjects[counter]['code'] = relation.code;
|
||||
let provenanceAction: string = relation.provenanceaction;
|
||||
if( provenanceAction == "sysimport:crosswalk:repository"
|
||||
|| provenanceAction == "sysimport:crosswalk:entityregistry"
|
||||
|| provenanceAction == "sysimport:crosswalk:datasetarchive") {
|
||||
|
||||
this.publicationInfo.fundedByProjects[counter]['provenanceAction'] = "Repository";
|
||||
}
|
||||
else if( provenanceAction == "iis"
|
||||
|| provenanceAction == "sysimport:mining:repository") {
|
||||
this.publicationInfo.fundedByProjects[counter]['provenanceAction'] = "Algorithm";
|
||||
} else if( provenanceAction == "user:claim:pid"
|
||||
|| provenanceAction == "user:claim:search"
|
||||
|| provenanceAction == "user:claim:datacite") {
|
||||
this.publicationInfo.fundedByProjects[counter]['provenanceAction'] = "User";
|
||||
}
|
||||
} else {
|
||||
this.publicationInfo.fundedByProjects[counter]['id'] = "";
|
||||
this.publicationInfo.fundedByProjects[counter]['acronym'] = "";
|
||||
this.publicationInfo.fundedByProjects[counter]['title'] = "";
|
||||
this.publicationInfo.fundedByProjects[counter]['code'] = "";
|
||||
this.publicationInfo.fundedByProjects[counter]['provenanceAction'] = "";
|
||||
}
|
||||
|
||||
if(relation.hasOwnProperty("funding")) {
|
||||
let funding: {"funderName": string, "funderShortname": string, "stream": string};
|
||||
funding = this.parsingFunctions.parseFundingTrees(relation.funding);
|
||||
|
||||
if(funding.funderName) {
|
||||
this.publicationInfo.fundedByProjects[counter]['funderName'] = funding.funderName;
|
||||
}
|
||||
if(funding.funderShortname) {
|
||||
this.publicationInfo.fundedByProjects[counter]['funderShortname'] = funding.funderShortname;
|
||||
}
|
||||
if(funding.stream) {
|
||||
this.publicationInfo.fundedByProjects[counter]['funding'] = funding.stream;
|
||||
}
|
||||
}
|
||||
} 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<string, { "name": string, "id": string, "date": string,
|
||||
"trust": number, "class": string}[]>();
|
||||
}
|
||||
|
||||
if(!this.publicationInfo.relatedResearchResults.has(provenanceAction)) {
|
||||
this.publicationInfo.relatedResearchResults.set(provenanceAction,
|
||||
new Array<{ "name": string, "id": string, "date": string,
|
||||
"trust": number, "class": string}>());
|
||||
}
|
||||
/*
|
||||
if(this.publicationInfo.relatedResearchResults == undefined) {
|
||||
this.publicationInfo.relatedResearchResults = new Array<{
|
||||
"name": string, "id": string, "date": string,
|
||||
"trust": number, "class": string}>();
|
||||
}
|
||||
*/
|
||||
|
||||
counter = this.publicationInfo.relatedResearchResults.get(provenanceAction).length;
|
||||
this.publicationInfo.relatedResearchResults.get(provenanceAction)[counter] = {"name": "", "id": "", "date": "", "trust": null, "class": ""}
|
||||
|
||||
//let url;
|
||||
if(relation['resulttype'].classname == "publication") {
|
||||
//url = OpenaireProperties.getsearchLinkToPublication() + relation['to'].content;
|
||||
this.publicationInfo.relatedResearchResults.get(provenanceAction)[counter]['class'] = "publication";
|
||||
} else {
|
||||
//url = OpenaireProperties.getsearchLinkToDataset() + relation['to'].content;
|
||||
this.publicationInfo.relatedResearchResults.get(provenanceAction)[counter]['class'] = "dataset";
|
||||
}
|
||||
|
||||
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.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) {
|
||||
this.publicationInfo.similarResearchResults = new Array<{
|
||||
"name": string, "id": string, "date": string,
|
||||
"trust": number, "class": string}>();
|
||||
}
|
||||
|
||||
counter = this.publicationInfo.similarResearchResults.length;
|
||||
this.publicationInfo.similarResearchResults[counter] = {"name": "", "id": "", "date": "", "trust": null, "class": ""}
|
||||
|
||||
//let url;
|
||||
if(relation['resulttype'].classname == "publication") {
|
||||
//url = OpenaireProperties.getsearchLinkToPublication() + relation['to'].content;
|
||||
this.publicationInfo.similarResearchResults[counter]['class'] = "publication";
|
||||
} else {
|
||||
//url = OpenaireProperties.getsearchLinkToDataset() + relation['to'].content;
|
||||
this.publicationInfo.similarResearchResults[counter]['class'] = "dataset";
|
||||
}
|
||||
|
||||
this.publicationInfo.similarResearchResults[counter]['id'] = relation['to'].content;
|
||||
//this.publicationInfo.similarResearchResults[counter]['url'] = url;
|
||||
let titleName = Array.isArray(relation['title']) ? relation['title'][0].content : relation['title'].content;
|
||||
this.publicationInfo.similarResearchResults[counter]['name'] = titleName;
|
||||
this.publicationInfo.similarResearchResults[counter]['date'] = relation.dateofacceptance.substring(0,4);;
|
||||
this.publicationInfo.similarResearchResults[counter]['trust'] = Math.round(relation.trust*100);
|
||||
} else if(relation['to'].class == "hasAuthorInstitution") {
|
||||
if(this.publicationInfo.organizations == undefined) {
|
||||
this.publicationInfo.organizations = new Array<{
|
||||
"name": string, "shortname": string,
|
||||
"id": string, "websiteUrl": string,
|
||||
"country": string, "trust": number}>();
|
||||
}
|
||||
|
||||
let organization: {
|
||||
"name": string, "shortname": string,
|
||||
"id": string, "websiteUrl": string,
|
||||
"country": string, "trust": number
|
||||
} = {
|
||||
"name": "", "shortname": "",
|
||||
"id": "", "websiteUrl": "",
|
||||
"country": "", "trust": null
|
||||
};
|
||||
|
||||
organization.id = relation['to'].content;
|
||||
organization.name = relation.legalname;
|
||||
organization.shortname = relation.legalshortname;
|
||||
organization.websiteUrl = relation.websiteurl;
|
||||
if(relation.country) {
|
||||
organization.country = relation.country.classname;
|
||||
}
|
||||
if(relation.trust) {
|
||||
organization.trust = Math.round(relation.trust*100);
|
||||
}
|
||||
|
||||
this.publicationInfo.organizations.push(organization);
|
||||
}
|
||||
}
|
||||
provenanceAction = "Other";
|
||||
}
|
||||
|
||||
if(this.publicationInfo.authors != undefined) {
|
||||
this.publicationInfo.authors = this.publicationInfo.authors.filter(function (item) {
|
||||
return (item != undefined);
|
||||
});
|
||||
}
|
||||
this.publicationInfo.relatedResearchResults = this.parsingFunctions.parseRelatedResearchResults(this.publicationInfo.relatedResearchResults, relation, provenanceAction);
|
||||
} else if(relation['to'].class == "hasAmongTopNSimilarDocuments") {
|
||||
this.publicationInfo.similarResearchResults = this.parsingFunctions.parseSimilarResearchResults(this.publicationInfo.similarResearchResults, relation);
|
||||
} else if(relation['to'].class == "hasAuthorInstitution") {
|
||||
this.publicationInfo.organizations = this.parseRelatedOrganizations(this.publicationInfo.organizations, relation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[3] != null) {
|
||||
if(data[3].hasOwnProperty("instance")) {
|
||||
this.publicationInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>();
|
||||
this.publicationInfo.publishedIn = new Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>();
|
||||
|
||||
this.publicationInfo.types = new Array<string>();
|
||||
|
||||
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 instance;
|
||||
for(let i=0; i<length; i++) {
|
||||
instance = Array.isArray(data[3]['instance']) ? data[3]['instance'][i] : data[3]['instance'];
|
||||
|
||||
if(instance.hasOwnProperty("instancetype")) {
|
||||
if(!types.has(instance['instancetype'].classname)) {
|
||||
this.publicationInfo.types[counter] = instance['instancetype'].classname;
|
||||
types.add(instance['instancetype'].classname);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
if(instance.hasOwnProperty("webresource")) {
|
||||
let url;
|
||||
if(!Array.isArray(instance['webresource'])) {
|
||||
url = instance['webresource'].url;
|
||||
} else{
|
||||
url = instance['webresource'][0].url;
|
||||
}
|
||||
|
||||
if(instance.hasOwnProperty("hostedby")) {
|
||||
if(instance['hostedby'].name != "other resources" && instance['hostedby'].name != "Unknown Repository") {
|
||||
this.parsingFunctions.parseDownloadFrom(this.publicationInfo.downloadFrom, instance, url);
|
||||
} else {
|
||||
counter1 = this.parsingFunctions.parsePublishedIn(this.publicationInfo.publishedIn, instance, data[0], url, counter1);
|
||||
}
|
||||
if(this.publicationInfo.title != undefined) {
|
||||
switch (this.publicationInfo.title['accessMode']) {
|
||||
case undefined:
|
||||
this.publicationInfo.title['accessMode'] = instance['licence'].classid;
|
||||
this.publicationInfo.title['url'] = url;
|
||||
break;
|
||||
case "CLOSED":
|
||||
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(instance['licence'].classid == "OPEN" ||
|
||||
instance['licence'].classid == "EMBARGO") {
|
||||
this.publicationInfo.title['accessMode'] = instance['licence'].classid;
|
||||
this.publicationInfo.title['url'] = url;
|
||||
}
|
||||
break;
|
||||
case "EMBARGO":
|
||||
if(instance['licence'].classid == "OPEN") {
|
||||
this.publicationInfo.title['accessMode'] = instance['licence'].classid;
|
||||
this.publicationInfo.title['url'] = url;
|
||||
}
|
||||
break;
|
||||
case "OPEN":
|
||||
if(instance['licence'].classid == "OPEN" &&
|
||||
this.publicationInfo.title['url'] == "") {
|
||||
this.publicationInfo.title['url'] = url;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[3].hasOwnProperty("externalreference")) {
|
||||
let length = Array.isArray(data[3]['externalreference']) ? data[3]['externalreference'].length : 1;
|
||||
|
||||
let externalreference;
|
||||
for(let i=0; i<length; i++) {
|
||||
externalreference = Array.isArray(data[3]['externalreference']) ? data[3]['externalreference'][i] : data[3]['externalreference'];
|
||||
|
||||
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(externalreference.sitename)) {
|
||||
this.publicationInfo.bioentities.set(externalreference.sitename, new Map<string, string>());
|
||||
}
|
||||
this.publicationInfo.bioentities.get(externalreference.sitename).set(externalreference.refidentifier, externalreference.url);
|
||||
|
||||
} 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": externalreference.sitename, "url": externalreference.url});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[4] != null) {
|
||||
this.publicationInfo.identifiers = new Map<string, string[]>();
|
||||
|
||||
if(data[4].hasOwnProperty("classname") && data[4]['classname'] != "") {
|
||||
if(data[4].classname == "doi" || data[4].classname == "pmc") {
|
||||
if(!this.publicationInfo.identifiers.has(data[4].classname)) {
|
||||
this.publicationInfo.identifiers.set(data[4].classname, new Array<string>());
|
||||
}
|
||||
this.publicationInfo.identifiers.get(data[4].classname).push(data[4].content);
|
||||
}
|
||||
} else {
|
||||
for(let i=0; i<data[4].length; i++) {
|
||||
if(data[4][i].classname == "doi" || data[4][i].classname == "pmc") {
|
||||
if(!this.publicationInfo.identifiers.has(data[4][i].classname)) {
|
||||
this.publicationInfo.identifiers.set(data[4][i].classname, new Array<string>());
|
||||
}
|
||||
this.publicationInfo.identifiers.get(data[4][i].classname).push(data[4][i].content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[5] != null) {
|
||||
this.publicationInfo.journal = {"journal": "", "issn": "", "lissn": ""}
|
||||
|
||||
this.publicationInfo.journal['journal'] = data[5].content;
|
||||
this.publicationInfo.journal['issn'] = data[5].issn;
|
||||
this.publicationInfo.journal['lissn'] = data[5].lissn;
|
||||
}
|
||||
|
||||
if(data[6] != null) {
|
||||
this.publicationInfo.languages = new Array<string>();
|
||||
|
||||
if(data[6].hasOwnProperty("classname")) {
|
||||
if(data[6].classname != "Undetermined") {
|
||||
this.publicationInfo.languages[0] = data[6].classname;
|
||||
}
|
||||
} else {
|
||||
for(let i=0; i<data[6].length; i++) {
|
||||
if(data[6][i].classname != "Undetermined") {
|
||||
this.publicationInfo.languages.push(data[6][i].classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this.publicationInfo.languages != undefined) {
|
||||
console.info("NUMBER OF LANGUAGES: "+this.publicationInfo.languages.length);
|
||||
} else {
|
||||
console.info("NUMBER OF LANGUAGES: 0 -- undefined");
|
||||
}
|
||||
console.info(this.publicationInfo.languages);
|
||||
|
||||
if(data[7] != null) {
|
||||
let subject;
|
||||
let length = Array.isArray(data[7]) ? data[7].length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
subject = Array.isArray(data[7]) ? data[7][i] : data[7];
|
||||
|
||||
if(subject.classid != "") {
|
||||
if(subject.inferred == true) {
|
||||
if(this.publicationInfo.classifiedSubjects == undefined) {
|
||||
this.publicationInfo.classifiedSubjects = new Map<string, string[]>();
|
||||
}
|
||||
|
||||
if(!this.publicationInfo.classifiedSubjects.has(subject.classname)) {
|
||||
this.publicationInfo.classifiedSubjects.set(subject.classname, new Array<string>());
|
||||
}
|
||||
|
||||
this.publicationInfo.classifiedSubjects.get(subject.classname).push(subject.content);
|
||||
} else {
|
||||
if(subject.classid == "keyword") {
|
||||
if(this.publicationInfo.subjects == undefined) {
|
||||
this.publicationInfo.subjects = new Array<string>();
|
||||
}
|
||||
|
||||
this.publicationInfo.subjects.push(subject.content);
|
||||
} else {
|
||||
if(this.publicationInfo.otherSubjects == undefined) {
|
||||
this.publicationInfo.otherSubjects = new Map<string, string[]>();
|
||||
}
|
||||
|
||||
if(!this.publicationInfo.otherSubjects.has(subject.classname)) {
|
||||
this.publicationInfo.otherSubjects.set(subject.classname, new Array<string>());
|
||||
}
|
||||
this.publicationInfo.otherSubjects.get(subject.classname).push(subject.content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[8] != null) {
|
||||
this.publicationInfo.bestlicense = data[8].classid;
|
||||
}
|
||||
|
||||
if(data[9] != null) {
|
||||
this.publicationInfo.collectedFrom = new Array<{"name": string, "id": string}>();
|
||||
|
||||
let collectedFrom;
|
||||
let length = Array.isArray(data[9]) ? data[9].length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
collectedFrom = Array.isArray(data[9]) ? data[9][i] : data[9];
|
||||
//let link = OpenaireProperties.getsearchLinkToDataProvider();
|
||||
this.publicationInfo.collectedFrom[i] = {"name": "", "id": ""};
|
||||
this.publicationInfo.collectedFrom[i]['name'] = collectedFrom.name;
|
||||
this.publicationInfo.collectedFrom[i]['id'] = /*link + */collectedFrom.id;
|
||||
}
|
||||
}
|
||||
|
||||
if( this.publicationInfo.publisher != undefined
|
||||
&& this.publicationInfo.publisher != null
|
||||
&& this.publicationInfo.publisher != ''
|
||||
&& this.publicationInfo.identifiers != null
|
||||
&& this.publicationInfo.identifiers.has('doi')) {
|
||||
|
||||
if( this.publicationInfo.downloadFrom == null) {
|
||||
this.publicationInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>();
|
||||
}
|
||||
|
||||
let key: string;
|
||||
if(this.publicationInfo.journal != undefined && this.publicationInfo.journal.journal != undefined
|
||||
&& this.publicationInfo.journal.journal != null && this.publicationInfo.journal.journal != '') {
|
||||
key = this.publicationInfo.publisher + "/ "+this.publicationInfo.journal['journal'];
|
||||
} else {
|
||||
key = this.publicationInfo.publisher;
|
||||
}
|
||||
this.publicationInfo.downloadFrom.set(key, {"url": null, "accessMode": null, "bestAccessMode": null});
|
||||
|
||||
let url = OpenaireProperties.getDoiURL()+this.publicationInfo.identifiers.get("doi")[0];
|
||||
|
||||
this.publicationInfo.downloadFrom.get(key)['url'] = new Array<string>();
|
||||
this.publicationInfo.downloadFrom.get(key)['accessMode'] = new Array<string>();
|
||||
|
||||
this.publicationInfo.downloadFrom.get(key)['url'][0] = url;
|
||||
this.publicationInfo.downloadFrom.get(key)['accessMode'][0] = "";
|
||||
|
||||
if(this.publicationInfo.title != undefined && this.publicationInfo.title['url'] == "") {
|
||||
this.publicationInfo.title['url'] = url;
|
||||
console.info("title url: by doi");
|
||||
}
|
||||
}
|
||||
|
||||
if(data[10] != null) {
|
||||
this.publicationInfo.references = new Array<{"name": string, "url": string}>();
|
||||
|
||||
let citation;
|
||||
let length = Array.isArray(data[10]) ? data[10].length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
citation = Array.isArray(data[10]) ? data[10][i] : data[10];
|
||||
|
||||
let url;
|
||||
if(citation.hasOwnProperty("id")) {
|
||||
let citationId;
|
||||
let length1 = Array.isArray(citation['id']) ? citation['id'].length : 1;
|
||||
for(let j=0; j<length1; j++) {
|
||||
citationId = Array.isArray(citation['id']) ? citation['id'][j] : citation['id'];
|
||||
|
||||
if(citationId.type == "pmid") {
|
||||
url = OpenaireProperties.getPmidURL()+citationId.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if(data[11] != null) {
|
||||
this.publicationInfo.contexts = new Array<
|
||||
{ "labelContext": string, "labelCategory": string, "labelConcept": string, inline:boolean}>();
|
||||
|
||||
let position = 0;
|
||||
let labels = "";
|
||||
let context;
|
||||
let length = Array.isArray(data[11]) ? data[11].length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
context = Array.isArray(data[11]) ? data[11][i] : data[11];
|
||||
|
||||
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++) {
|
||||
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'] = 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'] = 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'] = context.label;
|
||||
this.publicationInfo.contexts[position]['labelCategory'] = null;
|
||||
this.publicationInfo.contexts[position]['labelConcept'] = null;
|
||||
this.publicationInfo.contexts[position]['new'] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[12] != null && data[12] == "under curation") {
|
||||
this.publicationInfo.underCurationMessage = true;
|
||||
} else {
|
||||
this.publicationInfo.underCurationMessage = false;
|
||||
}
|
||||
|
||||
return this.publicationInfo;
|
||||
if(this.publicationInfo.authors != undefined) {
|
||||
this.publicationInfo.authors = this.publicationInfo.authors.filter(function (item) {
|
||||
return (item != undefined);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if(data[3] != null) {
|
||||
if(data[3].hasOwnProperty("instance")) {
|
||||
this.publicationInfo.downloadFrom = new Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>();
|
||||
this.publicationInfo.publishedIn = new Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>();
|
||||
|
||||
this.publicationInfo.types = new Array<string>();
|
||||
let types = new Set<string>();
|
||||
|
||||
let counter = 0;
|
||||
let instance;
|
||||
|
||||
let length = Array.isArray(data[3]['instance']) ? data[3]['instance'].length : 1;
|
||||
|
||||
for(let i=0; i<length; i++) {
|
||||
instance = Array.isArray(data[3]['instance']) ? data[3]['instance'][i] : data[3]['instance'];
|
||||
|
||||
this.parsingFunctions.parseTypes(this.publicationInfo.types, types, instance);
|
||||
|
||||
if(instance.hasOwnProperty("webresource")) {
|
||||
let url;
|
||||
if(!Array.isArray(instance['webresource'])) {
|
||||
url = instance['webresource'].url;
|
||||
} else{
|
||||
url = instance['webresource'][0].url;
|
||||
}
|
||||
|
||||
if(instance.hasOwnProperty("hostedby")) {
|
||||
if(instance['hostedby'].name != "other resources" && instance['hostedby'].name != "Unknown Repository") {
|
||||
this.parsingFunctions.parseDownloadFrom(this.publicationInfo.downloadFrom, instance, url);
|
||||
} else {
|
||||
counter = this.parsingFunctions.parsePublishedIn(this.publicationInfo.publishedIn, instance, data[0], url, counter);
|
||||
}
|
||||
|
||||
if(this.publicationInfo.title != undefined) {
|
||||
if(!this.publicationInfo.title['url']) {
|
||||
this.publicationInfo.title['url'] = url;
|
||||
}
|
||||
|
||||
if(this.parsingFunctions.changeBestAccessMode(this.publicationInfo.title['accessMode'], instance['licence'].classid)) {
|
||||
this.publicationInfo.title['accessMode'] = instance['licence'].classid;
|
||||
this.publicationInfo.title['url'] = url;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[3].hasOwnProperty("externalreference")) {
|
||||
let externalResults: [Map<string, Map<string, string>>, { "name": string, "url": string}[]] = this.parseBioentitiesAndSoftware(data[3]);
|
||||
this.publicationInfo.bioentities = externalResults[0];
|
||||
this.publicationInfo.software = externalResults[1];
|
||||
}
|
||||
}
|
||||
|
||||
if(data[4] != null) {
|
||||
this.publicationInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[4]);
|
||||
}
|
||||
|
||||
if(data[5] != null) {
|
||||
this.publicationInfo.journal = {"journal": "", "issn": "", "lissn": ""}
|
||||
|
||||
this.publicationInfo.journal['journal'] = data[5].content;
|
||||
this.publicationInfo.journal['issn'] = data[5].issn;
|
||||
this.publicationInfo.journal['lissn'] = data[5].lissn;
|
||||
}
|
||||
|
||||
if(data[6] != null) {
|
||||
this.publicationInfo.languages = new Array<string>();
|
||||
|
||||
if(data[6].hasOwnProperty("classname")) {
|
||||
if(data[6].classname != "Undetermined") {
|
||||
this.publicationInfo.languages[0] = data[6].classname;
|
||||
}
|
||||
} else {
|
||||
for(let i=0; i<data[6].length; i++) {
|
||||
if(data[6][i].classname != "Undetermined") {
|
||||
this.publicationInfo.languages.push(data[6][i].classname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(data[7] != null) {
|
||||
let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>] = this.parsingFunctions.parseAllSubjects(data[7]);
|
||||
this.publicationInfo.subjects = subjectResults[0];
|
||||
this.publicationInfo.otherSubjects = subjectResults[1];
|
||||
this.publicationInfo.classifiedSubjects = subjectResults[2];
|
||||
}
|
||||
|
||||
// if(data[8] != null) {
|
||||
// this.publicationInfo.bestlicense = data[8].classid;
|
||||
// }
|
||||
|
||||
if(data[9] != null) {
|
||||
this.publicationInfo.collectedFrom = this.parsingFunctions.parseCollectedFrom(data[9]);
|
||||
}
|
||||
|
||||
this.publicationInfo.downloadFrom = this.parsingFunctions.addPublisherToDownloadFrom(
|
||||
this.publicationInfo.downloadFrom, this.publicationInfo.publisher,
|
||||
this.publicationInfo.journal, this.publicationInfo.identifiers,
|
||||
this.publicationInfo.title);
|
||||
|
||||
if(data[10] != null) {
|
||||
this.publicationInfo.references = this.parseReferences(data[10]);
|
||||
}
|
||||
|
||||
if(data[11] != null) {
|
||||
this.publicationInfo.contexts = this.parsingFunctions.parseContexts(data[11]);
|
||||
}
|
||||
|
||||
if(data[12] != null && data[12] == "under curation") {
|
||||
this.publicationInfo.underCurationMessage = true;
|
||||
} else {
|
||||
this.publicationInfo.underCurationMessage = false;
|
||||
}
|
||||
|
||||
return this.publicationInfo;
|
||||
}
|
||||
|
||||
parseRelatedOrganizations(organizations: {"name": string, "shortname":string, "id": string, "websiteUrl": string, "country": string, "trust": number}[], relation: any):
|
||||
{"name": string, "shortname":string, "id": string, "websiteUrl": string, "country": string, "trust": number}[] {
|
||||
if(organizations == undefined) {
|
||||
organizations = new Array<{
|
||||
"name": string, "shortname": string,
|
||||
"id": string, "websiteUrl": string,
|
||||
"country": string, "trust": number}>();
|
||||
}
|
||||
|
||||
let organization: { "name": string, "shortname": string,
|
||||
"id": string, "websiteUrl": string,
|
||||
"country": string, "trust": number
|
||||
} = {
|
||||
"name": "", "shortname": "",
|
||||
"id": "", "websiteUrl": "",
|
||||
"country": "", "trust": null
|
||||
};
|
||||
|
||||
organization.id = relation['to'].content;
|
||||
organization.name = relation.legalname;
|
||||
organization.shortname = relation.legalshortname;
|
||||
organization.websiteUrl = relation.websiteurl;
|
||||
if(relation.country) {
|
||||
organization.country = relation.country.classname;
|
||||
}
|
||||
if(relation.trust) {
|
||||
organization.trust = Math.round(relation.trust*100);
|
||||
}
|
||||
|
||||
organizations.push(organization);
|
||||
return organizations;
|
||||
}
|
||||
|
||||
parseBioentitiesAndSoftware(children: any) : [Map<string, Map<string, string>>, { "name": string, "url": string}[]] {
|
||||
let bioentities: Map<string, Map<string, string>>;
|
||||
let software: {"name": string, "url": string}[];
|
||||
|
||||
let length = Array.isArray(children['externalreference']) ? children['externalreference'].length : 1;
|
||||
|
||||
let externalreference;
|
||||
for(let i=0; i<length; i++) {
|
||||
externalreference = Array.isArray(children['externalreference']) ? children['externalreference'][i] : children['externalreference'];
|
||||
|
||||
if(externalreference.hasOwnProperty("qualifier")) {
|
||||
if(externalreference['qualifier'].classid == "accessionNumber") {
|
||||
|
||||
if(bioentities == undefined) {
|
||||
bioentities = new Map<string, Map<string, string>>();
|
||||
}
|
||||
|
||||
if(!bioentities.has(externalreference.sitename)) {
|
||||
bioentities.set(externalreference.sitename, new Map<string, string>());
|
||||
}
|
||||
bioentities.get(externalreference.sitename).set(externalreference.refidentifier, externalreference.url);
|
||||
|
||||
} else if(externalreference['qualifier'].classid == "software") {
|
||||
|
||||
if(software == undefined) {
|
||||
software = new Array<{"name": string, "url": string}>();
|
||||
}
|
||||
|
||||
software.push({"name": externalreference.sitename, "url": externalreference.url});
|
||||
}
|
||||
}
|
||||
}
|
||||
return [bioentities, software];
|
||||
}
|
||||
|
||||
parseReferences(citations: any): {"name": string, "url": string}[] {
|
||||
let references = new Array<{"name": string, "url": string}>();
|
||||
|
||||
let citation;
|
||||
let length = Array.isArray(citations) ? citations.length : 1;
|
||||
for(let i=0; i<length; i++) {
|
||||
citation = Array.isArray(citations) ? citations[i] : citations;
|
||||
|
||||
let url;
|
||||
if(citation.hasOwnProperty("id")) {
|
||||
let citationId;
|
||||
let length1 = Array.isArray(citation['id']) ? citation['id'].length : 1;
|
||||
for(let j=0; j<length1; j++) {
|
||||
citationId = Array.isArray(citation['id']) ? citation['id'][j] : citation['id'];
|
||||
|
||||
if(citationId.type == "pmid") {
|
||||
url = OpenaireProperties.getPmidURL()+citationId.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
references[citation.position-1] = { "name": "", "url": ""};
|
||||
references[citation.position-1]['name'] = citation.rawText;
|
||||
references[citation.position-1]['url'] = url;
|
||||
}
|
||||
return references;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ export class DatasetInfo {
|
|||
date: string;
|
||||
dateofacceptance: string;
|
||||
embargoEndDate: string;
|
||||
type: string;
|
||||
types: string[];
|
||||
downloadFrom: Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>; //key is name
|
||||
publishedIn: Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>; //key is name
|
||||
identifiers: Map<string, string[]>;
|
||||
|
@ -14,12 +14,30 @@ export class DatasetInfo {
|
|||
otherSubjects: Map<string, string[]>;
|
||||
classifiedSubjects: Map<string, string[]>;
|
||||
description: string;
|
||||
bestlicense: string;
|
||||
//bestlicense: string;
|
||||
collectedFrom: { "name": string, "id": string}[];
|
||||
projectsProvenanceVocabulary: { "sysimport:crosswalk:repository": string,
|
||||
"sysimport:crosswalk:entityregistry": string,
|
||||
"sysimport:crosswalk:datasetarchive": string,
|
||||
"iis": string,
|
||||
"sysimport:mining:repository": string,
|
||||
"user:claim:pid": string,
|
||||
"user:claim:search": string,
|
||||
"user:claim:datacite": string
|
||||
} = {
|
||||
"sysimport:crosswalk:repository": "Repository",
|
||||
"sysimport:crosswalk:entityregistry": "Repository",
|
||||
"sysimport:crosswalk:datasetarchive": "Repository",
|
||||
"iis": "Algorithm",
|
||||
"sysimport:mining:repository": "Algorithm",
|
||||
"user:claim:pid": "User",
|
||||
"user:claim:search": "User",
|
||||
"user:claim:datacite": "User"
|
||||
};
|
||||
fundedByProjects: { "id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"funding": string, "code": string, "provenanceAction": string, "inline": boolean}[];
|
||||
provenanceVocabulary: {"iis": string, "sysimport": string, "user": string} = {"iis": "Inferred", "sysimport": "Harvested", "user": "Claimed"};
|
||||
researchResultsProvenanceVocabulary: {"iis": string, "sysimport": string, "user": string} = {"iis": "Inferred", "sysimport": "Harvested", "user": "Claimed"};
|
||||
relatedResearchResults: Map<string, { "name": string, "id": string, "date": string, "trust": number, "class": string}[]>;
|
||||
similarResearchResults: { "name": string, "id": string, "date": string, "trust": number, "class": string}[];
|
||||
contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[];
|
||||
|
|
|
@ -16,8 +16,26 @@ export class PublicationInfo {
|
|||
otherSubjects: Map<string, string[]>;
|
||||
classifiedSubjects: Map<string, string[]>; //<class of subject, subjects>
|
||||
description: string;
|
||||
bestlicense: string;
|
||||
//bestlicense: string;
|
||||
collectedFrom: { "name": string, "id": string}[];
|
||||
projectsProvenanceVocabulary: { "sysimport:crosswalk:repository": string,
|
||||
"sysimport:crosswalk:entityregistry": string,
|
||||
"sysimport:crosswalk:datasetarchive": string,
|
||||
"iis": string,
|
||||
"sysimport:mining:repository": string,
|
||||
"user:claim:pid": string,
|
||||
"user:claim:search": string,
|
||||
"user:claim:datacite": string
|
||||
} = {
|
||||
"sysimport:crosswalk:repository": "Repository",
|
||||
"sysimport:crosswalk:entityregistry": "Repository",
|
||||
"sysimport:crosswalk:datasetarchive": "Repository",
|
||||
"iis": "Algorithm",
|
||||
"sysimport:mining:repository": "Algorithm",
|
||||
"user:claim:pid": "User",
|
||||
"user:claim:search": "User",
|
||||
"user:claim:datacite": "User"
|
||||
};
|
||||
fundedByProjects: { "id": string, "acronym": string, "title": string,
|
||||
"funderShortname": string, "funderName": string,
|
||||
"funding": string, "code": string, "provenanceAction": string,
|
||||
|
@ -28,7 +46,7 @@ export class PublicationInfo {
|
|||
//relatedResearchData: { "name": string, "url": string, "date": string, "trust": number}[];
|
||||
//similarPublications: {"name": string, "url": string, "date": string, "trust": number}[];
|
||||
//similarDatasets: {"name": string, "url": string, "date": string, "trust": number}[];
|
||||
provenanceVocabulary: {"iis": string, "sysimport": string, "user": string} = {"iis": "Inferred", "sysimport": "Harvested", "user": "Claimed"};
|
||||
researchResultsProvenanceVocabulary: {"iis": string, "sysimport": string, "user": string} = {"iis": "Inferred", "sysimport": "Harvested", "user": "Claimed"};
|
||||
relatedResearchResults: Map<string, { "name": string, "id": string, "date": string, "trust": number, "class": string}[]>;
|
||||
similarResearchResults: { "name": string, "id": string, "date": string, "trust": number, "class": string}[];
|
||||
references: { "name": string, "url": string}[];
|
||||
|
|
Loading…
Reference in New Issue