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

1 SKOS API Support #625 #626

Open
wants to merge 15 commits into
base: dev
Choose a base branch
from
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package uk.ac.ebi.spot.ols.controller.api.v1;

public enum TopConceptEnum {
SCHEMA,
TOPCONCEPTOF_PROPERTY,
RELATIONSHIPS
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
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.*;

import javax.servlet.http.HttpServletResponse;

Expand All @@ -16,7 +15,7 @@
* @date 27/09/2016
* Samples, Phenotypes and Ontologies Team, EMBL-EBI
*/
@Controller
@RestController
public class V1ApiUnavailable {

@RequestMapping(path = "/api/unavailable", produces = {MediaType.APPLICATION_JSON_VALUE}, method = RequestMethod.GET)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* @date 18/08/2015
* Samples, Phenotypes and Ontologies Team, EMBL-EBI
*/
@Controller
@RestController
@RequestMapping("/api/individuals")
@ExposesResourceFor(V1Individual.class)
public class V1IndividualController implements
Expand Down Expand Up @@ -81,7 +81,7 @@ HttpEntity<PagedModel<V1Individual>> getAllIndividuals(

return new ResponseEntity<>(assembler.toModel(terms, individualAssembler), HttpStatus.OK);
}

@RequestMapping(path = "/findByIdAndIsDefiningOntology/{id}", produces = {MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE}, method = RequestMethod.GET)
HttpEntity<PagedModel<V1Individual>> getAllIndividualsByIdAndIsDefiningOntology(
@PathVariable("id") String termId,
Expand All @@ -92,11 +92,11 @@ HttpEntity<PagedModel<V1Individual>> getAllIndividualsByIdAndIsDefiningOntology(
decoded = UriUtils.decode(termId, "UTF-8");
return getAllIndividualsByIdAndIsDefiningOntology(decoded, null, null, lang, pageable, assembler);

}
@RequestMapping(path = "/findByIdAndIsDefiningOntology",
produces = {MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE},
}


@RequestMapping(path = "/findByIdAndIsDefiningOntology",
produces = {MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE},
method = RequestMethod.GET)
HttpEntity<PagedModel<V1Individual>> getAllIndividualsByIdAndIsDefiningOntology(
@RequestParam(value = "iri", required = false) String iri,
Expand All @@ -120,11 +120,11 @@ HttpEntity<PagedModel<V1Individual>> getAllIndividualsByIdAndIsDefiningOntology(

return new ResponseEntity<>(assembler.toModel(terms, individualAssembler), HttpStatus.OK);
}


@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "EntityModel not found")
@ExceptionHandler(ResourceNotFoundException.class)
public void handleError(HttpServletRequest req, Exception exception) {
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @date 19/08/2015
* Samples, Phenotypes and Ontologies Team, EMBL-EBI
*/
@Controller
@RestController
@RequestMapping("/api/ontologies")
@ExposesResourceFor(V1Ontology.class)
public class V1OntologyController implements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @date 02/11/15
* Samples, Phenotypes and Ontologies Team, EMBL-EBI
*/
@Controller
@RestController
@RequestMapping("/api/ontologies")
public class V1OntologyIndividualController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;

@Controller
@RestController
@RequestMapping("/api/ontologies")
public class V1OntologyPropertyController {

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import javax.servlet.http.HttpServletRequest;

@Controller
@RestController
@RequestMapping("/api/properties")
@ExposesResourceFor(V1Property.class)
public class V1PropertyController implements
Expand Down Expand Up @@ -93,8 +93,8 @@ HttpEntity<PagedModel<V1Property>> getPropertiesByIriAndIsDefiningOntology(@Path
String decoded = null;
decoded = UriUtils.decode(termId, "UTF-8");
return getPropertiesByIdAndIsDefiningOntology(decoded, null, null, lang, pageable, assembler);
}
}

@RequestMapping(path = "/findByIdAndIsDefiningOntology", produces = {MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE}, method = RequestMethod.GET)
HttpEntity<PagedModel<V1Property>> getPropertiesByIdAndIsDefiningOntology(
@RequestParam(value = "iri", required = false) String iri,
Expand All @@ -121,7 +121,7 @@ else if (oboId != null) {

return new ResponseEntity<>( assembler.toModel(terms, termAssembler), HttpStatus.OK);
}

@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "EntityModel not found")
@ExceptionHandler(ResourceNotFoundException.class)
public void handleError(HttpServletRequest req, Exception exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,11 @@
import com.google.gson.JsonParser;
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.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;
import org.springframework.web.bind.annotation.*;
import uk.ac.ebi.spot.ols.repository.Validation;
import uk.ac.ebi.spot.ols.repository.solr.OlsSolrClient;
import uk.ac.ebi.spot.ols.repository.transforms.LocalizationTransform;
Expand All @@ -35,7 +31,7 @@
* @date 02/07/2015
* Samples, Phenotypes and Ontologies Team, EMBL-EBI
*/
@Controller
@RestController
public class V1SearchController {

Gson gson = new Gson();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
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;
import org.springframework.web.bind.annotation.*;
import uk.ac.ebi.spot.ols.repository.Validation;
import uk.ac.ebi.spot.ols.repository.solr.OlsSolrClient;
import uk.ac.ebi.spot.ols.repository.transforms.LocalizationTransform;
Expand All @@ -28,7 +26,7 @@
import java.util.function.Function;
import java.util.stream.Collectors;

@Controller
@RestController
public class V1SelectController {

Gson gson = new Gson();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
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;
import org.springframework.web.bind.annotation.*;
import uk.ac.ebi.spot.ols.repository.Validation;
import uk.ac.ebi.spot.ols.repository.solr.OlsSolrClient;
import uk.ac.ebi.spot.ols.repository.v1.V1OntologyRepository;
Expand All @@ -22,7 +20,7 @@
import java.nio.charset.StandardCharsets;
import java.util.*;

@Controller
@RestController
public class V1SuggestController {

Gson gson = new Gson();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,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;
Expand All @@ -35,7 +32,7 @@
import java.util.List;
import java.util.Map;

@Controller
@RestController
@RequestMapping("/api/v2")
public class V2ClassController {

Expand Down Expand Up @@ -101,7 +98,7 @@ public HttpEntity<V2Entity> getClass(

iri = UriUtils.decode(iri, "UTF-8");

V2Entity entity = classRepository.getByOntologyIdAndIri(ontologyId, iri, lang);
V2Entity entity = classRepository.findByOntologyAndIri(ontologyId, iri, lang);
if (entity == null) throw new ResourceNotFoundException();
return new ResponseEntity<>( entity, HttpStatus.OK);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,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;
Expand All @@ -28,7 +25,7 @@
import java.util.List;
import java.util.Map;

@Controller
@RestController
@RequestMapping("/api/v2")
public class V2EntityController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,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;
Expand All @@ -29,7 +26,7 @@
import java.util.List;
import java.util.Map;

@Controller
@RestController
@RequestMapping("/api/v2")
public class V2IndividualController {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,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;
Expand All @@ -29,7 +26,7 @@
import java.util.List;
import java.util.Map;

@Controller
@RestController
@RequestMapping("/api/v2/ontologies")
public class V2OntologyController {

Expand Down
Loading