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:
konstantina.galouni 2017-07-07 13:09:59 +00:00
parent 70d980bce3
commit 6a5e1a9fae
11 changed files with 863 additions and 1215 deletions

View File

@ -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() {
}
}

View File

@ -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"

View File

@ -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) {

View File

@ -41,7 +41,7 @@ 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);
@ -84,189 +84,33 @@ export class DatasetService {
}
if(data[2] != null) {
let mydata;
let counter = 0;
let relation;
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") {
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}>();
}
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") {
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(mydata.provenanceaction in this.datasetInfo.provenanceVocabulary) {
provenanceAction = this.datasetInfo.provenanceVocabulary[mydata.provenanceaction];
if(relation.provenanceaction in this.datasetInfo.researchResultsProvenanceVocabulary) {
provenanceAction = this.datasetInfo.researchResultsProvenanceVocabulary[relation.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);
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);
}
}
}
@ -283,70 +127,41 @@ export class DatasetService {
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;
this.datasetInfo.types = new Array<string>();
let types = new Set<string>();
let counter = 0;
let counter1 = 0;
let counter2 = 0;
let mydata;
let instance;
let length = data[3]['instance'].length!=undefined ? data[3]['instance'].length : 1;
for(let i=0; i<length; i++) {
mydata = data[3]['instance'].length!=undefined ? data[3]['instance'][i] : data[3]['instance'];
instance = 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;
}
}
}
this.parsingFunctions.parseTypes(this.datasetInfo.types, types, instance);
if(mydata.hasOwnProperty("webresource")) {
if(instance.hasOwnProperty("webresource")) {
let url;
if(mydata['webresource'].length == undefined) {
url = mydata['webresource'].url;
if(instance['webresource'].length == undefined) {
url = instance['webresource'].url;
} else{
url = mydata['webresource'][0].url;
url = instance['webresource'][0].url;
}
if(mydata.hasOwnProperty("hostedby")) {
if(mydata['hostedby'].name != "other resources" && mydata['hostedby'].name != "Unknown Repository") {
this.parsingFunctions.parseDownloadFrom(this.datasetInfo.downloadFrom, mydata, url);
if(instance.hasOwnProperty("hostedby")) {
if(instance['hostedby'].name != "other resources" && instance['hostedby'].name != "Unknown Repository") {
this.parsingFunctions.parseDownloadFrom(this.datasetInfo.downloadFrom, instance, url);
} else {
counter1 = this.parsingFunctions.parsePublishedIn(this.datasetInfo.publishedIn, mydata, data[0], url, counter1);
counter = this.parsingFunctions.parsePublishedIn(this.datasetInfo.publishedIn, instance, data[0], url, counter);
}
if(this.datasetInfo.title != undefined) {
if(this.datasetInfo.title['url'] == undefined) {
if(!this.datasetInfo.title['url']) {
this.datasetInfo.title['url'] = url;
}
switch (this.datasetInfo.title['licence']) {
case undefined:
this.datasetInfo.title['licence'] = mydata['licence'].classid;
if(this.parsingFunctions.changeBestAccessMode(this.datasetInfo.title['accessMode'], instance['licence'].classid)) {
this.datasetInfo.title['accessMode'] = instance['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;
}
}
}
@ -356,259 +171,45 @@ export class DatasetService {
}
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;
}
}
}
this.datasetInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[4]);
}
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[]>();
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(!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[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;
}
this.datasetInfo.collectedFrom = this.parsingFunctions.parseCollectedFrom(data[7]);
}
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;
}
}
// 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 = 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;
}
}
}
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 && this.datasetInfo.type == undefined) {
// if(data[9].hasOwnProperty('classname')) {
// this.datasetInfo.type = data[9].classname;
// }
// }
if(data[10] != null && data[10] == "under curation") {
if(data[9] != null && data[9] == "under curation") {
this.datasetInfo.underCurationMessage = true;
} else {
this.datasetInfo.underCurationMessage = false;
}
//this.printdatasetInfo();
return this.datasetInfo;
}
printDatasetInfo() {
console.info("DATE: "+this.datasetInfo.date);
console.info("PUBLISHER: "+this.datasetInfo.publisher);
console.info("DESCRIPTION: "+this.datasetInfo.description);
console.info("TITLE: "+this.datasetInfo.title);
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");
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");
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");
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");
console.info("BEST LICENSE: "+this.datasetInfo.bestlicense);
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");
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");
}
}

View File

@ -1,3 +1,4 @@
import {OpenaireProperties} from '../../utils/properties/openaireProperties';
export class ParsingFunctions {
@ -5,6 +6,69 @@ 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": ""};
@ -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)
{
@ -136,14 +248,14 @@ export class ParsingFunctions {
case null:
return true;
case "CLOSED":
if(accessMode == "OPEN" ||
if( accessMode == "OPEN" ||
accessMode == "EMBARGO" ||
accessMode == "RESTRICTED") {
return true;
}
return false;
case "RESTRICTED":
if(accessMode == "OPEN" ||
if( accessMode == "OPEN" ||
accessMode == "EMBARGO") {
return true;
}
@ -157,4 +269,179 @@ export class ParsingFunctions {
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);
}
}
}
}

View File

@ -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});

View File

@ -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>

View File

@ -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')) {

View File

@ -77,8 +77,8 @@ export class PublicationService {
if(data[0]['bestlicense'].hasOwnProperty("classid")) {
this.publicationInfo.title.accessMode = data[0]['bestlicense'].classid;
}
if(data[1] != null) {
if(data[1] != null) {
if(Array.isArray(data[1])) {
this.publicationInfo.title['name'] = data[1][0].content;
} else {
@ -88,7 +88,6 @@ export class PublicationService {
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++) {
@ -101,167 +100,21 @@ export class PublicationService {
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;
}
}
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.provenanceVocabulary) {
provenanceAction = this.publicationInfo.provenanceVocabulary[relation.provenanceaction];
if(relation.provenanceaction in this.publicationInfo.researchResultsProvenanceVocabulary) {
provenanceAction = this.publicationInfo.researchResultsProvenanceVocabulary[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);
this.publicationInfo.relatedResearchResults = this.parsingFunctions.parseRelatedResearchResults(this.publicationInfo.relatedResearchResults, relation, provenanceAction);
} 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);
this.publicationInfo.similarResearchResults = this.parsingFunctions.parseSimilarResearchResults(this.publicationInfo.similarResearchResults, relation);
} 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);
this.publicationInfo.organizations = this.parseRelatedOrganizations(this.publicationInfo.organizations, relation);
}
}
}
@ -279,24 +132,17 @@ export class PublicationService {
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;
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++;
}
}
this.parsingFunctions.parseTypes(this.publicationInfo.types, types, instance);
if(instance.hasOwnProperty("webresource")) {
let url;
@ -310,42 +156,18 @@ export class PublicationService {
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);
counter = this.parsingFunctions.parsePublishedIn(this.publicationInfo.publishedIn, instance, data[0], url, counter);
}
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;
if(!this.publicationInfo.title['url']) {
this.publicationInfo.title['url'] = url;
}
break;
case "RESTRICTED":
if(instance['licence'].classid == "OPEN" ||
instance['licence'].classid == "EMBARGO") {
if(this.parsingFunctions.changeBestAccessMode(this.publicationInfo.title['accessMode'], instance['licence'].classid)) {
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;
}
}
}
}
@ -353,57 +175,14 @@ export class PublicationService {
}
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});
}
}
}
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 = 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);
}
}
}
this.publicationInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[4]);
}
if(data[5] != null) {
@ -429,111 +208,119 @@ export class PublicationService {
}
}
}
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[]>();
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(!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[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;
}
this.publicationInfo.collectedFrom = this.parsingFunctions.parseCollectedFrom(data[9]);
}
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");
}
}
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 = new Array<{"name": string, "url": string}>();
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(data[10]) ? data[10].length : 1;
let length = Array.isArray(citations) ? citations.length : 1;
for(let i=0; i<length; i++) {
citation = Array.isArray(data[10]) ? data[10][i] : data[10];
citation = Array.isArray(citations) ? citations[i] : citations;
let url;
if(citation.hasOwnProperty("id")) {
@ -548,61 +335,10 @@ export class PublicationService {
}
}
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;
references[citation.position-1] = { "name": "", "url": ""};
references[citation.position-1]['name'] = citation.rawText;
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;
return references;
}
}

View File

@ -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}[];

View File

@ -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}[];