diff --git a/backend/src/main/java/uk/ac/ebi/spot/ols/config/SwaggerConfig.java b/backend/src/main/java/uk/ac/ebi/spot/ols/config/SwaggerConfig.java index feabcc503..a8e069e3e 100644 --- a/backend/src/main/java/uk/ac/ebi/spot/ols/config/SwaggerConfig.java +++ b/backend/src/main/java/uk/ac/ebi/spot/ols/config/SwaggerConfig.java @@ -23,7 +23,7 @@ public OpenAPI customOpenApi(ServletContext context) { .addServersItem(new Server().url(serverUrl)) .info(new Info() .title("OLS Service") - .description("REST API for OLS") + .description("REST API for OLS. Please see this page for defined response field in OLS.") .version("3.0") .termsOfService("https://www.ebi.ac.uk/about/terms-of-use/") .license(new License() diff --git a/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2ClassController.java b/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2ClassController.java index 4c40859bc..48c975597 100644 --- a/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2ClassController.java +++ b/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2ClassController.java @@ -1,5 +1,7 @@ package uk.ac.ebi.spot.ols.controller.api.v2; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.data.rest.webmvc.ResourceNotFoundException; @@ -10,10 +12,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.util.MultiValueMap; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.*; import org.springframework.web.util.UriUtils; import uk.ac.ebi.spot.ols.controller.api.v2.helpers.DynamicQueryHelper; import uk.ac.ebi.spot.ols.controller.api.v2.responses.V2PagedAndFacetedResponse; @@ -30,7 +29,8 @@ import static uk.ac.ebi.ols.shared.DefinedFields.*; -@Controller +@Tag(name = "V2 Class Controller", description = "This endpoint provides access to class information.") +@RestController @RequestMapping("/api/v2") public class V2ClassController { @@ -41,12 +41,34 @@ public class V2ClassController { public HttpEntity> getClasses( @PageableDefault(size = 20, page = 0) Pageable pageable, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang, - @RequestParam(value = "search", required = false) String search, - @RequestParam(value = "searchFields", required = false) String searchFields, - @RequestParam(value = "boostFields", required = false) String boostFields, - @RequestParam(value = "exactMatch", required = false, defaultValue = "false") boolean exactMatch, - @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") boolean includeObsoleteEntities, - @RequestParam MultiValueMap searchProperties + @RequestParam(value = "search", required = false) + @Parameter(name="search", + description = "This parameter specify the search query text.", + example = "liver disease") String search, + @RequestParam(value = "searchFields", required = false) + @Parameter(name = "searchFields", + description = "This parameter is a white space separated list of fields to search in. " + + "The fields are weighted equally. The fields are defined in the schema. " + + "The default fields are label and definition. " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. " + + "For example, label^3 synonyms^2 description^1 logical_definition^1", + example = "label^100 description") String searchFields, + @RequestParam(value = "boostFields", required = false) + @Parameter(name = "boostFields", + description = "This parameter is a white space separated list of fields appended with a caret to boost in search. " + + "The default fields are type, is_defining_ontology, label, curie, shortForm and synonym . " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. ", + example = "label^100 curie^50") String boostFields, + @RequestParam(value = "exactMatch", required = false, defaultValue = "false") + @Parameter(name = "exactMatch", + description = "As the name suggests its a boolean parameter to specify if search should be exact match or not." + + "The default value is false") boolean exactMatch, + @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") + @Parameter(name = "includeObsoleteEntities", + description = "A boolean parameter to specify if obsolete entities should be included or not. Default value is false.") boolean includeObsoleteEntities, + @RequestParam + @Parameter(name="searchProperties", + description = "Specify any other search field here which are not specified by searchFields or boostFields.") MultiValueMap searchProperties ) throws ResourceNotFoundException, IOException { Map> properties = new HashMap<>(); @@ -65,14 +87,39 @@ public HttpEntity> getClasses( @RequestMapping(path = "/ontologies/{onto}/classes", produces = {MediaType.APPLICATION_JSON_VALUE}, method = RequestMethod.GET) public HttpEntity> getClasses( @PageableDefault(size = 20, page = 0) Pageable pageable, - @PathVariable("onto") @NotNull String ontologyId, + @PathVariable("onto") @NotNull + @Parameter(name = "onto", + description = "Ontology Id to get the information about.", + example = "efo") String ontologyId, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang, - @RequestParam(value = "search", required = false) String search, - @RequestParam(value = "searchFields", required = false) String searchFields, - @RequestParam(value = "boostFields", required = false) String boostFields, - @RequestParam(value = "exactMatch", required = false, defaultValue = "false") boolean exactMatch, - @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") boolean includeObsoleteEntities, - @RequestParam MultiValueMap searchProperties + @RequestParam(value = "search", required = false) + @Parameter(name="search", + description = "This parameter specify the search query text.", + example = "liver disease") String search, + @RequestParam(value = "searchFields", required = false) + @Parameter(name = "searchFields", + description = "This parameter is a white space separated list of fields to search in. " + + "The fields are weighted equally. The fields are defined in the schema. " + + "The default fields are label and definition. " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. " + + "For example, label^3 synonyms^2 description^1 logical_definition^1", + example = "label^100 description") String searchFields, + @RequestParam(value = "boostFields", required = false) + @Parameter(name = "boostFields", + description = "This parameter is a white space separated list of fields appended with a caret to boost in search. " + + "The default fields are type, is_defining_ontology, label, curie, shortForm and synonym . " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. ", + example = "label^100 curie^50") String boostFields, + @RequestParam(value = "exactMatch", required = false, defaultValue = "false") + @Parameter(name = "exactMatch", + description = "As the name suggests its a boolean parameter to specify if search should be exact match or not." + + "The default value is false") boolean exactMatch, + @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") + @Parameter(name = "includeObsoleteEntities", + description = "A boolean parameter to specify if obsolete entities should be included or not. Default value is false.") boolean includeObsoleteEntities, + @RequestParam + @Parameter(name="searchProperties", + description = "Specify any other search field here which are not specified by searchFields or boostFields.") MultiValueMap searchProperties ) throws ResourceNotFoundException, IOException { Map> properties = new HashMap<>(); @@ -89,8 +136,14 @@ public HttpEntity> getClasses( @RequestMapping(path = "/ontologies/{onto}/classes/{class}", produces = {MediaType.APPLICATION_JSON_VALUE }, method = RequestMethod.GET) public HttpEntity getClass( - @PathVariable("onto") String ontologyId, - @PathVariable("class") String iri, + @PathVariable("onto") + @Parameter(name = "onto", + description = "Ontology Id to get the information about.", + example = "efo") String ontologyId, + @PathVariable("class") + @Parameter(name = "class", + description = "The IRI of the class, this value must be double URL encoded", + example = "http%3A%2F%2Fwww.ebi.ac.uk%2Fefo%2FEFO_1000967") String iri, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang ) throws ResourceNotFoundException { @@ -104,8 +157,14 @@ public HttpEntity getClass( @RequestMapping(path = "/ontologies/{onto}/classes/{class}/children", produces = {MediaType.APPLICATION_JSON_VALUE}, method = RequestMethod.GET) public HttpEntity> getChildrenByOntology( @PageableDefault(size = 20, page = 0) Pageable pageable, - @PathVariable("onto") String ontologyId, - @PathVariable("class") String iri, + @PathVariable("onto") + @Parameter(name = "onto", + description = "Ontology Id to get the information about.", + example = "efo") String ontologyId, + @PathVariable("class") + @Parameter(name = "class", + description = "The IRI of the class, this value must be double URL encoded", + example = "http%3A%2F%2Fwww.ebi.ac.uk%2Fefo%2FEFO_1000967") String iri, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang ) throws ResourceNotFoundException { @@ -121,8 +180,14 @@ public HttpEntity> getChildrenByOntology( @RequestMapping(path = "/ontologies/{onto}/classes/{class}/ancestors", produces = {MediaType.APPLICATION_JSON_VALUE }, method = RequestMethod.GET) public HttpEntity> getAncestorsByOntology( @PageableDefault(size = 20, page = 0) Pageable pageable, - @PathVariable("onto") String ontologyId, - @PathVariable("class") String iri, + @PathVariable("onto") + @Parameter(name = "onto", + description = "Ontology Id to get the information about.", + example = "efo") String ontologyId, + @PathVariable("class") + @Parameter(name = "class", + description = "The IRI of the class, this value must be double URL encoded", + example = "http%3A%2F%2Fwww.ebi.ac.uk%2Fefo%2FEFO_1000967") String iri, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang ) throws ResourceNotFoundException { @@ -139,8 +204,14 @@ public HttpEntity> getAncestorsByOntology( @RequestMapping(path = "/ontologies/{onto}/classes/{class}/hierarchicalChildren", produces = {MediaType.APPLICATION_JSON_VALUE}, method = RequestMethod.GET) public HttpEntity> getHierarchicalChildrenByOntology( @PageableDefault(size = 20, page = 0) Pageable pageable, - @PathVariable("onto") String ontologyId, - @PathVariable("class") String iri, + @PathVariable("onto") + @Parameter(name = "onto", + description = "Ontology Id to get the information about.", + example = "efo") String ontologyId, + @PathVariable("class") + @Parameter(name = "class", + description = "The IRI of the class, this value must be double URL encoded", + example = "http%3A%2F%2Fwww.ebi.ac.uk%2Fefo%2FEFO_1000967") String iri, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang ) throws ResourceNotFoundException { @@ -156,8 +227,14 @@ public HttpEntity> getHierarchicalChildrenByOntology( @RequestMapping(path = "/ontologies/{onto}/classes/{class}/hierarchicalAncestors", produces = {MediaType.APPLICATION_JSON_VALUE }, method = RequestMethod.GET) public HttpEntity> getHierarchicalAncestorsByOntology( @PageableDefault(size = 20, page = 0) Pageable pageable, - @PathVariable("onto") String ontologyId, - @PathVariable("class") String iri, + @PathVariable("onto") + @Parameter(name = "onto", + description = "Ontology Id to get the information about.", + example = "efo") String ontologyId, + @PathVariable("class") + @Parameter(name = "class", + description = "The IRI of the class, this value must be double URL encoded", + example = "http%3A%2F%2Fwww.ebi.ac.uk%2Fefo%2FEFO_1000967") String iri, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang ) throws ResourceNotFoundException { @@ -178,8 +255,14 @@ public HttpEntity> getHierarchicalAncestorsByOntology( @RequestMapping(path = "/ontologies/{onto}/individuals/{individual}/ancestors", produces = {MediaType.APPLICATION_JSON_VALUE }, method = RequestMethod.GET) public HttpEntity> getIndividualAncestorsByOntology( @PageableDefault(size = 20, page = 0) Pageable pageable, - @PathVariable("onto") String ontologyId, - @PathVariable("individual") String iri, + @PathVariable("onto") + @Parameter(name = "onto", + description = "Ontology Id to get the information about.", + example = "efo") String ontologyId, + @PathVariable("individual") + @Parameter(name = "individual", + description = "The IRI of the individual, this value must be double URL encoded", + example = "http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FIAO_0000002") String iri, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang ) throws ResourceNotFoundException { diff --git a/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2DefinedFieldsController.java b/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2DefinedFieldsController.java new file mode 100644 index 000000000..50cf574c8 --- /dev/null +++ b/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2DefinedFieldsController.java @@ -0,0 +1,56 @@ +package uk.ac.ebi.spot.ols.controller.api.v2; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import uk.ac.ebi.ols.shared.DefinedFields; + +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +@RestController +public class V2DefinedFieldsController { + + @GetMapping("/api/v2/defined-fields") + public List getDefinedFields() { + return Stream.of(DefinedFields.values()) + .map(field -> new DefinedFieldDto( + field.getText(), + field.getOls3Text(), + field.getDescription(), + field.getType() + )) + .collect(Collectors.toList()); + } + + // DTO class for serialization + static class DefinedFieldDto { + private String ols4FieldName; + private String ols3FieldName; + private String description; + private String dataType; + + public DefinedFieldDto(String ols4FieldName, String ols3FieldName, String description, String dataType) { + this.ols4FieldName = ols4FieldName; + this.ols3FieldName = ols3FieldName; + this.description = description; + this.dataType = dataType; + } + + public String getOls4FieldName() { + return ols4FieldName; + } + + public String getOls3FieldName() { + return ols3FieldName; + } + + public String getDescription() { + return description; + } + + public String getDataType() { + return dataType; + } + } +} diff --git a/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2EntityController.java b/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2EntityController.java index 764520710..b025c4ce7 100644 --- a/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2EntityController.java +++ b/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2EntityController.java @@ -1,5 +1,7 @@ package uk.ac.ebi.spot.ols.controller.api.v2; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.data.rest.webmvc.ResourceNotFoundException; @@ -10,10 +12,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.util.MultiValueMap; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.*; import org.springframework.web.util.UriUtils; import uk.ac.ebi.spot.ols.controller.api.v2.helpers.DynamicQueryHelper; import uk.ac.ebi.spot.ols.controller.api.v2.responses.V2PagedAndFacetedResponse; @@ -29,7 +28,8 @@ import static uk.ac.ebi.ols.shared.DefinedFields.*; -@Controller +@Tag(name = "V2 Entity Controller", description = "This endpoint provides access to entity information.") +@RestController @RequestMapping("/api/v2") public class V2EntityController { @@ -40,13 +40,37 @@ public class V2EntityController { public HttpEntity> getEntities( @PageableDefault(size = 20, page = 0) Pageable pageable, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang, - @RequestParam(value = "search", required = false) String search, - @RequestParam(value = "searchFields", required = false) String searchFields, - @RequestParam(value = "boostFields", required = false) String boostFields, - @RequestParam(value = "facetFields", required = false) String facetFields, - @RequestParam(value = "exactMatch", required = false, defaultValue = "false") boolean exactMatch, - @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") boolean includeObsoleteEntities, - @RequestParam MultiValueMap searchProperties + @RequestParam(value = "search", required = false) + @Parameter(name="search", + description = "This parameter specify the search query text.", + example = "liver disease") String search, + @RequestParam(value = "searchFields", required = false) + @Parameter(name = "searchFields", + description = "This parameter is a white space separated list of fields to search in. " + + "The fields are weighted equally. The fields are defined in the schema. " + + "The default fields are label and definition. " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. " + + "For example, label^3 synonyms^2 description^1 logical_definition^1", + example = "label^100 description") String searchFields, + @RequestParam(value = "boostFields", required = false) + @Parameter(name = "boostFields", + description = "This parameter is a white space separated list of fields appended with a caret to boost in search. " + + "The default fields are type, is_defining_ontology, label, curie, shortForm and synonym . " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. ", + example = "label^100 curie^50") String boostFields, + @RequestParam(value = "facetFields", required = false) + @Parameter(name = "facetFields", + description = "This parameter is a white space separated list of fields to facet data by.") String facetFields, + @RequestParam(value = "exactMatch", required = false, defaultValue = "false") + @Parameter(name = "exactMatch", + description = "As the name suggests its a boolean parameter to specify if search should be exact match or not." + + "The default value is false") boolean exactMatch, + @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") + @Parameter(name = "includeObsoleteEntities", + description = "A boolean parameter to specify if obsolete entities should be included or not. Default value is false.") boolean includeObsoleteEntities, + @RequestParam + @Parameter(name="searchProperties", + description = "Specify any other search field here which are not specified by searchFields or boostFields.") MultiValueMap searchProperties ) throws ResourceNotFoundException, IOException { Map> properties = new HashMap<>(); @@ -64,15 +88,42 @@ public HttpEntity> getEntities( @RequestMapping(path = "/ontologies/{onto}/entities", produces = {MediaType.APPLICATION_JSON_VALUE}, method = RequestMethod.GET) public HttpEntity> getTerms( @PageableDefault(size = 20, page = 0) Pageable pageable, - @PathVariable("onto") @NotNull String ontologyId, + @PathVariable("onto") @NotNull + @Parameter(name = "onto", + description = "Ontology Id to get the information about.", + example = "efo") String ontologyId, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang, - @RequestParam(value = "search", required = false) String search, - @RequestParam(value = "searchFields", required = false) String searchFields, - @RequestParam(value = "boostFields", required = false) String boostFields, - @RequestParam(value = "facetFields", required = false) String facetFields, - @RequestParam(value = "exactMatch", required = false, defaultValue = "false") boolean exactMatch, - @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") boolean includeObsoleteEntities, - @RequestParam MultiValueMap searchProperties + @RequestParam(value = "search", required = false) + @Parameter(name="search", + description = "This parameter specify the search query text.", + example = "liver disease") String search, + @RequestParam(value = "searchFields", required = false) + @Parameter(name = "searchFields", + description = "This parameter is a white space separated list of fields to search in. " + + "The fields are weighted equally. The fields are defined in the schema. " + + "The default fields are label and definition. " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. " + + "For example, label^3 synonyms^2 description^1 logical_definition^1", + example = "label^100 description") String searchFields, + @RequestParam(value = "boostFields", required = false) + @Parameter(name = "boostFields", + description = "This parameter is a white space separated list of fields appended with a caret to boost in search. " + + "The default fields are type, is_defining_ontology, label, curie, shortForm and synonym . " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. ", + example = "label^100 curie^50") String boostFields, + @RequestParam(value = "facetFields", required = false) + @Parameter(name = "facetFields", + description = "This parameter is a white space separated list of fields to facet data by.") String facetFields, + @RequestParam(value = "exactMatch", required = false, defaultValue = "false") + @Parameter(name = "exactMatch", + description = "As the name suggests its a boolean parameter to specify if search should be exact match or not." + + "The default value is false") boolean exactMatch, + @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") + @Parameter(name = "includeObsoleteEntities", + description = "A boolean parameter to specify if obsolete entities should be included or not. Default value is false.") boolean includeObsoleteEntities, + @RequestParam + @Parameter(name="searchProperties", + description = "Specify any other search field here which are not specified by searchFields or boostFields.") MultiValueMap searchProperties ) throws ResourceNotFoundException, IOException { Map> properties = new HashMap<>(); @@ -89,8 +140,14 @@ public HttpEntity> getTerms( @RequestMapping(path = "/ontologies/{onto}/entities/{entity}", produces = {MediaType.APPLICATION_JSON_VALUE}, method = RequestMethod.GET) public HttpEntity getEntity( - @PathVariable("onto") String ontologyId, - @PathVariable("entity") String iri, + @PathVariable("onto") + @Parameter(name = "onto", + description = "Ontology Id to get the information about.", + example = "efo") String ontologyId, + @PathVariable("entity") + @Parameter(name = "entity", + description = "The IRI of the entity, this value must be double URL encoded", + example = "http%3A%2F%2Fwww.ebi.ac.uk%2Fefo%2FEFO_1000967") String iri, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang ) throws ResourceNotFoundException { diff --git a/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2IndividualController.java b/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2IndividualController.java index 00feeb842..5a45f9320 100644 --- a/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2IndividualController.java +++ b/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2IndividualController.java @@ -1,5 +1,7 @@ package uk.ac.ebi.spot.ols.controller.api.v2; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.data.rest.webmvc.ResourceNotFoundException; @@ -11,10 +13,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.util.MultiValueMap; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.*; import org.springframework.web.util.UriUtils; import uk.ac.ebi.spot.ols.controller.api.v2.helpers.DynamicQueryHelper; import uk.ac.ebi.spot.ols.controller.api.v2.responses.V2PagedAndFacetedResponse; @@ -30,7 +29,8 @@ import java.util.List; import java.util.Map; -@Controller +@Tag(name = "V2 Individual Controller", description = "This endpoint provides access to individuals information.") +@RestController @RequestMapping("/api/v2") public class V2IndividualController { @@ -41,12 +41,34 @@ public class V2IndividualController { public HttpEntity> getIndividuals( @PageableDefault(size = 20, page = 0) Pageable pageable, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang, - @RequestParam(value = "search", required = false) String search, - @RequestParam(value = "searchFields", required = false) String searchFields, - @RequestParam(value = "boostFields", required = false) String boostFields, - @RequestParam(value = "exactMatch", required = false, defaultValue = "false") boolean exactMatch, - @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") boolean includeObsoleteEntities, - @RequestParam MultiValueMap searchProperties + @RequestParam(value = "search", required = false) + @Parameter(name="search", + description = "This parameter specify the search query text.", + example = "liver disease") String search, + @RequestParam(value = "searchFields", required = false) + @Parameter(name = "searchFields", + description = "This parameter is a white space separated list of fields to search in. " + + "The fields are weighted equally. The fields are defined in the schema. " + + "The default fields are label and definition. " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. " + + "For example, label^3 synonyms^2 description^1 logical_definition^1", + example = "label^100 description") String searchFields, + @RequestParam(value = "boostFields", required = false) + @Parameter(name = "boostFields", + description = "This parameter is a white space separated list of fields appended with a caret to boost in search. " + + "The default fields are type, is_defining_ontology, label, curie, shortForm and synonym . " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. ", + example = "label^100 curie^50") String boostFields, + @RequestParam(value = "exactMatch", required = false, defaultValue = "false") + @Parameter(name = "exactMatch", + description = "As the name suggests its a boolean parameter to specify if search should be exact match or not." + + "The default value is false") boolean exactMatch, + @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") + @Parameter(name = "includeObsoleteEntities", + description = "A boolean parameter to specify if obsolete entities should be included or not. Default value is false.") boolean includeObsoleteEntities, + @RequestParam + @Parameter(name="searchProperties", + description = "Specify any other search field here which are not specified by searchFields or boostFields.") MultiValueMap searchProperties ) throws ResourceNotFoundException, IOException { Map> properties = new HashMap<>(); @@ -64,14 +86,39 @@ public HttpEntity> getIndividuals( @RequestMapping(path = "/ontologies/{onto}/individuals", produces = {MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE}, method = RequestMethod.GET) public HttpEntity> getIndividuals( @PageableDefault(size = 20, page = 0) Pageable pageable, - @PathVariable("onto") @NotNull String ontologyId, + @PathVariable("onto") @NotNull + @Parameter(name = "onto", + description = "Ontology Id to search individuals in.", + example = "efo") String ontologyId, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang, - @RequestParam(value = "search", required = false) String search, - @RequestParam(value = "searchFields", required = false) String searchFields, - @RequestParam(value = "boostFields", required = false) String boostFields, - @RequestParam(value = "exactMatch", required = false, defaultValue = "false") boolean exactMatch, - @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") boolean includeObsoleteEntities, - @RequestParam MultiValueMap searchProperties + @RequestParam(value = "search", required = false) + @Parameter(name="search", + description = "This parameter specify the search query text.", + example = "liver disease") String search, + @RequestParam(value = "searchFields", required = false) + @Parameter(name = "searchFields", + description = "This parameter is a white space separated list of fields to search in. " + + "The fields are weighted equally. The fields are defined in the schema. " + + "The default fields are label and definition. " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. " + + "For example, label^3 synonyms^2 description^1 logical_definition^1", + example = "label^100 description") String searchFields, + @RequestParam(value = "boostFields", required = false) + @Parameter(name = "boostFields", + description = "This parameter is a white space separated list of fields appended with a caret to boost in search. " + + "The default fields are type, is_defining_ontology, label, curie, shortForm and synonym . " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. ", + example = "label^100 curie^50") String boostFields, + @RequestParam(value = "exactMatch", required = false, defaultValue = "false") + @Parameter(name = "exactMatch", + description = "As the name suggests its a boolean parameter to specify if search should be exact match or not." + + "The default value is false") boolean exactMatch, + @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") + @Parameter(name = "includeObsoleteEntities", + description = "A boolean parameter to specify if obsolete entities should be included or not. Default value is false.") boolean includeObsoleteEntities, + @RequestParam + @Parameter(name="searchProperties", + description = "Specify any other search field here which are not specified by searchFields or boostFields.") MultiValueMap searchProperties ) throws ResourceNotFoundException, IOException { Map> properties = new HashMap<>(); @@ -88,8 +135,14 @@ public HttpEntity> getIndividuals( @RequestMapping(path = "/ontologies/{onto}/individuals/{individual}", produces = {MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE}, method = RequestMethod.GET) public HttpEntity getIndividual( - @PathVariable("onto") String ontologyId, - @PathVariable("individual") String iri, + @PathVariable("onto") + @Parameter(name = "onto", + description = "Ontology Id to get the information about.", + example = "efo") String ontologyId, + @PathVariable("individual") + @Parameter(name = "individual", + description = "The IRI of the individual, this value must be double URL encoded", + example = "http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FIAO_0000002") String iri, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang ) throws ResourceNotFoundException { @@ -104,8 +157,14 @@ public HttpEntity getIndividual( @RequestMapping(path = "/ontologies/{onto}/classes/{class}/individuals", produces = {MediaType.APPLICATION_JSON_VALUE }, method = RequestMethod.GET) public HttpEntity> getClassIndividuals( @PageableDefault(size = 20, page = 0) Pageable pageable, - @PathVariable("onto") String ontologyId, - @PathVariable("class") String classIri, + @PathVariable("onto") + @Parameter(name = "onto", + description = "Ontology Id to get the information about.", + example = "efo") String ontologyId, + @PathVariable("class") + @Parameter(name = "class", + description = "The IRI of the class, this value must be double URL encoded", + example = "http%3A%2F%2Fwww.ebi.ac.uk%2Fefo%2FEFO_1000967") String classIri, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang ) throws ResourceNotFoundException, IOException { diff --git a/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2OntologyController.java b/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2OntologyController.java index d84c8a82d..b032722b7 100644 --- a/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2OntologyController.java +++ b/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2OntologyController.java @@ -1,6 +1,8 @@ package uk.ac.ebi.spot.ols.controller.api.v2; import com.google.gson.Gson; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -12,10 +14,7 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.*; import uk.ac.ebi.spot.ols.controller.api.v2.helpers.DynamicQueryHelper; import uk.ac.ebi.spot.ols.controller.api.v2.responses.V2PagedAndFacetedResponse; import uk.ac.ebi.spot.ols.model.v2.V2Entity; @@ -28,7 +27,8 @@ import java.util.List; import java.util.Map; -@Controller +@Tag(name = "V2 Ontology Controller", description = "This endpoint provides access to ontology information.") +@RestController @RequestMapping("/api/v2/ontologies") public class V2OntologyController { @@ -43,12 +43,34 @@ public class V2OntologyController { public HttpEntity> getOntologies( @PageableDefault(size = 20, page = 0) Pageable pageable, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang, - @RequestParam(value = "search", required = false) String search, - @RequestParam(value = "searchFields", required = false) String searchFields, - @RequestParam(value = "boostFields", required = false) String boostFields, - @RequestParam(value = "exactMatch", required = false, defaultValue = "false") boolean exactMatch, - @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") boolean includeObsoleteEntities, - @RequestParam Map> searchProperties + @RequestParam(value = "search", required = false) + @Parameter(name="search", + description = "This parameter specify the search query text.", + example = "liver disease") String search, + @RequestParam(value = "searchFields", required = false) + @Parameter(name = "searchFields", + description = "This parameter is a white space separated list of fields to search in. " + + "The fields are weighted equally. The fields are defined in the schema. " + + "The default fields are label and definition. " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. " + + "For example, label^3 synonyms^2 description^1 logical_definition^1", + example = "label^100 description") String searchFields, + @RequestParam(value = "boostFields", required = false) + @Parameter(name = "boostFields", + description = "This parameter is a white space separated list of fields appended with a caret to boost in search. " + + "The default fields are type, is_defining_ontology, label, curie, shortForm and synonym . " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. ", + example = "label^100 curie^50") String boostFields, + @RequestParam(value = "exactMatch", required = false, defaultValue = "false") + @Parameter(name = "exactMatch", + description = "As the name suggests its a boolean parameter to specify if search should be exact match or not." + + "The default value is false") boolean exactMatch, + @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") + @Parameter(name = "includeObsoleteEntities", + description = "A boolean parameter to specify if obsolete entities should be included or not. Default value is false.") boolean includeObsoleteEntities, + @RequestParam + @Parameter(name="searchProperties", + description = "Specify any other search field here which are not specified by searchFields or boostFields.") Map> searchProperties ) throws ResourceNotFoundException, IOException { Map> properties = new HashMap<>(); @@ -65,7 +87,10 @@ public HttpEntity> getOntologies( @RequestMapping(path = "/{onto}", produces = {MediaType.APPLICATION_JSON_VALUE }, method = RequestMethod.GET) public HttpEntity getOntology( - @PathVariable("onto") String ontologyId, + @PathVariable("onto") + @Parameter(name = "onto", + description = "Ontology Id to get the information about.", + example = "efo") String ontologyId, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang ) throws ResourceNotFoundException { logger.trace("ontologyId = {}, lang = {}", ontologyId, lang); diff --git a/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2PropertyController.java b/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2PropertyController.java index b613fc0dc..0efb250af 100644 --- a/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2PropertyController.java +++ b/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2PropertyController.java @@ -1,5 +1,7 @@ package uk.ac.ebi.spot.ols.controller.api.v2; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.data.rest.webmvc.ResourceNotFoundException; @@ -8,7 +10,6 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.*; import org.springframework.web.util.UriUtils; @@ -28,7 +29,8 @@ import java.util.List; import java.util.Map; -@Controller +@Tag(name = "V2 Property Controller", description = "This endpoint provides access to property information.") +@RestController @RequestMapping("/api/v2") public class V2PropertyController { @@ -39,12 +41,33 @@ public class V2PropertyController { public HttpEntity> getProperties( @PageableDefault(size = 20, page = 0) Pageable pageable, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang, - @RequestParam(value = "search", required = false) String search, - @RequestParam(value = "searchFields", required = false) String searchFields, - @RequestParam(value = "boostFields", required = false) String boostFields, - @RequestParam(value = "exactMatch", required = false, defaultValue = "false") boolean exactMatch, - @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") boolean includeObsoleteEntities, - @RequestParam Map> searchProperties + @RequestParam(value = "search", required = false) + @Parameter(name="search", + description = "This parameter specify the search query text.", + example = "liver disease") String search, + @RequestParam(value = "searchFields", required = false) + @Parameter(name = "searchFields", + description = "This parameter is a white space separated list of fields to search in. " + + "The fields are weighted equally. The fields are defined in the schema. " + + "The default fields are label and definition. " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. " + + "For example, label^3 synonyms^2 description^1 logical_definition^1", + example = "label^100 description") String searchFields, + @RequestParam(value = "boostFields", required = false) + @Parameter(name = "boostFields", + description = "This parameter is a white space separated list of fields appended with a caret to boost in search. " + + "The default fields are type, is_defining_ontology, label, curie, shortForm and synonym . " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. ", + example = "label^100 curie^50") String boostFields, + @RequestParam(value = "exactMatch", required = false, defaultValue = "false") + @Parameter(name = "exactMatch", + description = "As the name suggests its a boolean parameter to specify if search should be exact match or not." + + "The default value is false") boolean exactMatch, + @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") + @Parameter(name = "includeObsoleteEntities", + description = "A boolean parameter to specify if obsolete entities should be included or not. Default value is false.") boolean includeObsoleteEntities, + @RequestParam + @Parameter(name="searchProperties", description = "Specify any other search field here which are not specified by searchFields or boostFields.") Map> searchProperties ) throws ResourceNotFoundException, IOException { Map> properties = new HashMap<>(); @@ -62,14 +85,38 @@ public HttpEntity> getProperties( @RequestMapping(path = "/ontologies/{onto}/properties", produces = {MediaType.APPLICATION_JSON_VALUE }, method = RequestMethod.GET) public HttpEntity> getProperties( @PageableDefault(size = 20, page = 0) Pageable pageable, - @PathVariable("onto") @NotNull String ontologyId, + @PathVariable("onto") @NotNull + @Parameter(name = "onto", + description = "Ontology Id to search properties in.", + example = "efo") String ontologyId, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang, - @RequestParam(value = "search", required = false) String search, - @RequestParam(value = "searchFields", required = false) String searchFields, - @RequestParam(value = "boostFields", required = false) String boostFields, - @RequestParam(value = "exactMatch", required = false, defaultValue = "false") boolean exactMatch, - @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") boolean includeObsoleteEntities, - @RequestParam MultiValueMap searchProperties + @RequestParam(value = "search", required = false) + @Parameter(name="search", + description = "This parameter specify the search query text.", + example = "liver disease") String search, + @RequestParam(value = "searchFields", required = false) + @Parameter(name = "search fields", + description = "This parameter is a white space separated list of fields to search in. " + + "The fields are weighted equally. The fields are defined in the schema. " + + "The default fields are label and definition. " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. " + + "For example, label^3 synonyms^2 description^1 logical_definition^1", + example = "label^100 description") String searchFields, + @RequestParam(value = "boostFields", required = false) + @Parameter(name = "boost fields", + description = "This parameter is a white space separated list of fields appended with a caret to boost in search. " + + "The default fields are type, is_defining_ontology, label, curie, shortForm and synonym . " + + "The fields weights can be boosted by appending a caret ^ and a positive integer to the field name. ", + example = "label^100 curie^50") String boostFields, + @RequestParam(value = "exactMatch", required = false, defaultValue = "false") + @Parameter(name = "exactMatch", + description = "As the name suggests its a boolean parameter to specify if search should be exact match or not." + + "The default value is false") boolean exactMatch, + @RequestParam(value = "includeObsoleteEntities", required = false, defaultValue = "false") + @Parameter(name = "includeObsoleteEntities", + description = "A boolean parameter to specify if obsolete entities should be included or not. Default value is false.") boolean includeObsoleteEntities, + @RequestParam + @Parameter(name="search properties", description = "Specify any other search field here which are not specified by searchFields or boostFields.") MultiValueMap searchProperties ) throws ResourceNotFoundException, IOException { Map> properties = new HashMap<>(); @@ -86,8 +133,14 @@ public HttpEntity> getProperties( @RequestMapping(path = "/ontologies/{onto}/properties/{property}", produces = {MediaType.APPLICATION_JSON_VALUE }, method = RequestMethod.GET) public HttpEntity getProperty( - @PathVariable("onto") String ontologyId, - @PathVariable("property") String iri, + @PathVariable("onto") + @Parameter(name = "onto", + description = "Ontology Id to search properties in.", + example = "efo") String ontologyId, + @PathVariable("property") + @Parameter(name = "property", + description = "The IRI of the property, this value must be double URL encoded", + example = "http%3A%2F%2Fwww.ebi.ac.uk%2Fefo%2FEFO_0000742") String iri, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang ) throws ResourceNotFoundException { @@ -101,8 +154,14 @@ public HttpEntity getProperty( @RequestMapping(path = "/ontologies/{onto}/properties/{property}/children", produces = {MediaType.APPLICATION_JSON_VALUE }, method = RequestMethod.GET) public HttpEntity> getChildrenByOntology( @PageableDefault(size = 20, page = 0) Pageable pageable, - @PathVariable("onto") String ontologyId, - @PathVariable("property") String iri, + @PathVariable("onto") + @Parameter(name = "onto", + description = "Ontology Id to search properties in.", + example = "efo") String ontologyId, + @PathVariable("property") + @Parameter(name = "property", + description = "The IRI of the property, this value must be double URL encoded", + example = "http%3A%2F%2Fwww.ebi.ac.uk%2Fefo%2FEFO_0000742") String iri, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang ) throws ResourceNotFoundException { @@ -118,8 +177,14 @@ public HttpEntity> getChildrenByOntology( @RequestMapping(path = "/ontologies/{onto}/properties/{property}/ancestors", produces = {MediaType.APPLICATION_JSON_VALUE }, method = RequestMethod.GET) public HttpEntity> getAncestorsByOntology( @PageableDefault(size = 20, page = 0) Pageable pageable, - @PathVariable("onto") String ontologyId, - @PathVariable("property") String iri, + @PathVariable("onto") + @Parameter(name = "onto", + description = "Ontology Id to search properties in.", + example = "efo") String ontologyId, + @PathVariable("property") + @Parameter(name = "property", + description = "The IRI of the property, this value must be double URL encoded", + example = "http%3A%2F%2Fwww.ebi.ac.uk%2Fefo%2FEFO_0000742") String iri, @RequestParam(value = "lang", required = false, defaultValue = "en") String lang ) throws ResourceNotFoundException { diff --git a/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2StatisticsController.java b/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2StatisticsController.java index 0af7b2460..e210bcbb3 100644 --- a/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2StatisticsController.java +++ b/backend/src/main/java/uk/ac/ebi/spot/ols/controller/api/v2/V2StatisticsController.java @@ -1,5 +1,6 @@ package uk.ac.ebi.spot.ols.controller.api.v2; +import io.swagger.v3.oas.annotations.tags.Tag; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.response.FacetField; import org.apache.solr.client.solrj.response.QueryResponse; @@ -13,14 +14,15 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; import uk.ac.ebi.spot.ols.model.v2.V2Statistics; import uk.ac.ebi.spot.ols.repository.solr.OlsSolrClient; import java.io.IOException; import java.util.HashMap; import java.util.Map; - -@Controller +@Tag(name = "V2 Stats Controller", description = "This endpoint provides statistics about the current state of the ontology index. It includes the number of ontologies, classes, individuals and properties indexed, and the last time the index was modified.") +@RestController @RequestMapping("/api/v2/stats") public class V2StatisticsController { diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 32e1a914e..17f71e114 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -13,6 +13,7 @@ import About from "./pages/About"; import Downloads from "./pages/Downloads"; import Error from "./pages/Error"; import Help from "./pages/Help"; +import DefinedResponseFields from "./pages/DefinedResponseFields"; import OLS3Help from "./pages/OLS3Help"; import Home from "./pages/home/Home"; import OntologiesPage from "./pages/ontologies/OntologiesPage"; @@ -85,6 +86,7 @@ class App extends React.Component { /> } /> + } /> } /> } /> } /> diff --git a/frontend/src/pages/DefinedResponseFields.tsx b/frontend/src/pages/DefinedResponseFields.tsx new file mode 100644 index 000000000..658f7703a --- /dev/null +++ b/frontend/src/pages/DefinedResponseFields.tsx @@ -0,0 +1,51 @@ +import { Fragment, useEffect, useState } from "react"; +import Header from "../components/Header"; + +interface DefinedField { + ols4FieldName: string; + ols3FieldName: string; + description: string; + dataType: string; +} + +export default function StaticDocs() { + document.title = "OLS Documentation"; + + const [fields, setFields] = useState([]); + + useEffect(() => { + fetch(process.env.REACT_APP_APIURL+'api/v2/defined-fields') + .then((response) => response.json()) + .then((data) => setFields(data)) + .catch((error) => console.error('Error fetching defined fields:', error)); + }, []); + + return ( + +
+
+
Defined Response Fields in OLS
+ + + + + + + + + + + {fields.map((field, index) => ( + + + + + + + ))} + +
OLS4 Field NameOLS3 Field NameDescriptionData Type
{field.ols4FieldName}{field.ols3FieldName}{field.description}{field.dataType}
+
+ + ); +} diff --git a/ols-shared/src/main/java/uk/ac/ebi/ols/shared/DefinedFields.java b/ols-shared/src/main/java/uk/ac/ebi/ols/shared/DefinedFields.java index 11891f33e..ba20b742e 100644 --- a/ols-shared/src/main/java/uk/ac/ebi/ols/shared/DefinedFields.java +++ b/ols-shared/src/main/java/uk/ac/ebi/ols/shared/DefinedFields.java @@ -1,64 +1,66 @@ package uk.ac.ebi.ols.shared; public enum DefinedFields { - APPEARS_IN("appearsIn", "", "The list of ontologies in which the current entity is used."), + APPEARS_IN("appearsIn", "", "The list of ontologies in which the current entity is used.", "array"), BASE_URI("baseUri", "baseUris", - "The beginning of URIs that OLS assumes to belong to an ontology."), - DEFINED_BY("definedBy", "", "A list of ontologies which defines this term"), - DEFINITION("definition", "description","The definition of this entity."), + "The beginning of URIs that OLS assumes to belong to an ontology.", "array"), + DEFINED_BY("definedBy", "", "A list of ontologies which defines this term", "array"), + DEFINITION("definition", "description","The definition of this entity.", "string"), DIRECT_ANCESTOR("directAncestor", "", - "A list of all direct parents by subclass- and hierarchical relations for this entity."), - DIRECT_PARENT("directParent", "","A list of the direct parents of this entity."), - EXPORTS_TO("exportsTo", "", "Lists the prefixes of ontologies that imports this ontology."), + "A list of all direct parents by subclass- and hierarchical relations for this entity.", "array"), + DIRECT_PARENT("directParent", "","A list of the direct parents of this entity.", "array"), + EXPORTS_TO("exportsTo", "", "Lists the prefixes of ontologies that imports this ontology.", "array"), HAS_DIRECT_CHILDREN("hasDirectChildren", "has_children", - "Whether this class has direct children or not."), + "Whether this class has direct children or not.", "boolean"), HAS_DIRECT_PARENTS("hasDirectParents", "", - "Indicates whether this class has direct parents or not."), + "Indicates whether this class has direct parents or not.", "boolean"), HAS_HIERARCHICAL_CHILDREN("hasHierarchicalChildren", "", - "Whether this class has hierarchical children or not."), + "Whether this class has hierarchical children or not.", "boolean"), HAS_HIERARCHICAL_PARENTS("hasHierarchicalParents", "", - "Whether this class has hierarchical parents or not."), - HAS_INDIVIDUALS("hasIndividuals", "", ""), + "Whether this class has hierarchical parents or not.", "boolean"), + HAS_INDIVIDUALS("hasIndividuals", "", "Whether individuals exists or not.", "boolean"), HAS_LOCAL_DEFINITION("hasLocalDefinition", "", - "True if term is definined within this ontology."), + "True if term is definined within this ontology.", "boolean"), HIERARCHICAL_ANCESTOR("hierarchicalAncestor","","The list of ancestors of this entity via " + - "subclass relationships and hierarchical properties such as part_of(BFO:0000050) relations."), + "subclass relationships and hierarchical properties such as part_of(BFO:0000050) relations.", "array"), HIERARCHICAL_PARENT("hierarchicalParent","" ,"The list of parents of this entity via " + - "subclass relationships and hierarchical properties such as part_of(BFO:0000050) relations."), + "subclass relationships and hierarchical properties such as part_of(BFO:0000050) relations.", "array"), IMPORTED("imported", "", - "Whether this entity is imported or not."), + "Whether this entity is imported or not.", "boolean"), IMPORTS_FROM("importsFrom", "", - "Lists the prefixes of the ontologies the current ontology imports from."), + "Lists the prefixes of the ontologies the current ontology imports from.", "array"), IS_DEFINING_ONTOLOGY("isDefiningOntology", - "is_defining_ontology","Whether this entity is defined in this ontology or not."), + "is_defining_ontology","Whether this entity is defined in this ontology or not.", "boolean"), IS_OBSOLETE("isObsolete", "isObsolete", - "Set to true if this entity is obsolete, otherwise is set to false."), + "Set to true if this entity is obsolete, otherwise is set to false.", "boolean"), IS_PREFERRED_ROOT("isPreferredRoot", "is_preferred_root", - "Set to true if this entity is a preferred root or not."), - LABEL("label", "", "The name or names of this entity."), - LANGUAGE("language", "", "The language or languages this ontology is available in."), - NUM_DESCENDANTS ("numDescendants", "", "Number of descendants of this entity."), + "Set to true if this entity is a preferred root or not.", "boolean"), + LABEL("label", "", "The name or names of this entity.", "string"), + LANGUAGE("language", "", "The language or languages this ontology is available in.", "array"), + NUM_DESCENDANTS ("numDescendants", "", "Number of descendants of this entity.", "integer"), NUM_HIERARCHICAL_DESCENDANTS ("numHierarchicalDescendants", "", - "Number of hierarchical descendants of this entity."), + "Number of hierarchical descendants of this entity.", "integer"), PREFERRED_ROOT("preferredRoot", "", - "A list of entities that serve as roots for this ontology."), + "A list of entities that serve as roots for this ontology.", "array"), RELATED_FROM("relatedFrom","", "The list of classes in which this class is used as part of its definition. " + "I.e. 'liver disease' (EFO:0001421) has a relatedFrom relation with 'serum albumin measurement' (EFO:0004535) because " + - "'serum albumin measurement' is a subclass of 'is about some liver disease'."), + "'serum albumin measurement' is a subclass of 'is about some liver disease'.", "array"), RELATED_TO("relatedTo","", "The list of classes that are used in axioms in the filler position" + " in defining this class. It only considers classes in the filler position, not classes expressions in the filler position." + "I.e. 'liver disease' (EFO:0001421) has a relatedTo relation with 'liver' (UBERON:0002107) because " + - "'liver disease' is a subclass of 'has_disease_location some liver'."), - SYNONYM("synonym", "", "The list of names that are synonyms of this entity."); + "'liver disease' is a subclass of 'has_disease_location some liver'.", "array"), + SYNONYM("synonym", "", "The list of names that are synonyms of this entity.", "array"),; private final String text; private final String ols3Text; private final String description; + private final String type; - DefinedFields(String text, String ols3Text, String description) { + DefinedFields(String text, String ols3Text, String description, String type) { this.text = text; this.ols3Text = ols3Text; this.description = description; + this.type = type; } public String getText() { @@ -68,4 +70,8 @@ public String getText() { public String getOls3Text() { return ols3Text; } + + public String getDescription() { return description; } + + public String getType() { return type; } }