I am new in node.js.I downloaded and executed a project from GitHub from this link. Here on this link there is live demo of this app. It is running rdf search using wikidata. This is the function that I found for the search of keyword from wikidata written in file public/scripts/controllers/main.js.
function search () {
//TODO: fix when null;
if (vm.searchInput != vm.lastSearch) {
var input = vm.searchInput;
vm.lastSearch = input;
vm.searchWait = true;
vm.noResults = false;
//$http.get('https://www.wikidata.org/w/api.php?action=wbsearchentities&format=json&language=en&limit=20&uselang=en&type=item&continue=0&search='+input).then(
$http({
method: 'GET',
url: 'https://www.wikidata.org/w/api.php',
params: {
action: 'wbsearchentities',
format: 'json',
language: 'en',
uselang: 'en',
type: 'item',
continue: '0',
limit: '20',
search: input,
origin: '*',
}
}).then(
function onSuccess (response) {
onSearch(response.data.search);
},
function onError (response) { onSearchErr(); console.log('Error: ' + response.data); }
);
//request.execQuery(query.search(input), onSearch, onSearchErr);
}
vm.searchActive = true;
}
I have changed the above function for DBpedia but it not search the keyword from DBpedia
function search2 () {
//TODO: fix when null;
if (vm.searchInput != vm.lastSearch) {
var input = vm.searchInput;
vm.lastSearch = input;
vm.searchWait = true;
vm.noResults = false;
//$http.get('https://www.wikidata.org/w/api.php?action=wbsearchentities&format=json&language=en&limit=20&uselang=en&type=item&continue=0&search='+input).then(
$http({
method: 'GET',
url: 'http://dbpedia.org/sparql',
params: {
action: 'wbsearchentities',
format: 'json',
language: 'en',
uselang: 'en',
type: 'item',
continue: '0',
limit: '20',
search: input,
origin: '*',
}
}).then(
function onSuccess (response) {
onSearch(response.data.search);
},
function onError (response) { onSearchErr(); console.log('Error: ' + response.data); }
);
//request.execQuery(query.search(input), onSearch, onSearchErr);
}
vm.searchActive = true;
}
how I can change this above function for search in DBpedia?Please help