Revision 59134
Added by Argiro Kokogiannaki almost 4 years ago
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/result-preview/result-preview.component.html | ||
---|---|---|
1 | 1 |
<!-- Before title --> |
2 | 2 |
<div uk-grid> |
3 | 3 |
<div class="uk-width-1-1"> |
4 |
<!-- deposit website URL -->
|
|
4 |
<!-- deposit searchPage URL -->
|
|
5 | 5 |
<span class="uk-width-expand uk-flex-right"> |
6 | 6 |
<a *ngIf="result.websiteURL && promoteWebsiteURL" href="{{result.websiteURL}}" target="_blank" type="submit" |
7 | 7 |
class=" zenodoButton uk-float-right uk-button portal-button uk-padding uk-padding-remove-vertical uk-margin-small-left"> |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/sharedComponents/schema2jsonld/model/jsonld-document.ts | ||
---|---|---|
1 | 1 |
export class JsonldDocument { |
2 |
id: string; |
|
2 | 3 |
title: String[]; |
3 | 4 |
description: String[]; |
4 | 5 |
identifier: Identifier[]; |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/sharedComponents/schema2jsonld/service/open-aire-jsonld-converter.service.ts | ||
---|---|---|
1 | 1 |
import { Injectable } from "@angular/core"; |
2 | 2 |
import { JsonldDocument, Identifier, Person, License, Citation, Dataset, Organization } from "../model/jsonld-document"; |
3 | 3 |
import * as _ from "lodash"; |
4 |
import {properties} from "../../../../../environments/environment"; |
|
4 | 5 |
|
5 | 6 |
@Injectable() |
6 | 7 |
export class OpenAireJsonldConverterService { |
7 |
constructor() { } |
|
8 | 8 |
|
9 |
createHome(name, URL, logoURL): any { |
|
10 |
const buffer = {}; |
|
11 |
buffer["@context"] = "http://schema.org"; |
|
12 |
buffer["@type"] = "Organization"; |
|
13 |
buffer["name"] = name; |
|
14 |
buffer["url"] = URL; |
|
15 |
buffer["logo"] = logoURL; |
|
9 |
constructor() { |
|
10 |
|
|
11 |
} |
|
12 |
|
|
13 |
createHome(name, URL, logoURL, description:string = null): any { |
|
14 |
const organization = {}; |
|
15 |
const searchPage = {}; |
|
16 |
organization["@context"] = "http://schema.org"; |
|
17 |
organization["@id"] = properties.baseLink+"/#organization"; |
|
18 |
organization["@type"] = "Organization"; |
|
19 |
organization["name"] = name; |
|
20 |
organization["url"] = properties.baseLink; |
|
21 |
organization["logo"] = logoURL; |
|
22 |
if(description){ |
|
23 |
organization["description"] = description; |
|
24 |
} |
|
25 |
const sameAs =["https://www.openaire.eu", |
|
26 |
"https://www.facebook.com/groups/openaire/", |
|
27 |
"https://www.twitter.com/OpenAIRE_eu", |
|
28 |
"https://www.linkedin.com/groups/OpenAIRE-3893548", |
|
29 |
"https://www.slideshare.net/OpenAIRE_eu", |
|
30 |
"https://www.youtube.com/channel/UChFYqizc-S6asNjQSoWuwjw"]; |
|
31 |
organization["sameAs"] = sameAs; |
|
32 |
|
|
33 |
searchPage["@context"] = "http://schema.org"; |
|
34 |
searchPage["@id"] = properties.baseLink+"/#search"; |
|
35 |
searchPage["@type"] = "Website"; |
|
36 |
searchPage["name"] = name; |
|
37 |
searchPage["url"] = properties.baseLink+"/search/find/"; |
|
38 |
searchPage["logo"] = logoURL; |
|
16 | 39 |
const action ={}; |
17 | 40 |
action["@type"]= "SearchAction"; |
18 |
action["target"]= URL+"/search/find/?keyword={search_term_string}"; |
|
41 |
action["@id"]= properties.baseLink+"/#search-action"; |
|
42 |
action["target"]= properties.baseLink+"/search/find/?fv0={search_term_string}&f0=q"; |
|
19 | 43 |
action["query-input"]= "required name=search_term_string"; |
20 | 44 |
|
21 |
buffer["potentialAction"] = action; |
|
22 |
const sameAs =["https://www.openaire.eu", |
|
23 |
"https://www.facebook.com/groups/openaire/", |
|
24 |
"https://www.twitter.com/OpenAIRE_eu", |
|
25 |
"https://www.linkedin.com/groups/OpenAIRE-3893548", |
|
26 |
"https://www.slideshare.net/OpenAIRE_eu", |
|
27 |
"https://www.youtube.com/channel/UChFYqizc-S6asNjQSoWuwjw"]; |
|
28 |
|
|
29 |
buffer["sameAs"] = sameAs; |
|
30 |
return buffer; |
|
45 |
searchPage["potentialAction"] = action; |
|
46 |
return [organization, searchPage]; |
|
31 | 47 |
} |
32 |
createSimplePage(name, URL): any { |
|
48 |
createSimplePage(name, URL, description:string = null): any {
|
|
33 | 49 |
const buffer = {}; |
34 | 50 |
buffer["@context"] = "http://schema.org"; |
35 | 51 |
buffer["@type"] = "WebPage"; |
36 | 52 |
buffer["name"] = name; |
37 | 53 |
buffer["url"] = URL; |
38 |
|
|
54 |
if(description){ |
|
55 |
buffer["description"] = description; |
|
56 |
} buffer["@id"] = URL; |
|
39 | 57 |
return buffer; |
40 | 58 |
} |
41 |
createSearchPage(name, URL, logoURL, searchAction:boolean = true): any { |
|
59 |
createSearchPage(name, URL, logoURL, searchAction:boolean = true, description:string = null): any {
|
|
42 | 60 |
const buffer = {}; |
43 | 61 |
buffer["@context"] = "http://schema.org"; |
44 | 62 |
buffer["@type"] = "SearchResultsPage"; |
45 | 63 |
buffer["name"] = name; |
64 |
if(description){ |
|
65 |
buffer["description"] = description; |
|
66 |
} |
|
46 | 67 |
buffer["url"] = URL; |
68 |
buffer["@id"] = URL; |
|
47 | 69 |
buffer["logo"] = logoURL; |
48 |
if(searchAction){ |
|
70 |
buffer["isPartOf"] = properties.baseLink+"/#search"; |
|
71 |
/*if(searchAction){ |
|
49 | 72 |
const action ={}; |
50 | 73 |
action["@type"]= "SearchAction"; |
51 | 74 |
action["target"]= URL+"?keyword={search_term_string}"; |
52 | 75 |
action["query-input"]= "required name=search_term_string"; |
53 | 76 |
buffer["potentialAction"] = action; |
54 |
} |
|
77 |
}*/
|
|
55 | 78 |
return buffer; |
56 | 79 |
} |
57 | 80 |
convertResult(result: any, URL): Dataset { |
... | ... | |
65 | 88 |
doc.issn = this.getISSN(result); |
66 | 89 |
doc.description = this.getDescription(result); |
67 | 90 |
doc.identifier = this.getIdentifier(result); |
91 |
doc.id = URL |
|
68 | 92 |
doc.url = URL; |
69 | 93 |
doc.sameAs = this.getSameAs(result); |
70 | 94 |
doc.creator = this.getCreator(result); |
... | ... | |
150 | 174 |
} |
151 | 175 |
private getDescription(result: any): String[] { |
152 | 176 |
const item = _.get(result, "result.metadata.oaf:entity.oaf:result.description", null); |
153 |
if (!item) return null;
|
|
177 |
if (!item) return this.getTitle(result);
|
|
154 | 178 |
let descr = Array.isArray(item) ? item[0]:item; |
155 | 179 |
return [(descr.substring(0,4997)+(descr.substring(0,4997).length == 4997?'...':'')) as String]; |
156 | 180 |
} |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/sharedComponents/schema2jsonld/service/jsonld-document-serializer.service.ts | ||
---|---|---|
24 | 24 |
|
25 | 25 |
serializeDocument(doc:JsonldDocument, buffer):any{ |
26 | 26 |
buffer["@context"] = "http://schema.org"; |
27 |
buffer["@id"] = doc.id; |
|
27 | 28 |
this.serializeName(doc, buffer); |
28 | 29 |
this.serializeDescription(doc, buffer); |
29 | 30 |
this.serializeIdentifier(doc, buffer); |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/sharedComponents/schema2jsonld/schema2jsonld.component.ts | ||
---|---|---|
1 |
import {Component, ElementRef, Input} from '@angular/core';
|
|
1 |
import {Component, Input} from '@angular/core'; |
|
2 | 2 |
import {OpenAireJsonldConverterService} from './service/open-aire-jsonld-converter.service'; |
3 | 3 |
import {JsonldDocumentSerializerService} from './service/jsonld-document-serializer.service'; |
4 | 4 |
|
... | ... | |
16 | 16 |
@Input() name; |
17 | 17 |
@Input() searchAction = true; |
18 | 18 |
@Input() type = "result"; |
19 |
@Input() description; |
|
19 | 20 |
public json; |
20 | 21 |
|
21 | 22 |
constructor(private documentParser: OpenAireJsonldConverterService, |
... | ... | |
35 | 36 |
docOvject = this.documentParser.convertDatasource(this.data, this.URL, this.otherURL); |
36 | 37 |
this.json = this.documentSerializer.serializeOrganization(docOvject); |
37 | 38 |
} else if (this.type == 'home') { |
38 |
this.json = this.documentParser.createHome(this.name, this.URL, this.logoURL); |
|
39 |
this.json = this.documentParser.createHome(this.name, this.URL, this.logoURL, this.description);
|
|
39 | 40 |
} else if (this.type == 'search') { |
40 |
this.json = this.documentParser.createSearchPage(this.name, this.URL, this.logoURL, this.searchAction); |
|
41 |
this.json = this.documentParser.createSearchPage(this.name, this.URL, this.logoURL, this.searchAction, this.description);
|
|
41 | 42 |
} else if (this.type == 'result') { |
42 | 43 |
docOvject = this.documentParser.convertResult(this.data, this.URL); |
43 | 44 |
this.json = this.documentSerializer.serializeDataset(docOvject); |
44 | 45 |
} else { |
45 |
this.json = this.documentParser.createSimplePage(this.name, this.URL); |
|
46 |
this.json = this.documentParser.createSimplePage(this.name, this.URL, this.description);
|
|
46 | 47 |
} |
47 | 48 |
} |
48 | 49 |
} |
modules/uoa-services-library/trunk/ng-openaire-library/src/assets/library.css | ||
---|---|---|
1001 | 1001 |
} |
1002 | 1002 |
|
1003 | 1003 |
ul.portalTabs.uk-tab::before { |
1004 |
border-bottom: 1px solid var(--portal-main-color);
|
|
1004 |
/*border-bottom: 1px solid var(--portal-main-color);*/
|
|
1005 | 1005 |
} |
1006 | 1006 |
|
1007 | 1007 |
/* theme */ |
Also available in: Unified diff
[Library|Trunk]
JSONLD changes:
Add id in every jsonld
Home page:
remove search action from Organization
Add description in Organization
Add Website with search action
Add Organization and Website in every page
In every search page add is part of the Website
In result landing (Type Dataset) when there is no description add title in description