Skip to content
Snippets Groups Projects
Commit a26df3e9 authored by Mirco Nasuti's avatar Mirco Nasuti
Browse files

new json format for simple mining

parent 1f6f2816
No related branches found
No related tags found
No related merge requests found
......@@ -108,7 +108,9 @@ public class MiningApi {
if (algo.getCode().equals(algoCode))
{
if(algo.getSource().equals(ML_SOURCE)) {
return postMipMining(algoCode, model);
Algorithm algorithm = new Gson().fromJson(new JsonParser().parse(query).getAsJsonObject()
.get("algorithm").getAsJsonObject(), Algorithm.class);
return postMipMining(algorithm, model);
}
else if(algo.getSource().equals(EXAREME_SOURCE))
{
......@@ -120,10 +122,10 @@ public class MiningApi {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
private ResponseEntity<String> postMipMining(String algoCode, Model model) throws Exception {
private ResponseEntity<String> postMipMining(Algorithm algorithm, Model model) throws Exception {
SimpleMiningQuery smq = new SimpleMiningQuery();
smq.setAlgorithm(algoCode);
smq.setAlgorithm(algorithm);
LinkedList<Map<String,String>> vars = new LinkedList<>();
for(Variable var : model.getQuery().getVariables())
......
......@@ -2,6 +2,7 @@ package org.hbp.mip.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import org.hbp.mip.model.algorithm.Algorithm;
import java.util.List;
import java.util.Map;
......@@ -14,7 +15,7 @@ import java.util.Map;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SimpleMiningQuery {
private String algorithm;
private Algorithm algorithm;
private List<Map<String,String>> variables;
......@@ -25,11 +26,11 @@ public class SimpleMiningQuery {
private List<Map<String,String>> filters;
public String getAlgorithm() {
public Algorithm getAlgorithm() {
return algorithm;
}
public void setAlgorithm(String algorithm) {
public void setAlgorithm(Algorithm algorithm) {
this.algorithm = algorithm;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment