From 603080dbcf3b02a57d7fd4c3038c84d9caa23bc6 Mon Sep 17 00:00:00 2001 From: tholulomo Date: Mon, 21 Oct 2024 13:50:25 -0400 Subject: [PATCH] FEAT(#508): Testing whyis changes --- .gitignore | 1 + app/src/modules/whyis-dataset.js | 258 +-- app/src/pages/explorer/curate/sdd/SddForm.vue | 1585 +++++++++++------ .../pages/explorer/curate/sdd/SddLinking.vue | 174 +- app/src/pages/explorer/dataset/Dataset.vue | 133 +- .../pages/explorer/dataset/DatasetGallery.vue | 274 +-- app/src/router/index.js | 65 +- app/src/store/modules/misc/getters.js | 21 +- app/src/store/modules/misc/index.js | 15 +- app/src/store/modules/misc/mutations.js | 25 +- docker-compose.yml | 12 +- mockDB/whyis-init.sh | 7 + whyis/Dockerfile | 7 +- whyis/Dockerfile.dev | 2 +- whyis/materialsmine/whyis.conf | 4 +- 15 files changed, 1539 insertions(+), 1044 deletions(-) create mode 100755 mockDB/whyis-init.sh diff --git a/.gitignore b/.gitignore index 629302a3..fa73633a 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,4 @@ resfulservice/.nyc_output old_services venv/ __pycache__/ +sparqlqueries.html diff --git a/app/src/modules/whyis-dataset.js b/app/src/modules/whyis-dataset.js index 38ddc6f1..f0c3992c 100644 --- a/app/src/modules/whyis-dataset.js +++ b/app/src/modules/whyis-dataset.js @@ -3,8 +3,8 @@ import { postNewNanopub, deleteNanopub, lodPrefix -} from './whyis-utils' -import store from '@/store' +} from './whyis-utils'; +import store from '@/store'; const defaultDataset = { title: '', @@ -33,13 +33,13 @@ const defaultDataset = { name: '', accessURL: null } -} +}; -const dcat = 'http://www.w3.org/ns/dcat#' -const dct = 'http://purl.org/dc/terms/' -const vcard = 'http://www.w3.org/2006/vcard/ns#' -const foaf = 'http://xmlns.com/foaf/0.1/' -const schema = 'http://schema.org/' +const dcat = 'http://www.w3.org/ns/dcat#'; +const dct = 'http://purl.org/dc/terms/'; +const vcard = 'http://www.w3.org/2006/vcard/ns#'; +const foaf = 'http://xmlns.com/foaf/0.1/'; +const schema = 'http://schema.org/'; const datasetFieldUris = { baseSpec: 'http://semanticscience.org/resource/hasValue', @@ -71,32 +71,32 @@ const datasetFieldUris = { depiction: `${foaf}depiction`, hasContent: 'http://vocab.rpi.edu/whyis/hasContent', accessURL: `${dcat}accessURL` -} +}; -const datasetPrefix = 'dataset' +const datasetPrefix = 'dataset'; // Generate a randum uuid, or use current if exists -function generateDatasetId (guuid) { - var datasetId +function generateDatasetId(guuid) { + var datasetId; if (arguments.length === 0) { - const { v4: uuidv4 } = require('uuid') - datasetId = uuidv4() + const { v4: uuidv4 } = require('uuid'); + datasetId = uuidv4(); } else { - datasetId = guuid + datasetId = guuid; } - return `${lodPrefix}/explorer/${datasetPrefix}/${datasetId}` + return `${lodPrefix}/explorer/${datasetPrefix}/${datasetId}`; } -function buildDatasetLd (dataset) { - dataset = Object.assign({}, dataset) - dataset.context = JSON.stringify(dataset.context) +function buildDatasetLd(dataset) { + dataset = Object.assign({}, dataset); + dataset.context = JSON.stringify(dataset.context); const datasetLd = { '@id': dataset.uri, '@type': [] - } + }; if (dataset['@type'] != null) { - datasetLd['@type'].push(dataset['@type']) + datasetLd['@type'].push(dataset['@type']); } Object.entries(dataset) @@ -104,51 +104,51 @@ function buildDatasetLd (dataset) { .filter(([field, value]) => datasetFieldUris[field.toLowerCase()]) .forEach(([field, value]) => { // make a new dictionary - var ldValues = {} + var ldValues = {}; // If the field has a value if (!isEmpty(value)) { - ldValues = recursiveFieldSetter([field, value]) - datasetLd[datasetFieldUris[field.toLowerCase()]] = ldValues + ldValues = recursiveFieldSetter([field, value]); + datasetLd[datasetFieldUris[field.toLowerCase()]] = ldValues; } - }) - return datasetLd + }); + return datasetLd; } // Recursively check if a value is empty -function isEmpty (value) { +function isEmpty(value) { // Base case if ([undefined, null, ''].includes(value)) { - return true + return true; } else if (Array.isArray(value)) { // Is empty if array has length 0 - let arrayEmpty = value.length === 0 + let arrayEmpty = value.length === 0; for (var val in value) { // if any entry in the array is empty, it's empty - arrayEmpty = arrayEmpty || isEmpty(value[val]) + arrayEmpty = arrayEmpty || isEmpty(value[val]); } - return arrayEmpty + return arrayEmpty; } else if (typeof value === 'object') { - let objEmpty = false + let objEmpty = false; for (var property in value) { // if any attribute of the object is empty, it's empty - objEmpty = objEmpty || isEmpty(value[property]) + objEmpty = objEmpty || isEmpty(value[property]); } - return objEmpty + return objEmpty; } - return false + return false; } // Helper for assigning values into JSON-LD format -function recursiveFieldSetter ([field, value]) { +function recursiveFieldSetter([field, value]) { // If the value is also an array, recur through the value if (Array.isArray(value)) { - var fieldArray = [] + var fieldArray = []; for (const val in value) { - fieldArray.push(recursiveFieldSetter([field, value[val]])) + fieldArray.push(recursiveFieldSetter([field, value[val]])); } - return fieldArray + return fieldArray; } else { - var fieldDict = {} + var fieldDict = {}; // Fields may have multiple values, so loop through all for (const val in value) { // type, value and id aren't in datasetFieldURIs dictionary @@ -160,7 +160,7 @@ function recursiveFieldSetter ([field, value]) { Object.getOwnPropertyDescriptor( datasetFieldUris, value[val].toLowerCase() - )?.value ?? value[val] + )?.value ?? value[val]; } else if ( Object.getOwnPropertyDescriptor(datasetFieldUris, val.toLowerCase()) ) { @@ -168,18 +168,18 @@ function recursiveFieldSetter ([field, value]) { fieldDict[datasetFieldUris[val.toLowerCase()]] = recursiveFieldSetter([ datasetFieldUris[val.toLowerCase()], value[val] - ]) + ]); } else { - fieldDict['@value'] = value + fieldDict['@value'] = value; } } - return fieldDict + return fieldDict; } } // Blank dataset -function getDefaultDataset () { - return Object.assign({}, defaultDataset) +function getDefaultDataset() { + return Object.assign({}, defaultDataset); } // TODO: Remove duplicate resource deletions @@ -191,68 +191,68 @@ function getDefaultDataset () { // } // ) // } -async function deleteResources (resourceURI) { +async function deleteResources(resourceURI) { return listNanopubs(resourceURI).then((nanopubs) => { - if (!nanopubs || !nanopubs.length) return + if (!nanopubs || !nanopubs.length) return; return Promise.all( nanopubs.map(async (nanopub) => await deleteNanopub(nanopub.np)) - ) - }) + ); + }); } // Handle all of the uploads as multipart form -async function saveDataset (dataset, fileList, imageList, guuid) { - const oldFiles = fileList.filter((file) => file.status === 'complete') - const oldDepiction = imageList.filter((file) => file.status === 'complete') +async function saveDataset(dataset, fileList, imageList, guuid) { + const oldFiles = fileList.filter((file) => file.status === 'complete'); + const oldDepiction = imageList.filter((file) => file.status === 'complete'); const imgToDelete = imageList.filter((file) => file.status === 'delete')?.[0] - ?.accessUrl - let imgDeleteId - if (imgToDelete) imgDeleteId = parseFileName(imgToDelete, true) + ?.accessUrl; + let imgDeleteId; + if (imgToDelete) imgDeleteId = parseFileName(imgToDelete, true); - let p = Promise.resolve() + let p = Promise.resolve(); if (dataset.uri) { - p = await deleteResources(dataset.uri) + p = await deleteResources(dataset.uri); } else if (arguments.length === 1) { - dataset.uri = generateDatasetId() + dataset.uri = generateDatasetId(); } else { - dataset.uri = generateDatasetId(guuid) + dataset.uri = generateDatasetId(guuid); } const [distrRes, imgRes] = await Promise.all([ saveDatasetFiles(fileList.filter((file) => file.status === 'incomplete')), saveDatasetFiles(imageList.filter((file) => file.status === 'incomplete')), deleteFile(imgDeleteId), p - ]) - const datasetLd = buildDatasetLd(dataset) - let allFiles = [...oldFiles] - if (distrRes?.files) allFiles = [...allFiles, ...distrRes.files] + ]); + const datasetLd = buildDatasetLd(dataset); + let allFiles = [...oldFiles]; + if (distrRes?.files) allFiles = [...allFiles, ...distrRes.files]; if (allFiles?.length) { - datasetLd[datasetFieldUris.distribution] = buildDistrLd(allFiles) + datasetLd[datasetFieldUris.distribution] = buildDistrLd(allFiles); } if (imgRes?.files?.length) { datasetLd[datasetFieldUris.depiction] = buildDepictionLd( imgRes?.files?.[0], dataset.uri - ) + ); } else if (oldDepiction.length) { datasetLd[datasetFieldUris.depiction] = buildDepictionLd( oldDepiction[0], dataset.uri - ) + ); } - return postNewNanopub(datasetLd) + return postNewNanopub(datasetLd); // TODO: Error handling } -async function saveDatasetFiles (fileList) { +async function saveDatasetFiles(fileList) { if (fileList.length) { - const url = `${window.location.origin}/api/files/upload` - const formData = new FormData() + const url = `${window.location.origin}/api/files/upload`; + const formData = new FormData(); fileList.forEach((file) => formData.append('uploadfile', file?.file ?? file) - ) + ); const result = await fetch(url, { method: 'POST', body: formData, @@ -260,13 +260,13 @@ async function saveDatasetFiles (fileList) { headers: { Authorization: 'Bearer ' + store.getters['auth/token'] } - }) - return await result.json() + }); + return await result.json(); // TODO: Error handling } } -async function deleteFile (fileId) { +async function deleteFile(fileId) { if (fileId) { const response = await fetch( `${window.location.origin}/api/files/${fileId}`, @@ -276,45 +276,45 @@ async function deleteFile (fileId) { Authorization: `Bearer ${store.getters['auth/token']}` } } - ) + ); if (response?.statusText !== 'OK') { const error = new Error( response?.message || 'Something went wrong while deleting file' - ) - throw error + ); + throw error; } - return response + return response; } } -function buildDistrLd (fileList) { - const distrLDs = Array(fileList.length) +function buildDistrLd(fileList) { + const distrLDs = Array(fileList.length); Array.from(Array(fileList.length).keys()).map((x) => { // TODO: check if we want to keep distribution uri as /explorer/dataset/id/filename and redirect for download - const fileName = fileList[x]?.swaggerFilename ?? fileList[x]?.name + const fileName = fileList[x]?.swaggerFilename ?? fileList[x]?.name; distrLDs[x] = { '@type': 'http://purl.org/net/provenance/ns#File', 'http://www.w3.org/2000/01/rdf-schema#label': fileName - } - if (fileList[x]?.status === 'complete') { - distrLDs[x]['@id'] = fileList[x].uri - } else { - distrLDs[x]['@id'] = `${window.location.origin}${fileList[x].filename}` - } - - // Note: When testing SDD linking locally enable below logic and comment above if statement + }; // if (fileList[x]?.status === 'complete') { // distrLDs[x]['@id'] = fileList[x].uri // } else { - // distrLDs[x]['@id'] = `http://restful:3001/${ - // fileList[x].filename?.split('/api/')?.[1] - // }` + // distrLDs[x]['@id'] = `${window.location.origin}${fileList[x].filename}` // } - }) - return distrLDs + + // Note: When testing SDD linking locally enable below logic and comment above if statement + if (fileList[x]?.status === 'complete') { + distrLDs[x]['@id'] = fileList[x].uri; + } else { + distrLDs[x]['@id'] = `http://restful:3001/${ + fileList[x].filename?.split('/api/')?.[1] + }`; + } + }); + return distrLDs; } -function buildDepictionLd (file, uri) { +function buildDepictionLd(file, uri) { const depictionLd = { '@id': `${uri}/depiction`, '@type': 'http://purl.org/net/provenance/ns#File', @@ -322,76 +322,76 @@ function buildDepictionLd (file, uri) { file?.swaggerFilename ?? file.originalname, 'http://www.w3.org/ns/dcat#accessURL': file?.accessUrl ?? `${window.location.origin}${file.filename}` - } - return depictionLd + }; + return depictionLd; } // Load for editing -async function loadDataset (datasetUri) { +async function loadDataset(datasetUri) { try { const response = await store.dispatch( 'explorer/fetchSingleDataset', datasetUri - ) + ); const [extractedDataset, oldDistributions, oldDepiction] = - extractDataset(response) - return [extractedDataset, oldDistributions, oldDepiction] + extractDataset(response); + return [extractedDataset, oldDistributions, oldDepiction]; } catch (e) { - store.commit('setSnackbar', { message: e }) + store.commit('setSnackbar', { message: e }); } } // Extract information from dataset in JSONLD format -function extractDataset (datasetLd) { +function extractDataset(datasetLd) { // eslint-disable-next-line no-undef - const dataset = structuredClone(defaultDataset) - dataset.uri = datasetLd?.['@id'] - let oldDistributions = [] - let oldDepiction + const dataset = structuredClone(defaultDataset); + dataset.uri = datasetLd?.['@id']; + let oldDistributions = []; + let oldDepiction; Object.entries(defaultDataset).forEach(([field]) => { - const uri = datasetFieldUris?.[field.toLowerCase()] - const val = datasetLd?.[uri] + const uri = datasetFieldUris?.[field.toLowerCase()]; + const val = datasetLd?.[uri]; if (!!uri && typeof val !== 'undefined') { if (field === 'distribution') { oldDistributions = val.map((fileId) => { return { uri: fileId['@id'], name: parseFileName(fileId['@id']) - } - }) - } else if (field === 'depiction') oldDepiction = val + }; + }); + } else if (field === 'depiction') oldDepiction = val; else if (Array.isArray(defaultDataset[field]) && Array.isArray(val)) { dataset[field] = val.map((entry) => { - return entry?.['@value'] ?? entry - }) + return entry?.['@value'] ?? entry; + }); } else if (typeof defaultDataset[field] === 'object') { Object.entries(defaultDataset[field]).forEach(([subfield]) => { if (typeof val?.[0]?.[subfield] !== 'undefined') { - dataset[field][subfield] = val?.[0]?.[subfield] + dataset[field][subfield] = val?.[0]?.[subfield]; } - }) + }); } else if (typeof val[0]['@value'] !== 'undefined') { - dataset[field] = datasetLd[uri][0]['@value'] + dataset[field] = datasetLd[uri][0]['@value']; } } - }) - return [dataset, oldDistributions, oldDepiction] + }); + return [dataset, oldDistributions, oldDepiction]; } // For extracting the original file name from the URI -function parseFileName (fileString, fullId = false) { +function parseFileName(fileString, fullId = false) { const dateString = - /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)-/ - let parsed - if (fullId) parsed = fileString.split('api/files/').pop() - else parsed = fileString.split(dateString).pop() - return parsed.split('?')[0] + /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)-/; + let parsed; + if (fullId) parsed = fileString.split('api/files/').pop(); + else parsed = fileString.split(dateString).pop(); + return parsed.split('?')[0]; } const isValidOrcid = (identifier) => { - return /^(\d{4}-){3}\d{3}(\d|X)$/.test(identifier) -} + return /^(\d{4}-){3}\d{3}(\d|X)$/.test(identifier); +}; export { getDefaultDataset, @@ -401,4 +401,4 @@ export { loadDataset, isValidOrcid, parseFileName -} +}; diff --git a/app/src/pages/explorer/curate/sdd/SddForm.vue b/app/src/pages/explorer/curate/sdd/SddForm.vue index a8b36d9a..cbd3f89a 100644 --- a/app/src/pages/explorer/curate/sdd/SddForm.vue +++ b/app/src/pages/explorer/curate/sdd/SddForm.vue @@ -1,253 +1,500 @@ diff --git a/app/src/pages/explorer/curate/sdd/SddLinking.vue b/app/src/pages/explorer/curate/sdd/SddLinking.vue index 9c731b9f..94d1ae7e 100644 --- a/app/src/pages/explorer/curate/sdd/SddLinking.vue +++ b/app/src/pages/explorer/curate/sdd/SddLinking.vue @@ -384,19 +384,19 @@ diff --git a/app/src/pages/explorer/dataset/Dataset.vue b/app/src/pages/explorer/dataset/Dataset.vue index 688300d4..4429d2fb 100644 --- a/app/src/pages/explorer/dataset/Dataset.vue +++ b/app/src/pages/explorer/dataset/Dataset.vue @@ -307,16 +307,16 @@ diff --git a/app/src/pages/explorer/dataset/DatasetGallery.vue b/app/src/pages/explorer/dataset/DatasetGallery.vue index 938bf75d..9b6419aa 100644 --- a/app/src/pages/explorer/dataset/DatasetGallery.vue +++ b/app/src/pages/explorer/dataset/DatasetGallery.vue @@ -1,29 +1,35 @@ diff --git a/app/src/router/index.js b/app/src/router/index.js index 8bd59c10..095b068a 100644 --- a/app/src/router/index.js +++ b/app/src/router/index.js @@ -1,19 +1,19 @@ -import Vue from 'vue' -import VueRouter from 'vue-router' -import store from '@/store/index.js' -import ExplorerBase from '@/pages/explorer/Base.vue' -import MetamineBase from '@/pages/metamine/Base.vue' -import NanomineBase from '@/pages/nanomine/Base.vue' -import PortalBase from '@/pages/portal/Base.vue' -import XsdBase from '@/pages/portal/curation/xsd/Base.vue' -import NotFound from '@/pages/NotFound.vue' -import nanomineRoutes from '@/router/module/nanomine' -import metamineRoutes from '@/router/module/metamine' -import explorerRoutes from '@/router/module/explorer' -import portalRoutes from '@/router/module/portal' -import xsdRoutes from '@/router/module/xsd' -import nsRoutes from './module/ns' -Vue.use(VueRouter) +import Vue from 'vue'; +import VueRouter from 'vue-router'; +import store from '@/store/index.js'; +import ExplorerBase from '@/pages/explorer/Base.vue'; +import MetamineBase from '@/pages/metamine/Base.vue'; +import NanomineBase from '@/pages/nanomine/Base.vue'; +import PortalBase from '@/pages/portal/Base.vue'; +import XsdBase from '@/pages/portal/curation/xsd/Base.vue'; +import NotFound from '@/pages/NotFound.vue'; +import nanomineRoutes from '@/router/module/nanomine'; +import metamineRoutes from '@/router/module/metamine'; +import explorerRoutes from '@/router/module/explorer'; +import portalRoutes from '@/router/module/portal'; +import xsdRoutes from '@/router/module/xsd'; +import nsRoutes from './module/ns'; +Vue.use(VueRouter); const routes = [ { @@ -63,26 +63,26 @@ const routes = [ { path: '/mm:notFound(.*)', component: NotFound }, { path: '/nm:notFound(.*)', component: NotFound }, { path: '/:notFound(.*)', component: NotFound } -] +]; const router = new VueRouter({ mode: 'history', routes, - scrollBehavior (to, _, prevPosition) { + scrollBehavior(to, _, prevPosition) { if (prevPosition) { - return prevPosition + return prevPosition; } if (to.hash) { return { el: to.hash, behavior: 'smooth' - } + }; } - return { x: 0, y: 0 } + return { x: 0, y: 0 }; } -}) +}); -router.beforeEach(async function (to, _, next) { +router.beforeEach(async function (to, from, next) { if (to.meta.requiresAuth && !store.getters['auth/isAuthenticated']) { if (!store.getters['auth/isAuthenticated']) { store.commit( @@ -92,19 +92,22 @@ router.beforeEach(async function (to, _, next) { duration: 1500 }, { root: true } - ) + ); - await store.dispatch('auth/tryLogin') + await store.dispatch('auth/tryLogin'); if (store.getters['auth/isAuthenticated']) { - return next() + store.commit('setRouteInfo', { to, from }); + return next(); } } - next('') + next(''); } else if (to.meta.requiresUnauth && store.getters.auth.isAuthenticated) { - next() + store.commit('setRouteInfo', { to, from }); + next(); } else { - next() + store.commit('setRouteInfo', { to, from }); + next(); } -}) +}); -export default router +export default router; diff --git a/app/src/store/modules/misc/getters.js b/app/src/store/modules/misc/getters.js index ead24afb..17965358 100644 --- a/app/src/store/modules/misc/getters.js +++ b/app/src/store/modules/misc/getters.js @@ -1,14 +1,17 @@ export default { - appHeaderInfo (state) { - return state.appHeaderInfo + appHeaderInfo(state) { + return state.appHeaderInfo; }, - countDownDate (state) { - return state.countDownDate + countDownDate(state) { + return state.countDownDate; }, - dialogBox (state) { - return state.dialogBox + dialogBox(state) { + return state.dialogBox; }, - getSnackbar (state) { - return state.snackbar + getSnackbar(state) { + return state.snackbar; + }, + getRouteInfo(state) { + return state.routeInfo; } -} +}; diff --git a/app/src/store/modules/misc/index.js b/app/src/store/modules/misc/index.js index 3959333d..50b54aaf 100644 --- a/app/src/store/modules/misc/index.js +++ b/app/src/store/modules/misc/index.js @@ -1,10 +1,10 @@ -import mutations from './mutations.js' -import actions from './actions.js' -import getters from './getters.js' +import mutations from './mutations.js'; +import actions from './actions.js'; +import getters from './getters.js'; export default { // namespaced: true, - state () { + state() { return { appHeaderInfo: { icon: '', @@ -21,10 +21,11 @@ export default { callToActionText: 'Retry' }, countDownDate: new Date('March 22, 2023 13:30:00').getTime(), - uploadedFile: null - } + uploadedFile: null, + routeInfo: {} + }; }, mutations, actions, getters -} +}; diff --git a/app/src/store/modules/misc/mutations.js b/app/src/store/modules/misc/mutations.js index 6e914910..02676b2d 100644 --- a/app/src/store/modules/misc/mutations.js +++ b/app/src/store/modules/misc/mutations.js @@ -1,11 +1,11 @@ export default { - setAppHeaderInfo (state, info) { - state.appHeaderInfo = info + setAppHeaderInfo(state, info) { + state.appHeaderInfo = info; }, - setDialogBox (state) { - state.dialogBox = !state.dialogBox + setDialogBox(state) { + state.dialogBox = !state.dialogBox; }, - setSnackbar ( + setSnackbar( state, { message, action = null, duration = false, callToActionText = 'Retry' } ) { @@ -14,17 +14,20 @@ export default { action, duration, callToActionText - } + }; }, - resetSnackbar (state) { + resetSnackbar(state) { state.snackbar = { message: '', action: null, duration: 0, // Indicate reset callToActionText: 'Retry' - } + }; }, - setUploadedFile (state, str) { - state.uploadedFile = str + setUploadedFile(state, str) { + state.uploadedFile = str; + }, + setRouteInfo(state, info) { + state.routeInfo = info; } -} +}; diff --git a/docker-compose.yml b/docker-compose.yml index c8b809e9..87692bea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -189,8 +189,8 @@ services: - fuseki stdin_open: true command: - /opt/venv/bin/gunicorn wsgi:application --workers ${WEB_CONCURRENCY:-8} - --timeout 0 -b :8000 + # twistd -n web --port tcp:8000 --wsgi wsgi:appliction + /opt/venv/bin/gunicorn wsgi:application --workers 4 --timeout 300 -b :8000 environment: - CHOKIDAR_USEPOLLING=true - NM_GRAPH_AUTH_SECRET=${TKNS} @@ -200,8 +200,8 @@ services: - ./mockDB/fuseki:/app/run ports: - '8000:8000' - mem_limit: 2048m - cpus: '0.25' + # mem_limit: 2048m + # cpus: '0.25' fuseki: build: whyis command: /opt/venv/bin/fuseki-server --mem /ds @@ -219,8 +219,8 @@ services: - '3030:3030' volumes: - ./mockDB/fuseki:/fuseki - mem_limit: 3072m - cpus: '0.45' + # mem_limit: 3072m + # cpus: '0.45' volumes: mockDB: diff --git a/mockDB/whyis-init.sh b/mockDB/whyis-init.sh new file mode 100755 index 00000000..08f87cfa --- /dev/null +++ b/mockDB/whyis-init.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Run the `whyis load` command inside the container +/opt/venv/bin/whyis load -f turtle -i 'https://raw.githubusercontent.com/tetherless-world/SemanticDataDictionary/master/sdd-ontology.ttl' +# Always use the .trig file as this overwrite the existing one +# /opt/venv/bin/whyis load -f trig -i 'https://raw.githubusercontent.com/Duke-MatSci/materialsmine/develop/ontology/materialsmine.trig' +/opt/venv/bin/whyis load -f turtle -i 'https://raw.githubusercontent.com/Duke-MatSci/materialsmine/develop/ontology/materialsmine.ttl' \ No newline at end of file diff --git a/whyis/Dockerfile b/whyis/Dockerfile index cf7414f3..3c6c8b32 100644 --- a/whyis/Dockerfile +++ b/whyis/Dockerfile @@ -1,7 +1,8 @@ -FROM tetherlessworld/whyis:2.2.2 -RUN /opt/venv/bin/pip install whyis-unit-converter==0.0.2 +FROM tetherlessworld/whyis:2.3.10 RUN apt-get update -RUN apt install -y git +RUN /opt/venv/bin/pip install whyis-unit-converter==0.0.2 +# RUN /opt/venv/bin/pip install twisted[tls] +# RUN apt install -y git COPY ./materialsmine /app WORKDIR '/app' CMD [ "/bin/bash" ] diff --git a/whyis/Dockerfile.dev b/whyis/Dockerfile.dev index 83432f03..bb301a7a 100644 --- a/whyis/Dockerfile.dev +++ b/whyis/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM tetherlessworld/whyis:latest +FROM tetherlessworld/whyis:2.3.8 RUN /opt/venv/bin/pip install whyis-unit-converter==0.0.2 WORKDIR '/app' CMD [ "/bin/bash" ] diff --git a/whyis/materialsmine/whyis.conf b/whyis/materialsmine/whyis.conf index b65fe616..d425c824 100644 --- a/whyis/materialsmine/whyis.conf +++ b/whyis/materialsmine/whyis.conf @@ -130,8 +130,8 @@ NAMESPACES = [ INFERENCERS = { "SDDAgent": autonomic.SDDAgent(), "SETLr": autonomic.SETLr(), - "SETLMaker": autonomic.SETLMaker(), - "CacheUpdater" : autonomic.CacheUpdater(), + # "SETLMaker": autonomic.SETLMaker(), + #"CacheUpdater" : autonomic.CacheUpdater(), "UnitConverter": converter.UnitConverter(), "SurfaceEnergyGen": materialsmine.SurfaceEnergyGen(), "AbstractAnnotator" : materialsmine.AbstractAnnotator(),