diff --git a/app/translator/translatorXchangeURIs.js b/app/translator/translatorXchangeURIs.js index 5282651..c5438c8 100644 --- a/app/translator/translatorXchangeURIs.js +++ b/app/translator/translatorXchangeURIs.js @@ -113,6 +113,7 @@ function translateAll (json) { var translated = []; var SPARQL = ""; + json = replaceAliasSpaces(json); for(var i = 0; i < json.SUBJECTS.length; i++) { @@ -321,6 +322,29 @@ function translateDatatypeProperty (itsSubject, eigenschaft, shownValues, transl } +/* + * little helper function to replace spaces in aliases with an underscore + */ +function replaceAliasSpaces(json) { + + var patt = new RegExp("[^A-Za-z0-9_]","g"); + + + for(var i = 0; i < json.SUBJECTS.length; i++) { + + json.SUBJECTS[i].alias = json.SUBJECTS[i].alias.replace(patt, "_"); + + for(var j = 0; j < json.SUBJECTS[i].properties.length; j++) { + + json.SUBJECTS[i].properties[j].alias = json.SUBJECTS[i].properties[j].alias.replace(patt, "_"); + } + } + + return json; +} + + + /* * little helper function to check, if an object obj is present in an array arr */