From e37376a6354dd7a0a5a154f4c3adfc047b5d7caa Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Thu, 14 Mar 2024 23:05:07 +0100 Subject: [PATCH] [Fix kbss-cvut/fta-fmea-ui#198] Refactor Vocabulary usage --- .../controller/ComponentController.java | 36 +++++++++---------- .../controller/FailureModeController.java | 32 ++++++++--------- .../FailureModesTableController.java | 6 ++-- .../controller/FaultEventController.java | 14 ++++---- .../controller/FaultTreeController.java | 18 +++++----- .../controller/FunctionController.java | 26 +++++++------- .../analysis/controller/SystemController.java | 16 ++++----- .../cvut/kbss/analysis/dao/BehaviorDao.java | 5 +-- .../cvut/kbss/analysis/dao/FaultEventDao.java | 2 +- .../cvut/kbss/analysis/dao/FaultTreeDao.java | 2 +- .../cvut/kbss/analysis/dao/FunctionDao.java | 5 +-- .../kbss/analysis/dao/NamedEntityDao.java | 4 +-- .../cz/cvut/kbss/analysis/dao/UserDao.java | 4 +-- .../kbss/analysis/model/AnalysisEvent.java | 10 +++--- .../kbss/analysis/model/AnalysisProduct.java | 2 +- .../cz/cvut/kbss/analysis/model/Behavior.java | 18 +++++----- .../cvut/kbss/analysis/model/Component.java | 4 +-- .../cz/cvut/kbss/analysis/model/Document.java | 3 +- .../cz/cvut/kbss/analysis/model/Event.java | 12 +++---- .../cvut/kbss/analysis/model/FailureMode.java | 6 ++-- .../kbss/analysis/model/FailureModesRow.java | 13 ++++--- .../analysis/model/FailureModesTable.java | 6 ++-- .../analysis/model/FailureRateEstimate.java | 4 +-- .../cvut/kbss/analysis/model/FaultEvent.java | 16 ++++----- .../analysis/model/FaultEventScenario.java | 2 +- .../cvut/kbss/analysis/model/FaultTree.java | 6 ++-- .../cz/cvut/kbss/analysis/model/Function.java | 2 +- .../kbss/analysis/model/FunctionEvent.java | 4 +-- .../cz/cvut/kbss/analysis/model/Item.java | 10 +++--- .../cvut/kbss/analysis/model/Mitigation.java | 2 +- .../cvut/kbss/analysis/model/NamedEntity.java | 4 +-- .../analysis/model/RiskPriorityNumber.java | 8 ++--- .../cvut/kbss/analysis/model/Situation.java | 8 ++--- .../cz/cvut/kbss/analysis/model/System.java | 2 +- .../cz/cvut/kbss/analysis/model/User.java | 6 ++-- .../service/FaultTreeRepositoryService.java | 4 +-- .../validation/ComponentValidator.java | 2 +- .../validation/FaultEventValidator.java | 2 +- .../validation/FaultTreeValidator.java | 2 +- .../service/validation/FunctionValidator.java | 2 +- .../validation/ComponentValidatorTest.java | 4 +-- .../validation/FaultEventValidatorTest.java | 4 +-- 42 files changed, 168 insertions(+), 170 deletions(-) diff --git a/src/main/java/cz/cvut/kbss/analysis/controller/ComponentController.java b/src/main/java/cz/cvut/kbss/analysis/controller/ComponentController.java index c3f00c4a..b280d7ac 100755 --- a/src/main/java/cz/cvut/kbss/analysis/controller/ComponentController.java +++ b/src/main/java/cz/cvut/kbss/analysis/controller/ComponentController.java @@ -53,21 +53,21 @@ 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 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 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); } @@ -75,7 +75,7 @@ public Set getFailureModes(@PathVariable(name = "componentFragment" @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); } @@ -84,16 +84,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"); @@ -103,7 +103,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); } @@ -112,8 +112,8 @@ 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); } @@ -121,8 +121,8 @@ public Function addFunctionByURI(@PathVariable(name = "componentFragment") Strin @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"); @@ -133,8 +133,8 @@ 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); } @@ -142,7 +142,7 @@ public Component linkComponents( @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"); @@ -153,8 +153,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); } diff --git a/src/main/java/cz/cvut/kbss/analysis/controller/FailureModeController.java b/src/main/java/cz/cvut/kbss/analysis/controller/FailureModeController.java index 420d9c9a..65d19465 100755 --- a/src/main/java/cz/cvut/kbss/analysis/controller/FailureModeController.java +++ b/src/main/java/cz/cvut/kbss/analysis/controller/FailureModeController.java @@ -36,7 +36,7 @@ public List 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); } @@ -62,7 +62,7 @@ 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); } @@ -70,8 +70,8 @@ public void delete(@PathVariable(name = "failureModeFragment") String failureMod 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); } @@ -79,8 +79,8 @@ public FailureMode addImpairedBehavior(@PathVariable(name = "failureModeFragment 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); } @@ -88,8 +88,8 @@ public void removeImpairedBehavior(@PathVariable(name = "failureModeFragment") S 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); } @@ -97,8 +97,8 @@ public void addRequiredBehavior(@PathVariable(name = "failureModeFragment") Stri 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); } @@ -106,8 +106,8 @@ public void removeRequiredBehavior(@PathVariable(name = "failureModeFragment") S 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); } @@ -115,22 +115,22 @@ public void addChildBehavior(@PathVariable(name = "failureModeFragment") String 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 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 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"); } } diff --git a/src/main/java/cz/cvut/kbss/analysis/controller/FailureModesTableController.java b/src/main/java/cz/cvut/kbss/analysis/controller/FailureModesTableController.java index d03c4b63..8af15f04 100755 --- a/src/main/java/cz/cvut/kbss/analysis/controller/FailureModesTableController.java +++ b/src/main/java/cz/cvut/kbss/analysis/controller/FailureModesTableController.java @@ -52,7 +52,7 @@ public FailureModesTable update(@RequestBody FailureModesTableUpdateDTO tableUpd public void delete(@PathVariable(name = "failureModeTableFragment") String failureModeTableFragment) { log.info("> delete - {}", failureModeTableFragment); - URI tableUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureModesTable, failureModeTableFragment); + URI tableUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_modes_table, failureModeTableFragment); repositoryService.remove(tableUri); } @@ -60,7 +60,7 @@ public void delete(@PathVariable(name = "failureModeTableFragment") String failu public FailureModesTableDataDTO computeTableData(@PathVariable(name = "failureModeTableFragment") String failureModeTableFragment) { log.info("> computeTableData - {}", failureModeTableFragment); - URI tableUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureModesTable, failureModeTableFragment); + URI tableUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_modes_table, failureModeTableFragment); return repositoryService.computeTableData(tableUri); } @@ -68,7 +68,7 @@ public FailureModesTableDataDTO computeTableData(@PathVariable(name = "failureMo public String export(@PathVariable(name = "failureModeTableFragment") String failureModeTableFragment, HttpServletResponse response) { log.info("> export - {}", failureModeTableFragment); - URI tableUri = identifierService.composeIdentifier(Vocabulary.s_c_FailureModesTable, failureModeTableFragment); + URI tableUri = identifierService.composeIdentifier(Vocabulary.s_c_failure_modes_table, failureModeTableFragment); response.setContentType("text/csv"); response.addHeader("Content-Disposition", "attachment; filename=\"table.csv\""); diff --git a/src/main/java/cz/cvut/kbss/analysis/controller/FaultEventController.java b/src/main/java/cz/cvut/kbss/analysis/controller/FaultEventController.java index ea107fd1..e0202e88 100755 --- a/src/main/java/cz/cvut/kbss/analysis/controller/FaultEventController.java +++ b/src/main/java/cz/cvut/kbss/analysis/controller/FaultEventController.java @@ -36,7 +36,7 @@ public List findAll() { public void delete(@PathVariable(name = "faultEventFragment") String faultEventFragment) { log.info("> delete - {}", faultEventFragment); - URI faultEventIri = identifierService.composeIdentifier(Vocabulary.s_c_FaultEvent, faultEventFragment); + URI faultEventIri = identifierService.composeIdentifier(Vocabulary.s_c_fault_event, faultEventFragment); FaultEvent instance = repositoryService.findRequired(faultEventIri); repositoryService.remove(instance); } @@ -51,7 +51,7 @@ public void update(@RequestBody FaultEvent faultEvent) { @ResponseStatus(HttpStatus.NO_CONTENT) @PutMapping(value = "/{faultEventFragment}/rectangle", consumes = {MediaType.APPLICATION_JSON_VALUE, JsonLd.MEDIA_TYPE}, produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE}) public void updateRectangle(@PathVariable(name = "faultEventFragment") String faultEventFragment, @RequestBody Rectangle rectangle) { - URI faultEventUri = identifierService.composeIdentifier(Vocabulary.s_c_FaultEvent, faultEventFragment); + URI faultEventUri = identifierService.composeIdentifier(Vocabulary.s_c_fault_event, faultEventFragment); log.trace("> update - updating rectangle - {} for event <{}>", rectangle, faultEventUri); repositoryService.update(rectangle); } @@ -60,7 +60,7 @@ public void updateRectangle(@PathVariable(name = "faultEventFragment") String fa @PostMapping(value = "/{faultEventFragment}/inputEvents", consumes = {MediaType.APPLICATION_JSON_VALUE, JsonLd.MEDIA_TYPE}) public FaultEvent addInputEvent(@PathVariable(name = "faultEventFragment") String faultEventFragment, @RequestBody FaultEvent inputEvent) { log.info("> addInputEvent - {}, {}", faultEventFragment, inputEvent); - URI faultEventUri = identifierService.composeIdentifier(Vocabulary.s_c_FaultEvent, faultEventFragment); + URI faultEventUri = identifierService.composeIdentifier(Vocabulary.s_c_fault_event, faultEventFragment); return repositoryService.addInputEvent(faultEventUri, inputEvent); } @@ -68,7 +68,7 @@ public FaultEvent addInputEvent(@PathVariable(name = "faultEventFragment") Strin @GetMapping(value = "/{faultEventFragment}/failureMode", produces = {MediaType.APPLICATION_JSON_VALUE, JsonLd.MEDIA_TYPE}) public FailureMode getFailureMode(@PathVariable(name = "faultEventFragment") String faultEventFragment) { log.info("> getFailureMode - {}", faultEventFragment); - URI faultEventUri = identifierService.composeIdentifier(Vocabulary.s_c_FaultEvent, faultEventFragment); + URI faultEventUri = identifierService.composeIdentifier(Vocabulary.s_c_fault_event, faultEventFragment); return repositoryService.getFailureMode(faultEventUri); } @@ -77,7 +77,7 @@ public FailureMode getFailureMode(@PathVariable(name = "faultEventFragment") Str @PostMapping(value = "/{faultEventFragment}/failureMode", consumes = {MediaType.APPLICATION_JSON_VALUE, JsonLd.MEDIA_TYPE}) public FailureMode addFailureMode(@PathVariable(name = "faultEventFragment") String faultEventFragment, @RequestBody FailureMode failureMode) { log.info("> addFailureMode - {}, {}", faultEventFragment, failureMode); - URI faultEventUri = identifierService.composeIdentifier(Vocabulary.s_c_FaultEvent, faultEventFragment); + URI faultEventUri = identifierService.composeIdentifier(Vocabulary.s_c_fault_event, faultEventFragment); return repositoryService.addFailureMode(faultEventUri, failureMode); } @@ -85,7 +85,7 @@ public FailureMode addFailureMode(@PathVariable(name = "faultEventFragment") Str @DeleteMapping(value = "/{faultEventFragment}/failureMode") public void deleteFailureMode(@PathVariable(name = "faultEventFragment") String faultEventFragment) { log.info("> deleteFailureMode - {}", faultEventFragment); - URI faultEventUri = identifierService.composeIdentifier(Vocabulary.s_c_FaultEvent, faultEventFragment); + URI faultEventUri = identifierService.composeIdentifier(Vocabulary.s_c_fault_event, faultEventFragment); repositoryService.deleteFailureMode(faultEventUri); log.info("< deleteFailureMode"); @@ -96,7 +96,7 @@ public void updateChildrenSequence( @PathVariable(name = "faultEventFragment") String faultEventFragment, @RequestBody List childrenSequence) { log.info("> updateChildrenSequence - {}, {}", faultEventFragment, childrenSequence); - URI faultEventUri = identifierService.composeIdentifier(Vocabulary.s_c_FaultEvent, faultEventFragment); + URI faultEventUri = identifierService.composeIdentifier(Vocabulary.s_c_fault_event, faultEventFragment); repositoryService.updateChildrenSequence(faultEventUri, childrenSequence); } diff --git a/src/main/java/cz/cvut/kbss/analysis/controller/FaultTreeController.java b/src/main/java/cz/cvut/kbss/analysis/controller/FaultTreeController.java index afb96f35..95fba2c4 100755 --- a/src/main/java/cz/cvut/kbss/analysis/controller/FaultTreeController.java +++ b/src/main/java/cz/cvut/kbss/analysis/controller/FaultTreeController.java @@ -38,7 +38,7 @@ public List summaries() { @GetMapping(value = "/{faultTreeFragment}", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE}) public FaultTree find(@PathVariable(name = "faultTreeFragment") String faultTreeFragment) { log.info("> find - {}", faultTreeFragment); - URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_FaultTree, faultTreeFragment); + URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_fault_tree, faultTreeFragment); return repositoryService.findRequired(faultTreeUri); } @@ -65,14 +65,14 @@ public FaultTree update(@RequestBody FaultTree faultTree) { public void delete(@PathVariable(name = "faultTreeFragment") String faultTreeFragment) { log.info("> delete - {}", faultTreeFragment); - URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_FaultTree, faultTreeFragment); + URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_fault_tree, faultTreeFragment); repositoryService.remove(faultTreeUri); } @GetMapping(value = "/{faultTreeFragment}/reusableEvents", produces = {MediaType.APPLICATION_JSON_VALUE, JsonLd.MEDIA_TYPE}) public List reusableEvents(@PathVariable(name = "faultTreeFragment") String faultTreeFragment) { log.info("> reusableEvents - {}", faultTreeFragment); - URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_FaultTree, faultTreeFragment); + URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_fault_tree, faultTreeFragment); return repositoryService.getReusableEvents(faultTreeUri); } @@ -80,7 +80,7 @@ public List reusableEvents(@PathVariable(name = "faultTreeFragment") @GetMapping(value = "/{faultTreeFragment}/treePaths", produces = {MediaType.APPLICATION_JSON_VALUE, JsonLd.MEDIA_TYPE}) public List> getTreePaths(@PathVariable(name = "faultTreeFragment") String faultTreeFragment) { log.info("> getTreePaths - {}", faultTreeFragment); - URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_FaultTree, faultTreeFragment); + URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_fault_tree, faultTreeFragment); return repositoryService.getTreePaths(faultTreeUri); } @@ -98,7 +98,7 @@ public FailureModesTable createFailureModesTable( @PathVariable(name = "faultTreeFragment") String faultTreeFragment, @RequestBody FailureModesTable failureModesTable) { log.info("> createFailureModesTable - {}, {}", faultTreeFragment, failureModesTable); - URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_FaultTree, faultTreeFragment); + URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_fault_tree, faultTreeFragment); return repositoryService.createFailureModesTable(faultTreeUri, failureModesTable); } @@ -106,7 +106,7 @@ public FailureModesTable createFailureModesTable( @GetMapping(value = "/{faultTreeFragment}/failureModesTable", produces = {MediaType.APPLICATION_JSON_VALUE, JsonLd.MEDIA_TYPE}) public FailureModesTable getFailureModesTable(@PathVariable(name = "faultTreeFragment") String faultTreeFragment) { log.info("> getFailureModesTable - {}", faultTreeFragment); - URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_FaultTree, faultTreeFragment); + URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_fault_tree, faultTreeFragment); return repositoryService.getFailureModesTable(faultTreeUri); } @@ -114,7 +114,7 @@ public FailureModesTable getFailureModesTable(@PathVariable(name = "faultTreeFra @ResponseStatus(HttpStatus.CREATED) @PostMapping(value = "/{functionFragment}/generateFunctionalDependencies/{faultTreeName}", produces = {MediaType.APPLICATION_JSON_VALUE, JsonLd.MEDIA_TYPE}) public FaultTree generateFunctionalDependenciesFaultTree(@PathVariable("functionFragment") String functionFragment,@PathVariable("faultTreeName") String faultTreeName) throws URISyntaxException { - URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, functionFragment); + URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_function, functionFragment); log.info("> generateFunctionalDependenciesFaultTree - {}, {}", functionFragment, faultTreeName); return repositoryService.generateFunctionDependencyTree(functionUri,faultTreeName); } @@ -122,7 +122,7 @@ public FaultTree generateFunctionalDependenciesFaultTree(@PathVariable("function @ResponseStatus(HttpStatus.NO_CONTENT) @PutMapping(value = "/{faultTreeFragment}/cutsets") public void performCutSetAnalysis(@PathVariable(name = "faultTreeFragment") String faultTreeFragment){ - URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_FaultTree, faultTreeFragment); + URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_fault_tree, faultTreeFragment); log.info("> performCutSetAnalysis - {}", faultTreeFragment); repositoryService.performCutSetAnalysis(faultTreeUri); } @@ -130,7 +130,7 @@ public void performCutSetAnalysis(@PathVariable(name = "faultTreeFragment") Stri @ResponseStatus(HttpStatus.NO_CONTENT) @PutMapping(value = "/{faultTreeFragment}/evaluate") public void evaluate(@PathVariable(name = "faultTreeFragment") String faultTreeFragment){ - URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_FaultTree, faultTreeFragment); + URI faultTreeUri = identifierService.composeIdentifier(Vocabulary.s_c_fault_tree, faultTreeFragment); log.info("> performCutSetAnalysis - {}", faultTreeFragment); repositoryService.evaluate(faultTreeUri); } diff --git a/src/main/java/cz/cvut/kbss/analysis/controller/FunctionController.java b/src/main/java/cz/cvut/kbss/analysis/controller/FunctionController.java index ecb65d2b..c4106af7 100755 --- a/src/main/java/cz/cvut/kbss/analysis/controller/FunctionController.java +++ b/src/main/java/cz/cvut/kbss/analysis/controller/FunctionController.java @@ -35,23 +35,23 @@ public List findAll() { @GetMapping(value = "/{functionFragment}/requiredFunctions", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE}) public Set getFunctions(@PathVariable(name = "functionFragment") String function) { log.info("> getRequiredFunctions - {}", function); - URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, function); + URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_function, function); return functionRepositoryService.getRequiredBehavior(functionUri); } @PostMapping(value = "/{functionFragment}/requiredFunctions/{requiredFunctionFragment}") public Function addRequiredFunction(@PathVariable(name = "functionFragment") String functionFragment,@PathVariable(name = "requiredFunctionFragment") String requiredFunctionFragment ) { log.info("> addRequiredFunction - {}, {}", functionFragment, requiredFunctionFragment); - URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, functionFragment); - URI requiredFunctionURI = identifierService.composeIdentifier(Vocabulary.s_c_Function, requiredFunctionFragment); + URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_function, functionFragment); + URI requiredFunctionURI = identifierService.composeIdentifier(Vocabulary.s_c_function, requiredFunctionFragment); return functionRepositoryService.addRequiredBehavior(functionUri, requiredFunctionURI); } @DeleteMapping(value = "/{functionFragment}/requiredFunctions/{requiredFunctionFragment}") public void deleteFunction(@PathVariable(name = "functionFragment") String functionFragment, @PathVariable(name = "requiredFunctionFragment") String requiredFunctionFragment) { log.info("> deleteRequiredFunction - {}, {}", functionFragment, functionFragment); - URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, functionFragment); - URI requiredFunctionUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, requiredFunctionFragment); + URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_function, functionFragment); + URI requiredFunctionUri = identifierService.composeIdentifier(Vocabulary.s_c_function, requiredFunctionFragment); functionRepositoryService.deleteRequiredBehavior(functionUri,requiredFunctionUri); log.info("< deleteRequiredFunction"); @@ -67,14 +67,14 @@ public Function updateFunction(@RequestBody Function function){ @GetMapping(value = "/{functionFragment}/getComponent", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE}) public Component getComponent(@PathVariable(name = "functionFragment") String function) { log.info("> getComponent - {}", function); - URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, function); + URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_function, function); return functionRepositoryService.getComponent(functionUri); } @GetMapping(value = "/{functionFragment}/impairedBehaviors", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE}) public List getImpairedBehaviors(@PathVariable(name = "functionFragment") String function) { log.info("> getImpairedBehaviors - {}", function); - URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, function); + URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_function, function); return functionRepositoryService.getImpairingBehaviors(functionUri); } @@ -82,8 +82,8 @@ public List getImpairedBehaviors(@PathVariable(name = "functionFragmen public void addChildBehavior(@PathVariable(name = "functionFragment") String functionFragment ,@PathVariable(name = "childBehaviorFragment") String childBehaviorFragment ) { log.info("> addChildBehavior - {}, {}", functionFragment, childBehaviorFragment); - URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, functionFragment); - URI childBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, childBehaviorFragment); + URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_function, functionFragment); + URI childBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_function, childBehaviorFragment); functionRepositoryService.addChildBehavior(functionUri, childBehaviorUri); } @@ -91,22 +91,22 @@ public void addChildBehavior(@PathVariable(name = "functionFragment") String fun public void removeChildBehavior(@PathVariable(name = "functionFragment") String failureModeFragment ,@PathVariable(name = "childBehaviorFragment") String childBehaviorFragment ) { log.info("> removeChildBehavior - {}, {}", failureModeFragment, childBehaviorFragment); - URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, failureModeFragment); - URI childBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, childBehaviorFragment); + URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_function, failureModeFragment); + URI childBehaviorUri = identifierService.composeIdentifier(Vocabulary.s_c_function, childBehaviorFragment); functionRepositoryService.removeChildBehavior(functionUri, childBehaviorUri); } @GetMapping(value = "/{functionFragment}/childTransitiveClosure", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE}) public Set getChildTransitiveClosure(@PathVariable(name = "functionFragment") String functionFragment){ log.info("> getChildTransitiveClosure - {}", functionFragment); - URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, functionFragment); + URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_function, functionFragment); return functionRepositoryService.getTransitiveClosure(functionUri,"child"); } @GetMapping(value = "/{functionFragment}/requiredTransitiveClosure", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE}) public Set getRequiredTransitiveClosure(@PathVariable(name = "functionFragment") String functionFragment){ log.info("> getRequiredTransitiveClosure - {}", functionFragment); - URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_Function, functionFragment); + URI functionUri = identifierService.composeIdentifier(Vocabulary.s_c_function, functionFragment); return functionRepositoryService.getTransitiveClosure(functionUri, "required"); } } diff --git a/src/main/java/cz/cvut/kbss/analysis/controller/SystemController.java b/src/main/java/cz/cvut/kbss/analysis/controller/SystemController.java index 5add8839..2fe2fba8 100755 --- a/src/main/java/cz/cvut/kbss/analysis/controller/SystemController.java +++ b/src/main/java/cz/cvut/kbss/analysis/controller/SystemController.java @@ -42,14 +42,14 @@ public List summaries() { @GetMapping(value = "/{systemFragment}", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE}) public System find(@PathVariable(name = "systemFragment") String systemFragment) { log.info("> find - {}", systemFragment); - URI systemUri = identifierService.composeIdentifier(Vocabulary.s_c_System, systemFragment); + URI systemUri = identifierService.composeIdentifier(Vocabulary.s_c_system, systemFragment); return repositoryService.findRequired(systemUri); } @GetMapping(value = "/{systemFragment}/failureModes", produces = {JsonLd.MEDIA_TYPE, MediaType.APPLICATION_JSON_VALUE}) public Set getFailureModes(@PathVariable(name = "systemFragment") String systemFragment) { log.info("> getAllFailureModes - {}", systemFragment); - URI systemUri = identifierService.composeIdentifier(Vocabulary.s_c_System, systemFragment); + URI systemUri = identifierService.composeIdentifier(Vocabulary.s_c_system, systemFragment); return repositoryService.getAllFailureModes(systemUri); } @@ -76,7 +76,7 @@ public System rename(@RequestBody System system) { public void delete(@PathVariable(name = "systemFragment") String systemFragment) { log.info("> delete - {}", systemFragment); - URI systemUri = identifierService.composeIdentifier(Vocabulary.s_c_System, systemFragment); + URI systemUri = identifierService.composeIdentifier(Vocabulary.s_c_system, systemFragment); repositoryService.remove(systemUri); } @@ -84,8 +84,8 @@ public void delete(@PathVariable(name = "systemFragment") String systemFragment) public void addComponent(@PathVariable(name = "systemFragment") String systemFragment, @PathVariable(name = "componentFragment") String componentFragment) { log.info("> addComponent - {}, {}", systemFragment, componentFragment); - URI systemUri = identifierService.composeIdentifier(Vocabulary.s_c_System, systemFragment); - URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, componentFragment); + URI systemUri = identifierService.composeIdentifier(Vocabulary.s_c_system, systemFragment); + URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_component, componentFragment); repositoryService.addComponent(systemUri, componentUri); } @@ -94,8 +94,8 @@ public void addComponent(@PathVariable(name = "systemFragment") String systemFra public void deleteComponent(@PathVariable(name = "systemFragment") String systemFragment, @PathVariable(name = "componentFragment") String componentFragment) { log.info("> deleteComponent - {}, {}", systemFragment, componentFragment); - URI systemUri = identifierService.composeIdentifier(Vocabulary.s_c_System, systemFragment); - URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_Component, componentFragment); + URI systemUri = identifierService.composeIdentifier(Vocabulary.s_c_system, systemFragment); + URI componentUri = identifierService.composeIdentifier(Vocabulary.s_c_component, componentFragment); repositoryService.removeComponent(systemUri, componentUri); } @@ -103,7 +103,7 @@ public void deleteComponent(@PathVariable(name = "systemFragment") String system @PostMapping(value = "/{systemFragment}/documents") public void importDocument(@PathVariable(name = "systemFragment") String systemFragment, @RequestParam URI documentId) throws UnsupportedEncodingException { - URI systemURI = identifierService.composeIdentifier(Vocabulary.s_c_System, systemFragment); + URI systemURI = identifierService.composeIdentifier(Vocabulary.s_c_system, systemFragment); log.info("> importing annotations from document <{}> into system <{}>", documentId, systemURI); annotatorService.convertDocument(documentId.toString()); repositoryService.importDocument(systemURI, documentId); diff --git a/src/main/java/cz/cvut/kbss/analysis/dao/BehaviorDao.java b/src/main/java/cz/cvut/kbss/analysis/dao/BehaviorDao.java index c70e60bf..cb20b04a 100644 --- a/src/main/java/cz/cvut/kbss/analysis/dao/BehaviorDao.java +++ b/src/main/java/cz/cvut/kbss/analysis/dao/BehaviorDao.java @@ -18,6 +18,7 @@ public abstract class BehaviorDao extends NamedEntityDao{ + public static URI P_IS_IMPAIRING = URI.create(Vocabulary.s_p_is_impairing); public BehaviorDao(Class type, EntityManager em, PersistenceConf config) { super(type, em, config); } @@ -31,7 +32,7 @@ public Set getTransitiveBehaviorParts(URI behaviorURI){ } public Set getTransitiveImpairingBehaviors(URI behaviorURI){ - return getTransitiveClosure(ResourceUtils.IMPAIRING_BEHAVIORS, URI.create(Vocabulary.s_p_impairs)); + return getTransitiveClosure(ResourceUtils.IMPAIRING_BEHAVIORS, P_IS_IMPAIRING); } /** @@ -59,7 +60,7 @@ public Set getIndirectBehaviorParts(URI behaviorURI){ * @return */ public Set getIndirectImpairingBehaviors(URI behaviorURI){ - return getTransitiveClosure(ResourceUtils.INDIRECT_IMPAIRING_BEHAVIORS, URI.create(Vocabulary.s_p_impairs)); + return getTransitiveClosure(ResourceUtils.INDIRECT_IMPAIRING_BEHAVIORS, P_IS_IMPAIRING); } public Set getTransitiveClosure(String queryName, URI behaviorURI) { diff --git a/src/main/java/cz/cvut/kbss/analysis/dao/FaultEventDao.java b/src/main/java/cz/cvut/kbss/analysis/dao/FaultEventDao.java index 06fe37a7..f19b9648 100755 --- a/src/main/java/cz/cvut/kbss/analysis/dao/FaultEventDao.java +++ b/src/main/java/cz/cvut/kbss/analysis/dao/FaultEventDao.java @@ -20,7 +20,7 @@ public boolean isChild(URI faultEventIri) { return em .createNativeQuery("ASK WHERE { ?x a ?type ; ?hasChildren ?eventUri . }", Boolean.class) .setParameter("type", typeUri) - .setParameter("hasChildren", URI.create(Vocabulary.s_p_hasChildren)) + .setParameter("hasChildren", URI.create(Vocabulary.s_p_has_child)) .setParameter("eventUri", faultEventIri) .getSingleResult(); } diff --git a/src/main/java/cz/cvut/kbss/analysis/dao/FaultTreeDao.java b/src/main/java/cz/cvut/kbss/analysis/dao/FaultTreeDao.java index 9fe9f2a3..ab0e1309 100755 --- a/src/main/java/cz/cvut/kbss/analysis/dao/FaultTreeDao.java +++ b/src/main/java/cz/cvut/kbss/analysis/dao/FaultTreeDao.java @@ -21,7 +21,7 @@ public boolean isRootEvent(URI faultEventIri) { return em .createNativeQuery("ASK WHERE { ?x a ?type ; ?isManifestedBy ?eventUri . }", Boolean.class) .setParameter("type", typeUri) - .setParameter("isManifestedBy", URI.create(Vocabulary.s_p_isManifestedBy)) + .setParameter("isManifestedBy", URI.create(Vocabulary.s_p_is_manifested_by)) .setParameter("eventUri", faultEventIri) .getSingleResult(); } diff --git a/src/main/java/cz/cvut/kbss/analysis/dao/FunctionDao.java b/src/main/java/cz/cvut/kbss/analysis/dao/FunctionDao.java index 1db4186e..97c5dbd3 100755 --- a/src/main/java/cz/cvut/kbss/analysis/dao/FunctionDao.java +++ b/src/main/java/cz/cvut/kbss/analysis/dao/FunctionDao.java @@ -15,6 +15,7 @@ @Repository public class FunctionDao extends BehaviorDao { + public static URI P_HAS_FUNCTION = URI.create(Vocabulary.s_p_has_function); @Autowired protected FunctionDao(EntityManager em, PersistenceConf config) { @@ -24,7 +25,7 @@ protected FunctionDao(EntityManager em, PersistenceConf config) { public Component getComponent(URI functionUri) { return em .createNativeQuery("SELECT ?component WHERE { ?component ?hasFunction ?function }", Component.class) - .setParameter("hasFunction", URI.create(Vocabulary.s_p_hasFunction)) + .setParameter("hasFunction", P_HAS_FUNCTION) .setParameter("function", functionUri) .getResultList().stream().findFirst().orElse(null); } @@ -33,7 +34,7 @@ public Component getComponent(URI functionUri) { public List getImpairingBehaviors(URI functionUri){ return em .createNativeQuery("SELECT ?failureMode WHERE { ?failureMode ?impairs ?function }", Behavior.class) - .setParameter("impairs", URI.create(Vocabulary.s_p_impairs)) + .setParameter("impairs", P_IS_IMPAIRING) .setParameter("function", functionUri) .getResultList(); } diff --git a/src/main/java/cz/cvut/kbss/analysis/dao/NamedEntityDao.java b/src/main/java/cz/cvut/kbss/analysis/dao/NamedEntityDao.java index 0dce0421..2adbc4e6 100644 --- a/src/main/java/cz/cvut/kbss/analysis/dao/NamedEntityDao.java +++ b/src/main/java/cz/cvut/kbss/analysis/dao/NamedEntityDao.java @@ -12,8 +12,8 @@ public class NamedEntityDao extends BaseDao { - public static URI P_HAS_NAME = URI.create(Vocabulary.s_p_hasName); - public static URI P_HAS_DESCRIPTION = URI.create(Vocabulary.s_p_hasDescription); + public static URI P_HAS_NAME = URI.create(Vocabulary.s_p_name); + public static URI P_HAS_DESCRIPTION = URI.create(Vocabulary.s_p_description); protected NamedEntityDao(Class type, EntityManager em, PersistenceConf config) { super(type, em, config); } diff --git a/src/main/java/cz/cvut/kbss/analysis/dao/UserDao.java b/src/main/java/cz/cvut/kbss/analysis/dao/UserDao.java index e127b8f6..57db184d 100755 --- a/src/main/java/cz/cvut/kbss/analysis/dao/UserDao.java +++ b/src/main/java/cz/cvut/kbss/analysis/dao/UserDao.java @@ -35,7 +35,7 @@ public Optional findByUsername(String username) { .createNativeQuery("SELECT ?x WHERE { ?x a ?type ; ?hasUsername ?username . }", type) .setParameter("type", typeUri) - .setParameter("hasUsername", URI.create(Vocabulary.s_p_hasUsername)) + .setParameter("hasUsername", URI.create(Vocabulary.s_p_username)) .setParameter("username", username, config.getLanguage()) .getSingleResult()); } catch (NoResultException e) { @@ -56,7 +56,7 @@ public boolean existsWithUsername(String username) { return em .createNativeQuery("ASK WHERE { ?x a ?type ; ?hasUsername ?username . }", Boolean.class) .setParameter("type", typeUri) - .setParameter("hasUsername", URI.create(Vocabulary.s_p_hasUsername)) + .setParameter("hasUsername", URI.create(Vocabulary.s_p_username)) .setParameter("username", username, config.getLanguage()) .getSingleResult(); } diff --git a/src/main/java/cz/cvut/kbss/analysis/model/AnalysisEvent.java b/src/main/java/cz/cvut/kbss/analysis/model/AnalysisEvent.java index 8451d896..ecf844ab 100644 --- a/src/main/java/cz/cvut/kbss/analysis/model/AnalysisEvent.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/AnalysisEvent.java @@ -14,18 +14,18 @@ @Setter public class AnalysisEvent extends AbstractEntity{ - @OWLObjectProperty(iri = Vocabulary.s_p_performed_by) + @OWLObjectProperty(iri = Vocabulary.s_p_is_performed_by) private User agent; - @OWLObjectProperty(iri = Vocabulary.s_p_based_on) + @OWLObjectProperty(iri = Vocabulary.s_p_is_based_on) private NamedEntity analysisMethod; - @OWLDataProperty(iri = Vocabulary.s_p_has_start) + @OWLDataProperty(iri = Vocabulary.s_p_start) private Date startTime; - @OWLDataProperty(iri = Vocabulary.s_p_has_end) + @OWLDataProperty(iri = Vocabulary.s_p_end) private Date endTime; - @OWLObjectProperty(iri = Vocabulary.s_p_creates) + @OWLObjectProperty(iri = Vocabulary.s_p_has_created) private T product; } diff --git a/src/main/java/cz/cvut/kbss/analysis/model/AnalysisProduct.java b/src/main/java/cz/cvut/kbss/analysis/model/AnalysisProduct.java index 04a2fafb..1412f952 100644 --- a/src/main/java/cz/cvut/kbss/analysis/model/AnalysisProduct.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/AnalysisProduct.java @@ -10,7 +10,7 @@ @Getter @Setter public class AnalysisProduct extends AbstractEntity{ - @OWLObjectProperty(iri = Vocabulary.s_p_creates) + @OWLObjectProperty(iri = Vocabulary.s_p_is_created_by) private AnalysisEvent creationEvent; } diff --git a/src/main/java/cz/cvut/kbss/analysis/model/Behavior.java b/src/main/java/cz/cvut/kbss/analysis/model/Behavior.java index d0c4c2e4..7d90d4df 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/Behavior.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/Behavior.java @@ -9,34 +9,34 @@ import java.util.HashSet; import java.util.Set; -@OWLClass(iri = Vocabulary.s_c_Behavior) +@OWLClass(iri = Vocabulary.s_c_behavior) @Getter @Setter public abstract class Behavior extends DomainEntity { - @OWLObjectProperty(iri = Vocabulary.s_p_isDerivedFrom, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_is_derived_from, fetch = FetchType.EAGER) protected Set supertypes; - @OWLDataProperty(iri = Vocabulary.s_p_hasBehaviorType) + @OWLDataProperty(iri = Vocabulary.s_p_behavior_type) private BehaviorType behaviorType = BehaviorType.AtomicBehavior; - @OWLObjectProperty(iri = Vocabulary.s_p_requires, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_has_required, fetch = FetchType.EAGER) private Set requiredBehaviors = new HashSet<>(); - @OWLObjectProperty(iri = Vocabulary.s_p_impairs, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_is_impairing, fetch = FetchType.EAGER) private Set impairedBehaviors = new HashSet<>(); - @OWLObjectProperty(iri = Vocabulary.s_p_hasChildBehavior, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_has_child_behavior, fetch = FetchType.EAGER) private Set childBehaviors = new HashSet<>(); - @OWLObjectProperty(iri = Vocabulary.s_p_manifested_by) + @OWLObjectProperty(iri = Vocabulary.s_p_is_manifested_by) private Set manifestations = new HashSet<>(); - @OWLObjectProperty(iri = Vocabulary.s_p_hasComponent, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_has_component, fetch = FetchType.EAGER) private Item item; - @OWLObjectProperty(iri = Vocabulary.s_p_activatedBy) + @OWLObjectProperty(iri = Vocabulary.s_p_is_activated_by) private Set activatedBySituations = new HashSet<>(); public boolean isFailureModeCause() { diff --git a/src/main/java/cz/cvut/kbss/analysis/model/Component.java b/src/main/java/cz/cvut/kbss/analysis/model/Component.java index c2d18059..321b454d 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/Component.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/Component.java @@ -12,12 +12,12 @@ import java.util.Objects; import java.util.Set; -@OWLClass(iri = Vocabulary.s_c_Component) +@OWLClass(iri = Vocabulary.s_c_component) @Getter @Setter public class Component extends Item { - @OWLObjectProperty(iri = Vocabulary.s_p_isPartOf, cascade = {CascadeType.MERGE, CascadeType.REFRESH})// TODO - how to load parent components, e.g. simulate fetch EAGER + @OWLObjectProperty(iri = Vocabulary.s_p_is_part_of, cascade = {CascadeType.MERGE, CascadeType.REFRESH})// TODO - how to load parent components, e.g. simulate fetch EAGER private Item parentComponent; @Override diff --git a/src/main/java/cz/cvut/kbss/analysis/model/Document.java b/src/main/java/cz/cvut/kbss/analysis/model/Document.java index fdb164d1..1995c5bd 100644 --- a/src/main/java/cz/cvut/kbss/analysis/model/Document.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/Document.java @@ -2,9 +2,8 @@ import cz.cvut.kbss.analysis.util.Vocabulary; import cz.cvut.kbss.jopa.model.annotations.OWLClass; -import cz.cvut.kbss.jopa.model.annotations.OWLDataProperty; -@OWLClass(iri = Vocabulary.s_c_Document) +@OWLClass(iri = Vocabulary.s_c_document) public class Document extends NamedEntity{ } diff --git a/src/main/java/cz/cvut/kbss/analysis/model/Event.java b/src/main/java/cz/cvut/kbss/analysis/model/Event.java index 1a4563a2..11157c9a 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/Event.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/Event.java @@ -11,24 +11,24 @@ import java.util.HashSet; import java.util.Set; -@OWLClass(iri = Vocabulary.s_c_Event) +@OWLClass(iri = Vocabulary.s_c_event) @Getter @Setter public class Event extends DomainEntity { - @OWLObjectProperty(iri = Vocabulary.s_p_isDerivedFrom, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_is_derived_from, fetch = FetchType.EAGER) protected Set supertypes; - @OWLObjectProperty(iri = Vocabulary.s_p_isPartOf, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_is_part_of, fetch = FetchType.EAGER) protected Set contextEvents; - @OWLObjectProperty(iri = Vocabulary.s_p_manifestationOf, cascade = CascadeType.ALL) + @OWLObjectProperty(iri = Vocabulary.s_p_is_manifestation_of, cascade = CascadeType.ALL) private Behavior behavior; - @OWLObjectProperty(iri = Vocabulary.s_p_bringsAbout) + @OWLObjectProperty(iri = Vocabulary.s_p_is_bringing_about) private Set bringsAboutSituations = new HashSet<>(); - @OWLObjectProperty(iri = Vocabulary.s_p_triggeredBy) + @OWLObjectProperty(iri = Vocabulary.s_p_is_triggered_by) private Set triggeredBySituations = new HashSet<>(); public void setBehavior(Behavior behavior){ diff --git a/src/main/java/cz/cvut/kbss/analysis/model/FailureMode.java b/src/main/java/cz/cvut/kbss/analysis/model/FailureMode.java index ebbf2656..034f7aba 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/FailureMode.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/FailureMode.java @@ -5,14 +5,12 @@ import lombok.Getter; import lombok.Setter; -import java.util.Objects; - -@OWLClass(iri = Vocabulary.s_c_FailureMode) +@OWLClass(iri = Vocabulary.s_c_failure_mode) @Getter @Setter public class FailureMode extends Behavior { - @OWLDataProperty(iri = Vocabulary.s_p_hasFailureModeType) + @OWLDataProperty(iri = Vocabulary.s_p_failure_mode_type) private FailureModeType failureModeType = FailureModeType.FailureMode; @Override diff --git a/src/main/java/cz/cvut/kbss/analysis/model/FailureModesRow.java b/src/main/java/cz/cvut/kbss/analysis/model/FailureModesRow.java index fb60cec3..34ec274f 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/FailureModesRow.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/FailureModesRow.java @@ -8,10 +8,9 @@ import jakarta.validation.constraints.NotNull; import java.net.URI; -import java.util.Objects; import java.util.Set; -@OWLClass(iri = Vocabulary.s_c_FailureModesRow) +@OWLClass(iri = Vocabulary.s_c_failure_modes_row) @Getter @Setter public class FailureModesRow extends AbstractEntity { @@ -29,21 +28,21 @@ public FailureModesRow(FailureModesRow failureModesRow) { @NotNull(message = "Final Effect must be chosen") @ParticipationConstraints(nonEmpty = true) - @OWLObjectProperty(iri = Vocabulary.s_p_hasFinalEffect, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_has_final_effect, fetch = FetchType.EAGER) private URI finalEffect; @NotNull(message = "Local Effect must be chosen") @ParticipationConstraints(nonEmpty = true) - @OWLObjectProperty(iri = Vocabulary.s_p_hasLocalEffect, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_has_local_effect, fetch = FetchType.EAGER) private URI localEffect; - @OWLObjectProperty(iri = Vocabulary.s_p_hasEffect, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_has_effect, fetch = FetchType.EAGER) private Set effects; - @OWLObjectProperty(iri = Vocabulary.s_p_hasRPN, cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_has_rpn, cascade = CascadeType.ALL, fetch = FetchType.EAGER) private RiskPriorityNumber riskPriorityNumber; - @OWLObjectProperty(iri = Vocabulary.s_p_hasMitigation, cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_has_mitigation, cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Mitigation mitigation; @Override diff --git a/src/main/java/cz/cvut/kbss/analysis/model/FailureModesTable.java b/src/main/java/cz/cvut/kbss/analysis/model/FailureModesTable.java index 2c5f3c06..f384c339 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/FailureModesTable.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/FailureModesTable.java @@ -11,16 +11,16 @@ import java.util.Objects; import java.util.Set; -@OWLClass(iri = Vocabulary.s_c_FailureModesTable) +@OWLClass(iri = Vocabulary.s_c_failure_modes_table) @Getter @Setter public class FailureModesTable extends NamedEntity { - @OWLObjectProperty(iri = Vocabulary.s_p_isDerivedFrom, fetch = FetchType.LAZY) + @OWLObjectProperty(iri = Vocabulary.s_p_is_derived_from, fetch = FetchType.LAZY) private FaultTree faultTree; - @OWLObjectProperty(iri = Vocabulary.s_p_hasRow, cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @OWLObjectProperty(iri = Vocabulary.s_p_has_row, cascade = CascadeType.ALL, fetch = FetchType.LAZY) private Set rows = new HashSet<>(); @Override diff --git a/src/main/java/cz/cvut/kbss/analysis/model/FailureRateEstimate.java b/src/main/java/cz/cvut/kbss/analysis/model/FailureRateEstimate.java index ca99d387..86c966e7 100644 --- a/src/main/java/cz/cvut/kbss/analysis/model/FailureRateEstimate.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/FailureRateEstimate.java @@ -14,13 +14,13 @@ @Setter public class FailureRateEstimate extends AnalysisProduct{ - @OWLDataProperty(iri = Vocabulary.s_p_has_value) + @OWLDataProperty(iri = Vocabulary.s_p_value) protected Double value; /** * The estimation method */ - @OWLObjectProperty(iri = Vocabulary.s_p_based_on, cascade = CascadeType.ALL) + @OWLObjectProperty(iri = Vocabulary.s_p_is_based_on, cascade = CascadeType.ALL) protected EstimationMethod estimationMethod; } diff --git a/src/main/java/cz/cvut/kbss/analysis/model/FaultEvent.java b/src/main/java/cz/cvut/kbss/analysis/model/FaultEvent.java index a0c03d70..6b9fce2f 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/FaultEvent.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/FaultEvent.java @@ -11,7 +11,7 @@ import java.net.URI; import java.util.*; -@OWLClass(iri = Vocabulary.s_c_FaultEvent) +@OWLClass(iri = Vocabulary.s_c_fault_event) @Getter @Setter public class FaultEvent extends Event { @@ -31,32 +31,32 @@ public static FaultEvent create(){ @NotNull(message = "EventType must be defined") @ParticipationConstraints(nonEmpty = true) - @OWLDataProperty(iri = Vocabulary.s_p_hasFaultEventType) + @OWLDataProperty(iri = Vocabulary.s_p_fault_event_type) private FtaEventType eventType; - @OWLDataProperty(iri = Vocabulary.s_p_hasGateType) + @OWLDataProperty(iri = Vocabulary.s_p_gate_type) private GateType gateType; @OWLObjectProperty(iri = Vocabulary.s_p_has_rectangle, fetch = FetchType.EAGER, cascade = CascadeType.ALL) private Rectangle rectangle; - @OWLDataProperty(iri = Vocabulary.s_p_hasProbability) + @OWLDataProperty(iri = Vocabulary.s_p_probability) private Double probability; @OWLObjectProperty(iri = Vocabulary.s_p_has_selected_estimation, fetch = FetchType.EAGER) private FailureRateEstimate selectedEstimate; - @OWLObjectProperty(iri = Vocabulary.s_p_hasChildren, cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_has_child, cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Set children = new HashSet<>(); - @OWLObjectProperty(iri = Vocabulary.s_p_hasFailureMode, cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}) + @OWLObjectProperty(iri = Vocabulary.s_p_has_failure_mode, cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH}) private FailureMode failureMode; - @OWLDataProperty(iri = Vocabulary.s_p_hasSequenceProbability) + @OWLDataProperty(iri = Vocabulary.s_p_sequence_probability) private Double sequenceProbability; @Sequence - @OWLObjectProperty(iri = Vocabulary.s_p_hasChildrenSequence, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_has_child_sequence, fetch = FetchType.EAGER) private List childrenSequence = new ArrayList<>(); public FailureMode getFailureMode(){ return getBehavior() instanceof FailureMode ? (FailureMode) getBehavior() : null; diff --git a/src/main/java/cz/cvut/kbss/analysis/model/FaultEventScenario.java b/src/main/java/cz/cvut/kbss/analysis/model/FaultEventScenario.java index 7bd000c5..950ee3b0 100644 --- a/src/main/java/cz/cvut/kbss/analysis/model/FaultEventScenario.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/FaultEventScenario.java @@ -18,7 +18,7 @@ public class FaultEventScenario extends AnalysisProduct { @OWLObjectProperty(iri = Vocabulary.s_p_has_part, fetch = FetchType.EAGER) private Set scenarioParts; - @OWLDataProperty(iri = Vocabulary.s_p_hasProbability) + @OWLDataProperty(iri = Vocabulary.s_p_probability) private Double probability; diff --git a/src/main/java/cz/cvut/kbss/analysis/model/FaultTree.java b/src/main/java/cz/cvut/kbss/analysis/model/FaultTree.java index 0033f240..c82b7bb9 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/FaultTree.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/FaultTree.java @@ -12,17 +12,17 @@ import java.util.Objects; import java.util.Set; -@OWLClass(iri = Vocabulary.s_c_FaultTree) +@OWLClass(iri = Vocabulary.s_c_fault_tree) @Getter @Setter public class FaultTree extends NamedEntity { @NotNull(message = "Manifesting event must be chosen") @ParticipationConstraints(nonEmpty = true) - @OWLObjectProperty(iri = Vocabulary.s_p_isManifestedBy, cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_is_manifested_by, cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, fetch = FetchType.EAGER) private FaultEvent manifestingEvent; - @OWLObjectProperty(iri = Vocabulary.s_p_hasFailureModesTable, cascade = CascadeType.ALL) + @OWLObjectProperty(iri = Vocabulary.s_p_has_failure_modes_table, cascade = CascadeType.ALL) private FailureModesTable failureModesTable; @OWLObjectProperty(iri = Vocabulary.s_p_has_scenario, fetch = FetchType.EAGER) diff --git a/src/main/java/cz/cvut/kbss/analysis/model/Function.java b/src/main/java/cz/cvut/kbss/analysis/model/Function.java index 9fba4008..1cbc0c8f 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/Function.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/Function.java @@ -7,7 +7,7 @@ import java.util.Objects; -@OWLClass(iri = Vocabulary.s_c_Function) +@OWLClass(iri = Vocabulary.s_c_function) @Getter @Setter public class Function extends Behavior { diff --git a/src/main/java/cz/cvut/kbss/analysis/model/FunctionEvent.java b/src/main/java/cz/cvut/kbss/analysis/model/FunctionEvent.java index acb78202..407f64d3 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/FunctionEvent.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/FunctionEvent.java @@ -9,12 +9,12 @@ import java.util.HashSet; import java.util.Set; -@OWLClass(iri = Vocabulary.s_c_FunctionEvent) +@OWLClass(iri = Vocabulary.s_c_function_event) @Getter @Setter public class FunctionEvent extends Event{ - @OWLObjectProperty(iri = Vocabulary.s_p_manifestationOf) + @OWLObjectProperty(iri = Vocabulary.s_p_is_manifestation_of) private Set functions = new HashSet<>(); public void addFunction(Function function){ diff --git a/src/main/java/cz/cvut/kbss/analysis/model/Item.java b/src/main/java/cz/cvut/kbss/analysis/model/Item.java index f16735ad..260fa4b9 100644 --- a/src/main/java/cz/cvut/kbss/analysis/model/Item.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/Item.java @@ -13,13 +13,13 @@ @Setter public class Item extends DomainEntity { - @OWLObjectProperty(iri = Vocabulary.s_p_isDerivedFrom, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_is_derived_from, fetch = FetchType.EAGER) protected Set supertypes; - @OWLObjectProperty(iri = Vocabulary.s_p_documented_in) + @OWLObjectProperty(iri = Vocabulary.s_p_is_documented_in) private Set documents; - @OWLObjectProperty(iri = Vocabulary.s_p_hasPartComponent, cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_has_part_component, cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Set components = new HashSet<>(); public void addComponent(Component component) { @@ -27,9 +27,9 @@ public void addComponent(Component component) { component.setParentComponent(this); } - @OWLObjectProperty(iri = Vocabulary.s_p_hasFunction, cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_has_function, cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Set functions = new HashSet<>(); - @OWLObjectProperty(iri = Vocabulary.s_p_hasFailureMode, cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @OWLObjectProperty(iri = Vocabulary.s_p_has_failure_mode, cascade = CascadeType.ALL, fetch = FetchType.EAGER) private Set failureModes = new HashSet<>(); diff --git a/src/main/java/cz/cvut/kbss/analysis/model/Mitigation.java b/src/main/java/cz/cvut/kbss/analysis/model/Mitigation.java index c616cc95..cbf04f62 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/Mitigation.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/Mitigation.java @@ -12,7 +12,7 @@ import jakarta.validation.constraints.NotEmpty; import java.util.Objects; -@OWLClass(iri = Vocabulary.s_c_Mitigation) +@OWLClass(iri = Vocabulary.s_c_mitigation) @Getter @Setter public class Mitigation extends Behavior { diff --git a/src/main/java/cz/cvut/kbss/analysis/model/NamedEntity.java b/src/main/java/cz/cvut/kbss/analysis/model/NamedEntity.java index 980e0ea8..bec24f2a 100644 --- a/src/main/java/cz/cvut/kbss/analysis/model/NamedEntity.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/NamedEntity.java @@ -13,11 +13,11 @@ public class NamedEntity extends AbstractEntity{ @NotEmpty(message = "Name must not be empty") @ParticipationConstraints(nonEmpty = true) - @OWLDataProperty(iri = Vocabulary.s_p_hasName) + @OWLDataProperty(iri = Vocabulary.s_p_name) private String name; - @OWLDataProperty(iri = Vocabulary.s_p_hasDescription) + @OWLDataProperty(iri = Vocabulary.s_p_description) private String description; } diff --git a/src/main/java/cz/cvut/kbss/analysis/model/RiskPriorityNumber.java b/src/main/java/cz/cvut/kbss/analysis/model/RiskPriorityNumber.java index d09537af..cf5dcac4 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/RiskPriorityNumber.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/RiskPriorityNumber.java @@ -14,24 +14,24 @@ import java.math.RoundingMode; import java.util.Objects; -@OWLClass(iri = Vocabulary.s_c_RiskPriorityNumber) +@OWLClass(iri = Vocabulary.s_c_risk_priority_number) @Getter @Setter public class RiskPriorityNumber extends AbstractEntity { @Min(value = 1, message = "Severity must not be lower than 1") @Max(value = 10, message = "Severity must not be greater than 10") - @OWLDataProperty(iri = Vocabulary.s_p_hasSeverity) + @OWLDataProperty(iri = Vocabulary.s_p_severity) private Integer severity; @Min(value = 1, message = "Occurrence must not be lower than 1") @Max(value = 10, message = "Occurrence must not be greater than 10") - @OWLDataProperty(iri = Vocabulary.s_p_hasOccurrence) + @OWLDataProperty(iri = Vocabulary.s_p_occurrence) private Integer occurrence; @Min(value = 1, message = "Detection must not be lower than 1") @Max(value = 10, message = "Detection must not be greater than 10") - @OWLDataProperty(iri = Vocabulary.s_p_hasDetection) + @OWLDataProperty(iri = Vocabulary.s_p_detection) private Integer detection; @Override diff --git a/src/main/java/cz/cvut/kbss/analysis/model/Situation.java b/src/main/java/cz/cvut/kbss/analysis/model/Situation.java index 3e082c88..b559e4dc 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/Situation.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/Situation.java @@ -9,17 +9,17 @@ import java.util.HashSet; import java.util.Set; -@OWLClass(iri = Vocabulary.s_c_Situation) +@OWLClass(iri = Vocabulary.s_c_situation) @Getter @Setter public class Situation extends AbstractEntity { - @OWLObjectProperty(iri = Vocabulary.s_p_broughtAboutBy) + @OWLObjectProperty(iri = Vocabulary.s_p_is_brought_about_by) private Set broughtAboutByEvents = new HashSet<>(); - @OWLObjectProperty(iri = Vocabulary.s_p_triggers) + @OWLObjectProperty(iri = Vocabulary.s_p_has_trigger) private Set triggersEvents = new HashSet<>(); - @OWLObjectProperty(iri = Vocabulary.s_p_activates) + @OWLObjectProperty(iri = Vocabulary.s_p_is_activating) private Set behaviors = new HashSet<>(); } diff --git a/src/main/java/cz/cvut/kbss/analysis/model/System.java b/src/main/java/cz/cvut/kbss/analysis/model/System.java index 51ec3faf..a34b8948 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/System.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/System.java @@ -11,7 +11,7 @@ import java.util.Objects; import java.util.Set; -@OWLClass(iri = Vocabulary.s_c_System) +@OWLClass(iri = Vocabulary.s_c_system) @Getter @Setter public class System extends Item { diff --git a/src/main/java/cz/cvut/kbss/analysis/model/User.java b/src/main/java/cz/cvut/kbss/analysis/model/User.java index 8278335c..381b0b60 100755 --- a/src/main/java/cz/cvut/kbss/analysis/model/User.java +++ b/src/main/java/cz/cvut/kbss/analysis/model/User.java @@ -16,20 +16,20 @@ import static java.util.stream.Collectors.toList; -@OWLClass(iri = Vocabulary.s_c_User) +@OWLClass(iri = Vocabulary.s_c_user) @Getter @Setter public class User extends AbstractEntity implements UserDetails { @NotEmpty(message = "Username must not be empty") @ParticipationConstraints(nonEmpty = true) - @OWLDataProperty(iri = Vocabulary.s_p_hasUsername) + @OWLDataProperty(iri = Vocabulary.s_p_username) private String username; @NotEmpty(message = "Password must not be empty") @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) @ParticipationConstraints(nonEmpty = true) - @OWLDataProperty(iri = Vocabulary.s_p_hasPassword) + @OWLDataProperty(iri = Vocabulary.s_p_password) private String password; @Transient diff --git a/src/main/java/cz/cvut/kbss/analysis/service/FaultTreeRepositoryService.java b/src/main/java/cz/cvut/kbss/analysis/service/FaultTreeRepositoryService.java index 7b18d147..c33d260b 100755 --- a/src/main/java/cz/cvut/kbss/analysis/service/FaultTreeRepositoryService.java +++ b/src/main/java/cz/cvut/kbss/analysis/service/FaultTreeRepositoryService.java @@ -259,11 +259,11 @@ private FaultEvent transferBehaviorToFaultEvent(Behavior behavior, FaultEvent pa private URI createUri(Behavior behavior, FaultEvent parentEvent, String type) throws URISyntaxException { String behaviorUri = behavior.getUri().toString(); if(parentEvent == null){ - return new URI(identifierService.composeIdentifier(Vocabulary.s_c_FaultEvent + return new URI(identifierService.composeIdentifier(Vocabulary.s_c_fault_event , behaviorUri.substring(behaviorUri.lastIndexOf("/") + 1)) + type); }else{ String parentBehaviorUri = parentEvent.getUri().toString(); - return new URI(identifierService.composeIdentifier(Vocabulary.s_c_FaultEvent + return new URI(identifierService.composeIdentifier(Vocabulary.s_c_fault_event , behaviorUri.substring(behaviorUri.lastIndexOf("/") + 1)) + parentBehaviorUri.split("instance")[1] + type); } } diff --git a/src/main/java/cz/cvut/kbss/analysis/service/validation/ComponentValidator.java b/src/main/java/cz/cvut/kbss/analysis/service/validation/ComponentValidator.java index c5da77c5..ff3ae24e 100755 --- a/src/main/java/cz/cvut/kbss/analysis/service/validation/ComponentValidator.java +++ b/src/main/java/cz/cvut/kbss/analysis/service/validation/ComponentValidator.java @@ -31,7 +31,7 @@ public void validate(Object target, Errors errors) { Component instance = (Component) target; - boolean duplicate = componentDao.existsWithPredicate(Vocabulary.s_p_hasName, instance.getName()); + boolean duplicate = componentDao.existsWithPredicate(Vocabulary.s_p_name, instance.getName()); if(instance.getUri() == null && duplicate) { errors.rejectValue("name", "name.duplicate", "Duplicate component name"); } diff --git a/src/main/java/cz/cvut/kbss/analysis/service/validation/FaultEventValidator.java b/src/main/java/cz/cvut/kbss/analysis/service/validation/FaultEventValidator.java index aa2b63ef..170cfe88 100755 --- a/src/main/java/cz/cvut/kbss/analysis/service/validation/FaultEventValidator.java +++ b/src/main/java/cz/cvut/kbss/analysis/service/validation/FaultEventValidator.java @@ -34,7 +34,7 @@ public void validate(Object target, Errors errors) { FaultEvent instance = (FaultEvent) target; - boolean duplicate = faultEventDao.existsWithPredicate(Vocabulary.s_p_hasName, instance.getName()); + boolean duplicate = faultEventDao.existsWithPredicate(Vocabulary.s_p_name, instance.getName()); if(instance.getUri() == null && duplicate) { errors.rejectValue("name", "name.duplicate"); } diff --git a/src/main/java/cz/cvut/kbss/analysis/service/validation/FaultTreeValidator.java b/src/main/java/cz/cvut/kbss/analysis/service/validation/FaultTreeValidator.java index 959fb43a..cb84b51d 100755 --- a/src/main/java/cz/cvut/kbss/analysis/service/validation/FaultTreeValidator.java +++ b/src/main/java/cz/cvut/kbss/analysis/service/validation/FaultTreeValidator.java @@ -34,7 +34,7 @@ public void validate(Object target, Errors errors) { FaultEvent instance = (FaultEvent) target; - boolean duplicate = faultEventDao.existsWithPredicate(Vocabulary.s_p_hasName, instance.getName()); + boolean duplicate = faultEventDao.existsWithPredicate(Vocabulary.s_p_name, instance.getName()); if(instance.getUri() == null && duplicate) { errors.rejectValue("name", "name.duplicate"); } diff --git a/src/main/java/cz/cvut/kbss/analysis/service/validation/FunctionValidator.java b/src/main/java/cz/cvut/kbss/analysis/service/validation/FunctionValidator.java index 56af1ea0..6614c0bf 100755 --- a/src/main/java/cz/cvut/kbss/analysis/service/validation/FunctionValidator.java +++ b/src/main/java/cz/cvut/kbss/analysis/service/validation/FunctionValidator.java @@ -31,7 +31,7 @@ public void validate(Object target, Errors errors) { Function instance = (Function) target; - boolean duplicate = functionDao.existsWithPredicate(Vocabulary.s_p_hasName, instance.getName()); + boolean duplicate = functionDao.existsWithPredicate(Vocabulary.s_p_name, instance.getName()); if(instance.getUri() == null && duplicate) { errors.rejectValue("name", "name.duplicate", "Duplicate component name"); } diff --git a/src/test/java/cz/cvut/kbss/analysis/service/validation/ComponentValidatorTest.java b/src/test/java/cz/cvut/kbss/analysis/service/validation/ComponentValidatorTest.java index 4b1d1de9..dc48e693 100755 --- a/src/test/java/cz/cvut/kbss/analysis/service/validation/ComponentValidatorTest.java +++ b/src/test/java/cz/cvut/kbss/analysis/service/validation/ComponentValidatorTest.java @@ -36,7 +36,7 @@ void validateDuplicates_duplicateExists_shouldThrowException() { Component component = new Component(); component.setName("Duplicate Name"); - Mockito.when(componentDao.existsWithPredicate(Vocabulary.s_p_hasName, component.getName())).thenReturn(true); + Mockito.when(componentDao.existsWithPredicate(Vocabulary.s_p_name, component.getName())).thenReturn(true); BindingResult bindingResult = ValidationTestUtils.createBinding(component, componentValidator); @@ -51,7 +51,7 @@ void validateDuplicates_noDuplicate_shouldJustRun() { Component component = new Component(); component.setName("Valid Name"); - Mockito.when(componentDao.existsWithPredicate(Vocabulary.s_p_hasName, component.getName())).thenReturn(false); + Mockito.when(componentDao.existsWithPredicate(Vocabulary.s_p_name, component.getName())).thenReturn(false); BindingResult bindingResult = ValidationTestUtils.createBinding(component, componentValidator); componentValidator.validate(component, bindingResult); diff --git a/src/test/java/cz/cvut/kbss/analysis/service/validation/FaultEventValidatorTest.java b/src/test/java/cz/cvut/kbss/analysis/service/validation/FaultEventValidatorTest.java index 35b54ef7..ef876b35 100755 --- a/src/test/java/cz/cvut/kbss/analysis/service/validation/FaultEventValidatorTest.java +++ b/src/test/java/cz/cvut/kbss/analysis/service/validation/FaultEventValidatorTest.java @@ -36,7 +36,7 @@ void validateDuplicates_duplicateExists_shouldReturnError() { FaultEvent event = new FaultEvent(); event.setName("Duplicate Name"); - Mockito.when(faultEventDao.existsWithPredicate(Vocabulary.s_p_hasName, event.getName())).thenReturn(true); + Mockito.when(faultEventDao.existsWithPredicate(Vocabulary.s_p_name, event.getName())).thenReturn(true); BindingResult bindingResult = ValidationTestUtils.createBinding(event, faultEventValidator); faultEventValidator.validate(event, bindingResult); @@ -51,7 +51,7 @@ void validateDuplicates_noDuplicate_shouldJustRun() { event.setEventType(FtaEventType.BASIC); event.setName("Valid Name"); - Mockito.when(faultEventDao.existsWithPredicate(Vocabulary.s_p_hasName, event.getName())).thenReturn(false); + Mockito.when(faultEventDao.existsWithPredicate(Vocabulary.s_p_name, event.getName())).thenReturn(false); BindingResult bindingResult = ValidationTestUtils.createBinding(event, faultEventValidator); faultEventValidator.validate(event, bindingResult);