jsonld:
move files in sharedComponents/schema2jsonld/model - not used only in add Organization, use JsonldDocument as the default class and extend Dataset and Organization add jsonld in search-find, org/datasource/project landing Claims: add limit in the number of results allowed to add in the basket git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@53724 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
80e22d6849
commit
f86a8891df
|
@ -233,6 +233,15 @@ isSelected(id):boolean{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
addNewContext(community,category,concept, notify=true){
|
addNewContext(community,category,concept, notify=true){
|
||||||
|
if(this.selectedList.length > 50){
|
||||||
|
UIkit.notification({
|
||||||
|
message : 'Your basket exceeds the number of allowed concepts (50)',
|
||||||
|
status : 'warning',
|
||||||
|
timeout : 1500,
|
||||||
|
pos : 'top-center'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
var context: ClaimContext= { community: community, category: category, concept: concept };
|
var context: ClaimContext= { community: community, category: category, concept: concept };
|
||||||
var found:boolean = false;
|
var found:boolean = false;
|
||||||
this.warningMessage = "";
|
this.warningMessage = "";
|
||||||
|
@ -241,9 +250,9 @@ isSelected(id):boolean{
|
||||||
this.selectedList.push(context);
|
this.selectedList.push(context);
|
||||||
if(notify){
|
if(notify){
|
||||||
UIkit.notification({
|
UIkit.notification({
|
||||||
message : 'A new concept added in the basket.',
|
message : 'A new concept added in your basket.',
|
||||||
status : 'primary',
|
status : 'primary',
|
||||||
timeout : 1000,
|
timeout : 1500,
|
||||||
pos : 'top-center'
|
pos : 'top-center'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -251,9 +260,9 @@ isSelected(id):boolean{
|
||||||
}else{
|
}else{
|
||||||
if(notify){
|
if(notify){
|
||||||
UIkit.notification({
|
UIkit.notification({
|
||||||
message : 'The concept is already on your basket.',
|
message : 'The concept is already in your basket.',
|
||||||
status : 'warning',
|
status : 'warning',
|
||||||
timeout : 1000,
|
timeout : 1500,
|
||||||
pos : 'top-center'
|
pos : 'top-center'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,15 @@ constructor(private _service: ProjectService, private _projectService: SearchPro
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
select(item){
|
select(item){
|
||||||
|
if(this.selectedProjects.length > 50){
|
||||||
|
UIkit.notification({
|
||||||
|
message : 'Your basket exceeds the number of allowed projects (50)',
|
||||||
|
status : 'warning',
|
||||||
|
timeout : 1500,
|
||||||
|
pos : 'top-center'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.query = "";
|
this.query = "";
|
||||||
// this.searchTermStream.next(this.query); //clear
|
// this.searchTermStream.next(this.query); //clear
|
||||||
item = item.value;
|
item = item.value;
|
||||||
|
@ -126,7 +135,7 @@ select(item){
|
||||||
let item = this.selectedProjects[_i];
|
let item = this.selectedProjects[_i];
|
||||||
if(item.projectId == project.projectId){
|
if(item.projectId == project.projectId){
|
||||||
found=true;
|
found=true;
|
||||||
this.warningMessage = "Project already in selected list";
|
this.warningMessage = "Project already in your basket";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,14 +150,14 @@ select(item){
|
||||||
UIkit.notification({
|
UIkit.notification({
|
||||||
message : 'A new project added in the basket.',
|
message : 'A new project added in the basket.',
|
||||||
status : 'primary',
|
status : 'primary',
|
||||||
timeout : 1000,
|
timeout : 1500,
|
||||||
pos : 'top-center'
|
pos : 'top-center'
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
UIkit.notification({
|
UIkit.notification({
|
||||||
message : 'The project is already on your basket.',
|
message : 'The project is already in your basket.',
|
||||||
status : 'warning',
|
status : 'warning',
|
||||||
timeout : 1000,
|
timeout : 1500,
|
||||||
pos : 'top-center'
|
pos : 'top-center'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,14 +49,23 @@ export class ClaimResultsComponent {
|
||||||
|
|
||||||
}
|
}
|
||||||
add(item){
|
add(item){
|
||||||
|
if(this.selectedResults.length > 150){
|
||||||
|
UIkit.notification({
|
||||||
|
message : 'Your basket exceeds the number of allowed results (150)',
|
||||||
|
status : 'warning',
|
||||||
|
timeout : 1500,
|
||||||
|
pos : 'top-center'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
var found:boolean = this.isSelected( item.id);
|
var found:boolean = this.isSelected( item.id);
|
||||||
if (!found) {
|
if (!found) {
|
||||||
this.selectedResults.push(item);
|
this.selectedResults.push(item);
|
||||||
|
|
||||||
UIkit.notification({
|
UIkit.notification({
|
||||||
message : 'A new research result added in the basket.',
|
message : 'A new research result added in your basket.',
|
||||||
status : 'primary',
|
status : 'primary',
|
||||||
timeout : 1000,
|
timeout : 1500,
|
||||||
pos : 'top-center'
|
pos : 'top-center'
|
||||||
});
|
});
|
||||||
if(this.results != null){
|
if(this.results != null){
|
||||||
|
@ -64,9 +73,9 @@ export class ClaimResultsComponent {
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
UIkit.notification({
|
UIkit.notification({
|
||||||
message : 'The research result is already on your basket.',
|
message : 'The research result is already in your basket.',
|
||||||
status : 'warning',
|
status : 'warning',
|
||||||
timeout : 1000,
|
timeout : 1500,
|
||||||
pos : 'top-center'
|
pos : 'top-center'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import {ModalLoading} from '../../../utils/modal/loading.component';
|
||||||
import {Dates, DOI} from '../../../utils/string-utils.class';
|
import {Dates, DOI} from '../../../utils/string-utils.class';
|
||||||
import {ClaimResult} from '../../claim-utils/claimEntities.class';
|
import {ClaimResult} from '../../claim-utils/claimEntities.class';
|
||||||
import{EnvProperties} from '../../../utils/properties/env-properties';
|
import{EnvProperties} from '../../../utils/properties/env-properties';
|
||||||
|
declare var UIkit:any;
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -85,7 +86,8 @@ export class BulkClaimComponent {
|
||||||
infoMEssage = "";
|
infoMEssage = "";
|
||||||
enableUpload:boolean = true;
|
enableUpload:boolean = true;
|
||||||
@Input() localStoragePrefix:string="";
|
@Input() localStoragePrefix:string="";
|
||||||
|
exceedsLimit = false;
|
||||||
|
limit =150;
|
||||||
constructor(private _searchCrossrefService: SearchCrossrefService, private _searchDataciteService: SearchDataciteService) {
|
constructor(private _searchCrossrefService: SearchCrossrefService, private _searchDataciteService: SearchDataciteService) {
|
||||||
this.filesToUpload = [];
|
this.filesToUpload = [];
|
||||||
}
|
}
|
||||||
|
@ -109,6 +111,7 @@ export class BulkClaimComponent {
|
||||||
this.makeFileRequest(this.properties.uploadService, [], this.filesToUpload).then((result) => {
|
this.makeFileRequest(this.properties.uploadService, [], this.filesToUpload).then((result) => {
|
||||||
var rows = (result as any).split('\n'); // I have used space, you can use any thing.
|
var rows = (result as any).split('\n'); // I have used space, you can use any thing.
|
||||||
console.log("Rows:" + rows.length);
|
console.log("Rows:" + rows.length);
|
||||||
|
this.exceedsLimit = false;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var invalid_rows = 0;
|
var invalid_rows = 0;
|
||||||
this.duplicateIds = [];
|
this.duplicateIds = [];
|
||||||
|
@ -117,8 +120,18 @@ export class BulkClaimComponent {
|
||||||
this.noValidIds = [];
|
this.noValidIds = [];
|
||||||
this.results.slice(0,this.results.length);
|
this.results.slice(0,this.results.length);
|
||||||
this.notFoundIds = [];
|
this.notFoundIds = [];
|
||||||
var limit = 100;
|
|
||||||
for(i=0;i<((rows.length>limit)?limit:rows.length);i++){
|
if(rows.length + this.results.length > this.limit){
|
||||||
|
this.exceedsLimit = true;
|
||||||
|
UIkit.notification({
|
||||||
|
message : 'Your basket exceeds the number of allowed results (150)',
|
||||||
|
status : 'warning',
|
||||||
|
timeout : 1500,
|
||||||
|
pos : 'top-center'
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
for(i=0;i<((rows.length>this.limit-this.results.length)?(this.limit-this.results.length):rows.length);i++){
|
||||||
if(rows[i] && rows[i] != null ){
|
if(rows[i] && rows[i] != null ){
|
||||||
console.log("Row is:" + rows[i]);
|
console.log("Row is:" + rows[i]);
|
||||||
var values = rows[i].split(',');
|
var values = rows[i].split(',');
|
||||||
|
@ -145,7 +158,7 @@ export class BulkClaimComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(rows.length == 0 || rows.length == invalid_rows || rows.length == (invalid_rows + this.noValidIds.length)){
|
if(rows.length == 0 || rows.length == invalid_rows || rows.length == (invalid_rows + this.noValidIds.length) || this.limit == this.results.length ){
|
||||||
this.endOfFetching();
|
this.endOfFetching();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +262,12 @@ export class BulkClaimComponent {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
endOfFetching(){
|
endOfFetching(){
|
||||||
if(this.allIds.length == this.foundIds.length+this.notFoundIds.length){
|
if(this.limit == this.results.length){
|
||||||
|
this.enableUpload = true;
|
||||||
|
this.loading.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(this.allIds.length == this.foundIds.length+this.notFoundIds.length ){
|
||||||
this.showReport = true;
|
this.showReport = true;
|
||||||
this.enableUpload = true;
|
this.enableUpload = true;
|
||||||
this.loading.close();
|
this.loading.close();
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
{{dataProviderInfo.title['name']}}
|
{{dataProviderInfo.title['name']}}
|
||||||
</p>
|
</p>
|
||||||
</h3-->
|
</h3-->
|
||||||
|
<schema2jsonld *ngIf="dataProviderInfo" [data]=dataProviderInfo [URL]="properties.baseLink+'/search/dataprovider?datasourceId='+datasourceId"
|
||||||
|
type="datasource" [otherURL]="(dataProviderInfo.openDoarId)?(properties.openDoarURL+dataProviderInfo.openDoarId):((dataProviderInfo.r3DataId)?properties.r3DataURL+dataProviderInfo.r3DataId:nul)"></schema2jsonld>
|
||||||
|
|
||||||
<showTitle [title]="dataProviderInfo.title"></showTitle>
|
<showTitle [title]="dataProviderInfo.title"></showTitle>
|
||||||
<div class="uk-text-large " *ngIf="dataProviderInfo.officialName && this.dataProviderInfo.title.name != dataProviderInfo.officialName ">{{dataProviderInfo.officialName}}</div>
|
<div class="uk-text-large " *ngIf="dataProviderInfo.officialName && this.dataProviderInfo.title.name != dataProviderInfo.officialName ">{{dataProviderInfo.officialName}}</div>
|
||||||
|
|
||||||
|
|
|
@ -34,13 +34,14 @@ import {OrpsServiceModule} from '../../services/orpsService.module';
|
||||||
// import { DataProviderRoutingModule } from './dataProvider-routing.module';
|
// import { DataProviderRoutingModule } from './dataProvider-routing.module';
|
||||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||||
|
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports:
|
imports:
|
||||||
[CommonModule, FormsModule, RouterModule,
|
[CommonModule, FormsModule, RouterModule,
|
||||||
TabResultModule, IFrameModule, ErrorMessagesModule, MetricsModule, LandingModule,
|
TabResultModule, IFrameModule, ErrorMessagesModule, MetricsModule, LandingModule,
|
||||||
DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, PublicationsServiceModule,
|
DataProvidersServiceModule, DatasetsServiceModule, ProjectsServiceModule, PublicationsServiceModule,
|
||||||
SoftwareServiceModule, OrpsServiceModule, PagingModule],
|
SoftwareServiceModule, OrpsServiceModule, PagingModule, Schema2jsonldModule],
|
||||||
declarations:
|
declarations:
|
||||||
[PublicationsTabComponent, DatasetsTabComponent, StatisticsTabComponent, ProjectsTabComponent, DatasourcesTabComponent, OrganizationsTabComponent,
|
[PublicationsTabComponent, DatasetsTabComponent, StatisticsTabComponent, ProjectsTabComponent, DatasourcesTabComponent, OrganizationsTabComponent,
|
||||||
RelatedDatasourcesTabComponent, DataProviderComponent, SoftwareTabComponent, OrpsTabComponent
|
RelatedDatasourcesTabComponent, DataProviderComponent, SoftwareTabComponent, OrpsTabComponent
|
||||||
|
|
|
@ -21,7 +21,7 @@ import {DatasetService} from './dataset.service';
|
||||||
|
|
||||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||||
import {Schema2jsonldModule} from '../landing-utils/schema2jsonld/schema2jsonld.module';
|
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
import {Component, ElementRef, Input} from '@angular/core';
|
|
||||||
import { OpenAireJsonldConverterService } from './service/open-aire-jsonld-converter.service';
|
|
||||||
import { JsonldDocumentSerializerService } from './service/jsonld-document-serializer.service';
|
|
||||||
@Component({
|
|
||||||
selector: 'schema2jsonld',
|
|
||||||
template: `
|
|
||||||
<ngx-json-ld [json]="json"></ngx-json-ld>
|
|
||||||
`
|
|
||||||
})
|
|
||||||
export class Schema2jsonldComponent {
|
|
||||||
@Input() data;
|
|
||||||
@Input() URL;
|
|
||||||
json;
|
|
||||||
constructor( private documentParser: OpenAireJsonldConverterService,
|
|
||||||
private documentSerializer: JsonldDocumentSerializerService) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
const docOvject = this.documentParser.convertPublication(this.data, this.URL);
|
|
||||||
this.json = this.documentSerializer.serialize(docOvject);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
<div *ngIf="organizationInfo != null" uk-grid class="uk-grid-large">
|
<div *ngIf="organizationInfo != null" uk-grid class="uk-grid-large">
|
||||||
<div class="uk-width-expand@m uk-width-1-1@s">
|
<div class="uk-width-expand@m uk-width-1-1@s">
|
||||||
|
<schema2jsonld *ngIf="organizationInfo" [data]=organizationInfo [URL]="properties.baseLink+'/search/organization?organizationId='+organizationId" type="organization"></schema2jsonld>
|
||||||
|
|
||||||
<showTitle [title]="organizationInfo.title"></showTitle>
|
<showTitle [title]="organizationInfo.title"></showTitle>
|
||||||
<div class="uk-text-large " *ngIf="organizationInfo.title.name && organizationInfo.title.name != organizationInfo.name ">{{organizationInfo.name}}</div>
|
<div class="uk-text-large " *ngIf="organizationInfo.title.name && organizationInfo.title.name != organizationInfo.name ">{{organizationInfo.name}}</div>
|
||||||
<span class="uk-label custom-label label-blue label-organization" title="Type">Organization</span>
|
<span class="uk-label custom-label label-blue label-organization" title="Type">Organization</span>
|
||||||
|
|
|
@ -23,6 +23,7 @@ import {ProjectsServiceModule} from '../../services/projectsService.module';
|
||||||
import { SearchingProjectsTabModule} from '../landing-utils/searchingProjectsInTab.module';
|
import { SearchingProjectsTabModule} from '../landing-utils/searchingProjectsInTab.module';
|
||||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||||
|
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -37,7 +38,8 @@ import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||||
OrganizationServiceModule,
|
OrganizationServiceModule,
|
||||||
PublicationsServiceModule,
|
PublicationsServiceModule,
|
||||||
// DatasetsServiceModule,
|
// DatasetsServiceModule,
|
||||||
ProjectsServiceModule
|
ProjectsServiceModule,
|
||||||
|
Schema2jsonldModule
|
||||||
|
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
|
|
|
@ -19,7 +19,7 @@ import {OrpService} from './orp.service';
|
||||||
|
|
||||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||||
import {Schema2jsonldModule} from '../landing-utils/schema2jsonld/schema2jsonld.module';
|
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
<div *ngIf="projectInfo != null" uk-grid class="uk-grid-large">
|
<div *ngIf="projectInfo != null" uk-grid class="uk-grid-large">
|
||||||
<div class="uk-width-expand@m uk-width-1-1@s">
|
<div class="uk-width-expand@m uk-width-1-1@s">
|
||||||
|
<schema2jsonld *ngIf="projectInfo" [data]=projectInfo [URL]="properties.baseLink+'/search/project?projectId='+projectId" type="project"></schema2jsonld>
|
||||||
<!--h3 *ngIf="projectInfo.acronym != undefined && projectInfo.acronym != ''">{{projectInfo.acronym}}</h3>
|
<!--h3 *ngIf="projectInfo.acronym != undefined && projectInfo.acronym != ''">{{projectInfo.acronym}}</h3>
|
||||||
<h3 *ngIf="projectInfo.acronym == undefined || projectInfo.acronym == ''">{{projectInfo.title}}</h3-->
|
<h3 *ngIf="projectInfo.acronym == undefined || projectInfo.acronym == ''">{{projectInfo.title}}</h3-->
|
||||||
<h2 class="projectIcon">
|
<h2 class="projectIcon">
|
||||||
|
|
|
@ -23,13 +23,16 @@ import {TabResultModule } from '../../searchPages/searchUtils/tabResult.module';
|
||||||
import { LandingModule } from '../landing-utils/landing.module';
|
import { LandingModule } from '../landing-utils/landing.module';
|
||||||
import {FreeGuard} from'../../login/freeGuard.guard';
|
import {FreeGuard} from'../../login/freeGuard.guard';
|
||||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||||
|
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule, FormsModule, RouterModule, LandingModule,
|
CommonModule, FormsModule, RouterModule, LandingModule,
|
||||||
LoadingModalModule, AlertModalModule, ErrorMessagesModule,
|
LoadingModalModule, AlertModalModule, ErrorMessagesModule,
|
||||||
TabResultModule, IFrameModule, MetricsModule, ReportsServiceModule,
|
TabResultModule, IFrameModule, MetricsModule, ReportsServiceModule,
|
||||||
PublicationsServiceModule, DatasetsServiceModule, SoftwareServiceModule, OrpsServiceModule, ProjectServiceModule
|
PublicationsServiceModule, DatasetsServiceModule, SoftwareServiceModule, OrpsServiceModule, ProjectServiceModule,
|
||||||
|
Schema2jsonldModule
|
||||||
|
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
ProjectComponent
|
ProjectComponent
|
||||||
|
|
|
@ -19,7 +19,7 @@ import {FreeGuard} from'../../login/freeGuard.guard';
|
||||||
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
|
||||||
import {PublicationService} from './publication.service';
|
import {PublicationService} from './publication.service';
|
||||||
import {PublicationComponent} from './publication.component';
|
import {PublicationComponent} from './publication.component';
|
||||||
import {Schema2jsonldModule} from '../landing-utils/schema2jsonld/schema2jsonld.module';
|
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { PagingModule } from '../../utils/paging.module';
|
||||||
import { ResultLandingModule } from '../landing-utils/resultLanding.module';
|
import { ResultLandingModule } from '../landing-utils/resultLanding.module';
|
||||||
import { LandingModule } from '../landing-utils/landing.module';
|
import { LandingModule } from '../landing-utils/landing.module';
|
||||||
import { FreeGuard } from'../../login/freeGuard.guard';
|
import { FreeGuard } from'../../login/freeGuard.guard';
|
||||||
import {Schema2jsonldModule} from '../landing-utils/schema2jsonld/schema2jsonld.module';
|
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
|
|
@ -17,6 +17,7 @@ import {PublicationsServiceModule} from '../../services/publicationsService.modu
|
||||||
import {OrganizationsServiceModule} from '../../services/organizationsService.module';
|
import {OrganizationsServiceModule} from '../../services/organizationsService.module';
|
||||||
import {BrowseEntitiesModule} from '../searchUtils/browseEntities.module';
|
import {BrowseEntitiesModule} from '../searchUtils/browseEntities.module';
|
||||||
import {SearchFormModule} from '../searchUtils/searchForm.module';
|
import {SearchFormModule} from '../searchUtils/searchForm.module';
|
||||||
|
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
|
||||||
|
|
||||||
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
|
import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ import {PiwikServiceModule} from '../../utils/piwik/piwikService.module';
|
||||||
CommonModule, FormsModule, RouterModule,
|
CommonModule, FormsModule, RouterModule,
|
||||||
DataProvidersServiceModule, DatasetsServiceModule, SoftwareServiceModule, OrpsServiceModule, ProjectsServiceModule,
|
DataProvidersServiceModule, DatasetsServiceModule, SoftwareServiceModule, OrpsServiceModule, ProjectsServiceModule,
|
||||||
PublicationsServiceModule, OrganizationsServiceModule,
|
PublicationsServiceModule, OrganizationsServiceModule,
|
||||||
BrowseEntitiesModule, SearchFormModule, SearchResultsModule, PiwikServiceModule
|
BrowseEntitiesModule, SearchFormModule, SearchResultsModule, PiwikServiceModule, Schema2jsonldModule
|
||||||
|
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<schema2jsonld *ngIf="name && logoURL" [URL]="properties.baseLink" [logoURL] = "properties.baseLink+logoURL" type="home" [name]=name></schema2jsonld>
|
||||||
|
|
||||||
|
|
||||||
<div id="tm-main" class=" uk-section uk-padding-remove-top tm-middle" >
|
<div id="tm-main" class=" uk-section uk-padding-remove-top tm-middle" >
|
||||||
|
|
|
@ -96,6 +96,8 @@ export class SearchComponent {
|
||||||
showOrganizations:boolean= false;
|
showOrganizations:boolean= false;
|
||||||
advancedSearchLink:string ="/search/advanced/publications";
|
advancedSearchLink:string ="/search/advanced/publications";
|
||||||
properties: EnvProperties;
|
properties: EnvProperties;
|
||||||
|
@Input() logoURL;
|
||||||
|
@Input() name;
|
||||||
|
|
||||||
public subPub;public subData; public subSoftware; public subOrps; public subProjects;public subOrg; public subDataPr;
|
public subPub;public subData; public subSoftware; public subOrps; public subProjects;public subOrg; public subDataPr;
|
||||||
constructor ( private route: ActivatedRoute,
|
constructor ( private route: ActivatedRoute,
|
||||||
|
|
|
@ -4,6 +4,10 @@ export class JsonldDocument {
|
||||||
identifier: Identifier[];
|
identifier: Identifier[];
|
||||||
url: String[];
|
url: String[];
|
||||||
sameAs: String[];
|
sameAs: String[];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Dataset extends JsonldDocument {
|
||||||
creator: Person[];
|
creator: Person[];
|
||||||
dateCreated: String[];
|
dateCreated: String[];
|
||||||
dateModified: String[];
|
dateModified: String[];
|
||||||
|
@ -32,3 +36,10 @@ export interface License {
|
||||||
title: string[];
|
title: string[];
|
||||||
identifier: Identifier[];
|
identifier: Identifier[];
|
||||||
}
|
}
|
||||||
|
export class Organization extends JsonldDocument {
|
||||||
|
alumni:Person;
|
||||||
|
areaServed:string; //The geographic area where a service or offered item is provided. Supersedes serviceArea.
|
||||||
|
funder:Organization;
|
||||||
|
legalName:string;
|
||||||
|
logo:string;
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
import {Component, ElementRef, Input} from '@angular/core';
|
||||||
|
import { OpenAireJsonldConverterService } from './service/open-aire-jsonld-converter.service';
|
||||||
|
import { JsonldDocumentSerializerService } from './service/jsonld-document-serializer.service';
|
||||||
|
@Component({
|
||||||
|
selector: 'schema2jsonld',
|
||||||
|
template: `
|
||||||
|
<ngx-json-ld [json]="json"></ngx-json-ld>
|
||||||
|
|
||||||
|
`
|
||||||
|
})
|
||||||
|
export class Schema2jsonldComponent {
|
||||||
|
@Input() data;
|
||||||
|
@Input() URL;
|
||||||
|
@Input() logoURL;
|
||||||
|
@Input() otherURL;
|
||||||
|
@Input() name;
|
||||||
|
@Input() type="result";
|
||||||
|
|
||||||
|
json;
|
||||||
|
constructor( private documentParser: OpenAireJsonldConverterService,
|
||||||
|
private documentSerializer: JsonldDocumentSerializerService) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
var docOvject;
|
||||||
|
if(this.type == 'project'){
|
||||||
|
docOvject = this.documentParser.convertProject(this.data, this.URL, this.otherURL);
|
||||||
|
this.json = this.documentSerializer.serializeOrganization(docOvject);
|
||||||
|
}else if(this.type == 'organization'){
|
||||||
|
docOvject = this.documentParser.convertOrganization(this.data, this.URL);
|
||||||
|
this.json = this.documentSerializer.serializeOrganization(docOvject);
|
||||||
|
}else if(this.type == 'datasource'){
|
||||||
|
docOvject = this.documentParser.convertDatasource(this.data, this.URL, this.otherURL);
|
||||||
|
this.json = this.documentSerializer.serializeOrganization(docOvject);
|
||||||
|
}else if(this.type == 'home'){
|
||||||
|
this.json = this.documentParser.createHome(this.name, this.URL, this.logoURL);
|
||||||
|
}else{
|
||||||
|
docOvject = this.documentParser.convertResult(this.data, this.URL);
|
||||||
|
this.json = this.documentSerializer.serializeDataset(docOvject);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,53 +1,40 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { JsonldDocument, Identifier, Person, License, Citation } from "../model/jsonld-document";
|
import { JsonldDocument, Identifier, Person, License, Citation, Dataset, Organization } from "../model/jsonld-document";
|
||||||
import * as _ from "lodash";
|
import * as _ from "lodash";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class JsonldDocumentSerializerService {
|
export class JsonldDocumentSerializerService {
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
serializeOrganization(doc: Organization): any {
|
||||||
serialize(doc: JsonldDocument): any {
|
|
||||||
const buffer = {};
|
const buffer = {};
|
||||||
|
buffer["@type"] = "Organization";
|
||||||
|
this.serializeDocument(doc, buffer);
|
||||||
|
if(doc.areaServed){
|
||||||
|
buffer["areaServed"] = doc.areaServed;
|
||||||
|
}
|
||||||
|
if(doc.legalName){
|
||||||
|
buffer["legalName"] = doc.legalName;
|
||||||
|
}
|
||||||
|
if(doc.funder ){
|
||||||
|
buffer["funder"] = this.serializeOrganization(doc.funder );
|
||||||
|
}
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
serializeDocument(doc:JsonldDocument, buffer):any{
|
||||||
|
buffer["@context"] = "http://schema.org";
|
||||||
|
this.serializeName(doc, buffer);
|
||||||
|
this.serializeDescription(doc, buffer);
|
||||||
|
this.serializeIdentifier(doc, buffer);
|
||||||
|
this.serializeURL(doc, buffer);
|
||||||
|
this.serializeSameAs(doc, buffer);
|
||||||
|
}
|
||||||
|
serializeDataset(doc: Dataset): any {
|
||||||
|
var buffer = {};
|
||||||
buffer["@context"] = "http://schema.org";
|
buffer["@context"] = "http://schema.org";
|
||||||
buffer["@type"] = "Dataset";
|
buffer["@type"] = "Dataset";
|
||||||
if (doc.title && doc.title.length == 1) {
|
this.serializeDocument(doc, buffer);
|
||||||
buffer["name"] = doc.title[0];
|
|
||||||
}
|
|
||||||
else if (doc.title && doc.title.length > 1) {
|
|
||||||
buffer["name"] = doc.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (doc.description && doc.description.length == 1) {
|
|
||||||
buffer["description"] = doc.description[0];
|
|
||||||
}
|
|
||||||
else if (doc.description && doc.description.length > 1) {
|
|
||||||
buffer["description"] = doc.description;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (doc.identifier && doc.identifier.length == 1) {
|
|
||||||
buffer["identifier"] = this.buildIdentifier(doc.identifier[0]);
|
|
||||||
}
|
|
||||||
else if (doc.identifier && doc.identifier.length > 1) {
|
|
||||||
const array = new Array<any>();
|
|
||||||
for (var i = 0; i < doc.identifier.length; i += 1) {
|
|
||||||
array.push(this.buildIdentifier(doc.identifier[i]));
|
|
||||||
}
|
|
||||||
buffer["identifier"] = array;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (doc.url && doc.url.length == 1) {
|
|
||||||
buffer["url"] = doc.url[0];
|
|
||||||
}
|
|
||||||
else if (doc.url && doc.url.length > 1) {
|
|
||||||
buffer["url"] = doc.url;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (doc.sameAs && doc.sameAs.length == 1) {
|
|
||||||
buffer["sameAs"] = doc.sameAs[0];
|
|
||||||
}
|
|
||||||
else if (doc.sameAs && doc.sameAs.length > 1) {
|
|
||||||
buffer["sameAs"] = doc.sameAs;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (doc.creator && doc.creator.length == 1) {
|
if (doc.creator && doc.creator.length == 1) {
|
||||||
buffer["creator"] = this.buildCreator(doc.creator[0]);
|
buffer["creator"] = this.buildCreator(doc.creator[0]);
|
||||||
|
@ -108,6 +95,52 @@ export class JsonldDocumentSerializerService {
|
||||||
// }, 4);
|
// }, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serializeName(doc, buffer){
|
||||||
|
if (doc.title && doc.title.length == 1) {
|
||||||
|
buffer["name"] = doc.title[0];
|
||||||
|
}
|
||||||
|
else if (doc.title && doc.title.length > 1) {
|
||||||
|
buffer["name"] = doc.title;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
serializeDescription(doc, buffer){
|
||||||
|
if (doc.description && doc.description.length == 1) {
|
||||||
|
buffer["description"] = doc.description[0];
|
||||||
|
}
|
||||||
|
else if (doc.description && doc.description.length > 1) {
|
||||||
|
buffer["description"] = doc.description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
serializeIdentifier(doc, buffer){
|
||||||
|
if (doc.identifier && doc.identifier.length == 1) {
|
||||||
|
buffer["identifier"] = this.buildIdentifier(doc.identifier[0]);
|
||||||
|
}
|
||||||
|
else if (doc.identifier && doc.identifier.length > 1) {
|
||||||
|
const array = new Array<any>();
|
||||||
|
for (var i = 0; i < doc.identifier.length; i += 1) {
|
||||||
|
array.push(this.buildIdentifier(doc.identifier[i]));
|
||||||
|
}
|
||||||
|
buffer["identifier"] = array;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
serializeURL(doc, buffer){
|
||||||
|
if (doc.url && doc.url.length == 1) {
|
||||||
|
buffer["URL"] = doc.url[0];
|
||||||
|
}
|
||||||
|
else if (doc.url && doc.url.length > 1) {
|
||||||
|
buffer["URL"] = doc.url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
serializeSameAs(doc, buffer){
|
||||||
|
if (doc.sameAs && doc.sameAs.length == 1) {
|
||||||
|
buffer["sameAs"] = doc.sameAs[0];
|
||||||
|
}
|
||||||
|
else if (doc.sameAs && doc.sameAs.length > 1) {
|
||||||
|
buffer["sameAs"] = doc.sameAs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buildIdentifier(item: Identifier): any {
|
buildIdentifier(item: Identifier): any {
|
||||||
return {
|
return {
|
||||||
"@type": "PropertyValue",
|
"@type": "PropertyValue",
|
|
@ -1,13 +1,36 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { JsonldDocument, Identifier, Person, License, Citation } from "../model/jsonld-document";
|
import { JsonldDocument, Identifier, Person, License, Citation, Dataset, Organization } from "../model/jsonld-document";
|
||||||
import * as _ from "lodash";
|
import * as _ from "lodash";
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class OpenAireJsonldConverterService {
|
export class OpenAireJsonldConverterService {
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
convertPublication(result: any, URL): JsonldDocument {
|
createHome(name, URL, logoURL): any {
|
||||||
const doc = new JsonldDocument();
|
const buffer = {};
|
||||||
|
buffer["@context"] = "http://schema.org";
|
||||||
|
buffer["@type"] = "Organization";
|
||||||
|
buffer["name"] = name;
|
||||||
|
buffer["url"] = URL;
|
||||||
|
buffer["logo"] = logoURL;
|
||||||
|
const action ={};
|
||||||
|
action["@type"]= "SearchAction";
|
||||||
|
action["target"]= URL+"/search/find/?keyword={search_term_string}";
|
||||||
|
action["query-input"]= "required name=search_term_string";
|
||||||
|
|
||||||
|
buffer["potentialAction"] = action;
|
||||||
|
const sameAs =["https://www.openaire.eu",
|
||||||
|
"https://www.facebook.com/groups/openaire/",
|
||||||
|
"https://www.twitter.com/OpenAIRE_eu",
|
||||||
|
"https://www.linkedin.com/groups/OpenAIRE-3893548",
|
||||||
|
"https://www.slideshare.net/OpenAIRE_eu",
|
||||||
|
"https://www.youtube.com/channel/UChFYqizc-S6asNjQSoWuwjw"];
|
||||||
|
|
||||||
|
buffer["sameAs"] = sameAs;
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
convertResult(result: any, URL): Dataset {
|
||||||
|
const doc = new Dataset();
|
||||||
|
|
||||||
doc.title = this.getTitle(result);
|
doc.title = this.getTitle(result);
|
||||||
doc.description = this.getDescription(result);
|
doc.description = this.getDescription(result);
|
||||||
|
@ -19,10 +42,63 @@ export class OpenAireJsonldConverterService {
|
||||||
doc.citation = this.getCitation(result);
|
doc.citation = this.getCitation(result);
|
||||||
doc.license = this.getLicense(result);
|
doc.license = this.getLicense(result);
|
||||||
doc.keyword = this.getKeyword(result);
|
doc.keyword = this.getKeyword(result);
|
||||||
|
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
convertProject(project: any, URL, otherUrl): Organization {
|
||||||
|
const doc = new Organization();
|
||||||
|
|
||||||
|
doc.title = (project.name)?project.title:project.acronym;
|
||||||
|
doc.identifier = new Array<Identifier>();
|
||||||
|
doc.identifier.push({id:project.contractNum, schema: "grantid"});
|
||||||
|
var funder = new Organization();
|
||||||
|
funder.title = project.funder;
|
||||||
|
doc.funder = funder;
|
||||||
|
doc.url = URL;
|
||||||
|
doc.sameAs =[project.url]
|
||||||
|
return doc;
|
||||||
|
}
|
||||||
|
|
||||||
|
convertOrganization(organization: any, URL): Organization {
|
||||||
|
const doc = new Organization();
|
||||||
|
|
||||||
|
doc.title = organization.title.name ;
|
||||||
|
doc.legalName = organization.name;
|
||||||
|
doc.areaServed = organization.country;
|
||||||
|
doc.url = URL;
|
||||||
|
|
||||||
|
return doc;
|
||||||
|
}
|
||||||
|
|
||||||
|
convertDatasource(datasource: any, URL, otherUrl): Organization {
|
||||||
|
const doc = new Organization();
|
||||||
|
|
||||||
|
doc.title = datasource.title.name
|
||||||
|
doc.identifier = datasource.contractNum;
|
||||||
|
doc.legalName = datasource.officialName;
|
||||||
|
// doc.areaServed = datasource.country;
|
||||||
|
console.log("HERE")
|
||||||
|
console.log(datasource.countries)
|
||||||
|
if(datasource.countries && datasource.countries.length > 0){
|
||||||
|
doc.areaServed = datasource.countries[0];
|
||||||
|
}
|
||||||
|
doc.url = URL;
|
||||||
|
if(datasource.oaiPmhURL || otherUrl || datasource.title.url){
|
||||||
|
doc.sameAs = [];
|
||||||
|
if(otherUrl){
|
||||||
|
doc.sameAs.push(otherUrl);
|
||||||
|
}
|
||||||
|
if(datasource.oaiPmhURL){
|
||||||
|
doc.sameAs.push(datasource.oaiPmhURL);
|
||||||
|
|
||||||
|
}
|
||||||
|
if(datasource.title.url){
|
||||||
|
doc.sameAs.push(datasource.title.url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return doc;
|
||||||
|
}
|
||||||
|
|
||||||
private getTitle(result: any): String[] {
|
private getTitle(result: any): String[] {
|
||||||
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.title.content", null);
|
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.title.content", null);
|
||||||
if (!item) return null;
|
if (!item) return null;
|
Loading…
Reference in New Issue