Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ server/common/build.info.js
.env
.idea
/.project
/nbproject/private/
/nbproject/private/
.DS_Store
nbproject/*
server/.DS_Store
server/api/.DS_Store
17 changes: 17 additions & 0 deletions server/api/services/wikidata.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ class WikidataService {
return res;
}

filterClaims(allClaims, claims) {
const newClaims = {};
for (let item of claims) {
if (Object.keys(allClaims).indexOf(item) !== -1 && Object.keys(allClaims).indexOf('P625') !== -1) {
newClaims[item] = allClaims[item];
} else if (Object.keys(allClaims).indexOf('P625') !== -1) {
newClaims['P625'] = allClaims['P625'];
}
}
return newClaims;
}

byIds(qids,locationName) {
// fetch fountains by their QIDs
Expand Down Expand Up @@ -115,7 +126,13 @@ class WikidataService {
}
// concatenate the fountains from each chunk into "dataAll"
dataAll = dataAll.concat(data);

});

dataAll.forEach((element, i) => {
element.claims = this.filterClaims(element.claims, ['P856', 'P973', 'P854', 'P2699', 'P625'])
})

if (1 == chkCnt) {
let dataAllSize = -1;
if (null != dataAll) {
Expand Down