diff --git a/onto-viewer-core/src/main/java/org/edmcouncil/spec/ontoviewer/core/ontology/generator/DescriptionGenerator.java b/onto-viewer-core/src/main/java/org/edmcouncil/spec/ontoviewer/core/ontology/generator/DescriptionGenerator.java index 3f3c836b..da67d05a 100644 --- a/onto-viewer-core/src/main/java/org/edmcouncil/spec/ontoviewer/core/ontology/generator/DescriptionGenerator.java +++ b/onto-viewer-core/src/main/java/org/edmcouncil/spec/ontoviewer/core/ontology/generator/DescriptionGenerator.java @@ -19,6 +19,7 @@ import org.edmcouncil.spec.ontoviewer.core.model.property.OwlAnnotationPropertyValue; import org.edmcouncil.spec.ontoviewer.core.model.property.OwlAxiomPropertyEntity; import org.edmcouncil.spec.ontoviewer.core.model.property.OwlAxiomPropertyValue; +import org.edmcouncil.spec.ontoviewer.core.model.property.OwlLabeledMultiAxiom; import org.edmcouncil.spec.ontoviewer.core.model.taxonomy.OwlTaxonomyElementImpl; import org.edmcouncil.spec.ontoviewer.core.model.taxonomy.OwlTaxonomyImpl; import org.slf4j.Logger; @@ -200,6 +201,21 @@ private void appendRestrictions(Map> ontologicalChar LOGGER.warn("Exception thrown while processing property '{}'. Details: {}", axiomProperty, ex.getMessage()); } + } else if (property instanceof OwlLabeledMultiAxiom){ + + OwlLabeledMultiAxiom axiomProperty = (OwlLabeledMultiAxiom) property; + + if (axiomProperty.getType() == OwlType.TAXONOMY) { + // We don't want to generate descriptions from super- and subclasses. + continue; + } + + try { + handleProperty(manager, axiomProperty.getFullRenderedString()); + } catch (GeneratorException ex) { + LOGGER.warn("Exception thrown while processing property '{}'. Details: {}", axiomProperty, + ex.getMessage()); + } } } } @@ -249,6 +265,25 @@ private void handleProperty(GeneratorManager manager, manager.getSb().append(".\n"); } + private void handleProperty(GeneratorManager manager, String property) throws GeneratorException { + + String withCapitalFirstLetter = property.substring(0,1).toUpperCase() + property.substring(1); + String withPrefix = "- " + withCapitalFirstLetter; + + if (withPrefix.endsWith(" ")) { + withPrefix = withPrefix.substring(0, withPrefix.length() - 1) + ""; + } + + if (withPrefix.endsWith(",")) { + withPrefix = withPrefix.substring(0, withPrefix.length() - 1) + "."; + } + + manager.getSb().append(withPrefix); + manager.getSb().append("\n"); + } + + + private String extractCenterOfPattern(String propertyPattern) throws GeneratorException { var pattern = Pattern.compile(PROPERTY_PATTERN); return extractGroupFromPattern(propertyPattern, pattern); diff --git a/onto-viewer-web-app/src/main/java/org/edmcouncil/spec/ontoviewer/webapp/boot/UpdaterThread.java b/onto-viewer-web-app/src/main/java/org/edmcouncil/spec/ontoviewer/webapp/boot/UpdaterThread.java index ef3ee57b..cfa0ca22 100644 --- a/onto-viewer-web-app/src/main/java/org/edmcouncil/spec/ontoviewer/webapp/boot/UpdaterThread.java +++ b/onto-viewer-web-app/src/main/java/org/edmcouncil/spec/ontoviewer/webapp/boot/UpdaterThread.java @@ -121,7 +121,10 @@ public void run() { LOGGER.info("File system manager created ? : {}", fileSystemService != null); - applicationConfigurationService.reloadConfiguration(); + if (ignoreInitialReloadConfiguration()) { + applicationConfigurationService.reloadConfiguration(); + } + ConfigurationData configurationData = applicationConfigurationService.getConfigurationData(); if (isInterrupt()) { @@ -227,6 +230,10 @@ public UpdateJob getJob() { private Boolean isInterrupt() { return job.getStatus() == UpdateJobStatus.ERROR - || job.getStatus() == UpdateJobStatus.INTERRUPT_IN_PROGRESS; + || job.getStatus() == UpdateJobStatus.INTERRUPT_IN_PROGRESS; + } + + private boolean ignoreInitialReloadConfiguration() { + return !job.getId().equals("0"); } }