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

Refactor/fta fmea UI 198 set iri conventions and refactor iris #70

Merged
15 changes: 15 additions & 0 deletions ontology-generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Project Description

This project creates java sources files based on the appliation ontology.
blcham marked this conversation as resolved.
Show resolved Hide resolved

### Project structure
- ./ontology - ontology folder
- ./src/main/resource/mapping - input mapping file used by the jopa-maven-plugin. The file maps ontology IRIs to files
in the ./ontology folder.


### Naming conventions
blcham marked this conversation as resolved.
Show resolved Hide resolved
The URIs in the ontology should follow the following naming conventions:
- concepts contain only small letters, with words separated by `-` (even classes)
- object properties start with `has-` or `is-`.
- datatype properties typically do not start with `:has-`
571 changes: 280 additions & 291 deletions ontology-generator/ontology/fta-fmea-model.ttl

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import cz.cvut.kbss.analysis.model.FailureMode;
import cz.cvut.kbss.analysis.model.Function;
import cz.cvut.kbss.analysis.service.ComponentRepositoryService;
import cz.cvut.kbss.analysis.service.FunctionRepositoryService;
import cz.cvut.kbss.analysis.service.IdentifierService;
import cz.cvut.kbss.analysis.util.Vocabulary;
import cz.cvut.kbss.jsonld.JsonLd;
Expand Down Expand Up @@ -53,29 +52,29 @@ public Component update(@RequestBody ComponentUpdateDTO componentUpdate) {
public void delete(@PathVariable(name = "componentFragment") String componentFragment) {
log.info("> delete - {}", componentFragment);

URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, componentFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_component, componentFragment);
repositoryService.remove(componentUri);
}

@GetMapping(value = "/{componentFragment}/functions", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE})
public Set<Function> getFunctions(@PathVariable(name = "componentFragment") String componentFragment) {
log.info("> getFunctions - {}", componentFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, componentFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_component, componentFragment);
return repositoryService.getFunctions(componentUri);
}

@GetMapping(value = "/{componentFragment}/failureModes", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE})
public Set<FailureMode> getFailureModes(@PathVariable(name = "componentFragment") String componentFragment) {
log.info("> getFailureModes - {}", componentFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, componentFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_component, componentFragment);
return repositoryService.getFailureModes(componentUri);
}

@ResponseStatus(HttpStatus.CREATED)
@PostMapping(value = "/{componentFragment}/failureModes", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE}, consumes = {MediaType.APPLICATION_JSON_VALUE, JsonLd.MEDIA_TYPE})
public FailureMode addFailureMode(@PathVariable(name = "componentFragment") String componentFragment, @RequestBody FailureMode failureMode) {
log.info("> addFailureMode - {}, {}", componentFragment, failureMode);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, componentFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_component, componentFragment);

return repositoryService.addFailureMode(componentUri,failureMode);
}
Expand All @@ -84,16 +83,16 @@ public FailureMode addFailureMode(@PathVariable(name = "componentFragment") Stri
@PostMapping(value = "/{componentFragment}/failureModes/{failureModeFragment}", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE}, consumes = {MediaType.APPLICATION_JSON_VALUE, JsonLd.MEDIA_TYPE})
public void addFailureModeByURI(@PathVariable(name = "componentFragment") String componentFragment, @PathVariable(name = "failureModeFragment") String failureModeFragment) {
log.info("> addFailureModeByUri - {}, {}", componentFragment, failureModeFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, componentFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, failureModeFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_component, componentFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, failureModeFragment);
repositoryService.addFailureModeByUri(componentUri, failureModeUri);
}

@DeleteMapping(value = "/{componentFragment}/failureModes/{failureModeFragment}")
public void deleteFailureMode(@PathVariable(name = "componentFragment") String componentFragment, @PathVariable(name = "failureModeFragment") String failureModeFragment) {
log.info("> deleteFailureMode - {}, {}", componentFragment, failureModeFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, componentFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, failureModeFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_component, componentFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, failureModeFragment);

repositoryService.deleteFailureMode(componentUri, failureModeUri);
log.info("< deleteFailureMode");
Expand All @@ -103,7 +102,7 @@ public void deleteFailureMode(@PathVariable(name = "componentFragment") String c
@PostMapping(value = "/{componentFragment}/functions", consumes = {MediaType.APPLICATION_JSON_VALUE, JsonLd.MEDIA_TYPE})
public Function addFunction(@PathVariable(name = "componentFragment") String componentFragment, @RequestBody Function function) {
log.info("> addFunction - {}, {}", componentFragment, function);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, componentFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_component, componentFragment);

return repositoryService.addFunction(componentUri, function);
}
Expand All @@ -112,17 +111,17 @@ public Function addFunction(@PathVariable(name = "componentFragment") String com
@PostMapping(value = "/{componentFragment}/functions/{functionFragment}", produces = {MediaType.APPLICATION_JSON_VALUE, JsonLd.MEDIA_TYPE})
public Function addFunctionByURI(@PathVariable(name = "componentFragment") String componentFragment, @PathVariable(name = "functionFragment") String functionFragment) {
log.info("> addFunction - {}, {}", componentFragment, functionFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, componentFragment);
URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, functionFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_component, componentFragment);
URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_function, functionFragment);

return repositoryService.addFunctionByURI(componentUri, functionUri);
}

@DeleteMapping(value = "/{componentFragment}/functions/{functionFragment}")
public void deleteFunction(@PathVariable(name = "componentFragment") String componentFragment, @PathVariable(name = "functionFragment") String functionFragment) {
log.info("> deleteFunction - {}, {}", componentFragment, functionFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, componentFragment);
URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, functionFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_component, componentFragment);
URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_function, functionFragment);

repositoryService.deleteFunction(componentUri, functionUri);
log.info("< deleteFunction");
Expand All @@ -133,16 +132,16 @@ public Component linkComponents(
@PathVariable(name = "componentFragment") String componentFragment,
@PathVariable(name = "linkFragment") String linkFragment) {
log.info("> addFunction - {}, {}", componentFragment, linkFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, componentFragment);
URI linkComponentUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, linkFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_component, componentFragment);
URI linkComponentUri = identifierService.composeIdentifier(Vocabulary.s_c_component, linkFragment);

return repositoryService.linkComponents(componentUri, linkComponentUri);
}

@DeleteMapping(value = "/{componentFragment}/linkComponent")
public void unlinkComponents(@PathVariable(name = "componentFragment") String componentFragment) {
log.info("> unlinkComponents - {}", componentFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, componentFragment);
URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_component, componentFragment);

repositoryService.unlinkComponents(componentUri);
log.info("< unlinkComponents");
Expand All @@ -153,8 +152,8 @@ public void mergeComponents(@PathVariable(name = "sourceFragment") String source
,@PathVariable(name = "targetFragment") String targetFragment){
log.info("> mergeComponents - {} {}", sourceFragment, targetFragment);

URI sourceUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, sourceFragment);
URI targetUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, targetFragment);
URI sourceUri = identifierService.composeIdentifier(Vocabulary.s_c_component, sourceFragment);
URI targetUri = identifierService.composeIdentifier(Vocabulary.s_c_component, targetFragment);

repositoryService.mergeComponents(sourceUri, targetUri);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cz.cvut.kbss.analysis.controller;

import cz.cvut.kbss.analysis.model.*;
import cz.cvut.kbss.analysis.service.ComponentRepositoryService;
import cz.cvut.kbss.analysis.model.FailureMode;
import cz.cvut.kbss.analysis.service.FailureModeRepositoryService;
import cz.cvut.kbss.analysis.service.IdentifierService;
import cz.cvut.kbss.analysis.util.Vocabulary;
Expand All @@ -11,8 +10,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;

import java.net.URI;
Expand All @@ -36,7 +33,7 @@ public List<FailureMode> findAll() {
@GetMapping(value = "/{failureModeFragment}", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE})
public FailureMode findFailureMode(@PathVariable(name = "failureModeFragment") String failureModeFragment) {
log.info("> findFailureMode - {}", failureModeFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, failureModeFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, failureModeFragment);
return repositoryService.findRequired(failureModeUri);
}

Expand All @@ -62,75 +59,75 @@ public FailureMode update(@RequestBody FailureMode failureMode) {
public void delete(@PathVariable(name = "failureModeFragment") String failureModeFragment) {
log.info("> delete - {}", failureModeFragment);

URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, failureModeFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, failureModeFragment);
repositoryService.remove(failureModeUri);
}

@PostMapping(value = "/{failureModeFragment}/impairedBehavior/{impairedBehaviorFragment}")
public FailureMode addImpairedBehavior(@PathVariable(name = "failureModeFragment") String failureModeFragment
, @PathVariable(name = "impairedBehaviorFragment") String impairedBehaviorFragment) {
log.info("> addImpairedBehavior - {}, {}", failureModeFragment, impairedBehaviorFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, failureModeFragment);
URI impairedBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, impairedBehaviorFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, failureModeFragment);
URI impairedBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_function, impairedBehaviorFragment);
return repositoryService.addImpairedBehavior(failureModeUri, impairedBehaviorUri);
}

@DeleteMapping(value = "/{failureModeFragment}/impairedBehavior/{impairedBehaviorFragment}")
public void removeImpairedBehavior(@PathVariable(name = "failureModeFragment") String failureModeFragment
, @PathVariable(name = "impairedBehaviorFragment") String impairedBehaviorFragment) {
log.info("> removeImpairedBehavior - {}, {}", failureModeFragment, impairedBehaviorFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, failureModeFragment);
URI impairedBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, impairedBehaviorFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, failureModeFragment);
URI impairedBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_function, impairedBehaviorFragment);
repositoryService.removeImpairedBehavior(failureModeUri, impairedBehaviorUri);
}

@PostMapping(value = "/{failureModeFragment}/requiredBehavior/{requiredBehaviorFragment}")
public void addRequiredBehavior(@PathVariable(name = "failureModeFragment") String failureModeFragment
, @PathVariable(name = "requiredBehaviorFragment") String requiredBehaviorFragment) {
log.info("> addRequiredBehavior - {}, {}", failureModeFragment, requiredBehaviorFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, failureModeFragment);
URI requiredBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, requiredBehaviorFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, failureModeFragment);
URI requiredBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, requiredBehaviorFragment);
repositoryService.addRequiredBehavior(failureModeUri, requiredBehaviorUri);
}

@DeleteMapping(value = "/{failureModeFragment}/requiredBehavior/{requiredBehaviorFragment}")
public void removeRequiredBehavior(@PathVariable(name = "failureModeFragment") String failureModeFragment
, @PathVariable(name = "requiredBehaviorFragment") String requiredBehaviorFragment) {
log.info("> removeRequiredBehavior - {}, {}", failureModeFragment, requiredBehaviorFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, failureModeFragment);
URI requiredBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, requiredBehaviorFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, failureModeFragment);
URI requiredBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, requiredBehaviorFragment);
repositoryService.removeRequiredBehavior(failureModeUri, requiredBehaviorUri);
}

@PostMapping(value = "/{failureModeFragment}/childBehavior/{childBehaviorFragment}")
public void addChildBehavior(@PathVariable(name = "failureModeFragment") String failureModeFragment
, @PathVariable(name = "childBehaviorFragment") String childBehaviorFragment) {
log.info("> addChildBehavior - {}, {}", failureModeFragment, childBehaviorFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, failureModeFragment);
URI childBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, childBehaviorFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, failureModeFragment);
URI childBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, childBehaviorFragment);
repositoryService.addChildBehavior(failureModeUri, childBehaviorUri);
}

@DeleteMapping(value = "/{failureModeFragment}/childBehavior/{childBehaviorFragment}")
public void removeChildBehavior(@PathVariable(name = "failureModeFragment") String failureModeFragment
, @PathVariable(name = "childBehaviorFragment") String childBehaviorFragment) {
log.info("> removeChildBehavior - {}, {}", failureModeFragment, childBehaviorFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, failureModeFragment);
URI childBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, childBehaviorFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, failureModeFragment);
URI childBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, childBehaviorFragment);
repositoryService.removeChildBehavior(failureModeUri, childBehaviorUri);
}

@GetMapping(value = "/{failureModeFragment}/childTransitiveClosure", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE})
public Set<URI> getChildTransitiveClosure(@PathVariable(name = "failureModeFragment") String failureModeFragment) {
log.info("> getChildTransitiveClosure - {}", failureModeFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, failureModeFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, failureModeFragment);
return repositoryService.getTransitiveClosure(failureModeUri, "child");
}

@GetMapping(value = "/{failureModeFragment}/requiredTransitiveClosure", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE})
public Set<URI> getRequiredTransitiveClosure(@PathVariable(name = "failureModeFragment") String failureModeFragment) {
log.info("> getRequiredTransitiveClosure - {}", failureModeFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureMode, failureModeFragment);
URI failureModeUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_mode, failureModeFragment);
return repositoryService.getTransitiveClosure(failureModeUri, "required");
}
}
Loading
Loading