-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from WSE-research/semanticsDemoImplementation
Semantics demo implementation
- Loading branch information
Showing
155 changed files
with
1,745 additions
and
2,020 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
[submodule "input-data-storage"] | ||
path = input-data-storage | ||
url = git@github.com:dschiese/input-data-storage.git | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Submodule input-data-storage
deleted from
9d29f9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 0 additions & 19 deletions
19
src/main/java/com/wse/qanaryexplanationservice/CacheConfig.java
This file was deleted.
Oops, something went wrong.
53 changes: 0 additions & 53 deletions
53
src/main/java/com/wse/qanaryexplanationservice/controller/AnnotationController.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 2 additions & 65 deletions
67
src/main/java/com/wse/qanaryexplanationservice/controller/ClientController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,18 @@ | ||
package com.wse.qanaryexplanationservice.controller; | ||
|
||
import com.wse.qanaryexplanationservice.pojos.ExperimentSelectionDTO; | ||
import com.wse.qanaryexplanationservice.pojos.Score; | ||
import com.wse.qanaryexplanationservice.services.ClientService; | ||
import com.wse.qanaryexplanationservice.services.ExplanationDataService; | ||
import org.json.JSONObject; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.HttpStatusCode; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.context.annotation.Lazy; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.CrossOrigin; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
|
||
import java.io.IOException; | ||
|
||
@Controller | ||
@Lazy | ||
public class ClientController { | ||
|
||
private final Logger logger = LoggerFactory.getLogger(ClientController.class); | ||
@Autowired | ||
private ClientService clientService; | ||
|
||
@Autowired | ||
private ExplanationDataService explanationDataService; | ||
|
||
// TODO: set CrossOrigin later | ||
|
||
/** | ||
* Endpoint to return all explanations for the experiments which are described by the passed JSON-String | ||
* | ||
* @param experimentSelectionDTO Class to mirror passed JSON | ||
* @return Experiments explanations | ||
* @throws IOException while reading file | ||
*/ | ||
@CrossOrigin(origins = {"http://localhost:3000"}) | ||
@PostMapping("/experiments/explanations") | ||
public ResponseEntity<String> getExperimentExplanations(@RequestBody ExperimentSelectionDTO experimentSelectionDTO) throws IOException { | ||
return new ResponseEntity<>(clientService.getExperimentExplanations(experimentSelectionDTO), HttpStatus.OK); | ||
} | ||
|
||
/** | ||
* Endpoint to pass a JSON-String following the AutomatedTest-Structure and insert it to the underlying triplestore | ||
* | ||
* @param automatedTest JSON-String following the AutomatedTest-Structure | ||
* @return ResponseEntity with "Successful"-message | ||
*/ | ||
@PostMapping(value = "/insertjson", consumes = "application/json") | ||
public ResponseEntity<String> insertAutomatedTestJson(@RequestBody String automatedTest) { | ||
try { | ||
JSONObject jsonObject = new JSONObject(automatedTest); | ||
clientService.insertJson(jsonObject); | ||
return new ResponseEntity<>("Successful", HttpStatus.OK); | ||
} catch (RuntimeException e) { | ||
logger.error("{}", e.toString()); | ||
return new ResponseEntity<>(null, HttpStatusCode.valueOf(500)); | ||
} | ||
} | ||
|
||
/** | ||
* Endpoint to return all experiments including all data | ||
* | ||
* @param experimentSelectionDTO Class to mirror passed JSON | ||
* @return JSON-String with all experiments including all data | ||
*/ | ||
@PostMapping("/experiments") | ||
public ResponseEntity<String> test(@RequestBody ExperimentSelectionDTO experimentSelectionDTO) { | ||
return new ResponseEntity<>(clientService.getExperiments(experimentSelectionDTO), HttpStatus.OK); | ||
} | ||
|
||
@CrossOrigin | ||
@PostMapping("/updatedataset") | ||
public ResponseEntity<String> updateDatasetWithScore(@RequestBody Score score) { | ||
return new ResponseEntity<>(explanationDataService.updateDataset(score), HttpStatus.OK); | ||
} | ||
|
||
} |
Oops, something went wrong.