Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/cz/cvut/kbss/study/dto/PatientRecordDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class PatientRecordDto extends AbstractEntity implements HasOwlKey {
private String localName;

@ParticipationConstraints(nonEmpty = true)
@OWLObjectProperty(iri = Vocabulary.s_p_has_author)
@OWLObjectProperty(iri = Vocabulary.s_p_record_manager_has_author)
private URI author;

@OWLDataProperty(iri = Vocabulary.s_p_created)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cz/cvut/kbss/study/model/PatientRecord.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class PatientRecord implements Serializable, HasOwlKey, HasUri {
private String localName;

@ParticipationConstraints(nonEmpty = true)
@OWLObjectProperty(iri = Vocabulary.s_p_has_author, fetch = FetchType.EAGER)
@OWLObjectProperty(iri = Vocabulary.s_p_record_manager_has_author, fetch = FetchType.EAGER)
private User author;

@OWLDataProperty(iri = Vocabulary.s_p_created)
Expand Down
71 changes: 71 additions & 0 deletions src/main/java/cz/cvut/kbss/study/model/qam/Comment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package cz.cvut.kbss.study.model.qam;

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.study.model.AbstractEntity;
import cz.cvut.kbss.study.model.Vocabulary;

import java.util.Date;

@OWLClass(iri = Vocabulary.s_c_comment)
public class Comment extends AbstractEntity {

@OWLObjectProperty(iri = Vocabulary.s_p_has_author)
private String author;

@OWLDataProperty(iri = Vocabulary.s_p_has_comment_value)
private String value;

@OWLDataProperty(iri = Vocabulary.s_p_has_timestamp)
private Date timestamp;

public Comment(String author, String value, Date created) {
this.author = author;
this.value = value;
this.timestamp = created;
}

public Comment() {
}

public Comment(Comment other) {
this.author = other.author;
this.value = other.value;
this.timestamp = other.timestamp;
}

public String getAuthor() {
return author;
}

public void setAuthor(String author) {
this.author = author;
}

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}

public Date getTimestamp() {
return timestamp;
}

public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}

@Override
public String toString() {
return "Comment{" +
"author='" + author + '\'' +
"value='" + value + '\'' +
", created=" + timestamp +
'}';
}

}
14 changes: 14 additions & 0 deletions src/main/java/cz/cvut/kbss/study/model/qam/Question.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public class Question extends AbstractEntity {
@OWLDataProperty(iri = Vocabulary.s_p_has_origin_path_id)
private String originPathId;

@OWLObjectProperty(iri = Vocabulary.s_p_has_comment, cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
private Set<Comment> comments = new HashSet<>();;

@Types
private Set<String> types = new HashSet<>();

Expand All @@ -43,6 +46,9 @@ public Question(Question other) {
if (other.answers != null) {
this.answers = other.answers.stream().map(Answer::new).collect(Collectors.toSet());
}
if(other.comments != null) {
this.comments = other.comments.stream().map(Comment::new).collect(Collectors.toSet());
}
if (other.types != null) {
this.types.addAll(other.types);
}
Expand Down Expand Up @@ -81,6 +87,14 @@ public void setTypes(Set<String> types) {
this.types = types;
}

public Set<Comment> getComments() {
return comments;
}

public void setComments(Set<Comment> comments) {
this.comments = comments;
}

@Override
public String toString() {
return "Question (" + types + "){" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public List<PatientRecord> findByAuthor(User author) {
Objects.requireNonNull(author);
return em.createNativeQuery("SELECT ?r WHERE { ?r a ?type ; ?createdBy ?author . }", PatientRecord.class)
.setParameter("type", typeUri)
.setParameter("createdBy", URI.create(Vocabulary.s_p_has_author))
.setParameter("createdBy", URI.create(Vocabulary.s_p_record_manager_has_author))
.setParameter("author", author.getUri()).getResultList();
}

Expand Down Expand Up @@ -291,7 +291,7 @@ public Page<RawRecord> findAllRecordsRaw(RecordFilterParams filters, Pageable pa
private void setQueryParameters(Query query, Map<String, Object> queryParams) {
query
.setParameter("type", typeUri)
.setParameter("hasAuthor", URI.create(Vocabulary.s_p_has_author))
.setParameter("hasAuthor", URI.create(Vocabulary.s_p_record_manager_has_author))
.setParameter("hasUsername", URI.create(Vocabulary.s_p_accountName))
.setParameter("hasPhase", URI.create(Vocabulary.s_p_has_phase))
.setParameter("hasFormTemplate", URI.create(Vocabulary.s_p_has_form_template))
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/form.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ form:has-origin-path-id rdf:type owl:DatatypeProperty .
doc:answer rdf:type owl:Class ;
rdfs:label "Answer"@en .

### http://onto.fel.cvut.cz/ontologies/form/comment
form:comment rdf:type owl:Class ;
rdfs:label "Comment"@en .

### http://onto.fel.cvut.cz/ontologies/documentation/question
doc:question rdf:type owl:Class ;
Expand Down
16 changes: 16 additions & 0 deletions src/main/resources/model.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
doc:has_answer rdf:type owl:ObjectProperty ;
rdfs:subPropertyOf rm:relates-to .

### http://onto.fel.cvut.cz/ontologies/form/has-comment
form:has-comment rdf:type owl:ObjectProperty ;
rdfs:subPropertyOf rm:relates-to .

### http://onto.fel.cvut.cz/ontologies/documentation/has_related_question
doc:has_related_question rdf:type owl:ObjectProperty ;
Expand Down Expand Up @@ -105,6 +108,15 @@ rm:has-role rdf:type owl:ObjectProperty ;
rm:action_type rdf:type owl:DatatypeProperty .


### http://onto.fel.cvut.cz/ontologies/form/has-author
form:has-author rdf:type owl:DatatypeProperty ;
rdfs:subPropertyOf rm:relates-to .

### http://onto.fel.cvut.cz/ontologies/form/has-comment-value
form:has-comment-value rdf:type owl:DatatypeProperty ;
rdfs:subPropertyOf rm:relates-to .


### http://onto.fel.cvut.cz/ontologies/record-manager/isInvited
rm:isInvited rdf:type owl:DatatypeProperty .

Expand All @@ -120,6 +132,10 @@ rm:has-form-template-version rdf:type owl:DatatypeProperty ;
rm:key rdf:type owl:DatatypeProperty .


form:has-timestamp rdf:type owl:DatatypeProperty ;
rdfs:subPropertyOf rm:relates-to .


### http://onto.fel.cvut.cz/ontologies/record-manager/password
rm:password rdf:type owl:DatatypeProperty .

Expand Down
Loading