Skip to content

Commit

Permalink
Merge pull request #387 from edmcouncil/Inherited_descriptions
Browse files Browse the repository at this point in the history
Inherited descriptions
  • Loading branch information
mereolog authored Mar 14, 2024
2 parents d7c9367 + 787b979 commit e7edd9e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -200,6 +201,21 @@ private void appendRestrictions(Map<String, List<PropertyValue>> 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());
}
}
}
}
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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");
}
}

0 comments on commit e7edd9e

Please sign in to comment.