From 58ad3111e9a74a557fa75a5fec6a9abd27c12994 Mon Sep 17 00:00:00 2001 From: Lana <48616148+pskLana@users.noreply.github.com> Date: Thu, 2 Jul 2020 17:12:29 +0200 Subject: [PATCH] Added interaface for the exploration of the results #232 --- limes-web-ui/package-lock.json | 5 + limes-web-ui/package.json | 1 + limes-web-ui/public/index.html | 1 + .../src/components/DoneButtonsComponent.vue | 246 +++++++++++++++++- 4 files changed, 245 insertions(+), 8 deletions(-) diff --git a/limes-web-ui/package-lock.json b/limes-web-ui/package-lock.json index 6b833a19e..0b956eac3 100644 --- a/limes-web-ui/package-lock.json +++ b/limes-web-ui/package-lock.json @@ -11743,6 +11743,11 @@ "integrity": "sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==", "dev": true }, + "vuejs-paginate": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vuejs-paginate/-/vuejs-paginate-2.1.0.tgz", + "integrity": "sha512-gnwyXlmCiDOu9MLWxN5UJ4PGijKGNOMpHG8ujsrynCzTJljn/rp7Jq0WiDGDAMi5/u0AHuYIHhced+tUW4jblA==" + }, "vuex": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/vuex/-/vuex-3.1.1.tgz", diff --git a/limes-web-ui/package.json b/limes-web-ui/package.json index 2c3317afa..059d2ab34 100644 --- a/limes-web-ui/package.json +++ b/limes-web-ui/package.json @@ -12,6 +12,7 @@ "core-js": "^2.6.5", "sass-loader": "^7.1.0", "vue": "^2.6.10", + "vuejs-paginate": "^2.1.0", "vuex": "^3.1.1" }, "devDependencies": { diff --git a/limes-web-ui/public/index.html b/limes-web-ui/public/index.html index a530a157d..e3d38483a 100644 --- a/limes-web-ui/public/index.html +++ b/limes-web-ui/public/index.html @@ -166,5 +166,6 @@ + diff --git a/limes-web-ui/src/components/DoneButtonsComponent.vue b/limes-web-ui/src/components/DoneButtonsComponent.vue index 8e38798cd..d0a0757d4 100644 --- a/limes-web-ui/src/components/DoneButtonsComponent.vue +++ b/limes-web-ui/src/components/DoneButtonsComponent.vue @@ -12,6 +12,17 @@ + + + + + +
+ +
+
+
+ Job status @@ -34,6 +45,7 @@ + Explore the results
Save the execution key for checking the state later: {{jobId}}
@@ -75,6 +87,61 @@
+ + + Explore the results +
Iteration: {{exploreResultsArray.iteration}}
+ + + +
+ +
{{(pageNum*10-10)+index+1+"."}}
+
{{i.source}}
+
{{i.target}}
+ Show table + + + - +
+ + + + {{iteratorResults[activeLearningTableForNum].source}} + {{iteratorResults[activeLearningTableForNum].target}} + + + + + + + {{row.predicate}}
+ {{row.object}} +
+ + {{iteratorResults[activeLearningTableForNum].targetContext[index].predicate}}
+ {{iteratorResults[activeLearningTableForNum].targetContext[index].object}} +
+
+
+
+
+
+ + +
+ + + Skip iteration + Continue execution + +
+ Supervised active ML dialog @@ -117,8 +184,8 @@ - Skip iteration - Continue execution + Skip iteration + Continue execution @@ -170,6 +237,7 @@ export default { return { configText: '', // execution progress + spinnerRunning: false, jobId: '', jobRunning: false, jobShowResult: false, @@ -187,6 +255,45 @@ export default { findStatusMessage: '', exampleConfigEnable: false, activeLearningArray: {}, + exploreResultsArray: {"requestId" : "6a835f2e725bb8", + "iteration" : 1, + "examples" : [ + { + "source" : "http://some.domain.tld/someSourceUri", + "target" : "http://some.domain.tld/someTargetUri", + "sourceContext" : [ + { + "predicate" : "http://some.domain.tld/somePredicateUri", + "object" : "http://some.domain.tld/somObjectUri" + }, + { + "predicate" : "http://some.domain.tld/somePredicateUri1", + "object" : "http://some.domain.tld/somObjectUri1" + }, + { + "predicate" : "http://some.domain.tld/somePredicateUri2", + "object" : "http://some.domain.tld/somObjectUri2" + }, + ], + "targetContext" : [ + { + "predicate" : "http://some.domain.tld/somePredicateUri", + "object" : "http://some.domain.tld/somObjectUri0" + }, + { + "predicate" : "http://some.domain.tld/somePredicateUri1", + "object" : "http://some.domain.tld/somObjectUri10" + }, + { + "predicate" : "http://some.domain.tld/somePredicateUri2", + "object" : "http://some.domain.tld/somObjectUri20" + }, + ] + }, + ] + }, + iteratorResults: null, + pageNum: 1, radioButton: [], activeLearningTableForNum: null, } @@ -324,6 +431,8 @@ ${data.type && data.type.length ? ` ${data.type}` : ''} }, // open this window if mlalgorithm.type === 'supervised active' openActiveWindow(){ + this.spinnerRunning = true; + this.$refs.spinnerDialog.open(); this.jobError = false; const config = this.generateConfig(); const configBlob = new Blob([config], {type: 'text/xml'}); @@ -343,6 +452,8 @@ ${data.type && data.type.length ? ` ${data.type}` : ''} this.radioButton.push(false); }); this.activeLearningArray = r; + this.spinnerRunning = false; + this.$refs.spinnerDialog.close(); this.$refs.supervisedActiveMLDialog.open(); }) .catch(e => { @@ -372,15 +483,22 @@ ${data.type && data.type.length ? ` ${data.type}` : ''} }); return exampleScores; }, - skipIteration(){ - this.continueExecute(true); + skipIteration(exploreResultsString){ + if(exploreResultsString.length){ + this.continueExecute(true, exploreResultsString); + } else{ + this.continueExecute(true); + } }, - continueExecute(isSkip){ - + continueExecute(isSkip, exploreResultsString){ + let backendUrl = window.LIMES_SERVER_URL + '/activeLearning/'+this.activeLearningArray.requestId; + if(exploreResultsString.length){ + backendUrl = window.LIMES_SERVER_URL + '/exploreResults/'+this.exploreResultsArray.requestId;//another url + } let exampleScores = this.calculateScores(isSkip); // send them: http://localhost:8080/activeLearning/6a835f2e725bb8 - fetch(window.LIMES_SERVER_URL + '/activeLearning/'+this.activeLearningArray.requestId, { + fetch(backendUrl, { method: 'post', body: JSON.stringify({"exampleScores" : exampleScores}), }) @@ -414,7 +532,7 @@ ${data.type && data.type.length ? ` ${data.type}` : ''} }, // execute button execute() { - this.limesServerUrl = window.LIMES_SERVER_URL; + this.limesServerUrl = window.LIMES_SERVER_URL; this.jobError = false; const config = this.generateConfig(); const configBlob = new Blob([config], {type: 'text/xml'}); @@ -487,6 +605,10 @@ ${data.type && data.type.length ? ` ${data.type}` : ''} history.pushState({}, '', '?'); this.$refs.jobDialog.close(); }, + exploreResults(){ + this.$refs.exploreResultsDialog.open(); + this.iteratorResults = this.exploreResultsArray.examples.slice(0,10); + }, //button check the state of the previous one showDialogForPreviousRun(){ @@ -563,6 +685,114 @@ ${data.type && data.type.length ? ` ${data.type}` : ''} }) } }, + clickCallback (pageNum){ + console.log(pageNum) + this.pageNum = pageNum; + let size = 10; + let from = pageNum*size-size; + let to = pageNum*size; + console.log(from, to); + this.iteratorResults = this.exploreResultsArray.examples.slice(from, to); + }, } } + +