101 lines
3.7 KiB
TypeScript
101 lines
3.7 KiB
TypeScript
//Classes used in linking / inlinelinking when selecting an entity
|
|
export class ClaimResult{
|
|
public id: string;
|
|
public type: string;
|
|
public source: string;
|
|
public title: string;
|
|
public url: string;
|
|
public result: any;
|
|
public accessRights: string = "OPEN";
|
|
public embargoEndDate: string;
|
|
public date: string;
|
|
public authors: string[] =[];
|
|
public publisher: string;
|
|
public description: string;
|
|
public resourceType:string;
|
|
|
|
public static generateResult(item, itemId,itemSource,itemType, itemUrl, itemTitle, date, accessmode){
|
|
|
|
var result: ClaimResult = new ClaimResult();
|
|
result.id = itemId;
|
|
result.type = itemType;
|
|
result.source = itemSource;
|
|
|
|
result.title = (Array.isArray(itemTitle) && itemTitle.length > 0 )?itemTitle[0]:itemTitle;
|
|
result.url = itemUrl;
|
|
result.accessRights = 'OPEN';
|
|
result.date = date;
|
|
result.result = item;
|
|
if(item.publisher){
|
|
result.publisher = item.publisher;
|
|
}
|
|
|
|
if(itemSource == 'datacite'){
|
|
|
|
result.publisher = item.attributes['container-title'];
|
|
if(item.attributes.author){
|
|
result.authors =[]
|
|
for(var i=0; i< item.attributes.author.length; i++){
|
|
result.authors.push((item.attributes.author[i].family)?item.attributes.author[i].family+', '+item.attributes.author[i].given:item.attributes.author[i].literal);
|
|
}
|
|
}
|
|
|
|
// result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date : date};
|
|
}else if (itemSource == 'openaire'){
|
|
//TODO put right access rights
|
|
// result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessMode, embargoEndDate: this.nextDate, date: date};
|
|
// result = {id:itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: accessmode, embargoEndDate: this.nextDate, date : date};
|
|
result.embargoEndDate = accessmode;
|
|
|
|
}else if(itemSource == 'crossref'){
|
|
date = (date == null) ? null : date.substring(0,10);
|
|
result.date = date;
|
|
result.resourceType = item.type;
|
|
result.description = item.abstract;
|
|
if(item.author){
|
|
result.authors =[]
|
|
for(var i=0; i< item.author.length; i++){
|
|
result.authors.push(item.author[i].family +" "+ item.author[i].given );
|
|
}
|
|
}
|
|
// result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date: date};
|
|
}else if (itemSource == 'orcid'){
|
|
date = (date == null) ? null : date + "-01.-01"
|
|
result.date = date;
|
|
if(item['work-type']){
|
|
result.resourceType = item.type;
|
|
|
|
}
|
|
if(item.contributors){
|
|
result.authors =[]
|
|
for(var i=0; i< item.contributors.length; i++){
|
|
result.authors.push(item.contributors[i]);
|
|
}
|
|
}
|
|
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
export class ClaimProject{
|
|
public funderId: string;
|
|
public funderName: string;
|
|
public projectId: string;
|
|
public projectName: string;
|
|
public projectAcronym: string;
|
|
public startDate: string;
|
|
public endDate: string;
|
|
public code: string;
|
|
public jurisdiction: string;
|
|
public fundingLevel0: string;
|
|
|
|
|
|
}
|
|
|
|
export class ClaimContext{
|
|
public community: string;
|
|
public category: string;
|
|
public concept:any;
|
|
|
|
}
|