diff --git a/app/js/config.js b/app/js/config.js index ca67ac7..133ab18 100644 --- a/app/js/config.js +++ b/app/js/config.js @@ -12,7 +12,7 @@ angular.module('GSB.config', []) ] }, queryURL: 'http://dbpedia.org/sparql?format=text%2Fhtml&timeout=5000&debug=on&query=', - testURLstart: 'http://dbpedia.org/sparql?format=json&timeout=30000&debug=on&query=', + testURLstart: 'http://dbpedia-live.openlinksw.com/sparql/?default-graph-uri=http%3A%2F%2Fdbpedia.org&format=json&timeout=30000&debug=on&query=', testURLend: '', baseURL: 'http://' + (location.host + location.pathname).substring(0,(location.host + location.pathname).lastIndexOf('app/') + 4), propertyOperators : [ diff --git a/app/js/services/availableClasses.js b/app/js/services/availableClasses.js index eda45d5..c877735 100644 --- a/app/js/services/availableClasses.js +++ b/app/js/services/availableClasses.js @@ -230,37 +230,14 @@ angular.module('GSB.services.availableClasses', ['GSB.config']) factory.buildAllInversePropertyQuery = function (uri) { var query = globalConfig.testURLstart; - - query += escape('select distinct ?propertyDomain ?propertyURI ?propertyRange ?propertyAlias where {{<'); - query += escape(uri); - query += escape('> rdfs:subClassOf+ ?class.{ ' - + ' ?propertyURI rdfs:domain ?class . ' - + ' ?propertyURI rdfs:domain ?propertyDomain . ' - + ' OPTIONAL { ?propertyURI rdfs:range ?propertyRange . } . ' - + ' OPTIONAL { ' - + ' ?propertyURI rdfs:label ?propertyAlias. ' - + ' FILTER(LANGMATCHES(LANG(?propertyAlias), "en")) ' - + ' } . ' - + ' OPTIONAL { ' - + ' ?propertyURI rdfs:comment ?propertyComment. ' - + ' FILTER(LANGMATCHES(LANG(?propertyComment), "en")) ' - + ' } ' - + ' } ' - + ' } UNION { ' - + ' ?propertyURI rdfs:domain <'); - query += escape(uri); - query += escape('>. ' - + ' ?propertyURI rdfs:domain ?propertyDomain . ' - + ' OPTIONAL { ?propertyURI rdfs:range ?propertyRange . } . ' - + ' OPTIONAL { ' - + ' ?propertyURI rdfs:label ?propertyAlias. ' - + ' FILTER(LANGMATCHES(LANG(?propertyAlias), "en")) ' - + ' } . ' - + ' OPTIONAL { ' - + ' ?propertyURI rdfs:comment ?propertyComment. ' - + ' FILTER(LANGMATCHES(LANG(?propertyComment), "en")) }}' ); + query += encodeURIComponent('select distinct ?propertyRange ?propertyURI ?propertyDomain ?propertyAlias ?propertyComment where {\n {\n <'+ + uri + + '> rdfs:subClassOf+ ?class.\n {\n ?propertyURI rdfs:range ?class . \n ?propertyURI rdfs:range ?propertyDomain .\n OPTIONAL { ?propertyURI rdfs:domain ?propertyRange . } .\n OPTIONAL {\n ?propertyURI rdfs:label ?propertyAlias.\n FILTER(LANGMATCHES(LANG(?propertyAlias), "en"))\n } . \n OPTIONAL {\n ?propertyURI rdfs:comment ?propertyComment.\n FILTER(LANGMATCHES(LANG(?propertyComment), "en"))\n }\n } \n } UNION {\n ?propertyURI rdfs:range <'+ + uri+ + '>.\n ?propertyURI rdfs:range ?propertyDomain . \n OPTIONAL { ?propertyURI rdfs:domain ?propertyRange . } .\n OPTIONAL {\n ?propertyURI rdfs:label ?propertyAlias.\n FILTER(LANGMATCHES(LANG(?propertyAlias), "en"))\n } . \n OPTIONAL {\n ?propertyURI rdfs:comment ?propertyComment.\n FILTER(LANGMATCHES(LANG(?propertyComment), "en"))\n }\n } \n}'); query += globalConfig.testURLend; console.log(query); + return query; }; diff --git a/app/js/services/translatorToJSON.js b/app/js/services/translatorToJSON.js index 9d27185..2dd87b1 100644 --- a/app/js/services/translatorToJSON.js +++ b/app/js/services/translatorToJSON.js @@ -40,10 +40,11 @@ angular.module('GSB.services.translatorToJSON', ['GSB.config']) SUBJECTS: [] }, allSubjects = angular.copy(subjects); - + console.log(allSubjects) allSubjects.map(function (currentSubject) { delete currentSubject["availableProperties"]; - currentSubject.properties = currentSubject["selectedProperties"].map(function (currentProperty) { + delete currentSubject["availableInverseProperties"]; + currentSubject.properties = currentSubject["selectedProperties"].concat(currentSubject["selectedInverseProperties"]).map(function (currentProperty) { delete currentProperty["propertyType"]; if (currentProperty.link.linkPartner !== null && currentProperty.link.linkPartner.hasOwnProperty("alias")) { currentProperty.link.linkPartner = currentProperty.link.linkPartner.alias; @@ -53,6 +54,7 @@ angular.module('GSB.services.translatorToJSON', ['GSB.config']) return currentProperty; }); delete currentSubject["selectedProperties"]; + delete currentSubject["selectedInverseProperties"]; return currentSubject; });