diff --git a/Gruntfile.js b/Gruntfile.js index c84ecc8a..c5cbbef5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -129,8 +129,10 @@ module.exports = function (grunt) { options: webpackConfig, build: { plugins: webpackConfig.plugins.concat( + // minimize the deployed code + //new webpack.optimize.UglifyJsPlugin(), new webpack.optimize.DedupePlugin() - // new webpack.optimize.UglifyJsPlugin() + ) }, "build-dev": { diff --git a/package.json b/package.json index ead0547b..f01b936d 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,9 @@ { "name": "webvowl", - "version": "1.1.6", + "version": "1.1.7", "dependencies": { "d3": "^3.5.6", + "grunt-cli": "^1.3.2", "lodash": "^4.1.0" }, "devDependencies": { diff --git a/src/app/js/loadingModule.js b/src/app/js/loadingModule.js index ee763cb4..e065b71a 100644 --- a/src/app/js/loadingModule.js +++ b/src/app/js/loadingModule.js @@ -502,11 +502,12 @@ module.exports = function ( graph ){ function loadPresetOntology( ontology ){ // check if already cached in ontology menu? var f2r; + var loadingNewOntologyForEditor=false; if ( ontology.indexOf("new_ontology") !== -1 ) { loadingModule.hideLoadingIndicator(); graph.showEditorHintIfNeeded(); f2r = "./data/new_ontology.json"; - + loadingNewOntologyForEditor=true; } loadingWasSuccessFul = false; @@ -532,11 +533,58 @@ module.exports = function ( graph ){ ontologyContent = request.responseText; parseOntologyContent(ontologyContent); } else { + + if (loadingNewOntologyForEditor){ + ontologyContent = '{\n' + + ' "_comment": "Empty ontology for WebVOWL Editor",\n' + + ' "header": {\n' + + ' "languages": [\n' + + ' "en"\n' + + ' ],\n' + + ' "baseIris": [\n' + + ' "http://www.w3.org/2000/01/rdf-schema"\n' + + ' ],\n' + + ' "iri": "http://visualdataweb.org/newOntology/",\n' + + ' "title": {\n' + + ' "en": "New ontology"\n' + + ' },\n' + + ' "description": {\n' + + ' "en": "New ontology description"\n' + + ' }\n' + + ' },\n' + + ' "namespace": [],\n' + + ' "metrics": {\n' + + ' "classCount": 0,\n' + + ' "datatypeCount": 0,\n' + + ' "objectPropertyCount": 0,\n' + + ' "datatypePropertyCount": 0,\n' + + ' "propertyCount": 0,\n' + + ' "nodeCount": 0,\n' + + ' "individualCount": 0\n' + + ' }\n' + + '}\n'; + parseOntologyContent(ontologyContent); + }else{ // some error occurred ontologyMenu.append_bulletPoint("Failed to load: " + ontology); - ontologyMenu.append_message_toLastBulletPoint(" ERROR STATUS: " + error.status); + if (error.status===0){ // assumption this is CORS error when running locally (error status == 0) + ontologyMenu.append_message_toLastBulletPoint(" ERROR STATUS: " + error.status); + if (window.location.toString().startsWith("file:/")){ + ontologyMenu.append_message_toLastBulletPoint("

WebVOWL runs in a local instance.

"); + ontologyMenu.append_message_toLastBulletPoint("

CORS prevents to automatically load files on host system.

"); + ontologyMenu.append_message_toLastBulletPoint("

You can load preprocessed ontologies (i.e. VOWL-JSON files) using the upload feature in the ontology menu or by dragging the files and dropping them on the canvas.

"); + ontologyMenu.append_message_toLastBulletPoint("

Hint: Note that the conversion of ontologies into the VOWL-JSON format is not part of WebVOWL but requires an additional converter such as OWL2VOWL.

"); + ontologyMenu.append_message_toLastBulletPoint("

Ontologies can be created using the editor mode (i.e. activate editing mode in Modes menu and create a new ontology using the Ontology menu.

"); + } + }else { + ontologyMenu.append_message_toLastBulletPoint(" ERROR STATUS: " + error.status); + } + + + graph.handleOnLoadingError(); loadingModule.setErrorMode(); + } } }); } diff --git a/src/app/js/menu/exportMenu.js b/src/app/js/menu/exportMenu.js index 0a441a87..7d5d545c 100644 --- a/src/app/js/menu/exportMenu.js +++ b/src/app/js/menu/exportMenu.js @@ -50,10 +50,10 @@ module.exports = function ( graph ){ function exportTurtle(){ var success = exportTTLModule.requestExport(); var result = exportTTLModule.resultingTTL_Content(); + var ontoTitle = "NewOntology"; console.log("Exporter was successful: " + success); if ( success ) { // console.log("The result is : " + result); - var ontoTitle = "NewOntology"; // var ontoTitle=graph.options().getGeneralMetaObjectProperty('title'); // if (ontoTitle===undefined || ontoTitle.length===0) // ontoTitle="NewOntology"; @@ -79,8 +79,6 @@ module.exports = function ( graph ){ console.log("Stay on the page! " + window.location.href); exportTurtleButton.attr("href", window.location.href); d3.event.preventDefault(); // prevent the href to be called ( reloads the page otherwise ) - - } } @@ -387,7 +385,7 @@ module.exports = function ( graph ){ var i, j, k; // an index variable for the for-loops /** get data for exporter **/ - + if (!graph.options().data()) {return {};} // return an empty json object // extract onotology information; var unfilteredData = graph.getUnfilteredData(); var ontologyComment = graph.options().data()._comment; diff --git a/src/app/js/menu/exportTTLModule.js b/src/app/js/menu/exportTTLModule.js index a3ed6602..a2279348 100644 --- a/src/app/js/menu/exportTTLModule.js +++ b/src/app/js/menu/exportTTLModule.js @@ -428,7 +428,7 @@ module.exports = function ( graph ){ function prepareHeader(){ resultingTTLContent += "#################################################################\r\n"; - resultingTTLContent += "### Generated with the experimental alpha version of the TTL exporter of WebVOWL (version 1.1.3) " + + resultingTTLContent += "### Generated with the experimental alpha version of the TTL exporter of WebVOWL (version 1.1.7) " + " http://visualdataweb.de/webvowl/ ###\r\n"; resultingTTLContent += "#################################################################\r\n\r\n"; diff --git a/src/app/js/warningModule.js b/src/app/js/warningModule.js index 04b2a4d8..67bff150 100644 --- a/src/app/js/warningModule.js +++ b/src/app/js/warningModule.js @@ -189,6 +189,11 @@ module.exports = function ( graph ){ var id = warningModule.addMessageBox(); warningModule.createMessageContext(id); }; + + warningModule.showExporterWarning=function (){ + warningModule.showWarning("Can not export ontology", "Detected unsupported ontology axioms, (e.g. owl:Union)", "Ontology is not exported", 1, false); + }; + warningModule.responseWarning = function ( header, reason, action, callback, parameterArray, forcedWarning ){ diff --git a/src/webvowl/js/graph.js b/src/webvowl/js/graph.js index 12d6f011..7cb3c8b4 100644 --- a/src/webvowl/js/graph.js +++ b/src/webvowl/js/graph.js @@ -3369,9 +3369,9 @@ module.exports = function ( graphContainerSelector ){ remId = unfilteredData.nodes.indexOf(property.range()); if ( remId !== -1 ) unfilteredData.nodes.splice(remId, 1); + remId = classNodes.indexOf(property.range()); if ( remId !== -1 ) - remId = classNodes.indexOf(property.range()); - classNodes.splice(remId, 1); + classNodes.splice(remId, 1); datatype = null; } remId = unfilteredData.properties.indexOf(property);