Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IsObsolete issues #710

Merged
merged 16 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
6 changes: 2 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ jobs:

- name: Build and push ols4 dataload Docker image
run: |
cd dataload
docker build -t ghcr.io/ebispot/ols4-dataload:${{ github.sha }} .
docker build -t ghcr.io/ebispot/ols4-dataload:${{ github.sha }} -f ./dataload/Dockerfile .
docker tag ghcr.io/ebispot/ols4-dataload:${{github.sha}} ghcr.io/ebispot/ols4-dataload:${{ github.head_ref || github.ref_name }}
docker push --all-tags ghcr.io/ebispot/ols4-dataload
- name: Build and push ols4 backend Docker image
run: |
cd backend
docker build -t ghcr.io/ebispot/ols4-backend:${{ github.sha }} .
docker build -t ghcr.io/ebispot/ols4-backend:${{ github.sha }} -f ./backend/Dockerfile .
docker tag ghcr.io/ebispot/ols4-backend:${{github.sha}} ghcr.io/ebispot/ols4-backend:${{ github.head_ref || github.ref_name }}
docker push --all-tags ghcr.io/ebispot/ols4-backend
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Once the backend is up, you can start the frontend with:

Once you are done testing, to stop everything:

./stopall.sh
./stopNeo4JSolr.sh

### Running the dataload locally

Expand Down Expand Up @@ -395,7 +395,7 @@ Ensure that all differences in this file can be explained and that they do make
new expected output:

rm -rf testcases_expected_output
cp -r testcases_output testcases_expected_output
cp -r testcases_output/testcases testcases_expected_output

6. Now continue with API testing.

Expand Down Expand Up @@ -432,6 +432,6 @@ the old `testcases_expected_output_api` and replace with new expected output:

12. You can stop the OLS4 backend with "Ctrl-C", and Solr and Neo4J with:

./dev-testing/stopall.sh
./dev-testing/stopNeo4JSolr.sh


16 changes: 11 additions & 5 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@

FROM maven:3.6.3-adoptopenjdk-14
#FROM maven:3.6.3-adoptopenjdk-14
FROM maven:3.8-jdk-11

RUN mkdir /opt/ols
COPY . /opt/ols/
RUN cd /opt/ols && ls && mvn clean package -DskipTests
RUN mkdir /opt/ols && mkdir /opt/ols/backend && mkdir /opt/ols/ols-shared
COPY ./backend /opt/ols/backend
COPY ./ols-shared /opt/ols/ols-shared

RUN cd /opt/ols/ols-shared && mvn package

RUN mvn install:install-file -DcreateChecksum=true -Dpackaging=jar -Dfile=/opt/ols/ols-shared/target/ols4-shared-1.0.0-SNAPSHOT.jar -DgroupId=uk.ac.ebi.spot.ols -DartifactId=ols4-shared -Dversion=1.0.0-SNAPSHOT
RUN cd /opt/ols/backend && ls && mvn clean package -DskipTests

EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/opt/ols/target/ols4-backend-4.0.0-SNAPSHOT.jar"]
ENTRYPOINT ["java", "-jar", "/opt/ols/backend/target/ols4-backend-4.0.0-SNAPSHOT.jar"]


6 changes: 5 additions & 1 deletion backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
</properties>

<dependencies>

<dependency>
<groupId>uk.ac.ebi.spot.ols</groupId>
<artifactId>ols4-shared</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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.RequestParam;
Expand All @@ -44,11 +43,9 @@
import uk.ac.ebi.spot.ols.repository.v1.V1OntologyRepository;
import uk.ac.ebi.spot.ols.repository.v1.mappers.AnnotationExtractor;

/**
* @author Simon Jupp
* @date 02/07/2015
* Samples, Phenotypes and Ontologies Team, EMBL-EBI
*/
import static uk.ac.ebi.ols.shared.DefinedFields.*;


@Tag(name = "Search Controller")
@RestController
public class V1SearchController {
Expand Down Expand Up @@ -186,7 +183,7 @@ public void search(
}
}

solrQuery.addFilterQuery("isObsolete:" + queryObsoletes);
solrQuery.addFilterQuery(IS_OBSOLETE.getText() + ":" + queryObsoletes);

solrQuery.setStart(start);
solrQuery.setRows(rows);
Expand All @@ -206,7 +203,12 @@ public void search(
*
*/
// TODO: Need to check and add additional faceted fields if required
solrQuery.addFacetField("ontologyId", "ontologyIri", "ontologyPreferredPrefix", "type", "isDefiningOntology", "isObsolete");
solrQuery.addFacetField("ontologyId",
"ontologyIri",
"ontologyPreferredPrefix",
"type",
"isDefiningOntology",
IS_OBSOLETE.getText());
/*
* Fix: End
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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.RequestParam;
Expand All @@ -32,6 +30,7 @@
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static uk.ac.ebi.ols.shared.DefinedFields.*;

@Tag(name = "Select Controller")
@RestController
Expand Down Expand Up @@ -112,7 +111,7 @@ public void select(
solrQuery.addFilterQuery("hierarchicalAncestor: (" + result + ")");
}

solrQuery.addFilterQuery("isObsolete:" + queryObsoletes);
solrQuery.addFilterQuery(IS_OBSOLETE.getText() + ":" + queryObsoletes);
solrQuery.setStart(start);
solrQuery.setRows(rows);
solrQuery.setHighlight(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
package uk.ac.ebi.spot.ols.controller.api.v2;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.rest.webmvc.RepositoryLinksResource;
import org.springframework.data.rest.webmvc.ResourceNotFoundException;
import org.springframework.data.web.PageableDefault;
import org.springframework.data.web.PagedResourcesAssembler;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
Expand All @@ -24,9 +19,7 @@
import uk.ac.ebi.spot.ols.controller.api.v2.responses.V2PagedAndFacetedResponse;
import uk.ac.ebi.spot.ols.controller.api.v2.responses.V2PagedResponse;
import uk.ac.ebi.spot.ols.model.v2.V2Entity;
import uk.ac.ebi.spot.ols.repository.solr.OlsFacetedResultsPage;
import uk.ac.ebi.spot.ols.repository.v2.V2ClassRepository;
import uk.ac.ebi.spot.ols.repository.v2.V2EntityRepository;

import javax.validation.constraints.NotNull;
import java.io.IOException;
Expand All @@ -35,6 +28,8 @@
import java.util.List;
import java.util.Map;

import static uk.ac.ebi.ols.shared.DefinedFields.*;

@Controller
@RequestMapping("/api/v2")
public class V2ClassController {
Expand All @@ -56,7 +51,7 @@ public HttpEntity<V2PagedAndFacetedResponse<V2Entity>> getClasses(

Map<String, Collection<String>> properties = new HashMap<>();
if(!includeObsoleteEntities)
properties.put("isObsolete", List.of("false"));
properties.put(IS_OBSOLETE.getText(), List.of("false"));
properties.putAll(searchProperties);

return new ResponseEntity<>(
Expand All @@ -82,7 +77,7 @@ public HttpEntity<V2PagedAndFacetedResponse<V2Entity>> getClasses(

Map<String,Collection<String>> properties = new HashMap<>();
if(!includeObsoleteEntities)
properties.put("isObsolete", List.of("false"));
properties.put(IS_OBSOLETE.getText(), List.of("false"));
properties.putAll(searchProperties);

return new ResponseEntity<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
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;
import uk.ac.ebi.spot.ols.repository.solr.OlsFacetedResultsPage;
import uk.ac.ebi.spot.ols.repository.v2.V2EntityRepository;

import javax.validation.constraints.NotNull;
Expand All @@ -28,6 +27,8 @@
import java.util.List;
import java.util.Map;

import static uk.ac.ebi.ols.shared.DefinedFields.*;

@Controller
@RequestMapping("/api/v2")
public class V2EntityController {
Expand All @@ -50,7 +51,7 @@ public HttpEntity<V2PagedAndFacetedResponse<V2Entity>> getEntities(

Map<String,Collection<String>> properties = new HashMap<>();
if(!includeObsoleteEntities)
properties.put("isObsolete", List.of("false"));
properties.put(IS_OBSOLETE.getText(), List.of("false"));
properties.putAll(searchProperties);

return new ResponseEntity<>(
Expand All @@ -76,7 +77,7 @@ public HttpEntity<V2PagedAndFacetedResponse<V2Entity>> getTerms(

Map<String,Collection<String>> properties = new HashMap<>();
if(!includeObsoleteEntities)
properties.put("isObsolete", List.of("false"));
properties.put(IS_OBSOLETE.getText(), List.of("false"));
properties.putAll(searchProperties);

return new ResponseEntity<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import uk.ac.ebi.spot.ols.controller.api.v2.responses.V2PagedResponse;
import uk.ac.ebi.spot.ols.model.v2.V2Entity;
import uk.ac.ebi.spot.ols.repository.v2.V2IndividualRepository;
import static uk.ac.ebi.ols.shared.DefinedFields.*;

import javax.validation.constraints.NotNull;
import java.io.IOException;
Expand Down Expand Up @@ -50,7 +51,7 @@ public HttpEntity<V2PagedAndFacetedResponse<V2Entity>> getIndividuals(

Map<String, Collection<String>> properties = new HashMap<>();
if(!includeObsoleteEntities)
properties.put("isObsolete", List.of("false"));
properties.put(IS_OBSOLETE.getText(), List.of("false"));
properties.putAll(searchProperties);

return new ResponseEntity<>(
Expand All @@ -75,7 +76,7 @@ public HttpEntity<V2PagedAndFacetedResponse<V2Entity>> getIndividuals(

Map<String, Collection<String>> properties = new HashMap<>();
if(!includeObsoleteEntities)
properties.put("isObsolete", List.of("false"));
properties.put(IS_OBSOLETE.getText(), List.of("false"));
properties.putAll(searchProperties);

return new ResponseEntity<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
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;
import uk.ac.ebi.spot.ols.repository.solr.OlsFacetedResultsPage;
import uk.ac.ebi.spot.ols.repository.v2.V2EntityRepository;
import uk.ac.ebi.spot.ols.repository.v2.V2OntologyRepository;
import static uk.ac.ebi.ols.shared.DefinedFields.*;

import java.io.IOException;
import java.util.Collection;
Expand Down Expand Up @@ -54,7 +53,7 @@ public HttpEntity<V2PagedAndFacetedResponse<V2Entity>> getOntologies(

Map<String,Collection<String>> properties = new HashMap<>();
if(!includeObsoleteEntities)
properties.put("isObsolete", List.of("false"));
properties.put(IS_OBSOLETE.getText(), List.of("false"));
properties.putAll(searchProperties);

return new ResponseEntity<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
import uk.ac.ebi.spot.ols.model.v2.V2Entity;
import uk.ac.ebi.spot.ols.repository.v2.V2PropertyRepository;

import static uk.ac.ebi.ols.shared.DefinedFields.*;


import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.util.Collection;
Expand Down Expand Up @@ -46,7 +49,7 @@ public HttpEntity<V2PagedAndFacetedResponse<V2Entity>> getProperties(

Map<String,Collection<String>> properties = new HashMap<>();
if(!includeObsoleteEntities)
properties.put("isObsolete", List.of("false"));
properties.put(IS_OBSOLETE.getText(), List.of("false"));
properties.putAll(searchProperties);

return new ResponseEntity<>(
Expand All @@ -71,7 +74,7 @@ public HttpEntity<V2PagedAndFacetedResponse<V2Entity>> getProperties(

Map<String,Collection<String>> properties = new HashMap<>();
if(!includeObsoleteEntities)
properties.put("isObsolete", List.of("false"));
properties.put(IS_OBSOLETE.getText(), List.of("false"));
properties.putAll(searchProperties);

return new ResponseEntity<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import uk.ac.ebi.spot.ols.repository.solr.OlsSolrQuery;
import uk.ac.ebi.spot.ols.repository.solr.OlsSolrClient;
import uk.ac.ebi.spot.ols.repository.v1.mappers.V1PropertyMapper;
import static uk.ac.ebi.ols.shared.DefinedFields.*;

@Component
public class V1PropertyRepository {
Expand Down Expand Up @@ -97,7 +98,7 @@ public Page<V1Property> getRoots(String ontologyId, boolean obsolete, String lan
query.addFilter("hasHierarchicalParent", List.of("false"), SearchType.WHOLE_FIELD);

if(!obsolete)
query.addFilter("isObsolete", List.of("false"), SearchType.WHOLE_FIELD);
query.addFilter(IS_OBSOLETE.getText(), List.of("false"), SearchType.WHOLE_FIELD);

return solrClient.searchSolrPaginated(query, pageable)
.map(result -> V1PropertyMapper.mapProperty(result, lang));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import uk.ac.ebi.spot.ols.repository.solr.OlsSolrQuery;
import uk.ac.ebi.spot.ols.repository.solr.SearchType;
import uk.ac.ebi.spot.ols.repository.v1.mappers.V1TermMapper;
import static uk.ac.ebi.ols.shared.DefinedFields.*;

import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -134,7 +135,7 @@ public Page<V1Term> findAllByOntology(String ontologyId, Boolean obsoletes, Stri
OlsSolrQuery query = new OlsSolrQuery();
query.addFilter("type", List.of("class"), SearchType.WHOLE_FIELD);
query.addFilter("ontologyId", List.of(ontologyId), SearchType.WHOLE_FIELD);
if (obsoletes != null) query.addFilter("isObsolete", List.of(Boolean.toString(obsoletes)), SearchType.WHOLE_FIELD);
if (obsoletes != null) query.addFilter(IS_OBSOLETE.getText(), List.of(Boolean.toString(obsoletes)), SearchType.WHOLE_FIELD);

return solrClient.searchSolrPaginated(query, pageable)
.map(result -> V1TermMapper.mapTerm(result, lang));
Expand Down Expand Up @@ -184,7 +185,7 @@ public Page<V1Term> getRoots(String ontologyId, boolean obsolete, String lang, P
query.addFilter("hasHierarchicalParent", List.of("false"), SearchType.WHOLE_FIELD);

if (!obsolete)
query.addFilter("isObsolete", List.of("false"), SearchType.WHOLE_FIELD);
query.addFilter(IS_OBSOLETE.getText(), List.of("false"), SearchType.WHOLE_FIELD);

return solrClient.searchSolrPaginated(query, pageable)
.map(result -> V1TermMapper.mapTerm(result, lang));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import uk.ac.ebi.spot.ols.model.v1.*;
import uk.ac.ebi.spot.ols.repository.transforms.LocalizationTransform;
import uk.ac.ebi.spot.ols.repository.v1.JsonHelper;
import static uk.ac.ebi.ols.shared.DefinedFields.*;

import java.util.*;

Expand Down Expand Up @@ -54,7 +55,7 @@ public static V1Term mapTerm(JsonElement json, String lang) {
Boolean.parseBoolean(JsonHelper.getString(localizedJson, "hasHierarchicalParent"))
);

term.isObsolete = Boolean.parseBoolean(JsonHelper.getString(localizedJson, "isObsolete"));
term.isObsolete = Boolean.parseBoolean(JsonHelper.getString(localizedJson, IS_OBSOLETE.getText()));


List<JsonElement> replacedBy = JsonHelper.getValues(localizedJson, "http://purl.obolibrary.org/obo/IAO_0100001");
Expand Down
Loading
Loading