Skip to content

Commit

Permalink
Merge pull request #470 from geneontology/status-version
Browse files Browse the repository at this point in the history
Include git revision and ontology version IRI in status service.
  • Loading branch information
kltm committed Mar 28, 2022
2 parents 54365e5 + 230866e commit 8b1473d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
20 changes: 20 additions & 0 deletions minerva-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@

<build>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.3</version>
<executions>
<execution>
<id>git-commit-id</id>
<goals>
<goal>revision</goal>
</goals>
<phase>validate</phase>
<configuration>
<skipPoms>false</skipPoms>
<gitDescribe>
<skip>false</skip>
</gitDescribe>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import org.geneontology.minerva.server.validation.MinervaShexValidator;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.vocab.OWLRDFVocabulary;
import owltools.cli.Opts;
import owltools.gaf.eco.EcoMapperFactory;
import owltools.gaf.eco.SimpleEcoMapper;
Expand Down Expand Up @@ -303,8 +305,13 @@ public static Server startUp(final MinervaStartUpConfig conf)

//grab ontology metadata and store for status service
Map<IRI, Set<OWLAnnotation>> ont_annos = new HashMap<IRI, Set<OWLAnnotation>>();
OWLDataFactory factory = OWLManager.getOWLDataFactory();
OWLAnnotationProperty versionIRI = factory.getOWLAnnotationProperty(OWLRDFVocabulary.OWL_VERSION_IRI.getIRI());
for (OWLOntology ont : graph.getAllOntologies()) {
ont_annos.put(ont.getOWLOntologyManager().getOntologyDocumentIRI(ont), ont.getAnnotations());
Set<OWLAnnotation> maybeVersionAnnotation = ont.getOntologyID().getVersionIRI().transform(iri -> factory.getOWLAnnotation(versionIRI, iri)).asSet();
Set<OWLAnnotation> annotations = ont.getAnnotations();
annotations.addAll(maybeVersionAnnotation);
ont_annos.put(ont.getOWLOntologyManager().getOntologyDocumentIRI(ont), annotations);
}

OWLOntology full_tbox = forceMergeImports(graph.getSourceOntology(), graph.getAllOntologies());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.Map;
import java.util.Optional;
import java.util.Set;


Expand All @@ -24,6 +25,7 @@ public class StatusHandler {

public class Status {
public String startup_date = started_at;
public String gitRevision;
// data configuration
public String ontology;
public String catalog;
Expand Down Expand Up @@ -80,10 +82,15 @@ public Status(MinervaStartUpConfig conf) {
this.sparqlEndpointTimeout = conf.sparqlEndpointTimeout;
this.shexFileUrl = conf.shexFileUrl;
this.goshapemapFileUrl = conf.goshapemapFileUrl;

this.gitRevision = getManifestVersionEntry("git-revision-sha1").orElse("UNKNOWN");
}
}

private static Optional<String> getManifestVersionEntry(String key) {
String value = owltools.version.VersionInfo.getManifestVersion(key);
return Optional.ofNullable(value);
}

/**
* @param ont_annos
* @param started_at
Expand Down

0 comments on commit 8b1473d

Please sign in to comment.