From 4e7dddb7659bd0fffa73036c93c93de4d9c4964a Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Thu, 7 Dec 2023 17:10:02 +0100 Subject: [PATCH 01/10] [#29] Extend record manager ontology with generic record states. --- src/main/resources/model.ttl | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/main/resources/model.ttl b/src/main/resources/model.ttl index 39067f2b..4ac5e451 100644 --- a/src/main/resources/model.ttl +++ b/src/main/resources/model.ttl @@ -74,6 +74,10 @@ rm:relates-to rdf:type owl:ObjectProperty . rm:was-treated-at rdf:type owl:ObjectProperty ; rdfs:subPropertyOf rm:relates-to . +### http://onto.fel.cvut.cz/ontologies/record-manager/has-state +rm:has-state rdf:type owl:ObjectProperty ; + rdfs:label "has-state"@en . + ################################################################# # Data properties @@ -163,5 +167,28 @@ rm:user rdf:type owl:Class ; rm:impersonator rdf:type owl:Class ; rdfs:label "Impersonator"@en . +### http://onto.fel.cvut.cz/ontologies/record-manager/record-state +rm:record-state rdf:type owl:Class ; + rdfs:label "record state"@en . + +### http://onto.fel.cvut.cz/ontologies/record-manager/open-record-state +rm:open-record-state rdf:type owl:Class ; + rdfs:subClassOf rm:record-state ; + rdfs:label "open record state"@en . + +### http://onto.fel.cvut.cz/ontologies/record-manager/valid-record-state +rm:valid-record-state rdf:type owl:Class ; + rdfs:subClassOf rm:record-state ; + rdfs:label "valid record state"@en . + +### http://onto.fel.cvut.cz/ontologies/record-manager/completed-record-state +rm:completed-record-state rdf:type owl:Class ; + rdfs:subClassOf rm:record-state ; + rdfs:label "completed record state"@en . + +### http://onto.fel.cvut.cz/ontologies/record-manager/published-record-state +rm:published-record-state rdf:type owl:Class ; + rdfs:subClassOf rm:record-state ; + rdfs:label "published record state"@en . ### Generated by the OWL API (version 4.2.8.20170104-2310) https://github.com/owlcs/owlapi From ff09c7709a97b18cf0cdd3cbad36e80679e829ab Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Thu, 7 Dec 2023 17:11:17 +0100 Subject: [PATCH 02/10] [#29] Add state object property to PatientRecord --- .../java/cz/cvut/kbss/study/model/PatientRecord.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java b/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java index f64db877..12e21807 100644 --- a/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java +++ b/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java @@ -52,6 +52,9 @@ public class PatientRecord implements Serializable, HasOwlKey { CascadeType.REMOVE}, fetch = FetchType.EAGER) private Question question; + @OWLObjectProperty(iri = Vocabulary.s_p_has_state) + private URI state; + public URI getUri() { return uri; } @@ -134,6 +137,14 @@ public void setFormTemplate(String formTemplate) { this.formTemplate = formTemplate; } + public URI getState() { + return state; + } + + public void setState(URI state) { + this.state = state; + } + @Override public String toString() { return "PatientRecord{" + From e6cdb6f9b5670cb3e709a9dd3940ac0868060ed9 Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Fri, 8 Dec 2023 09:03:50 +0100 Subject: [PATCH 03/10] [#29] Fix label of rm:has-state --- src/main/resources/model.ttl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/model.ttl b/src/main/resources/model.ttl index 4ac5e451..d62553dd 100644 --- a/src/main/resources/model.ttl +++ b/src/main/resources/model.ttl @@ -76,7 +76,7 @@ rm:was-treated-at rdf:type owl:ObjectProperty ; ### http://onto.fel.cvut.cz/ontologies/record-manager/has-state rm:has-state rdf:type owl:ObjectProperty ; - rdfs:label "has-state"@en . + rdfs:label "has state"@en . ################################################################# From 54e17e9411f69b8a3042190fed218e61db3de172 Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Fri, 8 Dec 2023 17:49:09 +0100 Subject: [PATCH 04/10] [#29] Update resources rm:has-record-state and rm:record-state in ontology model.ttl --- src/main/resources/model.ttl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/resources/model.ttl b/src/main/resources/model.ttl index d62553dd..30f3bc43 100644 --- a/src/main/resources/model.ttl +++ b/src/main/resources/model.ttl @@ -7,6 +7,7 @@ @prefix xsd: . @prefix form: . @prefix rdfs: . +@prefix ufo: . @base . rdf:type owl:Ontology ; @@ -76,6 +77,7 @@ rm:was-treated-at rdf:type owl:ObjectProperty ; ### http://onto.fel.cvut.cz/ontologies/record-manager/has-state rm:has-state rdf:type owl:ObjectProperty ; + rdfs:subPropertyOf rdf:type ; rdfs:label "has state"@en . @@ -169,6 +171,7 @@ rm:impersonator rdf:type owl:Class ; ### http://onto.fel.cvut.cz/ontologies/record-manager/record-state rm:record-state rdf:type owl:Class ; + rdfs:subClassOf ufo:phase ; rdfs:label "record state"@en . ### http://onto.fel.cvut.cz/ontologies/record-manager/open-record-state From 874e26c77c89f236f1ae81157a429584cc6f2ae4 Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Fri, 8 Dec 2023 17:52:35 +0100 Subject: [PATCH 05/10] [#29] Refactor type of PatientRecord.state from URI to RecordState - add enum RecordState --- .../cvut/kbss/study/model/PatientRecord.java | 16 ++++--------- .../cz/cvut/kbss/study/model/RecordState.java | 24 +++++++++++++++++++ 2 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 src/main/java/cz/cvut/kbss/study/model/RecordState.java diff --git a/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java b/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java index 12e21807..aba1fb79 100644 --- a/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java +++ b/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java @@ -1,13 +1,6 @@ package cz.cvut.kbss.study.model; -import cz.cvut.kbss.jopa.model.annotations.CascadeType; -import cz.cvut.kbss.jopa.model.annotations.FetchType; -import cz.cvut.kbss.jopa.model.annotations.Id; -import cz.cvut.kbss.jopa.model.annotations.OWLAnnotationProperty; -import cz.cvut.kbss.jopa.model.annotations.OWLClass; -import cz.cvut.kbss.jopa.model.annotations.OWLDataProperty; -import cz.cvut.kbss.jopa.model.annotations.OWLObjectProperty; -import cz.cvut.kbss.jopa.model.annotations.ParticipationConstraints; +import cz.cvut.kbss.jopa.model.annotations.*; import cz.cvut.kbss.study.model.qam.Question; import cz.cvut.kbss.study.model.util.HasOwlKey; @@ -52,8 +45,9 @@ public class PatientRecord implements Serializable, HasOwlKey { CascadeType.REMOVE}, fetch = FetchType.EAGER) private Question question; + @Enumerated(EnumType.OBJECT_ONE_OF) @OWLObjectProperty(iri = Vocabulary.s_p_has_state) - private URI state; + private RecordState state; public URI getUri() { return uri; @@ -137,11 +131,11 @@ public void setFormTemplate(String formTemplate) { this.formTemplate = formTemplate; } - public URI getState() { + public RecordState getState() { return state; } - public void setState(URI state) { + public void setState(RecordState state) { this.state = state; } diff --git a/src/main/java/cz/cvut/kbss/study/model/RecordState.java b/src/main/java/cz/cvut/kbss/study/model/RecordState.java new file mode 100644 index 00000000..b82b0b54 --- /dev/null +++ b/src/main/java/cz/cvut/kbss/study/model/RecordState.java @@ -0,0 +1,24 @@ +package cz.cvut.kbss.study.model; + +import cz.cvut.kbss.jopa.model.annotations.Individual; + +public enum RecordState { + @Individual(iri = Vocabulary.s_c_open_record_state) + open(Vocabulary.s_c_open_record_state), + @Individual(iri = Vocabulary.s_c_valid_record_state) + valid(Vocabulary.s_c_valid_record_state), + @Individual(iri = Vocabulary.s_c_completed_record_state) + completed(Vocabulary.s_c_completed_record_state), + @Individual(iri = Vocabulary.s_c_published_record_state) + published(Vocabulary.s_c_published_record_state); + + private final String iri; + + RecordState(String iri) { + this.iri = iri; + } + + public String getIri() { + return iri; + } +} From 002c3285761fcd548b66d14c326aa1f53704e302 Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Mon, 11 Dec 2023 15:03:34 +0100 Subject: [PATCH 06/10] [#29] Refactor field PatientRecord.state to PatientRecord.phase. - refactor type of PatientRecord.phase from RecordState to RecordPhase. --- .../java/cz/cvut/kbss/study/model/PatientRecord.java | 10 +++++----- .../study/model/{RecordState.java => RecordPhase.java} | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) rename src/main/java/cz/cvut/kbss/study/model/{RecordState.java => RecordPhase.java} (92%) diff --git a/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java b/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java index aba1fb79..287386a5 100644 --- a/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java +++ b/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java @@ -47,7 +47,7 @@ public class PatientRecord implements Serializable, HasOwlKey { @Enumerated(EnumType.OBJECT_ONE_OF) @OWLObjectProperty(iri = Vocabulary.s_p_has_state) - private RecordState state; + private RecordPhase phase; public URI getUri() { return uri; @@ -131,12 +131,12 @@ public void setFormTemplate(String formTemplate) { this.formTemplate = formTemplate; } - public RecordState getState() { - return state; + public RecordPhase getPhase() { + return phase; } - public void setState(RecordState state) { - this.state = state; + public void setPhase(RecordPhase phase) { + this.phase = phase; } @Override diff --git a/src/main/java/cz/cvut/kbss/study/model/RecordState.java b/src/main/java/cz/cvut/kbss/study/model/RecordPhase.java similarity index 92% rename from src/main/java/cz/cvut/kbss/study/model/RecordState.java rename to src/main/java/cz/cvut/kbss/study/model/RecordPhase.java index b82b0b54..dbb38e0a 100644 --- a/src/main/java/cz/cvut/kbss/study/model/RecordState.java +++ b/src/main/java/cz/cvut/kbss/study/model/RecordPhase.java @@ -2,7 +2,7 @@ import cz.cvut.kbss.jopa.model.annotations.Individual; -public enum RecordState { +public enum RecordPhase { @Individual(iri = Vocabulary.s_c_open_record_state) open(Vocabulary.s_c_open_record_state), @Individual(iri = Vocabulary.s_c_valid_record_state) @@ -14,7 +14,7 @@ public enum RecordState { private final String iri; - RecordState(String iri) { + RecordPhase(String iri) { this.iri = iri; } From 1da56ae00f9c24173342119d2e8359ea441a5683 Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Mon, 11 Dec 2023 17:19:01 +0100 Subject: [PATCH 07/10] [#29] Add phase to PatientRecord.toString --- src/main/java/cz/cvut/kbss/study/model/PatientRecord.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java b/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java index 287386a5..249c7dda 100644 --- a/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java +++ b/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java @@ -145,6 +145,7 @@ public String toString() { "localName=" + localName + ", dateCreated=" + dateCreated + ", institution=" + institution + + ", phase=" + phase + "} " + super.toString(); } } From 164974dc726d8e9d3ce3ac1db8534be5c30cbafb Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Tue, 12 Dec 2023 11:56:25 +0100 Subject: [PATCH 08/10] [#29] Refactor state to phase in ontology and jopa model --- .../cvut/kbss/study/model/PatientRecord.java | 2 +- src/main/resources/model.ttl | 34 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java b/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java index 249c7dda..7afedf16 100644 --- a/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java +++ b/src/main/java/cz/cvut/kbss/study/model/PatientRecord.java @@ -46,7 +46,7 @@ public class PatientRecord implements Serializable, HasOwlKey { private Question question; @Enumerated(EnumType.OBJECT_ONE_OF) - @OWLObjectProperty(iri = Vocabulary.s_p_has_state) + @OWLObjectProperty(iri = Vocabulary.s_p_has_phase) private RecordPhase phase; public URI getUri() { diff --git a/src/main/resources/model.ttl b/src/main/resources/model.ttl index 30f3bc43..168363f9 100644 --- a/src/main/resources/model.ttl +++ b/src/main/resources/model.ttl @@ -75,10 +75,10 @@ rm:relates-to rdf:type owl:ObjectProperty . rm:was-treated-at rdf:type owl:ObjectProperty ; rdfs:subPropertyOf rm:relates-to . -### http://onto.fel.cvut.cz/ontologies/record-manager/has-state -rm:has-state rdf:type owl:ObjectProperty ; +### http://onto.fel.cvut.cz/ontologies/record-manager/has-phase +rm:has-phase rdf:type owl:ObjectProperty ; rdfs:subPropertyOf rdf:type ; - rdfs:label "has state"@en . + rdfs:label "has phase"@en . ################################################################# @@ -169,29 +169,29 @@ rm:user rdf:type owl:Class ; rm:impersonator rdf:type owl:Class ; rdfs:label "Impersonator"@en . -### http://onto.fel.cvut.cz/ontologies/record-manager/record-state -rm:record-state rdf:type owl:Class ; +### http://onto.fel.cvut.cz/ontologies/record-manager/record-phase +rm:record-phase rdf:type owl:Class ; rdfs:subClassOf ufo:phase ; rdfs:label "record state"@en . -### http://onto.fel.cvut.cz/ontologies/record-manager/open-record-state -rm:open-record-state rdf:type owl:Class ; - rdfs:subClassOf rm:record-state ; +### http://onto.fel.cvut.cz/ontologies/record-manager/open-record-phase +rm:open-record-phase rdf:type owl:Class ; + rdfs:subClassOf rm:record-phase ; rdfs:label "open record state"@en . -### http://onto.fel.cvut.cz/ontologies/record-manager/valid-record-state -rm:valid-record-state rdf:type owl:Class ; - rdfs:subClassOf rm:record-state ; +### http://onto.fel.cvut.cz/ontologies/record-manager/valid-record-phase +rm:valid-record-phase rdf:type owl:Class ; + rdfs:subClassOf rm:record-phase ; rdfs:label "valid record state"@en . -### http://onto.fel.cvut.cz/ontologies/record-manager/completed-record-state -rm:completed-record-state rdf:type owl:Class ; - rdfs:subClassOf rm:record-state ; +### http://onto.fel.cvut.cz/ontologies/record-manager/completed-record-phase +rm:completed-record-phase rdf:type owl:Class ; + rdfs:subClassOf rm:record-phase ; rdfs:label "completed record state"@en . -### http://onto.fel.cvut.cz/ontologies/record-manager/published-record-state -rm:published-record-state rdf:type owl:Class ; - rdfs:subClassOf rm:record-state ; +### http://onto.fel.cvut.cz/ontologies/record-manager/published-record-phase +rm:published-record-phase rdf:type owl:Class ; + rdfs:subClassOf rm:record-phase ; rdfs:label "published record state"@en . ### Generated by the OWL API (version 4.2.8.20170104-2310) https://github.com/owlcs/owlapi From 4ae185fde400cf8f32c5ae72497728fb4369f1df Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Tue, 12 Dec 2023 12:16:22 +0100 Subject: [PATCH 09/10] [#29] Fix compilation error --- .../cz/cvut/kbss/study/model/RecordPhase.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/cz/cvut/kbss/study/model/RecordPhase.java b/src/main/java/cz/cvut/kbss/study/model/RecordPhase.java index dbb38e0a..042ad262 100644 --- a/src/main/java/cz/cvut/kbss/study/model/RecordPhase.java +++ b/src/main/java/cz/cvut/kbss/study/model/RecordPhase.java @@ -3,14 +3,14 @@ import cz.cvut.kbss.jopa.model.annotations.Individual; public enum RecordPhase { - @Individual(iri = Vocabulary.s_c_open_record_state) - open(Vocabulary.s_c_open_record_state), - @Individual(iri = Vocabulary.s_c_valid_record_state) - valid(Vocabulary.s_c_valid_record_state), - @Individual(iri = Vocabulary.s_c_completed_record_state) - completed(Vocabulary.s_c_completed_record_state), - @Individual(iri = Vocabulary.s_c_published_record_state) - published(Vocabulary.s_c_published_record_state); + @Individual(iri = Vocabulary.s_c_open_record_phase) + open(Vocabulary.s_c_open_record_phase), + @Individual(iri = Vocabulary.s_c_valid_record_phase) + valid(Vocabulary.s_c_valid_record_phase), + @Individual(iri = Vocabulary.s_c_completed_record_phase) + completed(Vocabulary.s_c_completed_record_phase), + @Individual(iri = Vocabulary.s_c_published_record_phase) + published(Vocabulary.s_c_published_record_phase); private final String iri; From 64e82b6266f90730d0358693c5a58c9bfd0e8173 Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Tue, 12 Dec 2023 19:38:57 +0100 Subject: [PATCH 10/10] [#29] Add phase field to PatientRecordDto --- .../cvut/kbss/study/dto/PatientRecordDto.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/cz/cvut/kbss/study/dto/PatientRecordDto.java b/src/main/java/cz/cvut/kbss/study/dto/PatientRecordDto.java index 2c8a69c1..1489461b 100644 --- a/src/main/java/cz/cvut/kbss/study/dto/PatientRecordDto.java +++ b/src/main/java/cz/cvut/kbss/study/dto/PatientRecordDto.java @@ -1,10 +1,7 @@ package cz.cvut.kbss.study.dto; import cz.cvut.kbss.jopa.model.annotations.*; -import cz.cvut.kbss.study.model.AbstractEntity; -import cz.cvut.kbss.study.model.Institution; -import cz.cvut.kbss.study.model.User; -import cz.cvut.kbss.study.model.Vocabulary; +import cz.cvut.kbss.study.model.*; import cz.cvut.kbss.study.model.util.HasOwlKey; import java.util.Date; @@ -39,6 +36,10 @@ public class PatientRecordDto extends AbstractEntity implements HasOwlKey { @OWLObjectProperty(iri = Vocabulary.s_p_was_treated_at, fetch = FetchType.EAGER) private Institution institution; + @Enumerated(EnumType.OBJECT_ONE_OF) + @OWLObjectProperty(iri = Vocabulary.s_p_has_phase) + private RecordPhase phase; + @Override public String getKey() { return key; @@ -105,12 +106,21 @@ public void setFormTemplate(String formTemplate) { this.formTemplate = formTemplate; } + public RecordPhase getPhase() { + return phase; + } + + public void setPhase(RecordPhase phase) { + this.phase = phase; + } + @Override public String toString() { return "PatientRecordDto{" + "localName=" + localName + "dateCreated=" + dateCreated + ", institution=" + institution + + ", phase=" + phase + "} " + super.toString(); } }