diff --git a/docker/Dockerfile b/docker/Dockerfile index 2f78dd0ac..d89cf0bd2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,14 +3,21 @@ FROM node:11.1.0-alpine RUN apk add nss git openjdk8-jre openjdk8 maven python alpine-sdk libxml2-dev yarn g++ gcc bash raptor2 jq WORKDIR /synbiohub -COPY . . -# RUN rm -rf .git - -RUN cd java && mvn package RUN git config --global url."https://".insteadOf git:// + +# Install Node dependencies from the manifest + lockfile alone, in their own +# cached layer, so application source changes don't re-run yarn install. +# node_modules is excluded from the build context (.dockerignore), so this +# install is what populates it. +COPY package.json yarn.lock ./ RUN yarn install +# Application source and build. The yarn layer above stays cached across source +# edits, so only the copy and the Java build below re-run on a code change. +COPY . . +RUN cd java && mvn package + COPY docker/config.local.json config.initial.local.json COPY docker/healthcheck.js healthcheck.js COPY docker/entry.sh entry.sh @@ -18,6 +25,5 @@ COPY docker/first_run.sh first_run.sh EXPOSE 7777 -HEALTHCHECK --start-period=60s CMD ["node", "healthcheck.js"] +HEALTHCHECK --start-period=60s CMD ["node", "healthcheck.js"] ENTRYPOINT ["./entry.sh"] - diff --git a/lib/actions/makePublic.js b/lib/actions/makePublic.js index bd3289635..ca536a476 100644 --- a/lib/actions/makePublic.js +++ b/lib/actions/makePublic.js @@ -228,7 +228,7 @@ module.exports = function (req, res) { newRootCollectionDisplayId: collectionId + '_collection', newRootCollectionVersion: version, ownedByURI: config.get('databasePrefix') + 'user/' + req.params.userId, - creatorName: '', + creatorName: req.user.name, citationPubmedIDs: citations, overwrite_merge: overwriteMerge, user: apiTokens.createToken(req.user) diff --git a/lib/fetch/local/fetch-sbol-object-recursive.js b/lib/fetch/local/fetch-sbol-object-recursive.js index 5a1dd8a71..dc87309b0 100644 --- a/lib/fetch/local/fetch-sbol-object-recursive.js +++ b/lib/fetch/local/fetch-sbol-object-recursive.js @@ -349,7 +349,14 @@ return [ '}' ]).join('\n') */ - var from = 'FROM <' + config.get('databasePrefix') + 'public>' + ' FROM <' + graphUri + '>' + var from = 'FROM <' + config.get('databasePrefix') + 'public>' + + // graphUri is null when resolving a purely public object. Only add the + // user-graph dataset clause when there is one; emitting `FROM ` + // produces an invalid (relative) IRI that a strict SPARQL parser rejects. + if (graphUri) { + from += ' FROM <' + graphUri + '>' + } var query = [ isCount diff --git a/lib/views/admin/graphs.js b/lib/views/admin/graphs.js index dbf246c16..4ae7cd3ec 100644 --- a/lib/views/admin/graphs.js +++ b/lib/views/admin/graphs.js @@ -9,7 +9,8 @@ module.exports = function (req, res) { const query = [ 'SELECT DISTINCT ?graph WHERE {', 'GRAPH ?graph { ?s ?a ?t }', - '}' + '}', + 'ORDER BY ?graph' ].join('\n') sparql.queryJson(query, null).then((results) => { diff --git a/sparql/AttachUpload.sparql b/sparql/AttachUpload.sparql index 35874c5d1..38e583927 100644 --- a/sparql/AttachUpload.sparql +++ b/sparql/AttachUpload.sparql @@ -3,7 +3,7 @@ PREFIX dcterms: PREFIX sbh: PREFIX sbol: -INSERT { +INSERT DATA { <$topLevel> sbol:attachment <$attachmentURI> . <$collectionUri> sbol:member <$attachmentURI> . diff --git a/sparql/AttachUrl.sparql b/sparql/AttachUrl.sparql index 5288f1f1e..4c2a56dd2 100644 --- a/sparql/AttachUrl.sparql +++ b/sparql/AttachUrl.sparql @@ -2,7 +2,7 @@ PREFIX dcterms: PREFIX sbh: PREFIX sbol: -INSERT { +INSERT DATA { <$topLevel> sbol:attachment <$uri> . <$collectionUri> sbol:member <$uri> . diff --git a/sparql/searchCount.sparql b/sparql/searchCount.sparql index f86ee972c..c3078f6c0 100644 --- a/sparql/searchCount.sparql +++ b/sparql/searchCount.sparql @@ -16,10 +16,11 @@ PREFIX so: PREFIX bench: PREFIX genbank: -select (sum(?tempcount) as ?count) WHERE { +select (sum(?tempcount) as ?count) +$from +WHERE { { SELECT (count(distinct ?subject) as ?tempcount) - $from WHERE { $criteria diff --git a/tests/previousresults/get_file_public-:collectionId-:displayId-:version-gff_.xml b/tests/previousresults/get_file_public-:collectionId-:displayId-:version-gff_.xml index dc44833ee..d264a7218 100644 --- a/tests/previousresults/get_file_public-:collectionId-:displayId-:version-gff_.xml +++ b/tests/previousresults/get_file_public-:collectionId-:displayId-:version-gff_.xml @@ -44,4 +44,4 @@ try { View Source on Github | Report an Issue -
| v1.6.1 (6d694887)
\ No newline at end of file +
| v1.6.1 (aa5056eb)
\ No newline at end of file diff --git a/tests/previousresults/get_file_public-:collectionId-:displayId-:version-omex_.xml b/tests/previousresults/get_file_public-:collectionId-:displayId-:version-omex_.xml index e69de29bb..739306a7e 100644 Binary files a/tests/previousresults/get_file_public-:collectionId-:displayId-:version-omex_.xml and b/tests/previousresults/get_file_public-:collectionId-:displayId-:version-omex_.xml differ diff --git a/tests/previousresults/get_file_public-:collectionId-:displayId-:version-sbol_.xml b/tests/previousresults/get_file_public-:collectionId-:displayId-:version-sbol_.xml index 0fe72f519..e3274b605 100644 --- a/tests/previousresults/get_file_public-:collectionId-:displayId-:version-sbol_.xml +++ b/tests/previousresults/get_file_public-:collectionId-:displayId-:version-sbol_.xml @@ -87,17 +87,6 @@ - - - - BBa_C0012 - 1 - - - - - - @@ -131,6 +120,17 @@ + + + + BBa_C0012 + 1 + + + + + + @@ -231,68 +231,68 @@ - - - BBa_J61120 + + + ECK120033736 1 - + - - - BBa_E0040 + + + BBa_R0010 1 - + - - - BBa_C0040 + + + BBa_J61130 1 - + - - - ECK120033736 + + + BBa_J61120 1 - + - - - BBa_R0010 + + + BBa_E0040 1 - + - - - BBa_J61130 + + + BBa_C0040 1 - + diff --git a/tests/previousresults/get_file_public-:collectionId-:displayId-sbol_.xml b/tests/previousresults/get_file_public-:collectionId-:displayId-sbol_.xml index 0fe72f519..e3274b605 100644 --- a/tests/previousresults/get_file_public-:collectionId-:displayId-sbol_.xml +++ b/tests/previousresults/get_file_public-:collectionId-:displayId-sbol_.xml @@ -87,17 +87,6 @@ - - - - BBa_C0012 - 1 - - - - - - @@ -131,6 +120,17 @@ + + + + BBa_C0012 + 1 + + + + + + @@ -231,68 +231,68 @@ - - - BBa_J61120 + + + ECK120033736 1 - + - - - BBa_E0040 + + + BBa_R0010 1 - + - - - BBa_C0040 + + + BBa_J61130 1 - + - - - ECK120033736 + + + BBa_J61120 1 - + - - - BBa_R0010 + + + BBa_E0040 1 - + - - - BBa_J61130 + + + BBa_C0040 1 - + diff --git a/tests/previousresults/get_file_public-:collectionId-:displayId-sbolnr_.xml b/tests/previousresults/get_file_public-:collectionId-:displayId-sbolnr_.xml index 0fe72f519..e3274b605 100644 --- a/tests/previousresults/get_file_public-:collectionId-:displayId-sbolnr_.xml +++ b/tests/previousresults/get_file_public-:collectionId-:displayId-sbolnr_.xml @@ -87,17 +87,6 @@ - - - - BBa_C0012 - 1 - - - - - - @@ -131,6 +120,17 @@ + + + + BBa_C0012 + 1 + + + + + + @@ -231,68 +231,68 @@ - - - BBa_J61120 + + + ECK120033736 1 - + - - - BBa_E0040 + + + BBa_R0010 1 - + - - - BBa_C0040 + + + BBa_J61130 1 - + - - - ECK120033736 + + + BBa_J61120 1 - + - - - BBa_R0010 + + + BBa_E0040 1 - + - - - BBa_J61130 + + + BBa_C0040 1 - + diff --git a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-gff_.xml b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-gff_.xml index dc44833ee..d264a7218 100644 --- a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-gff_.xml +++ b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-gff_.xml @@ -44,4 +44,4 @@ try { View Source on Github | Report an Issue -
| v1.6.1 (6d694887)
\ No newline at end of file +
| v1.6.1 (aa5056eb)
\ No newline at end of file diff --git a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-omex_.xml b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-omex_.xml index e69de29bb..88b6f9ed5 100644 Binary files a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-omex_.xml and b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-omex_.xml differ diff --git a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-sbol_.xml b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-sbol_.xml index 2022d8c88..5d08e1745 100644 --- a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-sbol_.xml +++ b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-sbol_.xml @@ -11,24 +11,24 @@ - - - pIKELeftCassette_1 + + + pIKERightCassette_1 1 - + - - - pIKERightCassette_1 + + + pIKELeftCassette_1 1 - + @@ -88,13 +88,13 @@ - - - ECK120029600 + + + BBa_J61101 1 - + @@ -110,24 +110,24 @@ - - - BBa_R0040 + + + ECK120029600 1 - + - - - BBa_J61101 + + + BBa_R0040 1 - + @@ -241,17 +241,6 @@ - - - - BBa_J61130 - 1 - - - - - - @@ -264,13 +253,13 @@ - - - ECK120033736 + + + BBa_E0040 1 - + @@ -286,13 +275,24 @@ - - - BBa_E0040 + + + BBa_J61130 1 - + + + + + + + + ECK120033736 + 1 + + + diff --git a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-sbolnr_.xml b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-sbolnr_.xml index f788de9d5..a8198206e 100644 --- a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-sbolnr_.xml +++ b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-:version-sbolnr_.xml @@ -11,24 +11,24 @@ - - - pIKELeftCassette_1 + + + pIKERightCassette_1 1 - + - - - pIKERightCassette_1 + + + pIKELeftCassette_1 1 - + diff --git a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-sbol_.xml b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-sbol_.xml index 2022d8c88..5d08e1745 100644 --- a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-sbol_.xml +++ b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-sbol_.xml @@ -11,24 +11,24 @@ - - - pIKELeftCassette_1 + + + pIKERightCassette_1 1 - + - - - pIKERightCassette_1 + + + pIKELeftCassette_1 1 - + @@ -88,13 +88,13 @@ - - - ECK120029600 + + + BBa_J61101 1 - + @@ -110,24 +110,24 @@ - - - BBa_R0040 + + + ECK120029600 1 - + - - - BBa_J61101 + + + BBa_R0040 1 - + @@ -241,17 +241,6 @@ - - - - BBa_J61130 - 1 - - - - - - @@ -264,13 +253,13 @@ - - - ECK120033736 + + + BBa_E0040 1 - + @@ -286,13 +275,24 @@ - - - BBa_E0040 + + + BBa_J61130 1 - + + + + + + + + ECK120033736 + 1 + + + diff --git a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-sbolnr_.xml b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-sbolnr_.xml index 2022d8c88..5d08e1745 100644 --- a/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-sbolnr_.xml +++ b/tests/previousresults/get_file_user-:userId-:collectionId-:displayId-sbolnr_.xml @@ -11,24 +11,24 @@ - - - pIKELeftCassette_1 + + + pIKERightCassette_1 1 - + - - - pIKERightCassette_1 + + + pIKELeftCassette_1 1 - + @@ -88,13 +88,13 @@ - - - ECK120029600 + + + BBa_J61101 1 - + @@ -110,24 +110,24 @@ - - - BBa_R0040 + + + ECK120029600 1 - + - - - BBa_J61101 + + + BBa_R0040 1 - + @@ -241,17 +241,6 @@ - - - - BBa_J61130 - 1 - - - - - - @@ -264,13 +253,13 @@ - - - ECK120033736 + + + BBa_E0040 1 - + @@ -286,13 +275,24 @@ - - - BBa_E0040 + + + BBa_J61130 1 - + + + + + + + + ECK120033736 + 1 + + + diff --git a/tests/previousresults/getrequest_admin-graphs_.html b/tests/previousresults/getrequest_admin-graphs_.html index e43b15a1c..cacd9b4c0 100644 --- a/tests/previousresults/getrequest_admin-graphs_.html +++ b/tests/previousresults/getrequest_admin-graphs_.html @@ -198,56 +198,6 @@

- - - - http://www.openlinksw.com/schemas/virtrdf# - - - - 2479 - - - - - - http://www.w3.org/ns/ldp# - - - - 3 - - - - - - http://localhost:8890/sparql - - - - 14 - - - - - - http://localhost:8890/DAV/ - - - - 2959 - - - - - - http://www.w3.org/2002/07/owl# - - - - 160 - - diff --git a/tests/previousresults/getrequest_admin-registries_.html b/tests/previousresults/getrequest_admin-registries_.html index 092ce1f9f..fc423907a 100644 --- a/tests/previousresults/getrequest_admin-registries_.html +++ b/tests/previousresults/getrequest_admin-registries_.html @@ -298,7 +298,7 @@

- +