Skip to content

Commit

Permalink
Adjusted Inverse Object Properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
leipert committed Apr 28, 2014
1 parent e70798f commit c97fe2b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app/js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 : [
Expand Down
35 changes: 6 additions & 29 deletions app/js/services/availableClasses.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Expand Down
6 changes: 4 additions & 2 deletions app/js/services/translatorToJSON.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -53,6 +54,7 @@ angular.module('GSB.services.translatorToJSON', ['GSB.config'])
return currentProperty;
});
delete currentSubject["selectedProperties"];
delete currentSubject["selectedInverseProperties"];
return currentSubject;
});

Expand Down

0 comments on commit c97fe2b

Please sign in to comment.