Skip to content

Commit

Permalink
fixing minor issues
Browse files Browse the repository at this point in the history
*added new message when running local instance
*enabled editing in local instances (modes->editing, ontology->create new ontology)
*added expoter warning for when exporting ontologies with unsupported types (export as ttl is still alpha)
*fixed datatype property delte
  • Loading branch information
vitalis-wiens committed Oct 14, 2019
1 parent 6748490 commit 1e7a9b7
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 11 deletions.
4 changes: 3 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
52 changes: 50 additions & 2 deletions src/app/js/loadingModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(" <span style='color: red'>ERROR STATUS:</span> " + error.status);
if (error.status===0){ // assumption this is CORS error when running locally (error status == 0)
ontologyMenu.append_message_toLastBulletPoint(" <span style='color: red'>ERROR STATUS:</span> " + error.status);
if (window.location.toString().startsWith("file:/")){
ontologyMenu.append_message_toLastBulletPoint("<br><p>WebVOWL runs in a local instance.</p>");
ontologyMenu.append_message_toLastBulletPoint("<p>CORS prevents to automatically load files on host system.</p>");
ontologyMenu.append_message_toLastBulletPoint("<p>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.</p>");
ontologyMenu.append_message_toLastBulletPoint("<p><i>Hint: </i>Note that the conversion of ontologies into the VOWL-JSON format is not part of WebVOWL but requires an additional converter such as OWL2VOWL.</p>");
ontologyMenu.append_message_toLastBulletPoint("<p>Ontologies can be created using the editor mode (i.e. activate editing mode in <b>Modes</b> menu and create a new ontology using the <b>Ontology</b> menu.</p>");
}
}else {
ontologyMenu.append_message_toLastBulletPoint(" <span style='color: red'>ERROR STATUS:</span> " + error.status);
}



graph.handleOnLoadingError();
loadingModule.setErrorMode();
}
}
});
}
Expand Down
6 changes: 2 additions & 4 deletions src/app/js/menu/exportMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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 )


}
}

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/app/js/menu/exportTTLModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
5 changes: 5 additions & 0 deletions src/app/js/warningModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ){
Expand Down
4 changes: 2 additions & 2 deletions src/webvowl/js/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1e7a9b7

Please sign in to comment.