Skip to content
This repository has been archived by the owner on Apr 28, 2023. It is now read-only.

Display config license #535

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ols-web/src/main/resources/scss/new_ols.scss
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,19 @@ a.nounderline.ontology-link {
padding: 10px 10px 10px 10px;
}

#ontology_info_box2 .panel-heading {
background: #00827c;
text-align: center;
}

#ontology_info_box2 .panel-heading h4 {
color: white;
}

#ontology_info_box2 .panel-body {
padding: 10px 10px 10px 10px;
}

#onto-tab-content .tabs-content {
min-height: 500px;
margin-bottom: 40px;
Expand Down
10 changes: 10 additions & 0 deletions ols-web/src/main/resources/static/css/new_ols.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ols-web/src/main/resources/static/css/new_ols.css.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ $("#diachron-link").on('click', function(){
$("#LegendDiv").fadeIn();
});

$("#ontology_info_box2").fadeOut(200, function(){
$("#LegendDiv").fadeIn();
});

})
})
})
Expand All @@ -85,6 +89,7 @@ function hideLegend() {
$("#LegendDiv").fadeOut(200, function() {
// alert('non-diachron tab clicked');
$("#ontology_info_box").fadeIn();
$("#ontology_info_box2").fadeIn();
});
}

Expand Down
42 changes: 36 additions & 6 deletions ols-web/src/main/resources/templates/ontology.html
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ <h3 style="font-size: 43px;" property="name" th:text="${ontologyDocument.getConf
<div id="right_info_box" class="small-4 columns">
<div id="ontology_info_box" class="panel">
<div class="panel-heading">
<h4 th:inline="text">[[${ontologyAlias}]] information</h4>
<h4 th:inline="text">[[${shortTitle}]] [[${ontologyAlias}]] information</h4>
</div>
<div class="panel-body">
<div>
Expand Down Expand Up @@ -241,17 +241,47 @@ <h4 th:inline="text">[[${ontologyAlias}]] information</h4>
<div th:each="creator : ${ontologyDocument.getConfig().getCreators()}">
<b>Creator: </b> <span th:text="${creator}">NCBI:9606</span>
</div>

<br/>

<div th:unless="${ontologyDocument.getConfig().getReasonerType() == T(uk.ac.ebi.spot.ols.util.ReasonerType).NONE}">
<b>Reasoner: </b> <span th:text="${ontologyDocument.getConfig().getReasonerType()}">NCBI_9606</span>
</div>

<div th:unless="${ontologyDocument.getConfig().getLicense().getLabel() == null}">
<b>License Label: </b> <span th:text="${ontologyDocument.getConfig().getLicense().getLabel()}">NCBI_9606</span>
</div>

<div th:unless="${ontologyDocument.getConfig().getLicense().getLogo() == null}">
<b>License Logo: </b>
<a th:href="${ontologyDocument.getConfig().getLicense().getLogo()}" th:text="${ontologyDocument.getConfig().getLicense().getLogo()}">License Logo</a>
</div>

<div th:unless="${ontologyDocument.getConfig().getLicense().getUrl() == null}">
<b>License URL: </b>
<a th:href="${ontologyDocument.getConfig().getLicense().getUrl()}" th:text="${ontologyDocument.getConfig().getLicense().getUrl()}">License URL</a>
</div>
</div>

<div th:unless="${ontologyDocument.getConfig().getAnnotations().isEmpty()}" id="ontology_info_box2" class="panel">
<div class="panel-heading">
<h4 th:inline="text">Original [[${ontologyAlias}]] information</h4>
</div>
<div class="panel-body">
<div th:each="annotations: ${ontologyDocument.getConfig().getAnnotations()}">
<b>
<a href="#"
th:href="@{../search(q=${annotations.key},exact='true', type=property, ontology=${ontologyDocument.getOntologyId()})}"
th:text="${annotations.key.replaceAll('_', ' ')}">property name</a>
</b>
<p style="margin-left:9px;" th:each="annovalue : ${annotations.value}"
th:text="${annovalue}">
NCBI_9606</p>
<div th:each="annovalue : ${annotations.value}">
<div th:unless="${annovalue.split(' ').length > 1}">
<div th:unless="${annovalue.startsWith('http://') or annovalue.startsWith('https://')}">
<a th:if="${annovalue.startsWith('www.')}" style="margin-left:9px;" th:href="'https://' + ${annovalue}" th:text="${annovalue}">NCBI_9606</a>
<p th:unless="${annovalue.startsWith('www.')}" style="margin-left:9px;" th:text="${annovalue}" th:text="${annovalue}">NCBI_9606</p>
</div>
<a th:if="${annovalue.startsWith('http://') or annovalue.startsWith('https://')}" style="margin-left:9px;" th:href="${annovalue}" th:text="${annovalue}">NCBI_9606</a>
</div>
<p th:if="${annovalue.split(' ').length > 1}" style="margin-left:9px;" th:text="${annovalue}" th:text="${annovalue}">NCBI_9606</p>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package uk.ac.ebi.spot.ols.config;


import uk.ac.ebi.spot.ols.util.License;
import uk.ac.ebi.spot.ols.util.ReasonerType;

import java.net.URI;
Expand Down Expand Up @@ -47,6 +48,7 @@ public class OntologyResourceConfig {
private boolean isSkos;

private boolean allowDownload;
private License license;

// these are any metadata properties for the ontology, such as title or definition that are included in the ontology as OWL ontology annotation
private Collection<String> internalMetadataProperties;
Expand All @@ -58,7 +60,7 @@ public OntologyResourceConfig(String id, String versionIri, String title, String
Collection<URI> synonymProperties, Collection<URI> hierarchicalProperties,
Collection<String> baseUris, Collection<URI> hiddenProperties, boolean isSkos,
Collection<String> internalMetadataProperties, Collection<URI> preferredRootTerms,
boolean allowDownload) {
boolean allowDownload, License license) {
this.id = id;
this.versionIri = versionIri;
this.title = title;
Expand All @@ -84,6 +86,7 @@ public OntologyResourceConfig(String id, String versionIri, String title, String
this.internalMetadataProperties = internalMetadataProperties;
this.preferredRootTerms = preferredRootTerms;
this.allowDownload = allowDownload;
this.license = license;
}

public OntologyResourceConfig() {
Expand Down Expand Up @@ -116,6 +119,7 @@ private OntologyResourceConfig(OntologyResourceConfigBuilder builder) {
this.internalMetadataProperties = builder.internalMetadatProperties;
this.preferredRootTerms = builder.preferredRootTerms;
this.allowDownload = builder.allowDownload;
this.license = builder.license;
}

public void setId(String id) {
Expand Down Expand Up @@ -328,6 +332,14 @@ public boolean getAllowDownload() {
public void setAllowDownload(boolean allowDownload) {
this.allowDownload = allowDownload;
}

public License getLicense() {
return this.license;
}

public void setLicense(License license) {
this.license= license;
}

public static class OntologyResourceConfigBuilder {
private String id;
Expand Down Expand Up @@ -356,6 +368,7 @@ public static class OntologyResourceConfigBuilder {
private Collection<String> internalMetadatProperties = Collections.emptySet();
private Collection<URI> preferredRootTerms = Collections.emptySet();
private boolean allowDownload = true;
private License license;

public OntologyResourceConfigBuilder(String id, String title, String namespace, URI fileLocation) {
this.id = id;
Expand Down Expand Up @@ -492,6 +505,10 @@ public void setPreferredRootTerms(Collection<URI> preferredRootTerms) {
public void setAllowDownload(boolean allowDownload) {
this.allowDownload = allowDownload;
}

public void setLicense(License license) {
this.license = license;
}

public OntologyResourceConfig build() {
return new OntologyResourceConfig(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public enum OntologyResourceConfigEnum {
LOGO("logo"),
CREATOR("creator"),
PREFERRED_ROOT_TERM("preferred_root_term"),
ALLOW_DOWNLOAD("allow_download");
ALLOW_DOWNLOAD("allow_download"),
LICENSE("license");

private final String propertyName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.ac.ebi.spot.ols.exception.ConfigParsingException;
import uk.ac.ebi.spot.ols.util.License;
import uk.ac.ebi.spot.ols.util.ReasonerType;

import java.net.URI;
Expand Down Expand Up @@ -80,6 +81,7 @@ public OntologyResourceConfig getConfiguration() throws ConfigParsingException {
populateCreator(builder);
populatePreferredRootTerms(builder);
populateAllowDownload(builder);
populateLicense(builder);

return builder.build();
}
Expand Down Expand Up @@ -279,4 +281,16 @@ private void populateAllowDownload(OntologyResourceConfig.OntologyResourceConfig
builder.setAllowDownload(true);
}
}

private void populateLicense(OntologyResourceConfig.OntologyResourceConfigBuilder builder) {
if (ontology.containsKey(LICENSE.getPropertyName())) {
License license = new License();
license.setLabel((String) ((Map<String, Object>) ontology.get(LICENSE.getPropertyName())).get("label"));
license.setLogo((String) ((Map<String, Object>) ontology.get(LICENSE.getPropertyName())).get("logo"));
license.setUrl((String) ((Map<String, Object>) ontology.get(LICENSE.getPropertyName())).get("url"));
builder.setLicense(license);
} else {
builder.setLicense(new License());
}
}
}
49 changes: 49 additions & 0 deletions ontology-tools/src/main/java/uk/ac/ebi/spot/ols/util/License.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package uk.ac.ebi.spot.ols.util;

public class License {

String url;
String logo;
String label;

public License() {}

public License(String url, String logo, String label) {
super();
this.url = url;
this.logo = logo;
this.label = label;
}

public String getUrl() {
return url;
}

public void setUrl(String url) {
this.url = url;
}

public String getLogo() {
return logo;
}

public void setLogo(String logo) {
this.logo = logo;
}

public String getLabel() {
return label;
}

public void setLabel(String label) {
this.label = label;
}

@Override
public String toString() {
return "License [url=" + url + ", logo=" + logo + ", label=" + label + "]";
}



}