Skip to content

Commit

Permalink
Merge branch 'main' into feature/jquery-update
Browse files Browse the repository at this point in the history
  • Loading branch information
gneissone committed Mar 22, 2024
2 parents 933db3f + 80a374f commit 26b44e5
Show file tree
Hide file tree
Showing 21 changed files with 210 additions and 73 deletions.
26 changes: 22 additions & 4 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
LOCAL_VIVO_HOME=./vivo-home
RESET_HOME=false
RESET_CORE=false
VERBOSE=no
# Variable substitution for docker-compose.yml

# solr service variable substitution
SOLR_RESET_CORE=false
SOLR_VERBOSE=no

SOLR_HOST_PORT=8983
SOLR_CONTAINER_PORT=8983

SOLR_CORES=./vivo-cores

# tomcat service variable substitution
VIVO_RESET_HOME=false
VIVO_VERBOSE=no

VIVO_TDB_FILE_MODE=direct

VIVO_HOST_VIVO_HOME=./vivo-home
VIVO_CONTAINER_VIVO_HOME=/usr/local/vivo/home

VIVO_HOST_PORT=8080
VIVO_CONTAINER_PORT=8080
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ utilities/rdbmigration/.work
**/.project
**/bin/

vivo-cores/
vivo-home/

.fake
Expand Down
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
FROM tomcat:9-jdk11-openjdk

ARG SOLR_URL=http://localhost:8983/solr/vivocore
ARG VIVO_DIR=/usr/local/vivo/home
ARG TDB_FILE_MODE=direct
ARG VIVO_HOME=/usr/local/vivo/home
ARG SOLR_URL=http://localhost:8983/solr/vivocore

ENV SOLR_URL=${SOLR_URL}
ENV JAVA_OPTS="${JAVA_OPTS} -Dtdb:fileMode=$TDB_FILE_MODE"
ENV VIVO_HOME=${VIVO_HOME}
ENV SOLR_URL=${SOLR_URL}

RUN mkdir /usr/local/vivo
RUN mkdir /usr/local/vivo/home
RUN mkdir -p ${VIVO_HOME}

# Copy VIVO home onto image for backup, initialization, and reset
COPY ./installer/home/target/vivo /vivo-home
COPY ./installer/webapp/target/vivo.war /usr/local/tomcat/webapps/ROOT.war

Expand Down
39 changes: 32 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,43 @@ VIVO docker container is available at [vivoweb/vivo](https://hub.docker.com/repo

### Docker Compose

Docker Compose environment variables:
Docker Compose variable substitution:

.env defaults
```
LOCAL_VIVO_HOME=./vivo-home
RESET_HOME=false
RESET_CORE=false
SOLR_RESET_CORE=false
SOLR_VERBOSE=no
SOLR_HOST_PORT=8983
SOLR_CONTAINER_PORT=8983
SOLR_CORES=./vivo-cores
VIVO_RESET_HOME=false
VIVO_VERBOSE=no
VIVO_TDB_FILE_MODE=direct
VIVO_HOST_VIVO_HOME=./vivo-home
VIVO_CONTAINER_VIVO_HOME=/usr/local/vivo/home
VIVO_HOST_PORT=8080
VIVO_CONTAINER_PORT=8080
```

- `LOCAL_VIVO_HOME`: VIVO home directory on your host machine which will mount to volume in docker container. Set this environment variable to persist your VIVO data on your host machine.
- `RESET_HOME`: Convenience to reset VIVO home when starting container. **Caution**, will delete local configuration, content, and configuration model.
- `RESET_CORE`: Convenience to reset VIVO Solr core when starting container. **Caution**, will require complete reindex.
- `SOLR_RESET_CORE`: Convenience to reset VIVO Solr core when starting container. **Caution**, will require complete reindex.
- `SOLR_VERBOSE`: Increase log verbosity.
- `SOLR_HOST_PORT`: Host port binding for solr service port mapping.
- `SOLR_CONTAINER_PORT`: Container port binding for solr service port mapping.
- `SOLR_CORES`: Solr cores data directories on your host machine which will mount to volume in docker container. Set this environment variable to persist your Solr data on your host machine.

- `VIVO_RESET_HOME`: Convenience to reset VIVO home when starting container. **Caution**, will delete local configuration, content, and configuration model.
- `VIVO_VERBOSE`: Increase log verbosity.
- `VIVO_TDB_FILE_MODE`: TDB file mode. See https://jena.apache.org/documentation/tdb/configuration.html#file-access-mode.
- `VIVO_HOST_VIVO_HOME`: VIVO home directory on your host machine which will mount to volume in docker container. Set this environment variable to persist your VIVO data on your host machine.
- `VIVO_CONTAINER_VIVO_HOME`: VIVO home directory within the container.
- `VIVO_HOST_PORT`: Host port binding for VIVO Tomcat service port mapping.
- `VIVO_CONTAINER_PORT`: Container port binding for VIVO Tomcat service port mapping.

Before building VIVO, you will also need to clone (and switch to the same branch, if other than main) of [Vitro](https://github.com/vivo-project/Vitro). The Vitro project must be cloned to a sibling directory next to VIVO so that it can be found during the build.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
import static edu.cornell.mannlib.vitro.webapp.auth.objects.AccessObject.SOME_LITERAL;
import static edu.cornell.mannlib.vitro.webapp.auth.objects.AccessObject.SOME_PREDICATE;
import static edu.cornell.mannlib.vitro.webapp.auth.objects.AccessObject.SOME_URI;
import static edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary.Precision.DAY;
import static edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary.Precision.MONTH;
import static edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary.Precision.YEAR;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -1218,19 +1221,19 @@ protected boolean addDateToResource(VitroRequest vreq, Resource work, ResourceMo
if (date.month != null) {
if (date.day != null) {
formattedDate = String.format("%04d-%02d-%02dT00:00:00", date.year, date.month, date.day);
precision = "http://vivoweb.org/ontology/core#dayPrecision";
precision = DAY.uri();
} else {
formattedDate = String.format("%04d-%02d-01T00:00:00", date.year, date.month);
precision = "http://vivoweb.org/ontology/core#monthPrecision";
precision = MONTH.uri();
}
} else {
formattedDate = String.format("%04d-01-01T00:00:00", date.year);
precision = "http://vivoweb.org/ontology/core#yearPrecision";
precision = YEAR.uri();
}

Resource dateResource = model.createResource(getUnusedUri(vreq)).addProperty(RDF.type, model.getResource("http://vivoweb.org/ontology/core#DateTimeValue"));
dateResource.addProperty(model.createProperty(VIVO_DATETIME), formattedDate);
dateResource.addProperty(model.createProperty(VIVO_DATETIMEPRECISION), precision);
dateResource.addProperty(model.createProperty(VIVO_DATETIMEPRECISION), model.createResource(precision));

work.addProperty(model.createProperty(VIVO_DATETIMEVALUE), dateResource);
return true;
Expand Down
42 changes: 27 additions & 15 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,47 @@ version: '3.2'

services:

solr:
vivo-solr:
container_name: vivo-solr
image: vivoweb/vivo-solr:latest
environment:
- RESET_CORE=${RESET_CORE}
- VERBOSE=${VERBOSE}
- RESET_CORE=${SOLR_RESET_CORE}
- VERBOSE=${SOLR_VERBOSE}
ports:
- 8983:8983
- ${SOLR_HOST_PORT}:${SOLR_CONTAINER_PORT}
volumes:
- ${SOLR_CORES}:/opt/solr/server/solr/mycores
networks:
- vivo
- vivoweb
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:8983/solr/vivocore/admin/ping || exit 1"]
interval: 15s
timeout: 5s
retries: 3

tomcat:
vivo:
container_name: vivo
image: vivoweb/vivo:latest
hostname: vivo
build:
context: ./
dockerfile: Dockerfile
args:
- VIVO_DIR=/usr/local/vivo/home
- TDB_FILE_MODE=direct
- SOLR_URL=http://solr:8983/solr/vivocore
- TDB_FILE_MODE=${VIVO_TDB_FILE_MODE}
- VIVO_HOME=${VIVO_CONTAINER_VIVO_HOME}
- SOLR_URL=http://vivo-solr:${SOLR_CONTAINER_PORT}/solr/vivocore
environment:
- RESET_HOME=${RESET_HOME}
- VERBOSE=${VERBOSE}
- RESET_HOME=${VIVO_RESET_HOME}
- VERBOSE=${VIVO_VERBOSE}
ports:
- 8080:8080
- ${VIVO_HOST_PORT}:${VIVO_CONTAINER_PORT}
volumes:
- ${LOCAL_VIVO_HOME}:/usr/local/vivo/home
- ${VIVO_HOST_VIVO_HOME}:${VIVO_CONTAINER_VIVO_HOME}
networks:
- vivo
- vivoweb
depends_on:
vivo-solr:
condition: service_healthy

networks:
vivo:
vivoweb:
Original file line number Diff line number Diff line change
Expand Up @@ -7,70 +7,70 @@ access-individual:PersonProfileProximityToResourceUri a access:SparqlSelectValue
access:id """
SELECT ?resourceUri WHERE {
{
?personUri <http://purl.obolibrary.org/obo/RO_0000053> ?roleUri .
?profileUri <http://purl.obolibrary.org/obo/RO_0000053> ?roleUri .
?roleUri a <http://vivoweb.org/ontology/core#AdvisorRole> .
?roleUri <http://vivoweb.org/ontology/core#relatedBy> ?resourceUri .
?resourceUri a <http://vivoweb.org/ontology/core#AdvisingRelationship> .
}
UNION
{
?personUri <http://purl.obolibrary.org/obo/RO_0000053> ?roleUri .
?profileUri <http://purl.obolibrary.org/obo/RO_0000053> ?roleUri .
?roleUri a <http://vivoweb.org/ontology/core#TeacherRole> .
?roleUri <http://purl.obolibrary.org/obo/BFO_0000054> ?resourceUri .
?resourceUri a <http://vivoweb.org/ontology/core#Course> .
}
UNION
{
?personUri <http://purl.obolibrary.org/obo/RO_0000053> ?roleUri .
?profileUri <http://purl.obolibrary.org/obo/RO_0000053> ?roleUri .
?roleUri a <http://vivoweb.org/ontology/core#PrincipalInvestigatorRole> .
?roleUri <http://vivoweb.org/ontology/core#relatedBy> ?resourceUri .
?resourceUri a <http://vivoweb.org/ontology/core#Grant> .
}
UNION
{
?personUri <http://purl.obolibrary.org/obo/RO_0000053> ?roleUri .
?profileUri <http://purl.obolibrary.org/obo/RO_0000053> ?roleUri .
?roleUri a <http://vivoweb.org/ontology/core#CoPrincipalInvestigatorRole> .
?roleUri <http://vivoweb.org/ontology/core#relatedBy> ?resourceUri .
?resourceUri a <http://vivoweb.org/ontology/core#Grant> .
}
UNION
{
?personUri <http://vivoweb.org/ontology/core#relatedBy> ?roleUri .
?profileUri <http://vivoweb.org/ontology/core#relatedBy> ?roleUri .
?roleUri a <http://vivoweb.org/ontology/core#Authorship> .
?roleUri <http://vivoweb.org/ontology/core#relates> ?resourceUri .
?resourceUri a <http://purl.obolibrary.org/obo/IAO_0000030> .
}
UNION
{
?personUri <http://vivoweb.org/ontology/core#relatedBy> ?roleUri .
?profileUri <http://vivoweb.org/ontology/core#relatedBy> ?roleUri .
?roleUri a <http://vivoweb.org/ontology/core#Editorship> .
?roleUri <http://vivoweb.org/ontology/core#relates> ?resourceUri .
?resourceUri a <http://purl.obolibrary.org/obo/IAO_0000030> .
}
UNION
{
?personUri <http://purl.obolibrary.org/obo/RO_0000053> ?roleUri .
?profileUri <http://purl.obolibrary.org/obo/RO_0000053> ?roleUri .
?roleUri a <http://vivoweb.org/ontology/core#PresenterRole> .
?roleUri <http://purl.obolibrary.org/obo/BFO_0000054> ?resourceUri .
?resourceUri a <http://vivoweb.org/ontology/core#Presentation> .
}
UNION
{
?personUri <http://purl.obolibrary.org/obo/RO_0000053> ?roleUri .
?profileUri <http://purl.obolibrary.org/obo/RO_0000053> ?roleUri .
?roleUri a <http://vivoweb.org/ontology/core#ClinicalRole> .
?roleUri <http://vivoweb.org/ontology/core#contributesTo> ?resourceUri .
?resourceUri a <http://vivoweb.org/ontology/core#Project> .
}
UNION
{
?personUri <http://purl.obolibrary.org/obo/RO_0000053> ?roleUri .
?profileUri <http://purl.obolibrary.org/obo/RO_0000053> ?roleUri .
?roleUri a <http://vivoweb.org/ontology/core#ClinicalRole> .
?roleUri <http://vivoweb.org/ontology/core#contributesTo> ?resourceUri .
?resourceUri a <http://vivoweb.org/ontology/core#Service> .
}
UNION
{
BIND ( ?personUri as ?resourceUri)
BIND ( ?profileUri as ?resourceUri)
}
}
""" .
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@prefix : <https://vivoweb.org/ontology/vitro-search-individual/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

:filter_publication_year rdfs:label "Erscheinungsjahr"@de-DE .
:field_persons rdfs:label "Personen"@de-DE .
:range_filter_dates rdfs:label "Dates"@de-DE .
:filter_organizations rdfs:label "Organisationen"@de-DE .
:filter_persons rdfs:label "Personen"@de-DE .
:field_dates rdfs:label "Dates"@de-DE .
:field_organizations rdfs:label "Organisationen"@de-DE .
:field_publication_year rdfs:label "Erscheinungsjahr"@de-DE .
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@prefix : <https://vivoweb.org/ontology/vitro-search-individual/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

:filter_publication_year rdfs:label "Publication year"@en-CA .
:field_persons rdfs:label "Persons"@en-CA .
:range_filter_dates rdfs:label "Dates"@en-CA .
:filter_organizations rdfs:label "Organizations"@en-CA .
:filter_persons rdfs:label "Persons"@en-CA .
:field_dates rdfs:label "Dates"@en-CA .
:field_organizations rdfs:label "Organizations"@en-CA .
:field_publication_year rdfs:label "Publication year"@en-CA .
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@prefix : <https://vivoweb.org/ontology/vitro-search-individual/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

:filter_publication_year rdfs:label "Año de publicación"@es .
:field_persons rdfs:label "personas"@es .
:range_filter_dates rdfs:label "fechas"@es .
:filter_organizations rdfs:label "Organizaciones"@es .
:filter_persons rdfs:label "personas"@es .
:field_dates rdfs:label "fechas"@es .
:field_organizations rdfs:label "Organizaciones"@es .
:field_publication_year rdfs:label "Año de publicación"@es .
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@prefix : <https://vivoweb.org/ontology/vitro-search-individual/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

:filter_publication_year rdfs:label "Année de parution"@fr-CA .
:field_persons rdfs:label "Personnes"@fr-CA .
:range_filter_dates rdfs:label "Dates"@fr-CA .
:filter_organizations rdfs:label "Organisations"@fr-CA .
:filter_persons rdfs:label "Personnes"@fr-CA .
:field_dates rdfs:label "Dates"@fr-CA .
:field_organizations rdfs:label "Organisations"@fr-CA .
:field_publication_year rdfs:label "Année de parution"@fr-CA .
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@prefix : <https://vivoweb.org/ontology/vitro-search-individual/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

:filter_publication_year rdfs:label "Ano de publicação"@pt-BR .
:field_persons rdfs:label "Pessoas"@pt-BR .
:range_filter_dates rdfs:label "datas"@pt-BR .
:filter_organizations rdfs:label "Organizações"@pt-BR .
:filter_persons rdfs:label "Pessoas"@pt-BR .
:field_dates rdfs:label "datas"@pt-BR .
:field_organizations rdfs:label "Organizações"@pt-BR .
:field_publication_year rdfs:label "Ano de publicação"@pt-BR .
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@prefix : <https://vivoweb.org/ontology/vitro-search-individual/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

:filter_publication_year rdfs:label "Год публикации"@ru-RU .
:field_persons rdfs:label "Персоны"@ru-RU .
:range_filter_dates rdfs:label "Даты"@ru-RU .
:filter_organizations rdfs:label "Организации"@ru-RU .
:filter_persons rdfs:label "Персоны"@ru-RU .
:field_dates rdfs:label "Даты"@ru-RU .
:field_organizations rdfs:label "Организации"@ru-RU .
:field_publication_year rdfs:label "Год публикации"@ru-RU .
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@prefix : <https://vivoweb.org/ontology/vitro-search-individual/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

:filter_publication_year rdfs:label "Godina izdanja"@sr-Latn-RS .
:field_persons rdfs:label "Osobe"@sr-Latn-RS .
:range_filter_dates rdfs:label "Datumi"@sr-Latn-RS .
:filter_organizations rdfs:label "Organizacije"@sr-Latn-RS .
:filter_persons rdfs:label "Osobe"@sr-Latn-RS .
:field_dates rdfs:label "Datumi"@sr-Latn-RS .
:field_organizations rdfs:label "Organizacije"@sr-Latn-RS .
:field_publication_year rdfs:label "Godina izdanja"@sr-Latn-RS .
Loading

0 comments on commit 26b44e5

Please sign in to comment.