Skip to content

Commit 5d4034c

Browse files
authored
Introduce ontology term concept for service API (#1124)
Adds records for OntologyTerm and CURIE. Changes the record API for experiment description to use the introduced concepts.
1 parent be55105 commit 5d4034c

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

project-management/src/main/java/life/qbic/projectmanagement/application/api/AsyncProjectService.java

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
package life.qbic.projectmanagement.application.api;
22

33
import static java.util.Objects.nonNull;
4+
import static java.util.Objects.requireNonNull;
45

6+
import java.net.URI;
57
import java.nio.ByteBuffer;
68
import java.util.Collection;
79
import java.util.List;
810
import java.util.Map;
11+
import java.util.Objects;
912
import java.util.Optional;
1013
import java.util.Set;
1114
import java.util.UUID;
@@ -179,6 +182,7 @@ Flux<ByteBuffer> roCrateSummary(String projectId)
179182
* <p>
180183
* Exceptions are wrapped as {@link Mono#error(Throwable)} and are one of the types described in
181184
* the throw section below.
185+
*
182186
* @param projectId the identifier of the project to get the experiments for
183187
* @return a {@link Flux} of {@link ExperimentDescription}. Exceptions are provided as
184188
* {@link Mono#error(Throwable)}.
@@ -624,8 +628,8 @@ record ExperimentalGroups(List<ExperimentalGroup> experimentalGroups) implements
624628
* containing CURIEs.
625629
* @since 1.9.0
626630
*/
627-
record ExperimentDescription(String experimentName, Set<String> species, Set<String> specimen,
628-
Set<String> analytes) implements ExperimentUpdateRequestBody,
631+
record ExperimentDescription(String experimentName, Set<OntologyTerm> species, Set<OntologyTerm> specimen,
632+
Set<OntologyTerm> analytes) implements ExperimentUpdateRequestBody,
629633
ExperimentUpdateResponseBody {
630634

631635
public ExperimentDescription {
@@ -765,6 +769,35 @@ record ExperimentUpdateResponse(String experimentId, ExperimentUpdateResponseBod
765769
*/
766770
record ProjectCreationRequest(ProjectDesign design, ProjectContacts contacts,
767771
FundingInformation funding) {
772+
}
773+
774+
/**
775+
* Represents an ontology term definition with a simple label that can be used to display the term
776+
* for humans, its assigned OBO identifier and its globally unique identifier.
777+
*
778+
* @param label an {@link OntologyTerm} label for visualisation
779+
* @param oboId the assigned OBO identifier
780+
* @param id the globally unique identifier of the term
781+
* @since 1.10.0
782+
*/
783+
record OntologyTerm(String label, Curie oboId, URI id) {
784+
public OntologyTerm {
785+
requireNonNull(oboId);
786+
requireNonNull(id);
787+
}
788+
}
789+
790+
/**
791+
* Represents a CURIE in the format <code>IDSPACE:LOCALID</code>.
792+
* <p>
793+
* Example: <code>GO:0008150</code>
794+
*
795+
* @param idSpace the id space defined that holds a set of local identifiers unique within a
796+
* space
797+
* @param localId the local id which is unique within the space
798+
* @since 1.10.0
799+
*/
800+
record Curie(String idSpace, String localId) {
768801

769802
}
770803

0 commit comments

Comments
 (0)