Compare commits

...

16 Commits

Author SHA1 Message Date
Konstantina Galouni 387692c03a [new-search-json | DONE | CHANGED]: searchFields.base.ts: Removed from facets and advanced filters fields "projectkeywords", "datasourceodcontenttypes", "datasourceodsubjects". 2024-10-30 13:45:43 +02:00
Konstantina Galouni c697f4b27d Merge develop branch into new-search-json 2024-10-29 16:25:17 +02:00
Konstantina Galouni 83f547aca5 [new-search-json | WIP | CHANGED]: Updated parsing according to new json schema - parsingFunctions.class.ts & deletedByInference.component.ts: Parse header.recordType field instead of result.resulttype. 2024-10-29 15:18:48 +02:00
Konstantina Galouni 01ccbb9d68 [new-search-json | WIP | CHANGED]: Updated parsing according to new json schema.
1. dataProviderInfo.ts: Updated field "contentpolicy: string;" to "contentpolicies: string[];".
2. dataProvider.service.ts: Parse contentPolicies field as array.
3. dataProvider.component.html: Display contentpolicies array.
4. searchResearchResults.service.ts: Parse field "entityType" from header.recordType instead of result.resulttype.
5. resultLanding.service.ts: Parse field "entityType" from header.recordType instead of result.resulttype | Parse header.status (not yet available field) for under curation records | [BUG] Parse field externalReference instead of externalreference.
6. searchOrganizations.service.ts: [BUG] Get "pid" field from correct path.
7. parsingFunctions.class.ts: [BUG] Fix parsing of measures - unit is an array.
2024-10-29 14:08:54 +02:00
argirok 61c60eff60 [develop | ADDED| CHANGED ] add test search API, add local widget url 2024-10-29 13:19:26 +02:00
argirok 6a4ffbe875 [new-search-json | CHANGED | DONE ] fix claims date, update check if claim is pending or available 2024-10-29 10:05:58 +02:00
argirok 25bae3caeb [develop | CHANGED | DONE] add in properties new claims api with new json parse 2024-10-25 18:01:07 +03:00
Konstantina Galouni 6b0c581920 [new-search-json | WIP | CHANGED]: Updated parsing according to new json schema.
1. open-aire-jsonld-converter.service.ts: On method "getLicense()", added statically schema: "dnet:access_modes" for bestaccessright.
2. searchResearchResults.service.ts: [BUG] Removed "/" after search service url (duplicate /) | Updated parsing of "measures" field | Updated parsing of "pid" field | Added parsing of orcid_pending.
3. searchProjects.service.ts: Updated parsing of "measures" field.
4. searchOrganizations.service.ts: Updated parsing of project links (relations).
5. searchDataproviders.service.ts: Updated parsing of "measures" field.
6. resultLanding.service.ts: Added parsing of orcid_pending | Added parsing of "externalreference" field and updated method "parseBioentitiesAndSoftware()" | Updated parsing of "measures" field | Added parsing of resultService links (relation).
7. project.service.ts: Updated parsing of "measures" field.
8. dataProvider.service.ts: Updated parsing of "measures" field | Updated parsing of "contentpolicies" field.
9. parsingFunctions.class.ts: Use identifierTypes array with ids/codes | Updated parsing of "accessRight" field | Updated parsing in method "parseDatasources()" | Updated parsing of "pid" field in method "parseIdentifiers()" | Updated parsing of "measures" field in method "parseMeasures()".
2024-10-23 18:57:15 +03:00
Konstantina Galouni 945a8b1c90 [new-search-json | WIP | CHANGED]: open-aire-jsonld-converter.service.ts: Updated parsing according to new json schema. 2024-10-22 13:20:10 +03:00
Konstantina Galouni a8e2a509d5 [new-search-json | WIP | CHANGED]: Updated parsing according to new json schema.
1. dataProvider.service.ts: Parse jurisdiction (label instead of classname) according to new schema.
2. organization/deletedByInference/deletedByInference.service.ts & result/deletedByInference/deletedByInference.service.ts: Not used - added @deprecated annotation to methods "getDeletedByInferenceResults()" and "parseDeletedByInferenceResults()".
3. project.service.ts: Added @deprecated annotation to method "getHTMLInfo()".
4. result/deletedByInference/deletedByInference.component.ts: Updated parsing of versions (previously children, now links with relations "merges") according to new json schema.
5. resultLanding.component.html: In <deletedByInference> updated parameter [id]="resultLandingInfo.record['header']['id']".
6. resultLanding.service.ts: Exclude relation "merges" from the related research.
7. organization.service.ts: Updated parsing according to new json schema for methods "getOrganizationNameAndUrlById()" and "parseOrganizationNameAndUrl()".
8. searchDataproviders.service.ts: Updated parsing of "eosctype" field and added TODO comment to check if parsing is correct.
9. searchOrganizations.service.ts: Added @deprecated annotation to method "parseResultsForDeposit()".
10. searchProjects.service.ts: Removed a console.log.
11. entitiesAutoComplete.component.ts: Commented @Input() public depositType:string and everything related to it.
12. entitySearch.service.ts: Added @deprecated annotation to method "searchByDepositType()" | Updated parsing according to new json schema for methods "searchByType()", "fetchByType()", "parse()".
2024-10-21 15:30:44 +03:00
Konstantina Galouni ccdf2f16dc Merge remote-tracking branch 'origin/develop' into new-search-json 2024-10-17 14:56:41 +03:00
Konstantina Galouni 7f7d0f859b [new-search-json | WIP | CHANGED]: Updated parsing according to new json schema.
1. dataProvider.component.ts: [BUG] Added check if provenanceUrls exist.
2. dataProvider.service.ts: Updated parsing of datasource by id according to new json schema.
3. entity-metadata.component.ts: [BUG] Updated checks to show label for openAccessMandatePublications and openAccessMandateDatasets.
4. parsingFunctions.class.ts: Updated parsing methods according to the new json schema.
5. project.component.ts: [BUG] Html downloaded file headers consistency issue.
6. project.service.ts: Updated parsing of project by id according to new json schema.
7. resultLanding.service.ts: Updated parsing of result by id according to new json schema.
8. organization.service.ts & searchDataproviders.service.ts & searchOrganizations.service.ts & searchProjects.service.ts: Updated parsing checks for consistency.
9. searchResearchResults.service.ts: Updated parsing methods according to the new json schema.
2024-10-17 13:14:52 +03:00
argirok f675fba83b [new-search-json | WIP ] continue parsing research results, start parsing result landing 2024-10-09 09:54:41 +03:00
argirok 187444bb09 [new-search-json | WIP ] continue parsing research results 2024-10-08 15:28:30 +03:00
argirok 89dcbb7c8f [new-search-json| WIP ] start parsing for search research results 2024-10-08 12:04:33 +03:00
Konstantina Galouni 82e8551129 [new-search-json | WIP | CHANGED]: Updated parsing of organizations, projects (landing & search) and search data sources according to new JSON response schema. 2024-10-07 16:20:12 +03:00
27 changed files with 1707 additions and 1865 deletions

View File

@ -102,7 +102,7 @@
</div>
<div>
<span class="uk-text-meta">Claimed date:</span>
<span class="uk-margin-xsmall-left">{{claim.date}}</span>
<span class="uk-margin-xsmall-left">{{claim.date | date :'MMM d, y h:mm:ss a'}}</span>
</div>
</div>
</div>

View File

@ -373,7 +373,9 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
if (claimDateStr < lastUpdateDateStr) {
return true;
} else {
return claim.target.collectedFrom != "infrastruct_::openaire";
//TODO uncomment when direct index API supports json
// return claim.target.collectedFrom != "infrastruct_::openaire";
return false;
}
}

View File

@ -617,9 +617,9 @@
{{dataProviderInfo.jurisdiction}}
</div>
<div *ngIf="dataProviderInfo.contentpolicy" class="uk-margin-medium-bottom">
<div *ngIf="dataProviderInfo.contentpolicies?.length > 0" class="uk-margin-medium-bottom">
<div class="uk-text-meta uk-margin-small-bottom">Content policy</div>
{{dataProviderInfo.contentpolicy}}
{{dataProviderInfo.contentpolicies.join(", ")}}
</div>
</ng-container>

View File

@ -921,7 +921,7 @@ export class DataProviderComponent {
}
public getProvenanceUrls() {
this.provenanceUrls = Array.from(this.dataProviderInfo.provenance.values()).map(res => res['url']).reduce((acc, val) => acc.concat(val), []);
this.provenanceUrls = this.dataProviderInfo.provenance ? Array.from(this.dataProviderInfo.provenance.values()).map(res => res['url']).reduce((acc, val) => acc.concat(val), []) : [];
}
public getTypeName(): string {

View File

@ -47,17 +47,6 @@ export class DataProviderService {
return res;
}
}))
.pipe(map(res => [res['result']['metadata']['oaf:entity'], res]))
.pipe(map(res => [
res[0]['oaf:datasource'], // 0
res[0]['oaf:datasource']['datasourcetype'], // 1
res[0]['oaf:datasource']['openairecompatibility'], // 2
res[0]['oaf:datasource']['collectedfrom'], // 3
res[0]['oaf:datasource']['accessinfopackage'], // 4
res[0]['oaf:datasource']['rels']['rel'], // 5
res[0]['oaf:datasource']['journal'], // 6
res[1] // 7
]))
.pipe(map(res => this.parseDataProviderInfo(res)));
}
@ -136,242 +125,240 @@ export class DataProviderService {
}
parseDataProviderInfo (data: any):any {
this.dataProviderInfo = new DataProviderInfo();
if(data == null) {
return null;
}
this.dataProviderInfo.record = data[7];
this.dataProviderInfo.objIdentifier = data[7]["result"]["header"]["dri:objIdentifier"];
this.dataProviderInfo.relcanId = ParsingFunctions.parseRelCanonicalId(this.dataProviderInfo.record, "datasource");
this.dataProviderInfo = new DataProviderInfo();
this.dataProviderInfo.record = data;
if(data[0] != null) {
this.dataProviderInfo.title = {"name": "", "url": data[0].websiteurl};
if(data[0].officialname) {
this.dataProviderInfo.title.name = StringUtils.HTMLToString(String(data[0].officialname));
this.dataProviderInfo.officialName = StringUtils.HTMLToString(String(data[0].officialname));
}
if(data[0].englishname) {
this.dataProviderInfo.title.name = StringUtils.HTMLToString(String(data[0].englishname));
}
if(data["header"]) {
this.dataProviderInfo.objIdentifier = data["header"]["id"];
// TODO: type for canonnical should be datasource or service???
this.dataProviderInfo.relcanId = ParsingFunctions.parseRelCanonicalId(this.dataProviderInfo.record, "datasource");
}
var pattern = /.{12}::.+/;
var originalIds =(data[0].originalId)?data[0].originalId:"";
if(originalIds) {
let provenances = new DataproviderProvenance().provenance;
this.dataProviderInfo.provenance = new Map<string, { "url": string[], "name" }>();
if(data["datasource"]) {
let datasource = data["datasource"];
const idRegex = RegExp('[^'+'::'+']*$');
let length = Array.isArray(originalIds) ? originalIds.length : 1;
for (let i = 0; i < length; i++) {
var originalId = Array.isArray(originalIds) ? originalIds[i] : originalIds;
var matched = originalId.match(pattern);
if (matched && originalId && originalId != "") {
// if (originalId.indexOf("opendoar____::") != -1) {
// this.dataProviderInfo.openDoarId = originalId.split("opendoar____::")[1];
// } else if (originalId.indexOf("re3data_____::") != -1) {
// this.dataProviderInfo.r3DataId = originalId.split("re3data_____::")[1];
// }
let prefix = originalId.substr(0, 14);
if(provenances.has(prefix)) {
let provenance = provenances.get(prefix);
if(this.dataProviderInfo.provenance.has(provenance.name)) {
this.dataProviderInfo.provenance.get(provenance.name).url.push(provenance.urlPrefix + idRegex.exec(originalId)[0]);
} else {
this.dataProviderInfo.provenance.set(provenance.name, {"url": [provenance.urlPrefix + idRegex.exec(originalId)[0]]})
}
// var replace = "/[^"+"::"+"]*$/";
// var re = new RegExp(replace,"g");
//
// console.log(re.exec(originalId)[0]);
}
this.dataProviderInfo.originalId = originalId;
}
}
}
this.dataProviderInfo.subjects = [];
if(data[0].subjects) {
let length = Array.isArray(data[0]['subjects']) ? data[0]['subjects'].length : 1;
for (let i = 0; i < length; i++) {
let subject = Array.isArray(data[0]['subjects']) ? data[0]['subjects'][i] : data[0]['subjects'];
if (subject && subject.content) {
this.dataProviderInfo.subjects.push(subject.content);
}
}
}
// if(!Array.isArray(data[0]['description'])) {
// this.dataProviderInfo.description = (data[0]['description']) ? String(data[0]['description']) : "";
// } else {
// this.dataProviderInfo.description = (data[0]['description'][0]) ? String(data[0]['description'][0]) : "";
// }
this.dataProviderInfo.description = this.parsingFunctions.parseDescription(data[0] && data[0].description?data[0].description:[]);
this.dataProviderInfo.thematic = data[0].thematic;
if(data[0].jurisdiction != null) {
this.dataProviderInfo.jurisdiction = data[0].jurisdiction.classname;
}
if(data[0].contentpolicy != null) {
this.dataProviderInfo.contentpolicy = data[0].contentpolicy.classname;
}
if(data[0].pid != null) {
this.dataProviderInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[0].pid);
}
this.dataProviderInfo.title = {"name": "", "url": datasource.websiteurl};
if(datasource.officialname) {
this.dataProviderInfo.title.name = StringUtils.HTMLToString(String(datasource.officialname));
this.dataProviderInfo.officialName = StringUtils.HTMLToString(String(datasource.officialname));
}
if(datasource.englishname) {
this.dataProviderInfo.title.name = StringUtils.HTMLToString(String(datasource.englishname));
}
if(data[1] != null) {
this.dataProviderInfo.type = data[1].classname;
var pattern = /.{12}::.+/;
var originalIds =(datasource.originalId)?datasource.originalId:"";
if(originalIds) {
let provenances = new DataproviderProvenance().provenance;
this.dataProviderInfo.provenance = new Map<string, { "url": string[], "name" }>();
if(data[1].classid == "entityregistry" || data[1].classid == "entityregistry::projects" || data[1].classid == "entityregistry::repositories") {
this.dataProviderInfo.registry = true;
} else {
this.dataProviderInfo.registry = false;
}
const idRegex = RegExp('[^'+'::'+']*$');
if(this.dataProviderInfo.tabs == undefined) {
this.dataProviderInfo.tabs = new Array<{"name": string, "content": string}>();
}
this.dataProviderInfo.tabs = [];
if(this.dataProviderInfo.tabsInTypes.publicationsTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": OpenaireEntities.PUBLICATIONS, "content": "publicationsTab"});
this.dataProviderInfo.tabs2.push(OpenaireEntities.PUBLICATIONS);
}
if(this.dataProviderInfo.tabsInTypes.datasetsTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": OpenaireEntities.DATASETS, "content": "datasetsTab"});
this.dataProviderInfo.tabs2.push(OpenaireEntities.DATASETS);
}
let length = Array.isArray(originalIds) ? originalIds.length : 1;
if(this.dataProviderInfo.tabsInTypes.projectsTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": OpenaireEntities.PROJECTS, "content": "projectsTab"});
this.dataProviderInfo.tabs2.push(OpenaireEntities.PROJECTS);
}
if(this.dataProviderInfo.tabsInTypes.datasourcesTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": OpenaireEntities.DATASOURCES, "content": "datasourcesTab"});
this.dataProviderInfo.tabs2.push(OpenaireEntities.DATASOURCES);
}
for (let i = 0; i < length; i++) {
var originalId = Array.isArray(originalIds) ? originalIds[i] : originalIds;
var matched = originalId.match(pattern);
if(this.dataProviderInfo.tabsInTypes.relatedDatasourcesTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": "Related "+OpenaireEntities.DATASOURCES, "content": "relatedDatasourcesTab"});
this.dataProviderInfo.tabs2.push("Related "+OpenaireEntities.DATASOURCES);
if (matched && originalId && originalId != "") {
let prefix = originalId.substr(0, 14);
if(provenances.has(prefix)) {
let provenance = provenances.get(prefix);
if(this.dataProviderInfo.provenance.has(provenance.name)) {
this.dataProviderInfo.provenance.get(provenance.name).url.push(provenance.urlPrefix + idRegex.exec(originalId)[0]);
} else {
this.dataProviderInfo.provenance.set(provenance.name, {"url": [provenance.urlPrefix + idRegex.exec(originalId)[0]]})
}
}
this.dataProviderInfo.originalId = originalId;
}
}
}
if(this.dataProviderInfo.tabsInTypes.statisticsTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": "Statistics", "content": "statisticsTab"});
this.dataProviderInfo.tabs2.push("Statistics");
this.dataProviderInfo.subjects = [];
if(datasource.subjects) {
let length = Array.isArray(datasource['subjects']) ? datasource['subjects'].length : 1;
for (let i = 0; i < length; i++) {
let subject = Array.isArray(datasource['subjects']) ? datasource['subjects'][i] : datasource['subjects'];
if (subject && subject.content) {
this.dataProviderInfo.subjects.push(subject.content);
}
}
}
if(this.dataProviderInfo.tabsInTypes.softwareTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": OpenaireEntities.SOFTWARE, "content": "softwareTab"});
this.dataProviderInfo.tabs2.push(OpenaireEntities.SOFTWARE);
}
this.dataProviderInfo.description = this.parsingFunctions.parseDescription(datasource && datasource.description?datasource.description:[]);
if(this.dataProviderInfo.tabsInTypes.orpsTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": OpenaireEntities.OTHER, "content": "orpsTab"});
this.dataProviderInfo.tabs2.push(OpenaireEntities.OTHER);
}
this.dataProviderInfo.thematic = datasource.thematic;
if(this.dataProviderInfo.tabsInTypes.metricsTab.has(data[1].classid)) {
this.dataProviderInfo.tabs.push({"name": "Metrics", "content": "metricsTab"});
this.dataProviderInfo.tabs2.push("Metrics");
}
if(datasource.jurisdiction) {
this.dataProviderInfo.jurisdiction = datasource.jurisdiction.label;
}
if(this.dataProviderInfo.resultTypes.collectedFrom.has(data[1].classid)) {
this.dataProviderInfo.resultsBy = "collectedFrom";
} else if(this.dataProviderInfo.resultTypes.hostedBy.has(data[1].classid)) {
this.dataProviderInfo.resultsBy = "hostedBy";
if(datasource.contentpolicies) {
this.dataProviderInfo.contentpolicies = [];
datasource.contentpolicies.forEach(contentpolicy => {
if(contentpolicy.label) {
this.dataProviderInfo.contentpolicies.push(contentpolicy.label);
}
})
}
if(datasource['datasourcetype']) {
let datasourcetype = datasource['datasourcetype'];
this.dataProviderInfo.type = datasourcetype.label;
if(datasourcetype.code == "entityregistry" || datasourcetype.code == "entityregistry::projects" || datasourcetype.code == "entityregistry::repositories") {
this.dataProviderInfo.registry = true;
} else {
this.dataProviderInfo.registry = false;
}
// if(this.dataProviderInfo.tabs == undefined) {
// this.dataProviderInfo.tabs = new Array<{"name": string, "content": string}>();
// }
// this.dataProviderInfo.tabs = [];
// if(this.dataProviderInfo.tabsInTypes.publicationsTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": OpenaireEntities.PUBLICATIONS, "content": "publicationsTab"});
// this.dataProviderInfo.tabs2.push(OpenaireEntities.PUBLICATIONS);
// }
// if(this.dataProviderInfo.tabsInTypes.datasetsTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": OpenaireEntities.DATASETS, "content": "datasetsTab"});
// this.dataProviderInfo.tabs2.push(OpenaireEntities.DATASETS);
// }
//
// if(this.dataProviderInfo.tabsInTypes.projectsTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": OpenaireEntities.PROJECTS, "content": "projectsTab"});
// this.dataProviderInfo.tabs2.push(OpenaireEntities.PROJECTS);
// }
// if(this.dataProviderInfo.tabsInTypes.datasourcesTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": OpenaireEntities.DATASOURCES, "content": "datasourcesTab"});
// this.dataProviderInfo.tabs2.push(OpenaireEntities.DATASOURCES);
// }
//
// if(this.dataProviderInfo.tabsInTypes.relatedDatasourcesTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": "Related "+OpenaireEntities.DATASOURCES, "content": "relatedDatasourcesTab"});
// this.dataProviderInfo.tabs2.push("Related "+OpenaireEntities.DATASOURCES);
// }
//
// if(this.dataProviderInfo.tabsInTypes.statisticsTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": "Statistics", "content": "statisticsTab"});
// this.dataProviderInfo.tabs2.push("Statistics");
// }
//
// if(this.dataProviderInfo.tabsInTypes.softwareTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": OpenaireEntities.SOFTWARE, "content": "softwareTab"});
// this.dataProviderInfo.tabs2.push(OpenaireEntities.SOFTWARE);
// }
//
// if(this.dataProviderInfo.tabsInTypes.orpsTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": OpenaireEntities.OTHER, "content": "orpsTab"});
// this.dataProviderInfo.tabs2.push(OpenaireEntities.OTHER);
// }
//
// if(this.dataProviderInfo.tabsInTypes.metricsTab.has(data[1].classid)) {
// this.dataProviderInfo.tabs.push({"name": "Metrics", "content": "metricsTab"});
// this.dataProviderInfo.tabs2.push("Metrics");
// }
if(this.dataProviderInfo.resultTypes.collectedFrom.has(datasourcetype.code)) {
this.dataProviderInfo.resultsBy = "collectedFrom";
} else if(this.dataProviderInfo.resultTypes.hostedBy.has(datasourcetype.code)) {
this.dataProviderInfo.resultsBy = "hostedBy";
}
}
if(!this.dataProviderInfo.registry) {
if(data[2] != null) {
this.dataProviderInfo.compatibility = {"info": "", "name": "", "id": ""};
this.dataProviderInfo.compatibility.info = data[2].classname;
//this.dataProviderInfo.compatibility = data[2].classname;
let compatibility = datasource['openairecompatibility'];
if(compatibility) {
this.dataProviderInfo.compatibility = {"info": "", "name": "", "id": ""};
this.dataProviderInfo.compatibility.info = compatibility.label;
}
if(compatibility != null && compatibility.code == "hostedBy" && datasource['collectedfrom'] != null) {
this.dataProviderInfo.compatibility.name = datasource['collectedfrom'].dsName;
this.dataProviderInfo.compatibility.id = datasource['collectedfrom'].dsId;
if(this.dataProviderInfo.compatibility.name) {
this.dataProviderInfo.compatibility.info = "Collected from ";
}
}
if(datasource['accessinfopackage']) {
let oaiPmhURL:string;
oaiPmhURL = Array.isArray(datasource['accessinfopackage']) ? datasource['accessinfopackage'][0]:datasource['accessinfopackage'];
if(oaiPmhURL != '' && oaiPmhURL != 'unknown') {
this.dataProviderInfo.oaiPmhURL = oaiPmhURL;
}
}
}
if(datasource['journal']) {
let journal = datasource['journal'];
this.dataProviderInfo.journal = {"journal": "", "issn": "", "lissn": "", "eissn": ""};
this.dataProviderInfo.journal['journal'] = journal.name;
this.dataProviderInfo.journal['issn'] = journal['issnPrinted'];
this.dataProviderInfo.journal['lissn'] = journal['issnLinking'];
this.dataProviderInfo.journal['eissn'] = journal['issnOnline'];
}else {
this.dataProviderInfo.journal = null;
}
}
if(data['pid']) {
this.dataProviderInfo.identifiers = this.parsingFunctions.parseIdentifiers(data.pid);
}
if(data['links']) {
let links = data['links'];
let relLength = Array.isArray(links) ? links.length : 1;
let counter: number = 0;
let countriesSet: Set<string>;
for (let i = 0; i < relLength; i++) {
let relation = Array.isArray(links) ? links[i] : links;
if (relation["header"] && relation["header"].relationClass && relation['header'].relationClass.toLowerCase() == "isprovidedby" && relation['header'].relatedRecordType == "organization") {
if (this.dataProviderInfo.organizations.length == 0) {
this.dataProviderInfo.countries = new Array<string>();
countriesSet = new Set<string>();
}
if(data[2] != null && data[2].classid == "hostedBy" && data[3] != null) {
this.dataProviderInfo.compatibility.name = data[3].name;
this.dataProviderInfo.compatibility.id = data[3].id;
this.dataProviderInfo.organizations[counter] = {"acronym": "", "name": "", "id": ""};
this.dataProviderInfo.organizations[counter]['id'] = relation['header'].relatedIdentifier;
if(this.dataProviderInfo.compatibility.name) {
this.dataProviderInfo.compatibility.info = "Collected from ";
if (relation["legalshortname"]) {
this.dataProviderInfo.organizations[counter]['acronym'] = relation.legalshortname;
}
if (relation["legalname"]) {
this.dataProviderInfo.organizations[counter]['name'] = relation.legalname;
}
if (!this.dataProviderInfo.organizations[counter]['acronym'] && !this.dataProviderInfo.organizations[counter]['name']) {
// acronym is displayed with link and name only in tooltip
this.dataProviderInfo.organizations[counter]['acronym'] = "[no title available]";
}
if (relation['header'].country && relation['header']['country'].label) {
if (!countriesSet.has(relation['header']['country'].label)) {
this.dataProviderInfo.countries.push(relation['header']['country'].label);
countriesSet.add(relation['header']['country'].label);
}
}
if(data[4] != null) {
let oaiPmhURL:string;
oaiPmhURL = Array.isArray(data[4]) ? data[4][0]:data[4];
if(oaiPmhURL != '' && oaiPmhURL != 'unknown') {
this.dataProviderInfo.oaiPmhURL = oaiPmhURL;
}
}
counter++;
}
}
}
if(data[5] != null) {
let mydata;
let counter = 0;
let countriesSet: Set<string>;
let length = data[5].length!=undefined ? data[5].length : 1;
for(let i=0; i<length; i++) {
mydata = data[5].length!=undefined ? data[5][i] : data[5];
if(mydata.hasOwnProperty("to")) {
if(mydata['to'].class && mydata['to'].class.toLowerCase() == "isprovidedby" && mydata['to'].type == "organization") {
//if(this.dataProviderInfo.organizations == undefined) {
if(this.dataProviderInfo.organizations.length == 0) {
//this.dataProviderInfo.organizations = new Array<{"name": string, "url": string}>();
this.dataProviderInfo.countries = new Array<string>();
countriesSet = new Set<string>();
}
this.dataProviderInfo.organizations[counter] = {"acronym": "", "name": "", "id": ""};
//this.dataProviderInfo.organizations[counter]['name'] = (mydata.legalname ? mydata.legalname : "[no title available");
this.dataProviderInfo.organizations[counter]['id'] = mydata['to'].content;
if(mydata.hasOwnProperty("legalshortname")) {
this.dataProviderInfo.organizations[counter]['acronym'] = mydata.legalshortname;
}
if(mydata.hasOwnProperty("legalname")) {
this.dataProviderInfo.organizations[counter]['name'] = mydata.legalname;
}
if(!this.dataProviderInfo.organizations[counter]['acronym'] && !this.dataProviderInfo.organizations[counter]['name']){
// acronym is displayed with link and name only in tooltip
this.dataProviderInfo.organizations[counter]['acronym'] = "[no title available]";
}
if(mydata.country != '' && mydata['country'].classname != '') {
if(!countriesSet.has(mydata['country'].classname)) {
this.dataProviderInfo.countries.push(mydata['country'].classname);
countriesSet.add(mydata['country'].classname);
}
}
counter++;
}
}
}
}
if(data[6] != null) {
this.dataProviderInfo.journal = {"journal": "", "issn": "", "lissn": "", "eissn": ""};
this.dataProviderInfo.journal['journal'] = data[6].content;
this.dataProviderInfo.journal['issn'] = data[6]['issn'];
this.dataProviderInfo.journal['lissn'] = data[6]['lissn'];
this.dataProviderInfo.journal['eissn'] = data[6]['eissn'];
}else {
this.dataProviderInfo.journal = null;
// this.dataProviderInfo.journal = {"journal": "", "issn": "", "lissn": "", "eissn": ""};
}
if (data[0]?.measure) {
this.dataProviderInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
}
if (data?.measure) {
this.dataProviderInfo.measure = this.parsingFunctions.parseMeasures(data.measure);
}
return this.dataProviderInfo;
}

View File

@ -11,20 +11,20 @@ import {RouterHelper} from "../../utils/routerHelper.class";
<div class="uk-text-xsmall entity-metadata uk-flex-inline uk-flex-wrap uk-text-emphasis">
<!-- oa -->
<span class="uk-flex-inline uk-flex-middle uk-flex-wrap"
*ngIf="(openAccessMandatePublications != undefined && openAccessMandatePublications) || (openAccessMandateDatasets != undefined && openAccessMandateDatasets)">
*ngIf="(openAccessMandatePublications && openAccessMandatePublications != 'false') || (openAccessMandateDatasets && openAccessMandateDatasets != 'false')">
<span class="uk-margin-xsmall-right open-access">
<icon name="open_access" [flex]="true" [ratio]="0.8"></icon>
</span>
<span class="uk-text-bolder"
*ngIf="openAccessMandatePublications != undefined && openAccessMandatePublications && openAccessMandateDatasets != undefined && openAccessMandateDatasets">
*ngIf="openAccessMandatePublications != 'false' && openAccessMandateDatasets != 'false'">
Open Access Mandate for {{openaireEntities.PUBLICATIONS}} and {{openaireEntities.DATASETS}}
</span>
<span class="uk-text-bolder"
*ngIf="openAccessMandatePublications != undefined && openAccessMandatePublications && (openAccessMandateDatasets == undefined || !openAccessMandateDatasets)">
*ngIf="openAccessMandatePublications != 'false' && openAccessMandatePublications && (openAccessMandateDatasets == 'false' || !openAccessMandateDatasets)">
Open Access Mandate for {{openaireEntities.PUBLICATIONS}}
</span>
<span class="uk-text-bolder"
*ngIf="openAccessMandateDatasets != undefined && openAccessMandateDatasets && (openAccessMandatePublications == undefined || !openAccessMandatePublications)">
*ngIf="openAccessMandateDatasets != 'false' && openAccessMandateDatasets && (openAccessMandatePublications == 'false' || !openAccessMandatePublications)">
Open Access Mandate for {{openaireEntities.DATASETS}}
</span>
</span>
@ -236,8 +236,8 @@ export class EntityMetadataComponent {
@Input() endYear: string; // search result
@Input() currentDate: number; // project landing
@Input() status: string; // project landing
@Input() openAccessMandatePublications: boolean // project landing
@Input() openAccessMandateDatasets: boolean // project landing
@Input() openAccessMandatePublications: string; // project landing
@Input() openAccessMandateDatasets: string; // project landing
@Input() date: Date;
@Input() embargoEndDate: Date | string;
@Input() underCuration: boolean = false;

View File

@ -28,7 +28,10 @@ export class ParsingFunctions {
public open = 'open_access';
public closed = 'closed_access';
public unknown = 'unknown_access';
public identifierTypes = ["doi", "pmc" , "handle", "pmid", "re3data", "swhid", "ROR", "ISNI", "Wikidata", "FundRef", "RRID"];
//TODO what are the names of Identifiers types e.g doi = Digital Object Identifier
// public identifierTypes = ["Digital Object Identifier", "pmc", "Handle", "PubMed ID", "re3data", "swhid",
// "ROR", "International Standard Name Identifier", "Wikidata", "FundRef"];
private instanceWithDoiExists: boolean = false;
constructor() {
@ -49,14 +52,14 @@ export class ParsingFunctions {
};
if (relation.title != 'unidentified') {
fundedByProject['id'] = relation['to'].content;
fundedByProject['id'] = relation['header'].relatedIdentifier;
fundedByProject['acronym'] = relation.acronym;
fundedByProject['title'] = relation.title;
fundedByProject['title'] = relation.projectTitle;
fundedByProject['code'] = relation.code;
if (relation.validated && relation.validated.date) {
if (relation.validationDate) {
fundedByProject['validated'] = true;
}
fundedByProject['provenanceAction'] = relation.provenanceaction;
fundedByProject['provenanceAction'] = relation.header.relationProvenance;
} else {
fundedByProject['id'] = "";
fundedByProject['acronym'] = "";
@ -101,7 +104,7 @@ export class ParsingFunctions {
if (fundingData.hasOwnProperty("funder")) {
funding.funderShortname = fundingData['funder'].shortname;
funding.funderName = fundingData['funder'].name;
funding.funderJurisdiction = fundingData['funder'].jurisdiction;
funding.funderJurisdiction = fundingData['funder'].jurisdiction?.code;
}
funding.stream = this.addFundingLevel0(fundingData, funding.stream);
@ -114,9 +117,8 @@ export class ParsingFunctions {
}
addFundingLevel0(parent: string, fundingStream: string): string {
if (parent.hasOwnProperty("funding_level_0")) {
let level0 = parent['funding_level_0'];
if (parent.hasOwnProperty("level0") && parent['level0'].name) {
let level0 = parent['level0'];
fundingStream += (fundingStream) ? " ; " : "";
fundingStream += level0.name;
}
@ -124,8 +126,8 @@ export class ParsingFunctions {
}
addFundingLevel1(parent: string, fundingStream: string): string {
if (parent.hasOwnProperty("funding_level_1")) {
let level1 = parent['funding_level_1'];
if (parent.hasOwnProperty("level1") && parent['level1'].name) {
let level1 = parent['level1'];
// For projects' parsing
if (level1.hasOwnProperty("parent")) {
@ -139,8 +141,8 @@ export class ParsingFunctions {
}
addFundingLevel2(parent: string, fundingStream: string): string {
if (parent.hasOwnProperty("funding_level_2")) {
let level2 = parent['funding_level_2'];
if (parent.hasOwnProperty("level2") && parent['level2'].name) {
let level2 = parent['level2'];
// For projects' parsing
if (level2.hasOwnProperty("parent")) {
@ -248,11 +250,11 @@ export class ParsingFunctions {
if (instance.hasOwnProperty("accessright")) {
if (url) {
mapStructure.get(key)['accessMode'].push(instance['accessright'].classname);
mapStructure.get(key)['accessMode'].push(instance['accessright'].label);
}
if (this.changeBestAccessMode(mapStructure.get(key)['bestAccessMode'], instance['accessright'])) {
mapStructure.get(key)['bestAccessMode'] = instance['accessright'].classname;
mapStructure.get(key)['bestAccessMode'] = instance['accessright'].label;
}
} else if (url) {
mapStructure.get(key)['accessMode'].push("");
@ -283,8 +285,8 @@ export class ParsingFunctions {
let length = Array.isArray(instance['hostedby']) ? instance['hostedby'].length : 1;
for (let i = 0; i < length; i++) {
let hostedBy = Array.isArray(instance['hostedby']) ? instance['hostedby'][i] : instance['hostedby'];
if (hostedBy.name && hostedBy.name != "other resources" && hostedBy.name != "Unknown Repository") {
downloadNames.add(String(hostedBy.name));
if (hostedBy.dsName && hostedBy.dsName != "other resources" && hostedBy.dsName != "Unknown Repository") {
downloadNames.add(String(hostedBy.dsName));
}
}
available.downloadNames = Array.from(downloadNames);
@ -298,8 +300,8 @@ export class ParsingFunctions {
let length = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'].length : 1;
for (let i = 0; i < length; i++) {
let collectedFrom = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'][i] : instance['collectedfrom'];
if (collectedFrom.name && collectedFrom.id) {
available.collectedNamesAndIds.set(String(collectedFrom.name), collectedFrom.id);
if (collectedFrom.dsName && collectedFrom.dsId) {
available.collectedNamesAndIds.set(String(collectedFrom.dsName), collectedFrom.dsId);
}
}
}
@ -309,8 +311,8 @@ export class ParsingFunctions {
let length = Array.isArray(instance['instancetype']) ? instance['instancetype'].length : 1;
for (let i = 0; i < length; i++) {
let instanceType = Array.isArray(instance['instancetype']) ? instance['instancetype'][i] : instance['instancetype'];
if (instanceType.classname && instanceType.classname.toLowerCase() !== "unknown") {
types.add(instanceType.classname);
if (instanceType && instanceType.toLowerCase() !== "unknown") {
types.add(instanceType);
}
}
available.types = Array.from(types);
@ -338,9 +340,9 @@ export class ParsingFunctions {
let accessRight = Array.isArray(instance['accessright']) ? instance['accessright'][i] : instance['accessright'];
if (this.changeBestAccessMode(available.accessRight, accessRight)) {
available.accessRight = accessRight.classname;
available.accessRight = accessRight.label;
if (this.changeBestAccessMode(globalAccessRight, accessRight)) {
globalAccessRight = accessRight.classname;
globalAccessRight = accessRight.label;
}
}
}
@ -369,7 +371,7 @@ export class ParsingFunctions {
available.fulltext = instance['fulltext'];
}
if(instance.hasOwnProperty("refereed") && instance.refereed.classname == "peerReviewed") {
if(instance.hasOwnProperty("refereed") && instance.refereed == "peerReviewed") {
available.peerReviewed = true;
}
@ -430,7 +432,7 @@ export class ParsingFunctions {
if (!accessMode) {
return false;
}
accessMode = accessMode.classid;
accessMode = accessMode.code;
switch (currentAccessMode) {
case null:
@ -487,29 +489,29 @@ export class ParsingFunctions {
// researchResult.relationName = relation.to.class;
if (relation['resulttype']) {
if (relation['resulttype'].classname == "publication") {
if (relation['header'] && relation.header.recordType) {
if (relation.header.recordType == "publication") {
researchResult['class'] = "publication";
} else if (relation['resulttype'].classname == "dataset") {
} else if (relation.header.recordType == "dataset") {
researchResult['class'] = "dataset";
} else if (relation['resulttype'].classname == "software") {
} else if (relation.header.recordType == "software") {
researchResult['class'] = "software";
} else if (relation['resulttype'].classname == "other") {
} else if (relation.header.recordType == "other") {
researchResult['class'] = "other";
}
}
researchResult['id'] = relation['to'].content;
if (Array.isArray(relation['title'])) {
for (let i = 0; i < relation['title'].length; i++) {
if (relation['title'][i] && relation['title'][i].content) {
if (!researchResult['name'] || relation['title'][i].classid == "main title") {
researchResult['name'] = String(relation['title'][i].content);
}
}
}
} else {
researchResult['name'] = (relation['title'] && relation['title'].content) ? String(relation['title'].content) : "";
}
researchResult['id'] = relation['header'].relatedIdentifier ;
//if (Array.isArray(relation['title'])) {
//for (let i = 0; i < relation['title'].length; i++) {
//if (relation['title'][i] && relation['title'][i]) {
//if (!researchResult['name'] || relation['title'][i].classid == "main title") {
//researchResult['name'] = String(relation['title'][i].content);
//}
//}
//}
//} else {
researchResult['name'] = (relation['title'] && relation['title']) ? String(relation['title']) : "";
//}
if (!researchResult['name']) {
researchResult['name'] = "[no title available]";
}
@ -519,13 +521,14 @@ export class ParsingFunctions {
}
//researchResult['date'] = relation.dateofacceptance.substring(0,4);;
let percentageName: string;
if (relation.trust) {
if (relation.header.trust) {
percentageName = "trust";
} else if (relation.similarity) {
percentageName = "similarity";
// TODO: not available
// percentageName = "similarity";
}
if (percentageName) {
researchResult['percentage'] = Math.round(relation[percentageName] * 100);
researchResult['percentage'] = Math.round(relation.header[percentageName] * 100);
researchResult['percentageName'] = percentageName;
}
researchResults.push(researchResult);
@ -545,7 +548,7 @@ export class ParsingFunctions {
openaireCompatibility: ""
};
datasource['id'] = relation['to'].content;
datasource['id'] = relation['header'].relatedIdentifier;
if(relation["officialname"])
datasource.name = relation.officialname;
else {
@ -553,10 +556,10 @@ export class ParsingFunctions {
}
let percentageName: string;
if (relation.trust) {
if (relation['header'].trust) {
percentageName = "trust";
} else if (relation.similarity) {
percentageName = "similarity";
// } else if (relation.similarity) {
// percentageName = "similarity";
}
if (percentageName) {
datasource['percentage'] = Math.round(relation[percentageName] * 100);
@ -564,13 +567,13 @@ export class ParsingFunctions {
}
// type
if(relation.hasOwnProperty('datasourcetype') && relation['datasourcetype'].hasOwnProperty("classname")) {
datasource.class = relation['datasourcetype'].classname;
if(relation['datasourcetype'] && relation['datasourcetype']["code"]) {
datasource.class = relation['datasourcetype'].code;
}
// compatibility
if(relation.hasOwnProperty("openairecompatibility")) {
datasource.openaireCompatibility = relation['openairecompatibility'].classname;
if(relation["openairecompatibility"]) {
datasource.openaireCompatibility = relation['openairecompatibility'].label;
}
if(datasource.class !== "service" || properties.adminToolsPortalType == "eosc") {
@ -595,26 +598,20 @@ export class ParsingFunctions {
parseIdentifiers(pid: any): Map<string, string[]> {
let identifiers = new Map<string, string[]>();
if (pid.hasOwnProperty("classid") && pid['classid'] != "") {
if (pid.classid == "doi" || pid.classid == "pmc" || pid.classid == "handle" || pid.classid == "pmid" || pid.classid == "re3data"
|| pid.classid == "swhid"
|| pid.classid == "ROR" || pid.classid == "ISNI" || pid.classid == "Wikidata" || pid.classid == "FundRef"
|| pid.classid == "RRID") {
if (!identifiers.has(pid.classid)) {
identifiers.set(pid.classid, new Array<string>());
if (pid.hasOwnProperty("typeCode") && pid['typeCode'] != "") {
if (this.identifierTypes.indexOf(pid.typeCode) !=-1) {
if (!identifiers.has(pid.typeCode)) {
identifiers.set(pid.typeCode, new Array<string>());
}
identifiers.get(pid.classid).push(pid.content + "");
identifiers.get(pid.typeCode).push(pid.value + "");
}
} else {
for (let i = 0; i < pid.length; i++) {
if (pid[i].classid == "doi" || pid[i].classid == "pmc" || pid[i].classid == "handle" || pid[i].classid == "pmid" || pid[i].classid == "re3data"
|| pid[i].classid == "swhid"
|| pid[i].classid == "ROR" || pid[i].classid == "ISNI" || pid[i].classid == "Wikidata" || pid[i].classid == "FundRef"
|| pid[i].classid == "RRID") {
if (!identifiers.has(pid[i].classid)) {
identifiers.set(pid[i].classid, new Array<string>());
if (this.identifierTypes.indexOf(pid[i].typeCode) !=-1) {
if (!identifiers.has(pid[i].typeCode)) {
identifiers.set(pid[i].typeCode, new Array<string>());
}
identifiers.get(pid[i].classid).push(pid[i].content + "");
identifiers.get(pid[i].typeCode).push(pid[i].value + "");
}
}
}
@ -659,9 +656,9 @@ export class ParsingFunctions {
for (let i = 0; i < length; i++) {
subject = Array.isArray(_subjects) ? _subjects[i] : _subjects;
if (subject.classid != "") {
if (subject.classid == "keyword") {
let content: string = subject.content + "";
if (subject.typeCode != "") {
if (subject.typeCode == "keyword") {
let content: string = subject.value + "";
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
// let found: boolean = checkAndAddEoscSubjectResp["found"];
// if(found) {
@ -673,49 +670,49 @@ export class ParsingFunctions {
}
subjects.push(content);
// }
} else if (!vocabulary || vocabulary[subject.classid] || subject.classid === "SDG" || subject.classid === "FOS") {
} else if (!vocabulary || vocabulary[subject.typeCode] || subject.typeCode === "SDG" || subject.typeCode === "FOS") {
// if (subject.inferred && subject.inferred == true) {
if (subject.classid === "SDG") {
if (subject.typeCode === "SDG") {
if (sdg == undefined) {
sdg = new Array<string>();
}
sdg.push(subject.content + "");
} else if (subject.classid === "FOS") {
sdg.push(subject.value + "");
} else if (subject.typeCode === "FOS") {
if (fos == undefined) {
fos = new Array<string>();
}
fos.push(subject.content + "");
fos.push(subject.value + "");
} else {
if (classifiedSubjects == undefined) {
classifiedSubjects = new Map<string, string[]>();
}
let content: string = subject.content + "";
let content: string = subject.value + "";
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
// let found: boolean = checkAndAddEoscSubjectResp["found"];
// if(found) {
// setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"];
// eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"];
// } else {
if (!classifiedSubjects.has(subject.classname)) {
classifiedSubjects.set(subject.classname, new Array<string>());
if (!classifiedSubjects.has(subject.typeLabel)) {
classifiedSubjects.set(subject.typeLabel, new Array<string>());
}
// if(properties.environment == "production") {
// classifiedSubjects.get(subject.classname).push(content);
// } else {
classifiedSubjects.get(subject.classname).push(subject.classid + ": " + content);
classifiedSubjects.get(subject.typeLabel).push(subject.typeCode + ": " + content);
// }
// }
}
} else {
let content: string = subject.content + "";
let content: string = subject.value + "";
// let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content);
// let found: boolean = checkAndAddEoscSubjectResp["found"];
// if(found) {
// setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"];
// eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"];
// } else {
let classname: string = subject.classname + "";
let classname: string = subject.typeLabel + "";
if (subjects == undefined) {
subjects = new Array<string>();
}
@ -842,10 +839,10 @@ export class ParsingFunctions {
}
parseTypes(types: string[], uniqueTypes: Set<string>, instance: any) {
if (instance && instance.hasOwnProperty("instancetype") && instance['instancetype'].classname) {
if (!uniqueTypes.has(instance['instancetype'].classname)) {
types.push(instance['instancetype'].classname);
uniqueTypes.add(instance['instancetype'].classname);
if (instance && instance.hasOwnProperty("instancetype")) {
if (!uniqueTypes.has(instance['instancetype'])) {
types.push(instance['instancetype']);
uniqueTypes.add(instance['instancetype']);
}
}
}
@ -854,13 +851,13 @@ export class ParsingFunctions {
var languages = new Array<string>();
if (!Array.isArray(_languages)) {
if (_languages.classname != "Undetermined" && _languages.classname) {
languages.push(_languages.classname);
if (_languages.label != "Undetermined" && _languages.label) {
languages.push(_languages.label);
}
} else {
for (let i = 0; i < _languages.length; i++) {
if (_languages[i].classname != "Undetermined" && _languages[i].classname) {
languages.push(_languages[i].classname);
if (_languages[i].label != "Undetermined" && _languages[i].label) {
languages.push(_languages[i].label);
}
}
}
@ -871,13 +868,13 @@ export class ParsingFunctions {
var countries = new Array<string>();
if (!Array.isArray(_countries)) {
if (_countries.classname != "Undetermined" && _countries.classname) {
countries.push(_countries.classname);
if (_countries.label != "Undetermined" && _countries.label) {
countries.push(_countries.label);
}
} else {
for (let i = 0; i < _countries.length; i++) {
if (_countries[i].classname != "Undetermined" && _countries[i].classname) {
countries.push(_countries[i].classname);
if (_countries[i].label != "Undetermined" && _countries[i].label) {
countries.push(_countries[i].label);
}
}
}
@ -888,13 +885,13 @@ export class ParsingFunctions {
var pLanguages = new Array<string>();
if (!Array.isArray(_pLanguages)) {
if (_pLanguages.classname != "Undetermined" && _pLanguages.classname) {
pLanguages.push(_pLanguages.classname);
if (_pLanguages != "Undetermined" && _pLanguages) {
pLanguages.push(_pLanguages);
}
} else {
for (let i = 0; i < _pLanguages.length; i++) {
if (_pLanguages[i].classname != "Undetermined" && _pLanguages[i].classname) {
pLanguages.push(_pLanguages[i].classname);
if (_pLanguages[i] != "Undetermined" && _pLanguages[i]) {
pLanguages.push(_pLanguages[i]);
}
}
}
@ -926,16 +923,23 @@ export class ParsingFunctions {
static parseRelCanonicalId(record, type) {
try {
if (record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"] && record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"][type]) {
for (let child of record["result"]["metadata"]["oaf:entity"][("oaf:" + type)]["children"][type]) {
return child["objidentifier"];
if (record && record['links']) {
let links = record['links'];
let relLength = Array.isArray(links) ? links.length : 1;
for(let i=0; i<relLength; i++) {
let relation = Array.isArray(links) ? links[i] : links;
if (relation.hasOwnProperty("header")) {
if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "merges" && relation['header'].relatedRecordType == type) {
return relation['header'].relatedIdentifier;
}
}
}
}
} catch (e) {
// console.error(e);
}
return record["result"]["header"]["dri:objIdentifier"];
return record["header"]["id"];
}
parseDescription(description, stripHTML: boolean = false): string {
@ -970,82 +974,73 @@ export class ParsingFunctions {
let downloads: number = 0;
elements.forEach(element => {
if (element.id == 'views') {
views += element.count;
let datasourceId = element.datasource;
if(datasourceId) {
if(datasourcePosition.has(element.datasource)) {
countsPerDatasource[datasourcePosition.get(element.datasource)].views = element.count;
} else {
datasourcePosition.set(element.datasource, countsPerDatasource.length);
countsPerDatasource.push({"datasourceId": element.datasource.split("||")[0], "datasourceName": element.datasource.split("||")[1], "views": element.count, "downloads": 0})
element.unit.forEach(unit => {
let viewsNum = parseInt(unit.label);
views += viewsNum;
let datasourceId = unit.code;
if(datasourceId) {
if(datasourcePosition.has(datasourceId)) {
countsPerDatasource[datasourcePosition.get(datasourceId)].views = viewsNum;
} else {
datasourcePosition.set(datasourceId, countsPerDatasource.length);
countsPerDatasource.push({"datasourceId": datasourceId.split("||")[0], "datasourceName": datasourceId.split("||")[1], "views": viewsNum, "downloads": 0})
}
}
}
// measure.views = element.count;
}
if (element.id == 'downloads') {
downloads += element.count;
let datasourceId = element.datasource;
if(datasourceId) {
if(datasourcePosition.has(element.datasource)) {
countsPerDatasource[datasourcePosition.get(element.datasource)].downloads = element.count;
} else {
datasourcePosition.set(element.datasource, countsPerDatasource.length);
countsPerDatasource.push({"datasourceId": element.datasource.split("||")[0], "datasourceName": element.datasource.split("||")[1], "views": 0, "downloads": element.count})
});
} else if (element.id == 'downloads') {
element.unit.forEach(unit => {
let downloadsNum = parseInt(unit.label);
downloads += downloadsNum;
let datasourceId = unit.code;
if (datasourceId) {
if (datasourcePosition.has(datasourceId)) {
countsPerDatasource[datasourcePosition.get(datasourceId)].downloads = downloadsNum;
} else {
datasourcePosition.set(datasourceId, countsPerDatasource.length);
countsPerDatasource.push({
"datasourceId": datasourceId.split("||")[0],
"datasourceName": datasourceId.split("||")[1],
"views": 0,
"downloads": downloadsNum
})
}
}
}
});
// measure.downloads = element.count;
}
if (element.id == 'influence_alt' || element.id == 'citation_count') {
bip.push({name: 'citations', icon: 'cite', value: element.score, order: 2});
// measure.citations = element.score;
}
if (element.id == 'popularity') {
let metric: Metric = {name: 'popularity', icon: 'fire', value: null, order: 3};
if (element.class == 'C1') {
metric.value = 'Top 0.01%';
} else if (element.class == 'C2') {
metric.value = 'Top 0.1%';
} else if (element.class == 'C3') {
metric.value = 'Top 1%';
} else if (element.class == 'C4') {
metric.value = 'Top 10%';
} else {
metric.value = 'Average';
} else if (element.id == 'influence_alt' || element.id == 'citation_count') {
for(let unit of element.unit) {
if(unit.code == "score") {
bip.push({name: 'citations', icon: 'cite', value: parseInt(unit.label), order: 2});
}
}
// measure.popularity = metric.value;
bip.push(metric);
}
if (element.id == 'influence') {
let metric: Metric = {name: 'influence', icon: 'landmark', value: null, order: 4};
if (element.class == 'C1') {
metric.value = 'Top 0.01%';
} else if (element.class == 'C2') {
metric.value = 'Top 0.1%';
} else if (element.class == 'C3') {
metric.value = 'Top 1%';
} else if (element.class == 'C4') {
metric.value = 'Top 10%';
} else {
metric.value = 'Average';
} else if (element.id == 'popularity' || element.id == 'influence' || element.id == 'impulse') {
let value = "";
for(let unit of element.unit) {
if (unit.code == "class") {
if (unit.label == 'C1') {
value = 'Top 0.01%';
} else if (unit.label == 'C2') {
value = 'Top 0.1%';
} else if (unit.label == 'C3') {
value = 'Top 1%';
} else if (unit.label == 'C4') {
value = 'Top 10%';
} else {
value = 'Average';
}
}
}
// measure.influence = metric.value;
bip.push(metric);
}
if (element.id == 'impulse') {
let metric: Metric = {name: 'impulse', icon: 'rocket', value: null, order: 5};
if (element.class == 'C1') {
metric.value = 'Top 0.01%';
} else if (element.class == 'C2') {
metric.value = 'Top 0.1%';
} else if (element.class == 'C3') {
metric.value = 'Top 1%';
} else if (element.class == 'C4') {
metric.value = 'Top 10%';
} else {
metric.value = 'Average';
if (element.id == 'popularity') {
let metric: Metric = {name: 'popularity', icon: 'fire', value: value, order: 3};
bip.push(metric);
} else if (element.id == 'influence') {
let metric: Metric = {name: 'influence', icon: 'landmark', value: value, order: 4};
bip.push(metric);
} else if (element.id == 'impulse') {
let metric: Metric = {name: 'impulse', icon: 'rocket', value: value, order: 5};
bip.push(metric);
}
// measure.impulse = metric.value;
bip.push(metric);
}
});

View File

@ -10,6 +10,7 @@ import {
} from '@angular/core';
import {EnvProperties} from "../../utils/properties/env-properties";
import {properties} from "../../../../environments/environment";
import {ParsingFunctions} from "./parsingFunctions.class";
@Component({
selector: 'showIdentifiers',
@ -26,8 +27,7 @@ import {properties} from "../../../../environments/environment";
<span class="uk-text-meta uk-text-small" [class.uk-text-uppercase]="key != 're3data'">{{key}}: </span>
<span [class.uk-margin-small-left]="modal">
<ng-container *ngFor="let item of identifiers.get(key) let j=index">
<a *ngIf="key == 'doi' || key == 'pmc' || key == 'pmid' || key == 'handle' || key == 're3data' || key == 'swhid'
|| key == 'ROR' || key == 'ISNI' || key == 'Wikidata' || key == 'FundRef' || key == 'RRID'"
<a *ngIf="parsingFunctions.identifierTypes.indexOf(key) != -1"
[href]="getUrl(key, item) + item" target="_blank" class="uk-display-inline-block custom-external">
{{item}}
</a>
@ -69,7 +69,7 @@ export class ShowIdentifiersComponent implements AfterViewInit {
properties: EnvProperties = properties;
@ViewChildren("content", { read: ElementRef }) types: QueryList<ElementRef>;
@ViewChild('identifiersModal') identifiersModal;
public parsingFunctions: ParsingFunctions = new ParsingFunctions();
constructor(private cdr: ChangeDetectorRef) {
}
@ -118,7 +118,7 @@ export class ShowIdentifiersComponent implements AfterViewInit {
if(value.includes("http://") || value.includes("https://")) {
return "";
}
if(key == "doi") {
if(key == "doi" || key == "Digital Object Identifier") {
return properties.doiURL;
} else if(key == "pmc") {
return properties.pmcURL;

View File

@ -102,7 +102,7 @@ export class OrganizationsDeletedByInferenceComponent {
}
if(result.hasOwnProperty("country")) {
preview.countries = [result['country'].classname];
preview.countries = [result['country'].label];
}
preview.resultType = 'organization';

View File

@ -13,6 +13,9 @@ export class OrganizationsDeletedByInferenceService {
public parsingFunctions: ParsingFunctions;
/**
* @deprecated
*/
getDeletedByInferenceResults(id: string, size: string, properties: EnvProperties): any {
let url = properties.searchAPIURLLAst + 'deletedByInferenceOrganizations/' + id + "?format=json&size=" + size;
@ -21,6 +24,9 @@ export class OrganizationsDeletedByInferenceService {
.pipe(map(res => this.parseDeletedByInferenceResults(res, properties)));
}
/**
* @deprecated
*/
parseDeletedByInferenceResults(_results: any, properties: EnvProperties): OrganizationInfo[] {
let results: OrganizationInfo[] = [];
if (_results) {

View File

@ -808,7 +808,7 @@ export class ProjectComponent {
}
this.header1 += "</div>";
this.header1 += "<h1 style=\"margin:0;\"><div><a href=\""+window.location.href +"\">";
this.header1 += "<h2 style=\"margin:0;\"><div><a href=\""+window.location.href +"\">";
if(this.projectInfo.acronym) {
this.header1 += this.projectInfo.acronym;
} else {

View File

@ -26,12 +26,7 @@ export class ProjectService {
let key = url;
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:project']))
.pipe(map(res => [res,
res['fundingtree'],
res['rels']['rel']]))
.pipe(map(res => this.parseProjectInfo(res, properties)));
.pipe(map(res => this.parseProjectInfo(res, properties)));
}
@ -46,10 +41,6 @@ export class ProjectService {
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => res['results'][0]))
.pipe(map(res => [res['result']['metadata']['oaf:entity']['oaf:project'], res['result']['header']['dri:objIdentifier']]))
.pipe(map(res => [res[0],
res[0]['fundingtree'],
res[0]['rels']['rel'], res[1]]))
.pipe(map(res => this.parseProjectInfo(res, properties)));
}
@ -63,15 +54,13 @@ export class ProjectService {
let key = url + '_projectDates';
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:project']))
.pipe(map(res => [res,
res['fundingtree'],
res['rels']['rel']]))
.pipe(map(res => this.parseProjectDates(id, res)))
}
/**
* @deprecated
*/
getHTMLInfo(id: string, properties: EnvProperties): any {
let url = properties.searchAPIURLLAst + 'projects/' + id + "?format=json";
let key = url;
@ -97,50 +86,36 @@ export class ProjectService {
}
parseProjectInfo(data: any, properties: EnvProperties): any {
if(data == null) {
return null;
}
this.projectInfo = new ProjectInfo();
this.projectInfo.funding = {
funderName: "", funderShortName: "", funderJurisdiction: "", code: "", callIdentifier: "",
fundingStream: "", budget: "", contribution: "", currency: ""
};
// ['result']['header']['dri:objIdentifier']
if (data[3] != null) {
this.projectInfo.id = data[3];
if(data["header"]) {
this.projectInfo.id = data["header"]["id"];
}
// ['result']['metadata']['oaf:entity']['oaf:project']['fundingtree']
if (data[1] != null) {
let funding: { "funderName": string, "funderShortname": string, "funderJurisdiction": string, "stream": string };
funding = this.parsingFunctions.parseFundingTrees(data[1]);
if (funding.funderName) {
this.projectInfo.funding.funderName = funding.funderName;
}
if (funding.funderShortname) {
this.projectInfo.funding.funderShortName = funding.funderShortname;
}
if (funding.funderJurisdiction) {
this.projectInfo.funding.funderJurisdiction = funding.funderJurisdiction;
}
if (funding.stream) {
this.projectInfo.funding.fundingStream = funding.stream;
}
}
if(data["project"]) {
let project = data["project"];
this.projectInfo.funding = {
funderName: "", funderShortName: "", funderJurisdiction: "", code: "", callIdentifier: "",
fundingStream: "", budget: "", contribution: "", currency: ""
};
// ['result']['metadata']['oaf:entity']['oaf:project']
if (data[0] != null) {
this.projectInfo.acronym = data[0].acronym;
if (data[0]['title']) {
this.projectInfo.title = Array.isArray(data[0]['title']) ? StringUtils.HTMLToString(String(data[0].title[0])) : StringUtils.HTMLToString(String(data[0].title));
this.projectInfo.acronym = project.acronym;
if (project['title']) {
this.projectInfo.title = Array.isArray(project['title']) ? StringUtils.HTMLToString(String(project.title[0])) : StringUtils.HTMLToString(String(project.title));
} else {
this.projectInfo.title = "";
}
this.projectInfo.funding.code = data[0].code;
if (data[0].startdate) {
let date: number = Date.parse(data[0].startdate);
this.projectInfo.funding.code = project.code;
if (project.startdate) {
let date: number = Date.parse(project.startdate);
this.projectInfo.startDate = (date ? date : null);
}
if (data[0].enddate) {
let date: number = Date.parse(data[0].enddate);
if (project.enddate) {
let date: number = Date.parse(project.enddate);
this.projectInfo.endDate = (date ? date : null);
}
if (this.projectInfo.endDate || this.projectInfo.startDate) {
@ -162,95 +137,78 @@ export class ProjectService {
}
}
if (this.projectInfo.funding) {
if (this.projectInfo.funding.funderShortName == "EC") {
this.projectInfo.openAccessMandatePublications = data[0].oamandatepublications;
// this.projectInfo.specialClause39 = data[0].ecsc39;
if (data[0].hasOwnProperty("projectoamandatedata")) {
this.projectInfo.openAccessMandateDatasets = data[0].projectoamandatedata;
} else if (data[0].hasOwnProperty("ecarticle29_3")) {
this.projectInfo.openAccessMandateDatasets = data[0].ecarticle29_3;
// if (this.projectInfo.funding.funderShortName == "EC") {
this.projectInfo.openAccessMandatePublications = project.oamandatepublications;
if (project["projectoamandatedata"]) {
this.projectInfo.openAccessMandateDatasets = project.oamandatedata;
} else if (project["ecarticle29_3"]) {
this.projectInfo.openAccessMandateDatasets = project.ecarticle29_3;
}
this.projectInfo.funding.callIdentifier = data[0].callidentifier;
}
this.projectInfo.funding.budget = data[0].totalcost;//"10000";
this.projectInfo.funding.contribution = data[0].fundedamount;//"200100";
this.projectInfo.funding.currency = data[0].currency;//"EUR";
this.projectInfo.funding.callIdentifier = project.callidentifier;
// }
this.projectInfo.funding.budget = project.totalcost;//"10000";
this.projectInfo.funding.contribution = project.fundedamount;//"200100";
this.projectInfo.funding.currency = project.currency;//"EUR";
}
this.projectInfo.description = this.parsingFunctions.parseDescription(project && project.summary ? project.summary : []);
if (project['funding']) {
let funding: { "funderName": string, "funderShortname": string, "funderJurisdiction": string, "stream": string };
funding = this.parsingFunctions.parseFundingTrees(project.funding);
if (funding.funderName) {
this.projectInfo.funding.funderName = funding.funderName;
}
if (funding.funderShortname) {
this.projectInfo.funding.funderShortName = funding.funderShortname;
}
if (funding.funderJurisdiction) {
this.projectInfo.funding.funderJurisdiction = funding.funderJurisdiction;
}
if (funding.stream) {
this.projectInfo.funding.fundingStream = funding.stream;
}
}
// if(!Array.isArray(data[0]['summary'])) {
// this.projectInfo.description = (data[0]['summary']) ? String(data[0]['summary']) : "";
// } else {
// this.projectInfo.description = (data[0]['summary'][0]) ? String(data[0]['summary'][0]) : "";
// }
this.projectInfo.description = this.parsingFunctions.parseDescription(data[0] && data[0].summary ? data[0].summary : []);
}
// ['result']['metadata']['oaf:entity']['oaf:project']['rels']['rel']
if (data[2] != null) {
if(data["links"]) {
this.projectInfo.organizations = [];
if (!Array.isArray(data[2])) {
if (data[2].hasOwnProperty("to") && data[2]['to'].class && data[2]['to'].class.toLowerCase() == "hasparticipant") {
let links = data['links'];
let relLength = Array.isArray(links) ? links.length : 1;
for (let i = 0; i < relLength; i++) {
let relation = Array.isArray(links) ? links[i] : links;
if (relation["header"] && relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "hasparticipant") {
let country: string = "";
let acronym: string = "";
let name: string = "";
let id: string = "";
if(data[2].hasOwnProperty("country")) {
country = data[2].country.classname;
id = relation['header'].relatedIdentifier;
if(relation["country"]) {
country = relation.country.label;
}
if (data[2].hasOwnProperty("legalshortname")) {
acronym = data[2].legalshortname;
if (relation["legalshortname"]) {
acronym = relation.legalshortname;
}
if (data[2].hasOwnProperty("legalname")) {
name = data[2].legalname;
if (relation["legalname"]) {
name = relation.legalname;
}
if (!acronym && !name) {
// acronym is displayed with link and name only in tooltip
acronym = "[no title available]";
}
if (data[2].hasOwnProperty("to")) {
id = data[2]['to'].content;
}
this.projectInfo.organizations.push({"country": country, "acronym": acronym, "name": name, "id": id});
}
} else {
for (let i = 0; i < data[2].length; i++) {
let country: string = "";
let acronym: string = "";
let name: string = "";
let id: string = "";
if (data[2][i].hasOwnProperty("to") && data[2][i]['to'].class && data[2][i]['to'].class.toLowerCase() == "hasparticipant") {
if(data[2][i].hasOwnProperty("country")) {
country = data[2][i].country.classname;
}
if (data[2][i].hasOwnProperty("legalshortname")) {
acronym = data[2][i].legalshortname;
}
if (data[2][i].hasOwnProperty("legalname")) {
name = data[2][i].legalname;
}
if (!acronym && !name) {
acronym = "[no title available]";
}
if (data[2][i].hasOwnProperty("to")) {
id = data[2][i]['to'].content;
}
this.projectInfo.organizations.push({"country": country, "acronym": acronym, "name": name, "id": id});
}
}
}
}
if (this.projectInfo.funding && this.projectInfo.funding.funderShortName == "EC") {
this.projectInfo.url = properties.cordisURL + this.projectInfo.funding.code;
this.projectInfo.urlInfo = "Detailed project information (CORDIS)";
}
if (data[0]?.measure) {
this.projectInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
if (data.measures) {
this.projectInfo.measure = this.parsingFunctions.parseMeasures(data.measures);
}
return this.projectInfo;
@ -259,9 +217,9 @@ export class ProjectService {
parseProjectDates(id: string, data: any): any {
let project = {id: id, startDate: "", endDate: ""};
if (data[0] != null) {
project.startDate = data[0].startdate;
project.endDate = data[0].enddate;
if (data['project'] != null) {
project.startDate = data['project'].startdate;
project.endDate = data['project'].enddate;
}
return project;

View File

@ -92,33 +92,31 @@ export class DeletedByInferenceComponent {
for (let i = 0; i < length; i++) {
let result = Array.isArray(this.children) ? this.children[i] : this.children;
let preview = new ResultPreview();
if(result.hasOwnProperty("creator")) {
if(result["author"]) {
preview.authors = [];
let authorsLength = Array.isArray(result.creator) ? result.creator.length : 1;
let authorsLength = Array.isArray(result.author) ? result.author.length : 1;
for (let j = 0; j < authorsLength; j++) {
let author = {"fullName": Array.isArray(result.creator) ? result.creator[j] : result.creator, "orcid": null, "orcid_pending": null};
let author = {"fullName": Array.isArray(result.author) ? result.author[j] : result.author, "orcid": null, "orcid_pending": null};
preview.authors.push(author);
}
}
if(result.hasOwnProperty("dateofacceptance")) {
preview.year = new Date(result.dateofacceptance).getFullYear().toString();
}
if(result.hasOwnProperty("title")) {
let titleLength = Array.isArray(result.title) ? result.title.length : 1;
for (let j = 0; j < titleLength; j++) {
let title = Array.isArray(result.title) ? result.title[j] : result.title;
if (!preview.title || title.classid == "main title") {
preview.title = StringUtils.HTMLToString(String(title.content));
}
}
if (result['title']) {
preview.title = StringUtils.HTMLToString(String(result['title']));
}
if(result.hasOwnProperty("description")) {
preview.description = result.description;
}
preview.resultType = result?.resulttype?.classid ? result.resulttype.classid : this.resultType;
if(result.header) {
// preview.resultType = result?.resulttype ? result.resulttype : this.resultType;
preview.resultType = result.header?.recordType ? result.result.header.recordType : this.resultType;
}
if (result.hasOwnProperty("instance")) {
if (result.hasOwnProperty("instances")) {
preview.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>();
preview.types = new Array<string>();
@ -127,10 +125,10 @@ export class DeletedByInferenceComponent {
let counter = 0;
let instance;
let instanesLength = Array.isArray(result['instance']) ? result['instance'].length : 1;
let instanesLength = Array.isArray(result['instances']) ? result['instances'].length : 1;
for (let j = 0; j < instanesLength; j++) {
instance = Array.isArray(result['instance']) ? result['instance'][j] : result['instance'];
instance = Array.isArray(result['instances']) ? result['instances'][j] : result['instances'];
if(result.hasOwnProperty('collectedfrom')) {
if(Array.isArray(result['collectedfrom'])) {
// not sure if this is correct mapping
@ -142,12 +140,12 @@ export class DeletedByInferenceComponent {
parsingFunctions.parseTypes(preview.types, types, instance);
if (instance.hasOwnProperty("webresource")) {
if (instance.hasOwnProperty("url")) {
let url;
if (!Array.isArray(instance['webresource'])) {
url = instance['webresource'].url;
if (!Array.isArray(instance['url'])) {
url = instance['url'];
} else {
url = instance['webresource'][0].url;
url = instance['url'][0];
}
if (url.includes('&amp;')) {
url = url.replace(/&amp;/gmu, '&');

View File

@ -16,6 +16,9 @@ export class DeletedByInferenceService {
public parsingFunctions: ParsingFunctions;
/**
* @deprecated
*/
getDeletedByInferenceResults (id: string, size: string, properties:EnvProperties):any {
let url = properties.searchAPIURLLAst + 'deletedByInferenceResults/' +id+"?format=json&size="+size;
let key = url;
@ -26,6 +29,9 @@ export class DeletedByInferenceService {
.pipe(map(res => this.parseDeletedByInferenceResults(res)));
}
/**
* @deprecated
*/
parseDeletedByInferenceResults (_results: any): ResultLandingInfo[] {
/*title, authors, abstract, List of projects, PIDs,
collectedfrom (link pointing to the download url), access rights*/

View File

@ -721,25 +721,25 @@
<modal-alert *ngIf="resultLandingInfo && resultLandingInfo.deletedByInferenceIds"
#AlertModalDeletedByInference large="true">
<deletedByInference *ngIf="type == 'publication' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[modal]="AlertModalDeletedByInference"
[resultType]="type" [type]="openaireEntities.PUBLICATIONS" [prevPath]="prevPath"
[children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'dataset' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[modal]="AlertModalDeletedByInference"
[resultType]="'dataset'" [type]="openaireEntities.DATASETS" [prevPath]="prevPath"
[children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'software' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[modal]="AlertModalDeletedByInference"
[resultType]="type" [type]="openaireEntities.SOFTWARE" [prevPath]="prevPath"
[children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'orp' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[modal]="AlertModalDeletedByInference"
[resultType]="'other'" [type]="openaireEntities.OTHER" [prevPath]="prevPath"
@ -1197,28 +1197,28 @@
<ng-container *ngIf="isMobile">
<fs-modal *ngIf="resultLandingInfo && resultLandingInfo.deletedByInferenceIds" #AlertModalDeletedByInferenceFS classTitle="uk-tile-default uk-border-bottom">
<deletedByInference *ngIf="type == 'publication' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[resultType]="type" [type]="openaireEntities.PUBLICATIONS"
[isMobile]="isMobile"
[modal]="alertModalDeletedByInferenceFS"
[children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'dataset' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[resultType]="'dataset'" [type]="openaireEntities.DATASETS"
[isMobile]="isMobile"
[modal]="alertModalDeletedByInferenceFS"
[children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'software' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[resultType]="type" [type]="openaireEntities.SOFTWARE"
[isMobile]="isMobile"
[modal]="alertModalDeletedByInferenceFS"
[children]="resultLandingInfo.children"></deletedByInference>
<deletedByInference *ngIf="type == 'orp' && deleteByInferenceOpened"
[id]="resultLandingInfo.record['result']['header']['dri:objIdentifier']"
[id]="resultLandingInfo.record['header']['id']"
[ids]="resultLandingInfo.deletedByInferenceIds"
[resultType]="'other'" [type]="openaireEntities.OTHER"
[isMobile]="isMobile"

View File

@ -74,13 +74,14 @@ export class ResultLandingService {
error: "Http failure response for " + finalUrl + ": 404 Not Found"
});
}
//TODO make sure to pass the correct part
return res['results'][0];
} else {
return res;
}
}))
.pipe(map(res => [res['result']['header']['dri:status'], res['result']['metadata']['oaf:entity'], res]))
.pipe(map(res => [
// .pipe(map(res => [res['meta']['status'], res['result']['metadata']['oaf:entity'], res]))
/*.pipe(map(res => [
res[1]['oaf:result'], // 0
res[1]['oaf:result']['title'], // 1
res[1]['oaf:result']['rels']['rel'], // 2
@ -99,7 +100,7 @@ export class ResultLandingService {
? res[1]['extraInfo']['references']['reference'] : null, // 13
res[0], // 14
res[2], // 15
]))
]))*/
.pipe(map(res => this.parseResultLandingInfo(res, subjectsVocabulary, properties)));
}
@ -127,155 +128,95 @@ export class ResultLandingService {
}
parseResultLandingInfo(data: any, subjectsVocabulary: any, properties: EnvProperties): any {
if(data == null) {
return null;
}
this.resultLandingInfo = new ResultLandingInfo();
// res
this.resultLandingInfo.record = data[15];
this.resultLandingInfo.objIdentifier = data[15]["result"]["header"]["dri:objIdentifier"];
this.resultLandingInfo.relcanId = ParsingFunctions.parseRelCanonicalId(this.resultLandingInfo.record, "result");
this.resultLandingInfo.resultType = data[0].resulttype.classid;
this.resultLandingInfo.record = data;
// res['result']['metadata']['oaf:entity']['oaf:result']
if (data[0] != null) {
let date: string = (data[0].dateofacceptance ? data[0].dateofacceptance : '') + ''; // transform to string in case it is an integer
if(data["header"]) {
this.resultLandingInfo.objIdentifier = data["header"]["id"];
this.resultLandingInfo.relcanId = ParsingFunctions.parseRelCanonicalId(this.resultLandingInfo.record, "result");
this.resultLandingInfo.resultType = data['header']['recordType'];
this.resultLandingInfo.underCurationMessage = data["header"]['status'] == "UNDER_CURATION";
}
if(data["result"]) {
let result = data["result"];
let date: string = (result['publicationdate'] ? result['publicationdate'] : '') + ''; // transform to string in case it is an integer
this.resultLandingInfo.date = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
this.resultLandingInfo.dateofacceptance = data[0].dateofacceptance ? Dates.getDate(data[0].dateofacceptance) : null;
this.resultLandingInfo.publisher = data[0].publisher;
this.resultLandingInfo.description = this.parsingFunctions.parseDescription(data[0] && data[0].description ? data[0].description : []);
this.resultLandingInfo.embargoEndDate = data[0].embargoenddate ? Dates.getDate(data[0].embargoenddate) : null;
this.resultLandingInfo.dateofacceptance = result['publicationdate'] ? Dates.getDate(result['publicationdate']) : null;
this.resultLandingInfo.publisher = result['publisher'];
this.resultLandingInfo.description = this.parsingFunctions.parseDescription(result['description'] ? result['description'] : []);
this.resultLandingInfo.embargoEndDate = result['embargoenddate'] ? Dates.getDate(result['embargoenddate']) : null;
if(data[0].hasOwnProperty("publiclyfunded") && data[0].publiclyfunded) {
this.resultLandingInfo.publiclyFunded = data[0].publiclyfunded;
if (result.publiclyFunded) {
this.resultLandingInfo.publiclyFunded = result.publiclyFunded;
}
if((data[0].hasOwnProperty("isgreen") && data[0].isgreen)
|| (data[0].hasOwnProperty("openaccesscolor") && data[0].openaccesscolor)
|| (data[0].hasOwnProperty("isindiamondjournal") && data[0].isindiamondjournal)) {
if (result["isGreen"] || result["openAccessColor"] || result["isInDiamondJournal"]) {
this.resultLandingInfo.oaRoutes = {
"green": data[0].isgreen,
"oaColor": data[0].openaccesscolor,
"isInDiamondJournal":data[0].isindiamondjournal
"green": result.isGreen,
"oaColor": result.openAccessColor,
"isInDiamondJournal": result.isInDiamondJournal
};
}
}
if (data[0]['bestaccessright'] && data[0]['bestaccessright'].hasOwnProperty("classname")) {
this.resultLandingInfo.accessMode = data[0]['bestaccessright'].classname;
}
// res['result']['metadata']['oaf:entity']['oaf:result']['title']
if (data[1] != null) {
if (Array.isArray(data[1])) {
for (let i = 0; i < data[1].length; i++) {
if (data[1][i] && data[1][i].content) {
if (!this.resultLandingInfo.title || data[1][i].classid == "main title") {
this.resultLandingInfo.title = StringUtils.HTMLToString(String(data[1][i].content));
}
if (!this.resultLandingInfo.subtitle && data[1][i].classid === 'subtitle') {
this.resultLandingInfo.subtitle = StringUtils.HTMLToString(String(data[1][i].content));
}
// if(data[1][i].classid == "main title") {
// break;
// }
}
}
if (this.resultLandingInfo.title === this.resultLandingInfo.subtitle) {
this.resultLandingInfo.subtitle = "";
}
if (!this.resultLandingInfo.title) {
this.resultLandingInfo.title = "";
}
// this.resultLandingInfo.title = (data[1][0] && data[1][0].content) ? String(data[1][0].content) : "";
} else {
this.resultLandingInfo.title = (data[1] && data[1].content) ? StringUtils.HTMLToString(String(data[1].content)) : "";
}
}
// res['result']['metadata']['oaf:entity']['oaf:result']['rels']['rel']
if (data[2] != null) {
let relation;
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 && relation['to'].class.toLowerCase() == "isproducedby") {
this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation);
}
if (relation['to'].scheme && relation['to'].scheme == "dnet:result_result_relations") {
let relationName: string = relation.to.class;
if (!this.resultLandingInfo.relatedClassFilters.has(relationName)) {
this.resultLandingInfo.relatedClassFilters.add(relationName);
}
let provenanceAction: string = relation.provenanceaction;
this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction, relationName);
} else if (relation['to'].class && relation['to'].class.toLowerCase() == "hasauthorinstitution") {
this.resultLandingInfo.organizations = this.parseRelatedOrganizations(this.resultLandingInfo.organizations, relation);
} else if (relation['to'].scheme && relation['to'].scheme == "dnet:result_datasource_relations" &&
(relation['datasourcetype']?.classname!== "service" || properties.adminToolsPortalType == "eosc")) {
let relationName: string = relation.to.class;
if (!this.resultLandingInfo.relatedServicesClassFilters.has(relationName)) {
this.resultLandingInfo.relatedServicesClassFilters.add(relationName);
}
let provenanceAction: string = relation.provenanceaction;
// this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction, relationName);
if (this.resultLandingInfo.relatedServices == undefined) {
this.resultLandingInfo.relatedServices = [];
}
this.resultLandingInfo.relatedServices = this.parsingFunctions.parseDatasources(this.resultLandingInfo.relatedServices, relation, provenanceAction, relationName);
}
}
}
}
// res['result']['metadata']['oaf:entity']['oaf:result']['children']
if (data[3] != null) {
if (data[3].hasOwnProperty("result")) {
this.resultLandingInfo.deletedByInferenceIds = [];
let length = Array.isArray(data[3]['result']) ? data[3]['result'].length : 1;
for (let i = 0; i < length; i++) {
let result = Array.isArray(data[3]['result']) ? data[3]['result'][i] : data[3]['result'];
this.resultLandingInfo.deletedByInferenceIds.push(result.objidentifier);
}
this.resultLandingInfo.children = data[3]['result'];
if (result['bestaccessright'] && result['bestaccessright']["label"]) {
this.resultLandingInfo.accessMode = result['bestaccessright'].label;
}
if (data[3].hasOwnProperty("instance")) {
if (result['maintitle']) {
this.resultLandingInfo.title = StringUtils.HTMLToString(String(result['maintitle']));
}
if (result['otherTitles'] != null) {
let titles = result['otherTitles'];
if (Array.isArray(titles)) {
for (let i = 0; i < titles.length; i++) {
if (titles[i]) {
if (!this.resultLandingInfo.subtitle) {
this.resultLandingInfo.subtitle = StringUtils.HTMLToString(String(titles[i]));
}
}
}
if (!this.resultLandingInfo.title) {
this.resultLandingInfo.title = this.resultLandingInfo.subtitle;
}
if (this.resultLandingInfo.title === this.resultLandingInfo.subtitle) {
this.resultLandingInfo.subtitle = "";
}
} else {
this.resultLandingInfo.title = (titles) ? StringUtils.HTMLToString(String(titles)) : "";
}
}
if (result["instance"]) {
this.resultLandingInfo.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>();
this.resultLandingInfo.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 length = Array.isArray(result['instance']) ? result['instance'].length : 1;
for (let i = 0; i < length; i++) {
instance = Array.isArray(data[3]['instance']) ? data[3]['instance'][i] : data[3]['instance'];
instance = Array.isArray(result['instance']) ? result['instance'][i] : result['instance'];
this.parsingFunctions.parseTypes(this.resultLandingInfo.types, types, instance);
if (instance.hasOwnProperty("webresource")) {
if (instance["url"]) {
let url;
if (!Array.isArray(instance['webresource'])) {
url = instance['webresource'].url;
} else {
url = instance['webresource'][0].url;
}
url = Array.isArray(instance['url']) ? instance['url'][0] : instance["url"];
if (url.includes('&amp;')) {
url = url.replace(/&amp;/gmu, '&');
}
/**********************************************************/
if (instance.hasOwnProperty("hostedby")) {
if (instance["hostedby"]) {
this.parsingFunctions.parseHostedBy_collectedFrom(this.resultLandingInfo.hostedBy_collectedFrom, instance, url, this.resultLandingInfo.accessMode);
}
/**********************************************************/
}
}
@ -283,174 +224,203 @@ export class ResultLandingService {
this.resultLandingInfo.hostedBy_collectedFrom.sort(this.parsingFunctions.compareHostedByCollectedFrom);
}
if (data[3].hasOwnProperty("externalreference")) {
let externalResults: Map<string, Map<string, string>> = this.parseBioentitiesAndSoftware(data[3]);
if (result['journal']) {
let journal = result['journal'];
this.resultLandingInfo.journal = {
"journal": "", "issn": "", "lissn": "", "eissn": "",
"issue": "", "volume": "", "start_page": "", "end_page": ""
}
this.resultLandingInfo.journal['journal'] = journal.name;
this.resultLandingInfo.journal['issn'] = journal.issnPrinted;
this.resultLandingInfo.journal['lissn'] = journal.issnLinking;
this.resultLandingInfo.journal['eissn'] = journal.issnOnline;
this.resultLandingInfo.journal['issue'] = journal.iss;
this.resultLandingInfo.journal['volume'] = journal.vol;
this.resultLandingInfo.journal['start_page'] = journal.sp;
this.resultLandingInfo.journal['end_page'] = journal.ep;
}
if(result['programmingLanguage']) {
this.resultLandingInfo.programmingLanguages = this.parsingFunctions.parseProgrammingLanguages(result['programmingLanguage']);
}
if(result['language']) {
this.resultLandingInfo.languages = this.parsingFunctions.parseLanguages(result['language']);
}
if (result['country']) {
this.resultLandingInfo.countries = this.parsingFunctions.parseCountries(result['country']);
}
if (result['eoscifguidelines'] != null) {
this.resultLandingInfo.eoscSubjects = this.parsingFunctions.parseEoscSubjects(result['eoscifguidelines']);
}
// res['result']['metadata']['oaf:entity']['oaf:result']['subject']
if (result['subject'] != null) {
let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>, string[], string[]] = this.parsingFunctions.parseAllSubjects(result['subject'], subjectsVocabulary);
this.resultLandingInfo.subjects = subjectResults[0];
this.resultLandingInfo.otherSubjects = subjectResults[1];
this.resultLandingInfo.classifiedSubjects = subjectResults[2];
if (subjectResults[3]) {
let searchFieldsHelper: SearchFields = new SearchFields();
subjectResults[3].forEach(element => {
// hide L3 & L4 FoS
let add = true;
if (element) {
let id = element.split(" ")[0];
if (id.length > 4 && properties.environment != "development") {
add = false;
}
}
if (add) {
this.resultLandingInfo.fos.push(
{
id: element,
label: searchFieldsHelper.getFosParameter() == "foslabel" ? element.replace(/^\d+/, '').trim() : element
}
);
}
});
}
if (this.resultLandingInfo.fos) {
this.resultLandingInfo.fos.sort((a, b) => a.id.localeCompare(b.id));
}
if (properties.dashboard != "irish") {
this.resultLandingInfo.sdg = subjectResults[4];
if (this.resultLandingInfo.sdg) {
this.resultLandingInfo.sdg.sort((a, b) => {
return HelperFunctions.sortSDGs(a, b);
})
}
}
}
if (result['author']) {
if (this.resultLandingInfo.authors == undefined) {
this.resultLandingInfo.authors = new Array<{ "fullName": string, "orcid": string, "orcid_pending": string }>();
}
let authors = result['author'];
let length = Array.isArray(authors) ? authors.length : 1;
for (let i = 0; i < length; i++) {
let parsedAuthor = {"fullName": null, "orcid": null, "orcid_pending": null};
let author = Array.isArray(authors) ? authors[i] : authors;
if (author) {
parsedAuthor.fullName = author.fullname;
let pids = author.pid?author.pid:[];
for(let pid of pids) {
if (pid.typeCode == 'orcid') {
parsedAuthor.orcid = pid.value.toUpperCase();
break;
} else if (pid.typeCode == "orcid_pending") {
parsedAuthor.orcid_pending = pid.value.toUpperCase();
}
}
if (this.resultLandingInfo['authors'][author.rank] && this.resultLandingInfo['authors'][author.rank].fullName == author.fullname) {
if (!parsedAuthor.orcid && this.resultLandingInfo['authors'][author.rank].orcid) {
parsedAuthor.orcid = this.resultLandingInfo['authors'][author.rank].orcid;
} else if (!parsedAuthor.orcid_pending && this.resultLandingInfo['authors'][author.rank].orcid_pending) {
parsedAuthor.orcid_pending = this.resultLandingInfo['authors'][author.rank].orcid_pending;
}
}
this.resultLandingInfo['authors'][author.rank] = {
"fullName": parsedAuthor.fullName,
"orcid": parsedAuthor.orcid,
"orcid_pending": parsedAuthor.orcid_pending
};
}
}
this.resultLandingInfo.authors = this.resultLandingInfo.authors.filter(function (item) {
return (item != undefined && item.fullName != undefined);
});
}
// TODO: example?
if (result["externalReference"]) {
let externalResults: Map<string, Map<string, string>> = this.parseBioentitiesAndSoftware(result["externalReference"]);
this.resultLandingInfo.bioentities = externalResults;
}
}
// res['result']['metadata']['oaf:entity']['oaf:result']['pid']
if (data[4] != null) {
this.resultLandingInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[4]);
if(data["pid"]) {
this.resultLandingInfo.identifiers = this.parsingFunctions.parseIdentifiers(data["pid"]);
}
// res['result']['metadata']['oaf:entity']['oaf:result']['journal']
if (data[5] != null) {
this.resultLandingInfo.journal = {
"journal": "",
"issn": "",
"lissn": "",
"eissn": "",
"issue": "",
"volume": "",
"start_page": "",
"end_page": ""
}
if(data["links"]) {
let links = data['links'];
let relLength = Array.isArray(links) ? links.length : 1;
this.resultLandingInfo.journal['journal'] = data[5].content;
this.resultLandingInfo.journal['issn'] = data[5].issn;
this.resultLandingInfo.journal['lissn'] = data[5].lissn;
this.resultLandingInfo.journal['eissn'] = data[5].eissn;
this.resultLandingInfo.journal['issue'] = data[5].iss;
this.resultLandingInfo.journal['volume'] = data[5].vol;
this.resultLandingInfo.journal['start_page'] = data[5].sp;
this.resultLandingInfo.journal['end_page'] = data[5].ep;
}
for (let i = 0; i < relLength; i++) {
let relation = Array.isArray(links) ? links[i] : links;
// res['result']['metadata']['oaf:entity']['oaf:result']['language']
if (data[6] != null) {
this.resultLandingInfo.languages = this.parsingFunctions.parseLanguages(data[6]);
// let languagesAndCodes: string[][] = this.parsingFunctions.parseLanguages(data[6]);
// this.resultLandingInfo.languages = languagesAndCodes[0];
// this.resultLandingInfo.languageCodes = languagesAndCodes[1];
}
// res['result']['metadata']['oaf:entity']['oaf:result']['country']
if (data[11] != null) {
this.resultLandingInfo.countries = this.parsingFunctions.parseCountries(data[11]);
}
// res['result']['metadata']['oaf:entity']['oaf:result']['eoscifguidelines']
if (data[7] != null) {
this.resultLandingInfo.eoscSubjects = this.parsingFunctions.parseEoscSubjects(data[7]);
}
// res['result']['metadata']['oaf:entity']['oaf:result']['subject']
if (data[8] != null) {
let subjectResults: [string[], Map<string, string[]>, Map<string, string[]>, string[], string[]] = this.parsingFunctions.parseAllSubjects(data[8], subjectsVocabulary);
this.resultLandingInfo.subjects = subjectResults[0];
this.resultLandingInfo.otherSubjects = subjectResults[1];
this.resultLandingInfo.classifiedSubjects = subjectResults[2];
if (subjectResults[3]) {
let searchFieldsHelper: SearchFields = new SearchFields();
subjectResults[3].forEach(element => {
// hide L3 & L4 FoS
let add = true;
if(element) {
let id = element.split(" ")[0];
if(id.length > 4 && properties.environment != "development") {
add = false;
if (relation["header"]) {
if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "isproducedby") {
this.resultLandingInfo.fundedByProjects = this.parsingFunctions.parseFundingByProjects(this.resultLandingInfo.fundedByProjects, relation);
}
// links.header.relationType (==resultResult)
if (relation['header'].relationType == "resultResult" && (!relation['header'].relationClass || relation['header'].relationClass.toLowerCase() != "merges")) {
let relationName: string = relation.header.relationClass;
if (!this.resultLandingInfo.relatedClassFilters.has(relationName)) {
this.resultLandingInfo.relatedClassFilters.add(relationName);
}
let provenanceAction: string = relation.provenanceaction;
this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction, relationName);
} else if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "hasauthorinstitution") {
this.resultLandingInfo.organizations = this.parseRelatedOrganizations(this.resultLandingInfo.organizations, relation);
} else if (relation['header'].relationType == "resultService" &&
(relation['datasourcetype']?.code !== "service" || properties.adminToolsPortalType == "eosc")) {
let relationName: string = relation.header.relationClass;
if (!this.resultLandingInfo.relatedServicesClassFilters.has(relationName)) {
this.resultLandingInfo.relatedServicesClassFilters.add(relationName);
}
let provenanceAction: string = relation.header.relationProvenance;
if (this.resultLandingInfo.relatedServices == undefined) {
this.resultLandingInfo.relatedServices = [];
}
this.resultLandingInfo.relatedServices = this.parsingFunctions.parseDatasources(this.resultLandingInfo.relatedServices, relation, provenanceAction, relationName);
} else if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "merges" && relation['header'].relationType == "resultResult") {
if(!this.resultLandingInfo.deletedByInferenceIds) {
this.resultLandingInfo.deletedByInferenceIds = [];
}
this.resultLandingInfo.deletedByInferenceIds.push(relation['header'].relatedIdentifier);
if(!this.resultLandingInfo.children) {
this.resultLandingInfo.children = [];
}
this.resultLandingInfo.children.push(relation);
}
if(add) {
this.resultLandingInfo.fos.push(
{
id: element,
label: searchFieldsHelper.getFosParameter() == "foslabel" ? element.replace(/^\d+/, '').trim() : element
}
);
}
});
}
if (this.resultLandingInfo.fos) {
this.resultLandingInfo.fos.sort((a, b) => a.id.localeCompare(b.id));
}
if(properties.dashboard != "irish") {
this.resultLandingInfo.sdg = subjectResults[4];
if (this.resultLandingInfo.sdg) {
this.resultLandingInfo.sdg.sort((a, b) => {
return HelperFunctions.sortSDGs(a, b);
})
}
}
this.resultLandingInfo.relatedResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.relatedResults);
}
// if(!this.resultLandingInfo.eoscSubjects) {
// this.resultLandingInfo.eoscSubjects = subjectResults[5];
// }
if(data['context']) {
this.resultLandingInfo.contexts = this.parsingFunctions.parseContexts(data['context']);
}
if (data.measures) {
this.resultLandingInfo.measure = this.parsingFunctions.parseMeasures(data.measures);
}
this.resultLandingInfo.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom(
this.resultLandingInfo.hostedBy_collectedFrom, this.resultLandingInfo.publisher,
this.resultLandingInfo.journal?.journal, this.resultLandingInfo.identifiers);
this.resultLandingInfo.hostedBy_collectedFrom, this.resultLandingInfo.publisher,
this.resultLandingInfo.journal?.journal, this.resultLandingInfo.identifiers);
// res['result']['metadata']['oaf:entity']['oaf:result']['programmingLanguage']
if (data[12] != null) {
this.resultLandingInfo.programmingLanguages = this.parsingFunctions.parseProgrammingLanguages(data[12]);
}
//TODO: missing
// res['result']['metadata']['oaf:entity']['extraInfo']['references']['reference']
if (data[13] != null) {
this.resultLandingInfo.references = this.parsingFunctions.parseReferences(data[13]);
}
// res['result']['metadata']['oaf:entity']['oaf:result']['context']
if (data[9] != null) {
this.resultLandingInfo.contexts = this.parsingFunctions.parseContexts(data[9]);
}
// res['result']['header']['dri:status']
if (data[14] != null && data[14] == "under curation") {
this.resultLandingInfo.underCurationMessage = true;
} else {
this.resultLandingInfo.underCurationMessage = false;
}
// res['result']['metadata']['oaf:entity']['oaf:result']['creator']
if (data[10] != null) {
if (this.resultLandingInfo.authors == undefined) {
this.resultLandingInfo.authors = new Array<{ "fullName": string, "orcid": string, "orcid_pending": string }>();
}
let authors = data[10];
let length = Array.isArray(authors) ? authors.length : 1;
for (let i = 0; i < length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors;
if (author) {
if (author.orcid) {
author.orcid = author.orcid.toUpperCase();
}
if (author.orcid_pending) {
author.orcid_pending = author.orcid_pending.toUpperCase();
}
if(this.resultLandingInfo['authors'][author.rank] && this.resultLandingInfo['authors'][author.rank].fullName == author.content) {
if(!author.orcid && this.resultLandingInfo['authors'][author.rank].orcid) {
author.orcid = this.resultLandingInfo['authors'][author.rank].orcid;
} else if(!author.orcid_pending && this.resultLandingInfo['authors'][author.rank].orcid_pending) {
author.orcid_pending = this.resultLandingInfo['authors'][author.rank].orcid_pending;
}
}
this.resultLandingInfo['authors'][author.rank] = {
"fullName": author.content,
"orcid": author.orcid,
"orcid_pending": author.orcid_pending
};
}
}
this.resultLandingInfo.authors = this.resultLandingInfo.authors.filter(function (item) {
return (item != undefined && item.fullName != undefined);
});
}
// res['result']['metadata']['oaf:entity']['oaf:result']['measure']
if (data[0]?.measure) {
this.resultLandingInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
}
this.resultLandingInfo.relatedResults = this.parsingFunctions.sortByPercentage(this.resultLandingInfo.relatedResults);
// // res['result']['metadata']['oaf:entity']['extraInfo']['references']['reference']
// if (data[13] != null) {
// this.resultLandingInfo.references = this.parsingFunctions.parseReferences(data[13]);
// }
//
return this.resultLandingInfo;
}
@ -470,15 +440,15 @@ export class ResultLandingService {
country: "", trust: null
};
organization.id = relation['to'].content;
organization.id = relation['header'].relatedIdentifier;
organization.name = relation.legalname;
organization.shortname = relation.legalshortname;
organization.websiteUrl = relation.websiteurl;
if (relation.country) {
organization.country = relation.country.classname;
organization.country = relation.country.label;
}
if (relation.trust) {
organization.trust = Math.round(relation.trust * 100);
if (relation.header.trust) {
organization.trust = Math.round(relation.header.trust * 100);
}
organizations.push(organization);
@ -488,14 +458,14 @@ export class ResultLandingService {
parseBioentitiesAndSoftware(children: any): Map<string, Map<string, string>> {
let bioentities: Map<string, Map<string, string>>;
let length = Array.isArray(children['externalreference']) ? children['externalreference'].length : 1;
let length = Array.isArray(children) ? children.length : 1;
let externalreference;
for (let i = 0; i < length; i++) {
externalreference = Array.isArray(children['externalreference']) ? children['externalreference'][i] : children['externalreference'];
externalreference = Array.isArray(children) ? children[i] : children;
if (externalreference.hasOwnProperty("qualifier")) {
if (externalreference['qualifier'].classid == "accessionNumber") {
if (externalreference["qualifier"]) {
if (externalreference['qualifier'].code == "accessionNumber") {
if (bioentities == undefined) {
bioentities = new Map<string, Map<string, string>>();

View File

@ -37,7 +37,7 @@ export class OrganizationService {
return this.http.get((properties.useCache) ? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:organization']))
// .pipe(map(res => res['result']['metadata']['oaf:entity']['oaf:organization']))
.pipe(map(res => this.parseOrganizationNameAndUrl(res)));
}
@ -48,170 +48,90 @@ export class OrganizationService {
return throwError(error || 'Server error');
}
parseOrganizationInfo (data: any):any {
this.organizationInfo = new OrganizationInfo();
this.organizationInfo.relcanId = ParsingFunctions.parseRelCanonicalId(data,"organization");
let organization;
let relations;
if(data != null) {
organization = data['result']['metadata']['oaf:entity']['oaf:organization'];
this.organizationInfo.objIdentifier = data["result"]["header"]["dri:objIdentifier"];
if(this.organizationInfo.objIdentifier.startsWith("openorgs____::")) {
this.organizationInfo.relcanId = this.organizationInfo.objIdentifier;
}
relations = data['result']['metadata']['oaf:entity']['oaf:organization']['rels']['rel'];
} else {
return null;
}
if(organization != null) {
if(organization.hasOwnProperty("websiteurl")) {
this.organizationInfo.title = {"name": organization.legalshortname, "url": organization.websiteurl};
} else {
this.organizationInfo.title = {"name": organization.legalshortname, "url": ''};
}
this.organizationInfo.name = organization.legalname;
if(!this.organizationInfo.title.name || this.organizationInfo.title.name == '') {
this.organizationInfo.title.name = this.organizationInfo.name;
}
if(organization.hasOwnProperty("country")) {
this.organizationInfo.country = organization['country'].classname;
}
if (organization.hasOwnProperty("children")) {
let children = organization['children'];
if( children.hasOwnProperty("organization")) {
this.organizationInfo.deletedByInferenceIds = [];
let length = Array.isArray(children['organization']) ? children['organization'].length : 1;
for (let i = 0; i < length; i++) {
let result = Array.isArray(children['organization']) ? children['organization'][i] : children['organization'];
this.organizationInfo.deletedByInferenceIds.push(result.objidentifier);
}
}
this.organizationInfo.children = children['organization'];
}
if(organization['pid']) {
this.organizationInfo.identifiers = this.parsingFunctions.parseIdentifiers(organization['pid']);
}
}
//Comment Parsing Projects info
/*
if(data[1] != null) {
let counter;
let length = relations.length!=undefined ? relations.length : 1;
for(let i=0; i<length; i++) {
let relation = relations.length!=undefined ? relations[i] : relations;
if(relation.hasOwnProperty("to")) {
if(relation['to'].class == "isParticipant") {
if(relation.hasOwnProperty("funding")) {
if(relation['funding'].hasOwnProperty("funder")) {
if(this.organizationInfo.projects == undefined) {
this.organizationInfo.projects = new Map<string,
{ "name": string, "id": string, "code": string,
"acronym": string, "funder": string, "funderId": string,
"fundingStream": string, "fundingLevel1": string, "fundingLevel2": string,
"sc39": string, "startDate": string, "endDate": string }[]>();
}
if(!this.organizationInfo.projects.has(relation['funding']['funder'].name)) {
this.organizationInfo.projects.setValues(relation['funding']['funder'].name,
new Array<{ "name": string, "id": string, "code": string,
"acronym": string, "funder": string, "funderId": string,
"fundingStream": string, "fundingLevel1": string, "fundingLevel2": string,
"sc39": string, "startDate": string, "endDate": string }>());
}
counter = this.organizationInfo.projects.get(relation['funding']['funder'].name).length;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter] =
{ "name": "", "id": "", "code": "",
"acronym": "", "funder": "", "funderId": "",
"fundingStream": "", "fundingLevel1": "", "fundingLevel2": "",
"sc39": "", "startDate": "", "endDate": "" };
//let url = "";
if(relation['to'].content != null && relation['to'].content != "") {
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['id'] = relation['to'].content;
//url = OpenaireProperties.getsearchLinkToProject()+relation['to'].content;
}
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['name'] = relation.title;
//this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['url'] = url;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['code'] = relation.code;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['acronym'] = relation.acronym;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['funder'] = relation['funding']['funder'].shortname;
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['funderId'] = relation['funding']['funder'].id;
if(relation['funding'].hasOwnProperty("funding_level_0")) {
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingStream'] = relation['funding']['funding_level_0'].name;
}
if(relation['funding'].hasOwnProperty("funding_level_1")) {
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingLevel1'] = relation['funding']['funding_level_1'].name;
}
if(relation['funding'].hasOwnProperty("funding_level_2")) {
this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['fundingLevel2'] = relation['funding']['funding_level_2'].name;
}
//this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['sc39'] =
//this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['startDate'] =
//this.organizationInfo.projects.get(relation['funding']['funder'].name)[counter]['endDate'] =
}
}
}
} /*else if(relation['to'].class == "isProvidedBy") {
if(this.organizationInfo.dataProviders == undefined) {
this.organizationInfo.dataProviders = new Array<{ "name": string, "url": string, "type": string, "websiteUrl": string , "organizations": {"name": string, "url": string}[]}>();
}
counter = this.organizationInfo.dataProviders.length;
this.organizationInfo.dataProviders[counter] = { "name": "", "url": "", "type": "", "websiteUrl": "", "organizations": [] }
let url="";
if(relation['to'].content != null && relation['to'].content != "") {
url = OpenaireProperties.getsearchLinkToDataProvider()+relation['to'].content;
}
this.organizationInfo.dataProviders[counter]['name'] = relation.officialname;
this.organizationInfo.dataProviders[counter]['url'] = url;
if(relation.hasOwnProperty("datasourcetype")) {
this.organizationInfo.dataProviders[counter]['type'] = relation['datasourcetype'].classname;
}
this.organizationInfo.dataProviders[counter]['websiteUrl'] = relation.websiteurl;
}*/
/* ----->
}
}
}
*/
return this.organizationInfo;
parseOrganizationInfo (data: any):any {
if(data == null) {
return null;
}
parseOrganizationNameAndUrl(organization: any): any {
let title: {"name": string, "url": string} = {"name": "", "url": ""};
this.organizationInfo = new OrganizationInfo();
let organization;
if(organization != null) {
if(organization.hasOwnProperty("websiteurl")) {
title = {"name": organization.legalshortname, "url": organization.websiteurl};
} else {
title = {"name": organization.legalshortname, "url": ''};
}
if(data["header"]) {
this.organizationInfo.relcanId = ParsingFunctions.parseRelCanonicalId(data,"organization");
if(title.name == '') {
title.name = organization.legalname;
}
this.organizationInfo.objIdentifier = data["header"]["id"];
if(this.organizationInfo.objIdentifier.startsWith("openorgs____::")) {
this.organizationInfo.relcanId = this.organizationInfo.objIdentifier;
}
}
if(data["organization"]) {
organization = data["organization"];
if (organization["websiteurl"]) {
this.organizationInfo.title = {"name": organization.legalshortname, "url": organization.websiteurl};
} else {
this.organizationInfo.title = {"name": organization.legalshortname, "url": ''};
}
return title;
this.organizationInfo.name = organization.legalname;
if (!this.organizationInfo.title.name || this.organizationInfo.title.name == '') {
this.organizationInfo.title.name = this.organizationInfo.name;
}
if (organization["country"]) {
this.organizationInfo.country = organization['country'].label;
}
}
if(data["pid"]) {
this.organizationInfo.identifiers = this.parsingFunctions.parseIdentifiers(data['pid']);
}
if(data["links"]) {
let links = data['links'];
let relLength = Array.isArray(links) ? links.length : 1;
for(let i=0; i<relLength; i++) {
let relation = Array.isArray(links) ? links[i] : links;
if (relation["header"]) {
// TODO: Check if merges or isMergedIn
if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "merges" && relation['header'].relatedRecordType == "organization") {
if(!this.organizationInfo.deletedByInferenceIds) {
this.organizationInfo.deletedByInferenceIds = [];
}
this.organizationInfo.deletedByInferenceIds.push(relation['header'].relatedIdentifier);
if(!this.organizationInfo.children) {
this.organizationInfo.children = [];
}
this.organizationInfo.children.push(relation);
}
}
}
}
return this.organizationInfo;
}
parseOrganizationNameAndUrl(res: any): any {
if(!res || res.organization) {
return null;
}
let organization = res.organization;
let title: {"name": string, "url": string} = {"name": "", "url": ""};
if(organization != null) {
if(organization["websiteurl"]) {
title = {"name": organization.legalshortname, "url": organization.websiteurl};
} else {
title = {"name": organization.legalshortname, "url": ''};
}
if(title.name == '') {
title.name = organization.legalname;
}
}
return title;
}
}

View File

@ -97,162 +97,169 @@ export class SearchDataprovidersService {
.pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
}
parseResults(data: any): SearchResult[] {
let results: SearchResult[] = [];
parseResults(data: any): SearchResult[] {
let results: SearchResult[] = [];
let length = Array.isArray(data) ? data.length : 1;
let length = Array.isArray(data) ? data.length : 1;
for(let i=0; i<length; i++) {
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:datasource'] : data['result']['metadata']['oaf:entity']['oaf:datasource'];
for(let i=0; i<length; i++) {
let resBody = Array.isArray(data) ? data[i] : data;
var result: SearchResult = new SearchResult();
var result: SearchResult = new SearchResult();
result['title'] = {"name": '', "accessMode": ''};
if(resData.officialname) {
result['title'].name = StringUtils.HTMLToString(String(resData.officialname));
}
if(resData.englishname) {
result['englishname'] = StringUtils.HTMLToString(String(resData.englishname));
} else {
result['englishname'] = "";
}
result['originalId'] = resData.originalId;
//result['title'].url = OpenaireProperties.getsearchLinkToDataProvider();
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
let canId = ParsingFunctions.parseRelCanonicalId(Array.isArray(data) ? data[i] : data, "datasource");
if (canId) {
result['id'] = canId;
}
result['relcanId'] = result['id'];
result['type'] = this.getDataproviderType(resData);
if (resData['eosctype']) {
result.entityType = resData['eosctype'].classname == "Service" ? "service" : "dataprovider";
}
let abstracts = this.parsingFunctions.parseDescription(resData.description, true);
result.description = abstracts;
// if (result.description && result.description.length > this.sizeOfDescription) {
// result.description = result.description.substring(0, this.sizeOfDescription) + "...";
// }
let typeid: string = resData['datasourcetype'] && resData['datasourcetype'].classid;
if(typeid != "entityregistry" && typeid != "entityregistry::projects" && typeid != "entityregistry::repositories") {
if(resData.hasOwnProperty('accessinfopackage')) {
let OAIPMHURL: string;
if(Array.isArray(resData['accessinfopackage'])) {
OAIPMHURL = resData['accessinfopackage'][0];
} else {
OAIPMHURL = resData['accessinfopackage'];
}
if(OAIPMHURL != '' && OAIPMHURL != 'unknown') {
result['OAIPMHURL'] = OAIPMHURL;
}
}
let compatibility = this.getDataproviderCompatibility(resData);
result['compatibility'] = compatibility.classname;
if(compatibility.classid == "UNKNOWN") {
result['compatibilityUNKNOWN'] = true;
}
} else {
result['compatibility'] = "";
}
result['websiteURL'] = resData.websiteurl;
let res:[string[], {"name":string, "id":string}[]] = this.getDataproviderCountriesOrganizations(resData, true, true);
result['organizations'] = res[1];
result['countries'] = res[0];
result['subjects'] = this.getDataproviderSubjects(resData);
if(resData['pid']) {
result.identifiers = this.parsingFunctions.parseIdentifiers(resData['pid']);
}
// Measure
result.measure = this.parsingFunctions.parseMeasures(resData['measure']);
results.push(result);
if(resBody["header"]) {
result.id = resBody['header']['id'];
let canId = ParsingFunctions.parseRelCanonicalId(resBody, "datasource");
if (canId) {
result['id'] = canId;
}
return results;
}
getDataproviderSubjects(resData: any): string [] {
var subjects:string [] = [];
let length = Array.isArray(resData['subjects']) ? resData['subjects'].length : 1;
for(let i=0; i<length; i++) {
let subject = Array.isArray(resData['subjects']) ? resData['subjects'][i] :resData['subjects'];
if(subject && subject.content) {
subjects.push(subject.content);
}
result['relcanId'] = result['id'];
}
return subjects;
}
getDataproviderType(resData: any): string {
if(resData.hasOwnProperty('datasourcetype') && resData['datasourcetype'].hasOwnProperty("classname")) {
return resData['datasourcetype'].classname;
} else {
return '';
if (resBody["datasource"]) {
let resData = resBody['datasource'];
result['title'] = {"name": '', "accessMode": ''};
if(resData.officialname) {
result['title'].name = StringUtils.HTMLToString(String(resData.officialname));
}
}
getDataproviderCompatibility(resData: any): {"classid": string, "classname": string} {
if(resData.hasOwnProperty('openairecompatibility')) {
return {"classid": resData['openairecompatibility'].classid, "classname": resData['openairecompatibility'].classname};
if(resData.englishname) {
result['englishname'] = StringUtils.HTMLToString(String(resData.englishname));
} else {
return {"classid": "", "classname": ""};
result['englishname'] = "";
}
}
result['originalId'] = resData.originalId;
getDataproviderCountriesOrganizations(resData: any, getCountries: boolean, getOrganizations: boolean): [string[], {"name": string, "id": string}[]] {
let countries: string[] = [];
let organizations: {"name": string, "id": string}[] = [];
result['type'] = this.getDataproviderType(resData);
if (resData['eosctype']) {
result.entityType = resData['eosctype'].label == "Service" ? "service" : "dataprovider";
}
if(resData['rels'].hasOwnProperty("rel")) {
let countriesSet: Set<string> = new Set<string>();
let abstracts = this.parsingFunctions.parseDescription(resData.description, true);
result.description = abstracts;
// if (result.description && result.description.length > this.sizeOfDescription) {
// result.description = result.description.substring(0, this.sizeOfDescription) + "...";
// }
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
let typeid: string = resData['datasourcetype'] && resData['datasourcetype'].code;
if(typeid != "entityregistry" && typeid != "entityregistry::projects" && typeid != "entityregistry::repositories") {
for(let i=0; i<relLength; i++) {
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][i] : resData['rels']['rel'];
if(relation.hasOwnProperty("to")) {
if(relation['to'].class && relation['to'].class.toLowerCase() == "isprovidedby" && relation['to'].type == "organization") {
if(getOrganizations) {
let item: {"name":string, "id":string} = {"name": "", "id": ""};
//item['name'] = relation.legalname;
if(relation.legalshortname) {
item['name'] = relation.legalshortname;
} else {
item['name'] = relation.legalname;
}
if(!item['name']) {
item['name'] = "[no title available]";
}
item['id'] = /*OpenaireProperties.getsearchLinkToOrganization()+*/relation['to'].content;
organizations.push(item);
}
if(getCountries) {
if(relation.hasOwnProperty('country') &&
relation.country.hasOwnProperty('classname')) {
if(!countriesSet.has(relation.country.classname)) {
countriesSet.add(relation.country.classname);
countries.push(relation.country.classname);
}
}
}
}
}
if(resData['accessinfopackage']) {
let OAIPMHURL: string;
if(Array.isArray(resData['accessinfopackage'])) {
OAIPMHURL = resData['accessinfopackage'][0];
} else {
OAIPMHURL = resData['accessinfopackage'];
}
if(OAIPMHURL != '' && OAIPMHURL != 'unknown') {
result['OAIPMHURL'] = OAIPMHURL;
}
}
let compatibility = this.getDataproviderCompatibility(resData);
result['compatibility'] = compatibility.classname;
if(compatibility.classid == "UNKNOWN") {
result['compatibilityUNKNOWN'] = true;
}
} else {
result['compatibility'] = "";
}
return [countries, organizations];
result['websiteURL'] = resData.websiteurl;
result['subjects'] = this.getDataproviderSubjects(resData);
// Measure
result.measure = this.parsingFunctions.parseMeasures(resData['measures']);
}
if(resBody["links"]) {
let res:[string[], {"name":string, "id":string}[]] = this.getDataproviderCountriesOrganizations(resBody['links'], true, true);
result['organizations'] = res[1];
result['countries'] = res[0];
}
if(resBody['pid']) {
result.identifiers = this.parsingFunctions.parseIdentifiers(resBody['pid']);
}
results.push(result);
}
return results;
}
getDataproviderSubjects(resData: any): string [] {
var subjects:string [] = [];
let length = Array.isArray(resData['subjects']) ? resData['subjects'].length : 1;
for(let i=0; i<length; i++) {
let subject = Array.isArray(resData['subjects']) ? resData['subjects'][i] :resData['subjects'];
if(subject && subject.value) {
subjects.push(subject.value);
}
}
return subjects;
}
getDataproviderType(resData: any): string {
if(resData['datasourcetype'] && resData['datasourcetype']["label"]) {
return resData['datasourcetype'].label;
} else {
return '';
}
}
getDataproviderCompatibility(resData: any): {"classid": string, "classname": string} {
if(resData['openairecompatibility']) {
return {"classid": resData['openairecompatibility'].code, "classname": resData['openairecompatibility'].label};
} else {
return {"classid": "", "classname": ""};
}
}
getDataproviderCountriesOrganizations(links: any, getCountries: boolean, getOrganizations: boolean): [string[], {"name": string, "id": string}[]] {
let countries: string[] = [];
let organizations: {"name": string, "id": string}[] = [];
let countriesSet: Set<string> = new Set<string>();
let relLength = Array.isArray(links) ? links.length : 1;
for(let i=0; i<relLength; i++) {
let relation = Array.isArray(links) ? links[i] : links;
if(relation["header"]) {
if(relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "isprovidedby" && relation['header'].relatedRecordType == "organization") {
if(getOrganizations) {
let item: {"name":string, "id":string} = {"name": "", "id": ""};
//item['name'] = relation.legalname;
if(relation.legalshortname) {
item['name'] = relation.legalshortname;
} else {
item['name'] = relation.legalname;
}
if(!item['name']) {
item['name'] = "[no title available]";
}
item['id'] = /*OpenaireProperties.getsearchLinkToOrganization()+*/relation['header'].relatedIdentifier;
organizations.push(item);
}
if(getCountries) {
if(relation['country'] &&
relation.country.label) {
if(!countriesSet.has(relation.country.label)) {
countriesSet.add(relation.country.label);
countries.push(relation.country.label);
}
}
}
}
}
}
return [countries, organizations];
}
numOfDataproviders(url: string, properties:EnvProperties):any {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
.pipe(map(res => res['total']));

View File

@ -17,26 +17,29 @@ export class SearchOrganizationsService {
constructor(private http: HttpClient ) {}
parseResultsForDeposit(data: any): {"name": string, "id": string}[] {
let results: {"name": string, "id": string}[] = [];
let length = Array.isArray(data) ? data.length : 1;
for(let i=0; i<length; i++) {
let name: string = '';
let id: string = '';
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:organization'] : data['result']['metadata']['oaf:entity']['oaf:organization'];
name = resData.legalname;
if(name == '') {
name = resData.legalshortname;
}
id = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
results.push({"name": name, "id": id});
}
return results;
}
/**
* @deprecated
*/
// parseResultsForDeposit(data: any): {"name": string, "id": string}[] {
// let results: {"name": string, "id": string}[] = [];
//
// let length = Array.isArray(data) ? data.length : 1;
//
// for(let i=0; i<length; i++) {
// let name: string = '';
// let id: string = '';
// let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:organization'] : data['result']['metadata']['oaf:entity']['oaf:organization'];
// name = resData.legalname;
// if(name == '') {
// name = resData.legalshortname;
// }
//
// id = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
//
// results.push({"name": name, "id": id});
// }
// return results;
// }
searchOrganizations (params: string, refineParams:string, page: number, size: number, refineFields:string[] , properties:EnvProperties):any {
@ -88,107 +91,113 @@ export class SearchOrganizationsService {
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "organization")]));
}
parseResults(data: any): SearchResult[] {
let results: SearchResult[] = [];
parseResults(data: any): SearchResult[] {
let results: SearchResult[] = [];
let length = Array.isArray(data) ? data.length : 1;
let length = Array.isArray(data) ? data.length : 1;
for(let i=0; i<length; i++) {
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:organization'] : data['result']['metadata']['oaf:entity']['oaf:organization'];
for(let i=0; i<length; i++) {
let resBody = Array.isArray(data) ? data[i] : data;
var result: SearchResult = new SearchResult();
var result: SearchResult = new SearchResult();
result['title'] = {"name": '', "accessMode": ''};
if(resData.legalname) {
result['title'].name = StringUtils.HTMLToString(String(resData.legalname));
} else {
result['title'].name = "";
}
if(resData.legalshortname) {
result['acronym'] = StringUtils.HTMLToString(String(resData.legalshortname));
if(resBody["header"]) {
result.id = resBody['header']['id'];
if(!result['id'].startsWith("openorgs____::")) {
let canId = ParsingFunctions.parseRelCanonicalId(resBody, "organization");
if(canId){
result['id'] = canId;
}
}
}
//result['title'].url = OpenaireProperties.getsearchLinkToOrganization();
//result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
if(!result['id'].startsWith("openorgs____::")) {
let canId = ParsingFunctions.parseRelCanonicalId(Array.isArray(data) ? data[i] : data, "organization");
if(canId){
result['id'] = canId;
}
}
if(resData['rels'].hasOwnProperty("rel")) {
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
if (resBody["organization"]) {
let resData = resBody['organization'];
for(let j=0; j<relLength; j++) {
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel'];
result['title'] = {"name": '', "accessMode": ''};
if(relation.hasOwnProperty("to")) {
if(relation['to'].class && relation['to'].class.toLowerCase() == "isparticipant") {
if(result['projects'] == undefined) {
result['projects'] = new Array<
{ "id": string, "acronym": string, "title": string,
"funderShortname": string, "funderName": string,
"code": string
}>();
}
let countProjects = result['projects'].length;
result['projects'][countProjects] = {
"id": "", "acronym": "", "title": "",
"funderShortname": "", "funderName": "",
"code": ""
}
if(relation.title != 'unidentified') {
result['projects'][countProjects]['id'] =
/*OpenaireProperties.getsearchLinkToProject() + */relation['to'].content;
result['projects'][countProjects]['acronym'] = relation.acronym;
result['projects'][countProjects]['title'] = relation.title;
result['projects'][countProjects]['code'] = relation.code;
} else {
result['projects'][countProjects]['id'] = "";
result['projects'][countProjects]['acronym'] = "";
result['projects'][countProjects]['title'] = "";
result['projects'][countProjects]['code'] = "";
}
if(relation.hasOwnProperty("funding")) {
let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1;
for(let z=0; z<fundingLength; z++) {
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding'];
if(fundingData.hasOwnProperty("funder")) {
result['projects'][countProjects]['funderShortname'] = fundingData['funder'].shortname;
result['projects'][countProjects]['funderName'] = fundingData['funder'].name;
}
}
}
}
}
}
}
if(resData.country.hasOwnProperty("classname")) {
result.country = resData.country.classname;
}
if(resData['pid']) {
result.identifiers = this.parsingFunctions.parseIdentifiers(resData['pid']);
}
results.push(result);
if(resData.legalname) {
result['title'].name = StringUtils.HTMLToString(String(resData.legalname));
} else {
result['title'].name = "";
}
return results;
if(resData.legalshortname) {
result['acronym'] = StringUtils.HTMLToString(String(resData.legalshortname));
}
if(resData.country["label"]) {
result.country = resData.country.label;
}
}
if (resBody["links"]) {
let relLength = Array.isArray(resBody['links']) ? resBody['links'].length : 1;
for (let j = 0; j < relLength; j++) {
let relation = Array.isArray(resBody['links']) ? resBody['links'][j] : resBody['links'];
if(relation["header"]) {
if(relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "isparticipant") {
if(result['projects'] == undefined) {
result['projects'] = new Array<
{ "id": string, "acronym": string, "title": string,
"funderShortname": string, "funderName": string,
"code": string
}>();
}
let countProjects = result['projects'].length;
result['projects'][countProjects] = {
"id": "", "acronym": "", "title": "",
"funderShortname": "", "funderName": "",
"code": ""
}
// TODO: Missing projectTitle and sometimes no acronym either.
if(relation.projectTitle != 'unidentified') {
result['projects'][countProjects]['id'] =
/*OpenaireProperties.getsearchLinkToProject() + */relation['header'].relatedIdentifier;
result['projects'][countProjects]['acronym'] = relation.acronym;
result['projects'][countProjects]['title'] = relation.projectTitle;
result['projects'][countProjects]['code'] = relation.code;
} else {
result['projects'][countProjects]['id'] = "";
result['projects'][countProjects]['acronym'] = "";
result['projects'][countProjects]['title'] = "";
result['projects'][countProjects]['code'] = "";
}
if(relation["funding"]) {
let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1;
for(let z=0; z<fundingLength; z++) {
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding'];
if(fundingData["funder"]) {
result['projects'][countProjects]['funderShortname'] = fundingData['funder'].shortname;
result['projects'][countProjects]['funderName'] = fundingData['funder'].name;
}
}
}
}
}
}
}
if(resBody['pid']) {
result.identifiers = this.parsingFunctions.parseIdentifiers(resBody['pid']);
}
results.push(result);
}
numOfOrganizations(url: string, properties:EnvProperties ): any {
return results;
}
numOfOrganizations(url: string, properties:EnvProperties ): any {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())

View File

@ -127,154 +127,140 @@ export class SearchProjectsService {
}) ;
}
parseResults(data: any): SearchResult[] {
let results: SearchResult[] = [];
let length = Array.isArray(data) ? data.length : 1;
parseResults(data: any): SearchResult[] {
let results: SearchResult[] = [];
for(let i=0; i<length; i++) {
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:project'] : data['result']['metadata']['oaf:entity']['oaf:project'];
let length = Array.isArray(data) ? data.length : 1;
var result: SearchResult = new SearchResult();
result.openAccessMandatePublications = (resData['oamandatepublications'])?true:false;
if(resData.hasOwnProperty("oamandatedata")) {
result.openAccessMandateDatasets = (resData['oamandatedata'])?true:false;
} else {
result.openAccessMandateDatasets = (resData['ecarticle29_3'])?true:false;
}
result['title'] = {"name": '', "accessMode": ''};
// if(resData['acronym'] != undefined && resData['acronym'] != "") {
// result['title'].name = resData['acronym'] + " - ";
// }
if(resData['title']) {
if (Array.isArray(resData['title'])) {
result['title'].name += StringUtils.HTMLToString(String(resData['title'][0]));
} else {
result['title'].name += StringUtils.HTMLToString(String(resData['title']));
}
for (let i = 0; i < length; i++) {
let resBody = Array.isArray(data) ? data[i] : data;
var result: SearchResult = new SearchResult();
if (resBody["header"]) {
result.id = resBody['header']['id'];
}
if (resBody["project"]) {
let resData = resBody['project'];
result.openAccessMandatePublications = resData['oamandatepublications'];
if (resData["oamandatedata"]) {
result.openAccessMandateDatasets = resData['oamandatedata'];
} else {
result.openAccessMandateDatasets = resData['ecarticle29_3'];
}
result['title'] = {"name": '', "accessMode": ''};
// if(resData['acronym'] != undefined && resData['acronym'] != "") {
// result['title'].name = resData['acronym'] + " - ";
// }
if (resData['title']) {
if (Array.isArray(resData['title'])) {
result['title'].name += StringUtils.HTMLToString(String(resData['title'][0]));
} else {
result['title'].name = "";
result['title'].name += StringUtils.HTMLToString(String(resData['title']));
}
// if(result['title'].name != '') {
// result['title'].name += " ("+resData['code']+")"
// }
// if(resData['ecsc39'] == true) {
// result['title'].sc39 = "sc39";
// }
result.acronym = resData['acronym'];
result.code = resData['code'];
result.budget = resData.totalcost;//"10000";
result.contribution = resData.fundedamount;//"200100";
result.currency = resData.currency;//"EUR";
result.id = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
let abstracts = this.parsingFunctions.parseDescription(resData.summary, true);
result.description = abstracts;
// if (result.description && result.description.length > this.sizeOfDescription) {
// result.description = result.description.substring(0, this.sizeOfDescription) + "...";
// }
if(resData['rels'].hasOwnProperty("rel")) {
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
for(let j=0; j<relLength; j++) {
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel'];
if(relation.hasOwnProperty("to")) {
if(relation['to'].class && relation['to'].class.toLowerCase() == "hasparticipant") {
if(result['organizations'] == undefined) {
result['organizations'] = new Array<
{ "name": string, "id": string}>();
}
let countOrganizations = result['organizations'].length;
result['organizations'][countOrganizations] = { "name": "", "id": "" }
result['organizations'][countOrganizations]['id'] =
/*OpenaireProperties.getsearchLinkToOrganization() + */relation['to'].content;
if(relation.legalshortname) {
result['organizations'][countOrganizations]['name'] = relation.legalshortname;
} else {
result['organizations'][countOrganizations]['name'] = relation.legalname;
}
if(!result['organizations'][countOrganizations]['name']) {
result['organizations'][countOrganizations]['name'] = "[no title available]";
}
}
}
}
}
if(resData.hasOwnProperty("fundingtree")) {
/*let funderSet: Set<string>;
if(result['funders'] == undefined) {
result['funders'] = new Array<
{"funderShortname": string, "funderName": string}>();
funderSet = new Set<string>();
}
let fundingLength = Array.isArray(resData['fundingtree']) ? resData['fundingtree'].length : 1;
for(let z=0; z<fundingLength; z++) {
let fundingData = Array.isArray(resData['fundingtree']) ? resData['fundingtree'][z] : resData['fundingtree'];
if(fundingData.hasOwnProperty("funder")) {
if(!funderSet.has(fundingData['funder'].shortname)) {
let countFunders = result['funders'].length;
result['funders'][countFunders] = {"funderShortname": "", "funderName": ""};
result['funders'][countFunders]['funderShortname'] = fundingData['funder'].shortname;
result['funders'][countFunders]['funderName'] = fundingData['funder'].name;
funderSet.add(fundingData['funder'].shortname);
}
}
}*/
let fundingLength = Array.isArray(resData['fundingtree']) ? resData['fundingtree'].length : 1;
for(let z=0; z<fundingLength; z++) {
let fundingData = Array.isArray(resData['fundingtree']) ? resData['fundingtree'][z] : resData['fundingtree'];
if(fundingData.hasOwnProperty("funder")) {
result['funderShortname'] = fundingData['funder'].shortname;
result['funderName'] = fundingData['funder'].name;
result['funderId'] = fundingData['funder'].id;
result['jurisdiction'] = (fundingData['funder']['id']['jurisdiction'] )?fundingData['funder']['id']['jurisdiction']:"";
if(fundingData['funding_level_2']){
result['fundingLevel0'] = (fundingData['funding_level_2'] && fundingData['funding_level_2']['parent'] &&
fundingData['funding_level_2']['parent']['funding_level_1'] && fundingData['funding_level_2']['parent']['funding_level_1']['parent']
&& fundingData['funding_level_2']['parent']['funding_level_1']['parent']['funding_level_0'])?
fundingData['funding_level_2']['parent']['funding_level_1']['parent']['funding_level_0']['name']:"";
}else if(fundingData['funding_level_1']){
result['fundingLevel0'] = (fundingData['funding_level_1'] && fundingData['funding_level_1']['parent'] && fundingData['funding_level_1']['parent']['funding_level_0'])?
fundingData['funding_level_1']['parent']['funding_level_0']['name']:"";
}else if(fundingData['funding_level_0']){
result['fundingLevel0'] = (fundingData['funding_level_0'] )?fundingData['funding_level_0']['name']:"";
}else {
result['fundingLevel0']="";
}
break;
}
}
}
if(resData.hasOwnProperty("startdate") && resData['startdate']) {
result.startYear = resData.startdate.split('-')[0];
}
if(resData.hasOwnProperty("enddate") && resData['enddate']) {
result.endYear = resData.enddate.split('-')[0];
}
// Measure
result.measure = this.parsingFunctions.parseMeasures(resData['measure']);
results.push(result);
} else {
result['title'].name = "";
}
return results;
// if(result['title'].name != '') {
// result['title'].name += " ("+resData['code']+")"
// }
// if(resData['ecsc39'] == true) {
// result['title'].sc39 = "sc39";
// }
result.acronym = resData['acronym'];
result.code = resData['code'];
result.budget = resData.totalcost;//"10000";
result.contribution = resData.fundedamount;//"200100";
result.currency = resData.currency;//"EUR";
let abstracts = this.parsingFunctions.parseDescription(resData.summary, true);
result.description = abstracts;
// if (result.description && result.description.length > this.sizeOfDescription) {
// result.description = result.description.substring(0, this.sizeOfDescription) + "...";
// }
if (resData["funding"]) {
let fundingLength = Array.isArray(resData['funding']) ? resData['funding'].length : 1;
for (let z = 0; z < fundingLength; z++) {
let fundingData = Array.isArray(resData['funding']) ? resData['funding'][z] : resData['funding'];
if (fundingData["funder"]) {
result['funderShortname'] = fundingData['funder'].shortname;
result['funderName'] = fundingData['funder'].name;
result['funderId'] = fundingData['funder'].id;
result['jurisdiction'] = fundingData['funder']['jurisdiction']?.code;
if (fundingData['level2']) {
result['fundingLevel0'] = (fundingData['level2'] && fundingData['level2']['parent'] &&
fundingData['level2']['parent']['level1'] && fundingData['level2']['parent']['level1']['parent']
&& fundingData['level2']['parent']['level1']['parent']['level0']) ?
fundingData['level2']['parent']['level1']['parent']['level0']['name'] : "";
} else if (fundingData['level1']) {
result['level0'] = (fundingData['level1'] && fundingData['level1']['parent'] && fundingData['level1']['parent']['level0']) ?
fundingData['level1']['parent']['level0']['name'] : "";
} else if (fundingData['level0']) {
result['fundingLevel0'] = (fundingData['level0']) ? fundingData['level0']['name'] : "";
} else {
result['fundingLevel0'] = "";
}
break;
}
}
}
if (resData["startdate"]) {
result.startYear = resData.startdate.split('-')[0];
}
if (resData['enddate']) {
result.endYear = resData.enddate.split('-')[0];
}
// Measure
result.measure = this.parsingFunctions.parseMeasures(resData['measures']);
}
if (resBody["links"]) {
let relLength = Array.isArray(resBody['links']) ? resBody['links'].length : 1;
for (let j = 0; j < relLength; j++) {
let relation = Array.isArray(resBody['links']) ? resBody['links'][j] : resBody['links'];
if (relation["header"]) {
if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "hasparticipant") {
if (result['organizations'] == undefined) {
result['organizations'] = new Array<
{ "name": string, "id": string }>();
}
let countOrganizations = result['organizations'].length;
result['organizations'][countOrganizations] = {"name": "", "id": ""}
result['organizations'][countOrganizations]['id'] =
/*OpenaireProperties.getsearchLinkToOrganization() + */relation['header'].relatedIdentifier;
if (relation.legalshortname) {
result['organizations'][countOrganizations]['name'] = relation.legalshortname;
} else {
result['organizations'][countOrganizations]['name'] = relation.legalname;
}
if (!result['organizations'][countOrganizations]['name']) {
result['organizations'][countOrganizations]['name'] = "[no title available]";
}
}
}
}
}
results.push(result);
}
return results;
}
numOfProjects(url: string, properties:EnvProperties ):any {
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)

View File

@ -149,7 +149,7 @@ export class SearchResearchResultsService {
//let url = link+"/resources2?format=json&query="+params+" sortBy resultdateofacceptance/sort.descending&type="+this.getEntityQueryName(resultType,true);
let url = link + "/" + this.getEntityQueryName(resultType, true);
let url = link + this.getEntityQueryName(resultType, true);
url += "?format=json";
url += "&fq=" + params;
url += "&sortBy=resultdateofacceptance,descending";
@ -190,262 +190,249 @@ export class SearchResearchResultsService {
let length = Array.isArray(data) ? data.length : 1;
for (let i = 0; i < length; i++) {
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:result'] : data['result']['metadata']['oaf:entity']['oaf:result'];
let resData = Array.isArray(data) ? data[i]: data;
var result: SearchResult = new SearchResult();
if (resData['resulttype']) {
result.entityType = resData['resulttype']['classname'];
} else {
result.entityType = resultType;
}
result['title'] = {"name": '', "accessMode": ''};
if (Array.isArray(resData['title'])) {
for (let i = 0; i < resData['title'].length; i++) {
if (resData['title'][i] && resData['title'][i].content) {
if (!result.title.name || resData['title'][i].classid == "main title") {
result['title'].name = StringUtils.HTMLToString(String(resData['title'][i].content));
}
if (resData['title'][i].classid == "main title") {
break;
}
}
try {
if (resData.header['recordType']) {
result.entityType = resData.header['recordType'];
} else {
result.entityType = resultType;
}
if (!result.title.name) {
result['title'].name = "";
result['title'] = {"name": '', "accessMode": ''};
result['title'].name = (resData.result['maintitle']) ? StringUtils.HTMLToString(resData.result['maintitle']) : "";
if (resData.result['bestaccessright'] && resData.result['bestaccessright']['label']) {
result['title'].accessMode = resData.result['bestaccessright']['label'];
}
// result['title'].name = (resData['title'][0] && resData['title'][0].content) ? String(resData['title'][0].content) : "";
} else {
result['title'].name = (resData['title'] && resData['title'].content) ? StringUtils.HTMLToString(String(resData['title'].content)) : "";
}
if (resData['bestaccessright'] && resData['bestaccessright'].hasOwnProperty("classname")) {
result['title'].accessMode = resData['bestaccessright'].classname;
}
result.types = new Array<string>();
let types = new Set<string>();
result.types = new Array<string>();
let types = new Set<string>();
let instance;
let length = Array.isArray(resData.result['instance']) ? resData.result['instance'].length : 1;
result.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>();
for (let i = 0; i < length; i++) {
instance = Array.isArray(resData.result['instance']) ? resData.result['instance'][i] : resData.result['instance'];
this.parsingFunctions.parseTypes(result.types, types, instance);
if (instance && instance["hostedby"]) {
if (instance["url"]) {
let url = Array.isArray(instance['url']) ? instance['url'][0] : instance['url'];
if (url.includes('&amp;')) {
url = url.replace(/&amp;/gmu, '&');
}
let instance;
let length = Array.isArray(resData['children']['instance']) ? resData['children']['instance'].length : 1;
result.hostedBy_collectedFrom = new Array<HostedByCollectedFrom>();
for (let i = 0; i < length; i++) {
instance = Array.isArray(resData['children']['instance']) ? resData['children']['instance'][i] : resData['children']['instance'];
this.parsingFunctions.parseTypes(result.types, types, instance);
if(instance?.hasOwnProperty("hostedby")) {
if(instance.hasOwnProperty("webresource")) {
let url = Array.isArray(instance['webresource'])?instance['webresource'][0].url:instance['webresource'].url;
if(url.includes('&amp;')) {
url = url.replace(/&amp;/gmu, '&');
}
if(instance.hasOwnProperty("hostedby")) {
this.parsingFunctions.parseHostedBy_collectedFrom(result.hostedBy_collectedFrom, instance, url, result.title.accessMode);
}
}
}
}
result.hostedBy_collectedFrom.sort(this.parsingFunctions.compareHostedByCollectedFrom);
// Measure
result.measure = this.parsingFunctions.parseMeasures(resData['measure']);
/////////////////////////// Athena Code ///////////////////////////
if (resData['pid']) {
if (!Array.isArray(resData['pid'])) {
if (resData['pid'].classid && resData['pid'].classid == 'doi') {
if (resData['pid'].content != '' && resData['pid'].content != null) {
result.DOIs.push((resData['pid'].content + "").replace("https://doi.org/", ""));
}
}
} else {
for (let i = 0; i < resData['pid'].length; i++) {
if (resData['pid'][i].classid == 'doi') {
if (resData['pid'][i].content != '' && resData['pid'][i].content != null && resData['pid'][i].content) {
result.DOIs.push((resData['pid'][i].content + "").replace("https://doi.org/", ""));
result.hostedBy_collectedFrom.sort(this.parsingFunctions.compareHostedByCollectedFrom);
// Measure
result.measure = this.parsingFunctions.parseMeasures(resData['measures']);
/////////////////////////// Athena Code ///////////////////////////
if (resData['pid']) {
if (!Array.isArray(resData['pid'])) {
if (resData['pid'].typeCode && resData['pid'].typeCode == 'doi') {
if (resData['pid'].value != '' && resData['pid'].value != null) {
result.DOIs.push((resData['pid'].value + "").replace("https://doi.org/", ""));
}
}
}
}
result.identifiers = this.parsingFunctions.parseIdentifiers(resData['pid']);
}
/////////////////////////// Athena Code ///////////////////////////
if (resData['programmingLanguage'] && resData['programmingLanguage'] != null) {
result.programmingLanguages = new Array<string>();
if (!Array.isArray(resData['programmingLanguage'])) {
if (resData['programmingLanguage'].classname != "Undetermined" && resData['programmingLanguage'].classname) {
result.programmingLanguages.push(resData['programmingLanguage'].classname);
}
} else {
for (let i = 0; i < resData['programmingLanguage'].length; i++) {
if (resData['programmingLanguage'][i].classname != "Undetermined" && resData['programmingLanguage'][i].classname) {
result.programmingLanguages.push(resData['programmingLanguage'][i].classname);
}
}
}
}
if (resData['language'] && resData['language'] != null) {
result.languages = new Array<string>();
if (!Array.isArray(resData['language'])) {
if (resData['language'].classname != "Undetermined" && resData['language'].classname) {
result.languages.push(resData['language'].classname);
}
} else {
for (let i = 0; i < resData['language'].length; i++) {
if (resData['language'][i].classname != "Undetermined" && resData['language'][i].classname) {
result.languages.push(resData['language'][i].classname);
}
}
}
}
if (resData['country'] && resData['country'] != null) {
result.countriesForResults = new Array<string>();
if (!Array.isArray(resData['country'])) {
if (resData['country'].classname != "Undetermined" && resData['country'].classname) {
result.countriesForResults.push(resData['country'].classname);
}
} else {
for (let i = 0; i < resData['country'].length; i++) {
if (resData['country'][i].classname != "Undetermined" && resData['country'][i].classname) {
result.countriesForResults.push(resData['country'][i].classname);
}
}
}
}
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
result['objId'] = result['id'];
let canId = ParsingFunctions.parseRelCanonicalId(Array.isArray(data) ? data[i] : data, "result");
if (canId) {
result['id'] = canId;
}
result['relcanId'] = result['id'];
if (resData['rels'].hasOwnProperty("rel")) {
let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
for (let j = 0; j < relLength; j++) {
let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][j] : resData['rels']['rel'];
if (relation.hasOwnProperty("to")) {
if (relation['to'].class && relation['to'].class.toLowerCase() == "isproducedby") {
result['projects'] = this.parseProjects(result['projects'], relation);
}
}
}
}
if (resData.hasOwnProperty("creator") && resData['creator'] != null) {
if (result['authors'] == undefined) {
result['authors'] = new Array<{ "fullName": string, "orcid": string, "orcid_pending": string }>();
}
let authors = resData['creator'];
let length = Array.isArray(authors) ? authors.length : 1;
for (let i = 0; i < length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors;
if (author) {
if (author.orcid) {
author.orcid = author.orcid.toUpperCase();
}
if (author.orcid_pending) {
author.orcid_pending = author.orcid_pending.toUpperCase();
}
if(result['authors'][author.rank] && result['authors'][author.rank].fullName == author.content) {
if(!author.orcid && result['authors'][author.rank].orcid) {
author.orcid = result['authors'][author.rank].orcid;
} else if(!author.orcid_pending && result['authors'][author.rank].orcid_pending) {
author.orcid_pending = result['authors'][author.rank].orcid_pending;
}
}
result['authors'][author.rank] = {
"fullName": author.content,
"orcid": author.orcid,
"orcid_pending": author.orcid_pending
};
}
}
result.authors = result.authors.filter(function (item) {
return (item != undefined && item.fullName != undefined);
});
}
var date: string = (resData.dateofacceptance ? resData.dateofacceptance : '') + ''; // transform to string in case it is an integer
result.year = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
let abstracts = this.parsingFunctions.parseDescription(resData.description, true);
result.description = abstracts;
// if (result.description && result.description.length > this.sizeOfDescription) {
// result.description = result.description.substring(0, this.sizeOfDescription) + "...";
// }
if (resData.embargoenddate && resData.embargoenddate != '') {
result.embargoEndDate = Dates.getDate(resData.embargoenddate);
}
if (!Array.isArray(resData.publisher)) {
result.publisher = resData.publisher;
} else {
for (let i = 0; i < resData.publisher.length; i++) {
if (result.publisher != undefined) {
result.publisher += ', ' + resData['publisher'][i];
} else {
result.publisher = resData['publisher'][i];
for (let i = 0; i < resData['pid'].length; i++) {
if (resData['pid'][i].typeCode == 'doi') {
if (resData['pid'][i].value != '' && resData['pid'][i].value != null && resData['pid'][i].value) {
result.DOIs.push((resData['pid'][i].value + "").replace("https://doi.org/", ""));
}
}
}
}
result.identifiers = this.parsingFunctions.parseIdentifiers(resData['pid']);
}
/////////////////////////// Athena Code ///////////////////////////
if (resData.result['programmingLanguage'] && resData.result['programmingLanguage'] != null) {
result.programmingLanguages = new Array<string>();
if (!Array.isArray(resData.result['programmingLanguage'])) {
if (resData.result['programmingLanguage'] != "Undetermined" && resData.result['programmingLanguage']) {
result.programmingLanguages.push(resData.result['programmingLanguage']);
}
} else {
for (let i = 0; i < resData.result['programmingLanguage'].length; i++) {
if (resData.result['programmingLanguage'][i] != "Undetermined" && resData.result['programmingLanguage'][i]) {
result.programmingLanguages.push(resData.result['programmingLanguage'][i]);
}
}
}
}
}
if (resData['context'] != null) {
result.enermapsId = ParsingFunctions.getEnermapsConceptId(this.parsingFunctions.parseContexts(resData['context']));
}
if (resData.dateofacceptance && resData.dateofacceptance != null) {
let date: string = (resData.dateofacceptance ? resData.dateofacceptance : '') + ''; // transform to string in case it is an integer
result.date = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
result.dateofacceptance = resData.dateofacceptance ? Dates.getDate(resData.dateofacceptance) : null;
}
if (resData.journal && resData.journal != null) {
result.journal = {
"journal": "",
"issn": "",
"lissn": "",
"eissn": "",
"issue": "",
"volume": "",
"start_page": "",
"end_page": ""
if (resData['language'] && resData['language'] != null) {
result.languages = new Array<string>();
if (!Array.isArray(resData['language'])) {
if (resData['language'].label != "Undetermined" && resData['language'].label) {
result.languages.push(resData['language'].label);
}
} else {
for (let i = 0; i < resData['language'].length; i++) {
if (resData['language'][i].label != "Undetermined" && resData['language'][i].label) {
result.languages.push(resData['language'][i].label);
}
}
}
}
result.journal['journal'] = resData.journal.content;
result.journal['issn'] = resData.journal.issn;
result.journal['lissn'] = resData.journal.lissn;
result.journal['eissn'] = resData.journal.eissn;
result.journal['issue'] = resData.journal.iss;
result.journal['volume'] = resData.journal.vol;
result.journal['start_page'] = resData.journal.sp;
result.journal['end_page'] = resData.journal.ep;
}
result.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom(
result.hostedBy_collectedFrom, result.publisher,
result['journal']?result['journal'].journal:null, result.identifiers);
if (resData.result['country'] && resData.result['country'] != null) {
result.countriesForResults = new Array<string>();
if (!Array.isArray(resData.result['country'])) {
if (resData.result['country'].label != "Undetermined" && resData.result['country'].label) {
result.countriesForResults.push(resData.result['country'].label);
}
} else {
for (let i = 0; i < resData.result['country'].length; i++) {
if (resData.result['country'][i].label != "Undetermined" && resData.result['country'][i].label) {
result.countriesForResults.push(resData.result['country'][i].label);
}
}
}
}
result['id'] = resData['header']['id'];
result['objId'] = result['id'];
//TODO canID
let canId = ParsingFunctions.parseRelCanonicalId(Array.isArray(data) ? data[i] : data, "result");
if (canId) {
result['id'] = canId;
}
result['relcanId'] = result['id'];
if (resData['links']) {
let relLength = Array.isArray(resData['links']) ? resData['links'].length : 1;
for (let j = 0; j < relLength; j++) {
let relation = Array.isArray(resData['links']) ? resData['links'][j] : resData['links'];
if (relation['header']['relationClass'] && relation['header']['relationClass'].toLowerCase() == "isproducedby") {
result['projects'] = this.parseProjects(result['projects'], relation);
}
// }
}
}
if (resData['result']["author"]) {
if (result['authors'] == undefined) {
result['authors'] = new Array<{ "fullName": string, "orcid": string, "orcid_pending": string }>();
}
let authors = resData['result']['author'];
let length = Array.isArray(authors) ? authors.length : 1;
for (let i = 0; i < length; i++) {
let author = Array.isArray(authors) ? authors[i] : authors;
if (author) {
let pids = author.pid?author.pid:[];
for(let pid of pids) {
if (pid.typeCode == 'orcid') {
author.orcid = pid.value.toUpperCase();
break;
} else if (pid.typeCode == "orcid_pending") {
author.orcid_pending = pid.value.toUpperCase();
}
}
/* The same author with the same rank if it */
if (result['authors'][author.rank] && result['authors'][author.rank].fullName == author.fullName) {
if (!author.orcid && result['authors'][author.rank].orcid) {
author.orcid = result['authors'][author.rank].orcid;
} else if (!author.orcid_pending && result['authors'][author.rank].orcid_pending) {
author.orcid_pending = result['authors'][author.rank].orcid_pending;
}
}
result['authors'][author.rank] = {
"fullName": author.fullname,
"orcid": author.orcid? author.orcid: "",
"orcid_pending": author.orcid_pending ? author.orcid_pending : ""
};
}
}
result.authors = result.authors.filter(function (item) {
return (item != undefined && item.fullName != undefined);
});
}
var date: string = (resData['result'].publicationdate ? resData['result'].publicationdate : '') + ''; // transform to string in case it is an integer
result.year = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
let abstracts = this.parsingFunctions.parseDescription(resData['result'].description, true);
result.description = abstracts;
// if (result.description && result.description.length > this.sizeOfDescription) {
// result.description = result.description.substring(0, this.sizeOfDescription) + "...";
// }
if (resData['result'].embargoenddate && resData['result'].embargoenddate != '') {
result.embargoEndDate = Dates.getDate(resData['result'].embargoenddate);
}
if (!Array.isArray(resData['result'].publisher)) {
result.publisher = resData['result'].publisher;
} else {
for (let i = 0; i < resData.publisher['result'].length; i++) {
if (result.publisher != undefined) {
result.publisher += ', ' + resData['result']['publisher'][i];
} else {
result.publisher = resData['result']['publisher'][i];
}
}
}
//todo DOUBLEcheck with connect
if (resData['context'] != null) {
result.enermapsId = ParsingFunctions.getEnermapsConceptId(this.parsingFunctions.parseContexts(resData['context']));
}
if (resData['result'].publicationdate && resData['result'].publicationdate != null) {
let date: string = (resData['result'].publicationdate ? resData['result'].publicationdate : '') + ''; // transform to string in case it is an integer
result.date = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
result.dateofacceptance = resData['result'].publicationdate ? Dates.getDate(resData['result'].publicationdate) : null;
}
if (resData['result'].journal && resData['result'].journal != null) {
result.journal = {
"journal": "",
"issn": "",
"lissn": "",
"eissn": "",
"issue": "",
"volume": "",
"start_page": "",
"end_page": ""
}
result.journal['journal'] = resData['result'].journal.name;
result.journal['issn'] = resData['result'].journal.issnPrinted;
result.journal['lissn'] = resData['result'].journal.issnLinking;
result.journal['eissn'] = resData['result'].journal.issnOnline;
result.journal['issue'] = resData['result'].journal.iss;
result.journal['volume'] = resData['result'].journal.vol;
result.journal['start_page'] = resData['result'].journal.sp;
result.journal['end_page'] = resData['result'].journal.ep;
}
result.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom(
result.hostedBy_collectedFrom, result.publisher,
result['journal'] ? result['journal'].journal : null, result.identifiers);
if(resData.hasOwnProperty("publiclyfunded") && resData.publiclyfunded) {
result.publiclyFunded = resData.publiclyfunded;
}
if((resData.hasOwnProperty("isgreen") && resData.isgreen)
|| (resData.hasOwnProperty("openaccesscolor") && resData.openaccesscolor)
|| (resData.hasOwnProperty("isindiamondjournal") && resData.isindiamondjournal)) {
result.oaRoutes = {
"green": resData.isgreen,
"oaColor": resData.openaccesscolor,
"isInDiamondJournal":resData.isindiamondjournal
};
if (resData['result'].publiclyFunded) {
result.publiclyFunded = resData['result'].publiclyFunded;
}
if (resData['result'].isGreen
|| resData['result'].openAccessColor
|| resData['result'].isInDiamondJournal) {
result.oaRoutes = {
"green": resData['result'].isGreen,
"oaColor": resData['result'].openAccessColor,
"isInDiamondJournal": resData['result'].isInDiamondJournal
};
}
}catch (e){
console.error(e)
}
results.push(result);
@ -478,10 +465,10 @@ export class SearchResearchResultsService {
"code": ""
};
if (relation.title != 'unidentified') {
projects[countProjects]['id'] = relation['to'].content;
if (relation.projectTitle != 'unidentified') {
projects[countProjects]['id'] = relation['header']['identifier'];
projects[countProjects]['acronym'] = relation.acronym;
projects[countProjects]['title'] = relation.title;
projects[countProjects]['title'] = relation.projectTitle;
projects[countProjects]['code'] = relation.code;
} else {
projects[countProjects]['id'] = "";
@ -490,13 +477,13 @@ export class SearchResearchResultsService {
projects[countProjects]['code'] = "";
}
if (relation.hasOwnProperty("funding")) {
if (relation["funding"]) {
let fundingLength = Array.isArray(relation['funding']) ? relation['funding'].length : 1;
for (let z = 0; z < fundingLength; z++) {
let fundingData = Array.isArray(relation['funding']) ? relation['funding'][z] : relation['funding'];
if (fundingData.hasOwnProperty("funder")) {
if (fundingData["funder"]) {
projects[countProjects]['funderShortname'] = fundingData['funder'].shortname;
projects[countProjects]['funderName'] = fundingData['funder'].name;
}
@ -508,7 +495,7 @@ export class SearchResearchResultsService {
parseRefineResults(id: string, data: any): any {
var results: any = [];
if (data.hasOwnProperty("resulthostingdatasource")) {
if (data["resulthostingdatasource"]) {
let length = Array.isArray(data['resulthostingdatasource']) ? data['resulthostingdatasource'].length : 1;
for (let i = 0; i < length; i++) {
@ -620,7 +607,7 @@ export class SearchResearchResultsService {
.pipe(map(res => res['meta']['total']));
}
fetchByDOIs(DOIs:string[],query:string): any {
let url = properties.searchAPIURLLAst + "/researchProducts/byDoi?type=publications" + (query?query:"");
let url = properties.searchAPIURLLAst + "researchProducts/byDoi?type=publications" + (query?query:"");
return this.http.post(url, {doiArray: DOIs})
.pipe(map(res => [res['meta'].total, this.parseResults("result", res['results'], properties), RefineResultsUtils.parse(res['refineResults'], null, "publication")]));
}

View File

@ -201,45 +201,46 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
}
private getTitle(result: any): String[] {
const title = _.get(result, "result.metadata.oaf:entity.oaf:result.title", null);
const title = _.get(result, "result.maintitle", null);
let return_title;
if(title && Array.isArray(title) ){
for(let i=0; i<title.length; i++) {
if(title[i] && title[i].content) {
if(!return_title || title[i].classid == "main title") {
return_title = String(title[i].content);
}
if(title[i].classid == "main title") {
if(title){
return_title = String(title);
} else {
const other_titles = _.get(result, "result.otherTitles", null);
if(other_titles && Array.isArray(other_titles) ){
for(let i=0; i<other_titles.length; i++) {
if(other_titles[i] && other_titles[i]) {
return_title = String(other_titles[i]);
break;
}
}
}
if(!return_title) {
return_title = "";
}
return return_title;
// return (title[0] && title[0].content)?title[0].content:"";
}else{
return (title && title.content)?title.content:"";
}
if(!return_title) {
return_title = "";
}
return return_title;
}
// TODO: Returns String[], but the actual value is just a string
private getSubTitle(result: any): String[] {
const title = _.get(result, "result.metadata.oaf:entity.oaf:result.title", null);
const title = _.get(result, "result.otherTitles", null);
if(title && Array.isArray(title) ){
if(title[1] && title[1].classid == "subtitle") {
return title[1].content;
}
for(let i=0; i<title.length; i++) {
if(title[i] && title[i]) {
return title[i];
}
}
}
return null;
}
private getISSN(result: any): String[] {
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.journal.issn", null);
const item = _.get(result, "result.journal.issnPrinted", null);
if (!item) return null;
return [item as String];
}
private getDescription(result: any): String[] {
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.description", null);
const item = _.get(result, "result.description", null);
if (!item) return [ "" + this.getTitle(result)];
let parsing = new ParsingFunctions();
let abstracts = parsing.parseDescription(item, true);
@ -247,29 +248,30 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
}
private getDateCreated(result: any): String[] {
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.dateofacceptance", null);
const item = _.get(result, "result.publicationdate", null);
if (!item) return null;
return [item as String];
}
private getLicense(result: any): License[] {
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.bestaccessright", null);
const item = _.get(result, "result.bestaccessright", null);
if (!item) return null;
if (!_.has(item, "classid")) return null;
if (!_.has(item, "classname")) return null;
if (!_.has(item, "schemeid")) return null;
if (!_.has(item, "code")) return null;
if (!_.has(item, "label")) return null;
// if (!_.has(item, "schemeid")) return null;
return [{
title: [_.get(item, "classname")],
title: [_.get(item, "label")],
identifier: [{
id: _.get(item, "classid"),
schema: _.get(item, "schemeid")
id: _.get(item, "code"),
schema: "dnet:access_modes"
// schema: _.get(item, "schemeid")
}]
}];
}
private getIdentifier(result: any): Identifier[] {
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.pid", null);
const item = _.get(result, "result.pid", null);
if (!item) return null;
const array = new Array<Identifier>();
if (Array.isArray(item)) {
@ -288,45 +290,58 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
}
private getSingleIdentifier(item: any): Identifier {
if (!_.has(item, "classname")) return null;
if (!_.has(item, "content")) return null;
if (!_.has(item, "type")) return null;
if (!_.has(item, "value")) return null;
return {
schema: _.get(item, "classname"),
id: _.get(item, "content")
schema: _.get(item, "type"),
id: _.get(item, "value")
};
}
private getSameAs(result: any): String[] {
const instances = _.get(result, "result.metadata.oaf:entity.oaf:result.children.instance", null);
if (!instances) return null;
if (!Array.isArray(instances)) return null;
const relations = _.get(result, "links", null);
if (!relations) return null;
const array = new Array<String>();
if(Array.isArray(relations) ) {
const array = new Array<String>();
const instanceArray = instances as Array<any>;
for (var i = 0; i < instanceArray.length; i += 1) {
const webresources = _.get(instanceArray[i], "webresource", null);
if (!webresources) continue;
if (Array.isArray(webresources)) {
const webresourceArray = webresources as Array<any>;
for (var q = 0; q < webresourceArray.length; q += 1) {
const url = _.get(webresourceArray[q], "url", null);
if (!url) continue;
array.push(url as String);
}
}
else {
const url = _.get(webresources, "url", null);
if (!url) continue;
array.push(url as String);
}
}
if (array.length == 0) return null;
return array;
for (let i = 0; i < relations.length; i++) {
let relation = relations[i];
if (relation && relation['header'] && relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "merges" && relation['header'].relationType == "resultResult") {
const instances = relation.instances;
if(instances) {
console.log("instances");
const instanceArray = instances as Array<any>;
for (var j = 0; j < instanceArray.length; j += 1) {
const webresources = _.get(instanceArray[j], "url", null);
console.log(webresources);
if (!webresources) continue;
if (Array.isArray(webresources)) {
const webresourceArray = webresources as Array<any>;
for (var q = 0; q < webresourceArray.length; q += 1) {
const url = webresourceArray[q];
console.log(url);
if (!url) continue;
console.log(url);
array.push(url as String);
}
}
else {
const url = webresources;
if (!url) continue;
console.log(url);
array.push(url as String);
}
}
}
}
}
}
if (array.length == 0) return null;
return array;
}
private getKeyword(result: any, classification:'FOS'|'SDG' |null = null): String[] {
const subjects = _.get(result, "result.metadata.oaf:entity.oaf:result.subject", null);
const subjects = _.get(result, "result.subject", null);
if (!subjects) return null;
if (!Array.isArray(subjects)) return null;
@ -334,10 +349,10 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
const subjectArray = subjects as Array<any>;
for (var i = 0; i < subjectArray.length; i += 1) {
const classid = _.get(subjectArray[i], "classid", null);
const classid = _.get(subjectArray[i], "typeCode", null);
if(classification && classid !==classification) continue;
const sub = _.get(subjectArray[i], "content", null);
const sub = _.get(subjectArray[i], "value", null);
if (!sub) return null;
array.push(sub as String);
@ -347,7 +362,7 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
}
private getCreator(result: any): Person[] {
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.creator", null);
const item = _.get(result, "result.author", null);
if (!item) return null;
const array = new Array<Person>();
if (Array.isArray(item)) {
@ -366,14 +381,15 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
}
private getSinglePerson(item: any): Person {
if (!_.has(item, "surname") && !_.has(item, "name") && !_.has(item, "content")) return null;
if (!_.has(item, "surname") && !_.has(item, "name") && !_.has(item, "fullname")) return null;
return {
familyName: _.get(item, "surname", null),
givenName: _.get(item, "name", null),
name: _.get(item, "content", null)
name: _.get(item, "fullname", null)
};
}
// TODO: extraInfo missing - should be references, not citations
private getCitation(result: any): Citation[] {
const item = _.get(result, "result.metadata.oaf:entity.extraInfo.citations.citation", null);
if (!item) return null;

View File

@ -35,7 +35,7 @@ export class DataProviderInfo {
subjects: string[];
jurisdiction: string;
thematic: boolean;
contentpolicy: string;
contentpolicies: string[];
identifiers: Map<string, string[]>; //key is the classname
fundedContent: string; // search query

View File

@ -84,7 +84,7 @@ export class EntitiesAutocompleteComponent {
@Input() public funderId:string;
@Input() public entityType:string ;
@Input() public depositType:string ;
// @Input() public depositType:string ;
public results = 0;
public focus:boolean = false;
constructor (public _search:EntitiesSearchService, private myElement: ElementRef) {
@ -117,17 +117,17 @@ export class EntitiesAutocompleteComponent {
}),);
}else */
if(this.entityType == "organization" && this.depositType ){
this.filtered = this.searchTermStream.pipe(
debounceTime(300),distinctUntilChanged(),
switchMap((term: string) => {
var results = this._search.searchByDepositType(term, this.depositType, this.properties);
this.showLoading = false;
this.results = results.length;
return results;
}),);
}else{
// if(this.entityType == "organization" && this.depositType ){
// this.filtered = this.searchTermStream.pipe(
// debounceTime(300),distinctUntilChanged(),
// switchMap((term: string) => {
// var results = this._search.searchByDepositType(term, this.depositType, this.properties);
// this.showLoading = false;
// this.results = results.length;
// return results;
// }),);
//
// }else{
this.filtered = this.searchTermStream.pipe(
debounceTime(300),
@ -140,7 +140,7 @@ export class EntitiesAutocompleteComponent {
}),);
this.getSelectedNameFromGivenId();
}
// }
}
ngOnDestroy(){

View File

@ -7,6 +7,8 @@ import {throwError} from 'rxjs';
import{EnvProperties} from '../properties/env-properties';
import {catchError, map} from "rxjs/operators";
import {StringUtils} from "../string-utils.class";
@Injectable()
export class EntitiesSearchService {
public ready:boolean = false;
@ -40,79 +42,79 @@ export class EntitiesSearchService {
}*/
// not used
/**
* @deprecated
*/
searchByDepositType(keyword:string, DepositType:string, properties:EnvProperties ):any {
this.ready = false;
let link = properties.searchResourcesAPIURL;
let url = link+"?query=";
if(keyword!= null && keyword != '' ) {
/*url += "((oaftype exact organization and deletedbyinference=false and "+
"(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=* or reldatasourcecompatibilityid = native))"+
" and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " +
// "and " + this.quote(params) + " " +
"and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "*/
// in search there is this filter:
//reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*
//url += "((oaftype exact organization and deletedbyinference=false )"+
url += "((oaftype exact organization and deletedbyinference=false and"+
"(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire4.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=* or reldatasourcecompatibilityid = native))"+
" and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " +
// "and " + this.quote(params) + " " +
//"and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "
")";
}
url += "&page=0&size=10";
url += "&format=json";
// let url = properties.searchAPIURLLAst+"projects?"+((keyword && keyword.length > 0)?("q=" +keyword):"")+((funderId && funderId.length > 0 )?"&fq=funderid exact " + '"'+funderId+ '"':"")+"&size=10&page=0&format=json";
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url).toPromise()
.then(request =>
{
//request = request.json().results;
request = request['results'];
//console.log(request);
this.ready = true;
return this.parse(request,"oaf:organization","organization");
}).catch((ex) => {
console.error('An error occured', ex);
return [{id:'-2',label:'Error'}];
});
}
// /**
// * @deprecated
// */
// searchByDepositType(keyword:string, DepositType:string, properties:EnvProperties ):any {
// this.ready = false;
//
// let link = properties.searchResourcesAPIURL;
//
// let url = link+"?query=";
// if(keyword!= null && keyword != '' ) {
// /*url += "((oaftype exact organization and deletedbyinference=false and "+
// "(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=* or reldatasourcecompatibilityid = native))"+
// " and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " +
// // "and " + this.quote(params) + " " +
// "and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "*/
//
// // in search there is this filter:
// //reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*
//
//
// //url += "((oaftype exact organization and deletedbyinference=false )"+
// url += "((oaftype exact organization and deletedbyinference=false and"+
// "(reldatasourcecompatibilityid=driver or reldatasourcecompatibilityid=driver-openaire2.0 or reldatasourcecompatibilityid=openaire2.0 or reldatasourcecompatibilityid=openaire3.0 or reldatasourcecompatibilityid=openaire4.0 or reldatasourcecompatibilityid=openaire2.0_data or reldatasourcecompatibilityid=hostedBy or relprojectid=* or reldatasourcecompatibilityid = native))"+
// " and ((organizationlegalname all "+'"'+keyword+'"'+") or (organizationlegalshortname all "+'"'+keyword+'"'+")) " +
// // "and " + this.quote(params) + " " +
// //"and (collectedfrom exact "+StringUtils.quote(StringUtils.URIEncode(DepositType))+")) "
// ")";
// }
//
// url += "&page=0&size=10";
// url += "&format=json";
//
// // let url = properties.searchAPIURLLAst+"projects?"+((keyword && keyword.length > 0)?("q=" +keyword):"")+((funderId && funderId.length > 0 )?"&fq=funderid exact " + '"'+funderId+ '"':"")+"&size=10&page=0&format=json";
// return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url).toPromise()
// .then(request =>
// {
// //request = request.json().results;
// request = request['results'];
// //console.log(request);
// this.ready = true;
// return this.parse(request,"oaf:organization","organization");
// }).catch((ex) => {
// console.error('An error occured', ex);
// return [{id:'-2',label:'Error'}];
// });
// }
searchByType(keyword:string,type:string, properties:EnvProperties ){
if (type == "project"){
return this.searchEntity(keyword,"projects","oaf:project","project", properties);
return this.searchEntity(keyword,"projects","project","project", properties);
}else if (type == "dataset"){
return this.searchEntity(keyword,"datasets","oaf:result","dataset", properties);
return this.searchEntity(keyword,"datasets","result","dataset", properties);
}else if (type == "datasource" || type == "hostedBy" || type== "collectedFrom"){
return this.searchEntity(keyword,"datasources","oaf:datasource","datasource", properties);
return this.searchEntity(keyword,"datasources","datasource","datasource", properties);
}else if (type == "publication"){
return this.searchEntity(keyword,"publications","oaf:result","publication", properties);
return this.searchEntity(keyword,"publications","result","publication", properties);
}else if (type == "organization"){
return this.searchEntity(keyword,"organizations","oaf:organization","organization", properties);
return this.searchEntity(keyword,"organizations","organization","organization", properties);
}
}
fetchByType(id:string,type:string, properties:EnvProperties ){
if (type == "project"){
return this.fetchEntity(id,"projects","oaf:project","project", properties);
return this.fetchEntity(id,"projects","project","project", properties);
}else if (type == "dataset"){
return this.fetchEntity(id,"datasets","oaf:result","dataset", properties);
return this.fetchEntity(id,"datasets","result","dataset", properties);
}else if (type == "datasource" || type == "hostedBy" || type== "collectedFrom"){
return this.fetchEntity(id,"datasources","oaf:datasource","datasource", properties);
return this.fetchEntity(id,"datasources","datasource","datasource", properties);
}else if (type == "publication"){
return this.fetchEntity(id,"publications","oaf:result","publication", properties);
return this.fetchEntity(id,"publications","result","publication", properties);
}else if (type == "organization"){
return this.fetchEntity(id,"organizations","oaf:organization","organization", properties);
return this.fetchEntity(id,"organizations","organization","organization", properties);
}
@ -174,105 +176,99 @@ private fetch (link,id,oafEntityType,type, properties:EnvProperties ){
}
private parse(data: any,oafEntityType:string, type:string){
var array:any =[]
let results: any[] = [];
let length = Array.isArray(data) ? data.length : 1;
for(let i=0; i<length; i++) {
let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity'][oafEntityType] : data['result']['metadata']['oaf:entity'][oafEntityType];
for (let i = 0; i < length; i++) {
let resBody = Array.isArray(data) ? data[i] : data;
var result: any = {};
var value:any={} ;
if(resData['title']){
if(Array.isArray(resData['title'])) {
value.label = resData['title'][0];
} else {
value.label = resData['title'];
}
if(oafEntityType=="oaf:result"){
value.label = value.label.content;
value.result = resData;
}
}else if(resData["fullname"]){
if(Array.isArray(resData["fullname"])) {
value.label = resData["fullname"][0];
} else {
value.label = resData["fullname"];
}
}else if(resData["legalname"]){
if (resBody["header"]) {
result.id = resBody['header']['id'];
}
if(Array.isArray(resData["legalname"])) {
value.label = resData["legalname"][0];
} else {
value.label = resData["legalname"];
}
if(resData["legalshortname"]){
if (resBody[oafEntityType]) {
let resData = resBody[oafEntityType];
if(Array.isArray(resData["legalshortname"])) {
value.label += " (" + resData["legalshortname"][0] +")";
} else {
value.label += " (" + resData["legalshortname"] +")";
if (oafEntityType == "result") {
result.result = resData;
}
if (resData['mainTitle']) { // result
result.label = StringUtils.HTMLToString(String(resData['mainTitle']));
} else if (resData['title']) { // project
if (Array.isArray(resData['title'])) {
result.label = StringUtils.HTMLToString(String(resData['title'][0]));
} else {
result.label = StringUtils.HTMLToString(String(resData['title']));
}
// } else if(resData["fullname"]) {
// if(Array.isArray(resData["fullname"])) {
// value.label = resData["fullname"][0];
// } else {
// value.label = resData["fullname"];
// }
} else if (resData["legalname"]) { // organization
result.label = resData["legalname"];
if (resData["legalshortname"]) {
result.label += " (" + resData["legalshortname"] + ")";
}
} else if (resData["officialname"]) { // datasource
result.label = resData["officialname"];
} else if(resData['otherTitles']) {
result.label = StringUtils.HTMLToString(String(resData['otherTitles'][0]));
}
if (type == "project") {
result.projectAcronym = resData['acronym'] ? resData['acronym'] : "";
result.projectName = result.label;
result.endDate = resData.enddate ? resData.enddate.split('-')[0] : null;
result.startDate = resData.startdate ? resData.startdate.split('-')[0] : null;
result.funderId = "";
result.funderName = "";
result.jurisdiction = "";
result.fundingLevel0 = "";
result.code = resData['code'];
if(resData['funding'] && type == "project") {
let fundingLength = Array.isArray(resData['funding']) ? resData['funding'].length : 1;
for (let z = 0; z < fundingLength; z++) {
let fundingData = Array.isArray(resData['funding']) ? resData['funding'][z] : resData['funding'];
if (fundingData["funder"]) {
result['funderId'] = fundingData['funder'].id ? fundingData['funder'].id : "";
result['funderName'] = fundingData['funder'].name ? fundingData['funder'].name : "";
result['funderShortName'] = fundingData['funder'].shortname ? fundingData['funder'].shortname : "";
result['jurisdiction'] = (fundingData['funder']['jurisdiction'] && fundingData['funder']['jurisdiction'].code) ? fundingData['funder']['jurisdiction'].code : "";
if (fundingData['level2']) {
result['fundingLevel0'] = (fundingData['level2'] && fundingData['level2']['parent'] &&
fundingData['level2']['parent']['level1'] && fundingData['level2']['parent']['level1']['parent']
&& fundingData['level2']['parent']['level1']['parent']['level0']) ?
fundingData['level2']['parent']['level1']['parent']['level0']['name'] : "";
} else if (fundingData['level1']) {
result['level0'] = (fundingData['level1'] && fundingData['level1']['parent'] && fundingData['level1']['parent']['level0']) ?
fundingData['level1']['parent']['level0']['name'] : "";
} else if (fundingData['level0']) {
result['fundingLevel0'] = (fundingData['level0']) ? fundingData['level0']['name'] : "";
} else {
result['fundingLevel0'] = "";
}
break;
}
}
}else if(resData["officialname"]){
if(Array.isArray(resData["officialname"])) {
value.label = resData["officialname"][0];
} else {
value.label = resData["officialname"];
}
}
value.id = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
if(type=="project"){
value.projectAcronym = resData['acronym'];
value.projectName = value.label;
value.endDate = null;
value.startDate = null;
value.funderId = "";
value.funderName = "";
value.jurisdiction = "";
value.fundingLevel0 = "";
value.code = resData['code'];
if(resData['fundingtree'] && resData['fundingtree']['funder']){
value.funderId = (resData['fundingtree']['funder']['id'] )?resData['fundingtree']['funder']['id']:"";
value.funderName = (resData['fundingtree']['funder']['name'] )?resData['fundingtree']['funder']['name']:"";
value.funderShortName = (resData['fundingtree']['funder']['shortname'] )?resData['fundingtree']['funder']['shortname']:"";
value.jurisdiction = (resData['fundingtree']['funder']['jurisdiction'] )?resData['fundingtree']['funder']['jurisdiction']:"";
if(resData['fundingtree']['funding_level_2']){
value.fundingLevel0 = (resData['fundingtree']['funding_level_2'] && resData['fundingtree']['funding_level_2']['parent'] &&
resData['fundingtree']['funding_level_2']['parent']['funding_level_1'] && resData['fundingtree']['funding_level_2']['parent']['funding_level_1']['parent']
&& resData['fundingtree']['funding_level_2']['parent']['funding_level_1']['parent']['funding_level_0'])?
resData['fundingtree']['funding_level_2']['parent']['funding_level_1']['parent']['funding_level_0']['name']:"";
}else if(resData['fundingtree']['funding_level_1']){
value.fundingLevel0 = (resData['fundingtree']['funding_level_1'] && resData['fundingtree']['funding_level_1']['parent'] && resData['fundingtree']['funding_level_1']['parent']['funding_level_0'])?
resData['fundingtree']['funding_level_1']['parent']['funding_level_0']['name']:"";
}else if(resData['fundingtree']['funding_level_0']){
value.fundingLevel0 = (resData['fundingtree']['funding_level_0'] )?resData['fundingtree']['funding_level_0']['name']:"";
}else {
value.fundingLevel0="";
}
}
if(resData.hasOwnProperty("startdate")) {
value.startDate = resData.startdate.split('-')[0];
}
if(resData.hasOwnProperty("enddate")) {
value.endDate = resData.enddate.split('-')[0];
}
}
// console.info("add:"+value.label+" "+value.id);
array.push(value);
}
}
if(array.length == 0){
array.push({id:'-1',label:'No results found'});
}
//console.info("Parsing results.... Size:"+array.length);
return array;
results.push(result);
}
if(results.length == 0){
results.push({id:'-1',label:'No results found'});
}
return results;
}
private handleError (error: HttpErrorResponse) {

View File

@ -103,9 +103,8 @@ export let commonDev: EnvProperties = {
statisticsFrameAPIURL: "https://beta.openaire.eu/stats/",
statisticsFrameNewAPIURL: "https://beta.services.openaire.eu/stats-tool/",
claimsAPIURL: "http://dl170.madgik.di.uoa.gr:19780/uoa-claims-service/claimsService/",
searchAPIURLLAst: "http://beta.services.openaire.eu/search/v2/api/",
searchResourcesAPIURL: "https://beta.services.openaire.eu/search/v2/api/resources",
searchAPIURLLAst: "http://beta.services.openaire.eu:8480/test/rest/v2/api/",
searchResourcesAPIURL: "http://beta.services.openaire.eu:8480/test/rest/v2/api/resources",
openCitationsAPIURL: "https://services.openaire.eu/opencitations/getCitations?id=",
csvAPIURL: "https://beta.services.openaire.eu/search/v2/api/reports",
orcidAPIURL: "http://dl170.madgik.di.uoa.gr:19480/uoa-orcid-service/",
@ -123,7 +122,7 @@ export let commonDev: EnvProperties = {
contextsAPI: "https://dev-openaire.d4science.org/openaire/context",
communityAPI: "https://dev-openaire.d4science.org/openaire/community/",
lastIndexInformationLink: "https://www.openaire.eu/aggregation-and-content-provision-workflows",
widgetLink: "https://beta.openaire.eu/index.php?option=com_openaire&view=widget&format=raw&projectId=",
widgetLink: "http://scoobydoo.di.uoa.gr/joomla/index.php?option=com_openaire&view=widget&format=raw&projectId=",
claimsInformationLink: "https://www.openaire.eu/linking-beta",
indexInfoAPI: "https://beta.services.openaire.eu/openaire/info/",
admins: ['kostis30fylloy@gmail.com', 'alexandros.martzios@athenarc.gr', 'kgalouni@di.uoa.gr'],

View File

@ -414,7 +414,7 @@ export class SearchFieldsBase {
{type: "refine", title: "", values: ["projectoamandatepublications"]}
];
public PROJECT_ADVANCED_FIELDS: string[] = ["q", "projectacronym", "projecttitle", "projectkeywords",
public PROJECT_ADVANCED_FIELDS: string[] = ["q", "projectacronym", "projecttitle",
"funder", "fundinglevel0_id", "fundinglevel1_id", "fundinglevel2_id",
"projectstartdate", "projectenddate",
"projectcode_nt", "relorganizationid", "collectedfromdatasourceid"];
@ -572,12 +572,12 @@ export class SearchFieldsBase {
public DATASOURCE_STATIC_FIELDS = ["eosctype"];
// add Collected From Filter "collectedfromname"
public DATASOURCE_REFINE_FIELDS: string[] = ["eoscdatasourcetype", "datasourceodlanguages", "datasourceodcontenttypes",
public DATASOURCE_REFINE_FIELDS: string[] = ["eoscdatasourcetype", "datasourceodlanguages",
"datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"];
public DATASOURCE_ADVANCED_FIELDS: string[] = ["q", "datasourceofficialname",
"datasourceenglishname", "datasourceodsubjects", "datasourcetypename", "datasourceodlanguages",
"datasourceodcontenttypes", "datasourcecompatibilityname", "relorganizationid", "collectedfromdatasourceid", "pid"];
"datasourceenglishname", "datasourcetypename", "datasourceodlanguages",
"datasourcecompatibilityname", "relorganizationid", "collectedfromdatasourceid", "pid"];
public DATASOURCE_FIELDS: { [key: string]: FieldDetails } = {
["q"]: {name: "Any field", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null},
@ -744,7 +744,7 @@ export class SearchFieldsBase {
{"name": "country", "equalityOperator": " exact "},
{"name": "datasourcesubject", "equalityOperator": " all "}
];
public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypename", "country", "datasourceodsubjects", "datasourceodcontenttypes", "datasourcecompatibilityname", "datasourcethematic", "datasourcejurisdiction"];
public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypename", "country", "datasourcecompatibilityname", "datasourcethematic", "datasourcejurisdiction"];
public DEPOSIT_DATASOURCE_FIELDS: { [key: string]: FieldDetails } = {
["datasourcetypeuiname"]: {
@ -798,15 +798,15 @@ export class SearchFieldsBase {
};
// public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes",
public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages",
"datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"];
// public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes",
public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages",
"datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"];
// public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages", "datasourceodcontenttypes",
public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourceodlanguages",
"datasourcecompatibilityname", "country", "collectedfromname", "datasourcethematic",
"datasourcejurisdiction"];