From 7714503003553d0bb067ed7bc92bc47c5c17680b Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 6 Apr 2020 15:46:35 -0500 Subject: [PATCH] Issue 3: Add tags to articles Harvest and index tag on document. Update individual view subsection accordingly. --- .../middleware/discovery/model/Document.java | 12 ++++++++++++ .../scholars/middleware/graphql/model/Document.java | 10 ++++++++++ src/main/resources/defaults/displayViews.yml | 3 +++ .../defaults/displayViews/documents/other/tags.html | 9 +++++++++ .../resources/templates/sparql/document/tag.sparql | 7 +++++++ 5 files changed, 41 insertions(+) create mode 100644 src/main/resources/defaults/displayViews/documents/other/tags.html create mode 100644 src/main/resources/templates/sparql/document/tag.sparql diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Document.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Document.java index 9fe0a980e..a45fee979 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Document.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Document.java @@ -431,6 +431,10 @@ public class Document extends Common { @PropertySource(template = "document/receipt", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List receipts; + @Indexed(type = "whole_strings") + @PropertySource(template = "document/tag", predicate = "http://purl.obolibrary.org/obo/ARG_0000015") + private List tags; + public Document() { } @@ -1179,4 +1183,12 @@ public void setReceipts(List receipts) { this.receipts = receipts; } + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + } diff --git a/src/main/java/edu/tamu/scholars/middleware/graphql/model/Document.java b/src/main/java/edu/tamu/scholars/middleware/graphql/model/Document.java index 17327c9a7..e5207719e 100644 --- a/src/main/java/edu/tamu/scholars/middleware/graphql/model/Document.java +++ b/src/main/java/edu/tamu/scholars/middleware/graphql/model/Document.java @@ -195,6 +195,8 @@ public class Document extends AbstractNestedDocument { private String modTime; + private List tags; + @JsonProperty("class") private String clazz; @@ -771,6 +773,14 @@ public void setModTime(String modTime) { this.modTime = modTime; } + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + public String getClazz() { return clazz; } diff --git a/src/main/resources/defaults/displayViews.yml b/src/main/resources/defaults/displayViews.yml index e8cdd3d33..7866d2227 100644 --- a/src/main/resources/defaults/displayViews.yml +++ b/src/main/resources/defaults/displayViews.yml @@ -981,6 +981,9 @@ - name: date/time value template: "defaults/displayViews/documents/other/dateTimeValue.html" field: dateTimeValue + - name: tags + template: "defaults/displayViews/documents/other/tags.html" + field: tags - name: Relationships types: diff --git a/src/main/resources/defaults/displayViews/documents/other/tags.html b/src/main/resources/defaults/displayViews/documents/other/tags.html new file mode 100644 index 000000000..4fc05f6da --- /dev/null +++ b/src/main/resources/defaults/displayViews/documents/other/tags.html @@ -0,0 +1,9 @@ +{{#if tags}} +
    + {{#each tags}} +
  • + {{this}} +
  • + {{/each}} +
+{{/if}} diff --git a/src/main/resources/templates/sparql/document/tag.sparql b/src/main/resources/templates/sparql/document/tag.sparql new file mode 100644 index 000000000..c4116f625 --- /dev/null +++ b/src/main/resources/templates/sparql/document/tag.sparql @@ -0,0 +1,7 @@ +PREFIX obo: + +CONSTRUCT { + <{{uri}}> obo:ARG_0000015 ?tag . +} WHERE { + <{{uri}}> obo:ARG_0000015 ?tag . +} \ No newline at end of file