Skip to content
Snippets Groups Projects
Commit bd7fbb12 authored by Esko Ikkala's avatar Esko Ikkala
Browse files

Do not capitalize base values

parent ea69f44a
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
......@@ -14,7 +14,11 @@ export const groupBy = (sparqlBindings, group, simplify) => Object.values(_.redu
result[group] = value.value;
} else {
if (simplify) {
result[key] = capitalizeFirstLetter(value.value);
if (key === 'basicElement') {
result[key] = value.value;
} else {
result[key] = capitalizeFirstLetter(value.value);
}
} else {
const oldVal = result[key];
// add new value if it doesn't already exist
......
import GeographicLib from 'geographiclib';
// import GeographicLib from 'geographiclib';
import SparqlApi from './SparqlApi';
import datasetConfig from './Datasets';
import {
......@@ -45,33 +45,33 @@ class SparqlSearchEngine {
this.getResults(queryTerm, datasetId))).then(mergeResults);
}
getComparisonResults() {
const { endpoint, comparisonQuery } = datasetConfig['kotus'];
const sparqlApi = new SparqlApi({ endpoint });
//console.log(comparisonQuery)
return this.doSearch(comparisonQuery, sparqlApi, mapResults).then((results) => {
// console.log(results)
const geod = GeographicLib.Geodesic.WGS84;
let filtered = [];
for (let i = 0; i < results.length; i++) {
for (let j = i + 1; j < results.length; j++) {
const resultObj = geod.Inverse(results[i].lat, results[i].long, results[j].lat, results[j].long, GeographicLib.Geodesic.DISTANCE);
//console.log(resultObj);
if (resultObj.s12 >= 4000) {
console.log('near: ' + resultObj.s12)
console.log(results[i])
console.log(results[j])
filtered.push(results[i]);
filtered.push(results[j]);
} else {
console.log('far away: ' + resultObj.s12)
}
}
}
console.log(filtered)
return filtered;
});
}
// getComparisonResults() {
// const { endpoint, comparisonQuery } = datasetConfig['kotus'];
// const sparqlApi = new SparqlApi({ endpoint });
// //console.log(comparisonQuery)
// return this.doSearch(comparisonQuery, sparqlApi, mapResults).then((results) => {
// // console.log(results)
// const geod = GeographicLib.Geodesic.WGS84;
// let filtered = [];
// for (let i = 0; i < results.length; i++) {
// for (let j = i + 1; j < results.length; j++) {
// const resultObj = geod.Inverse(results[i].lat, results[i].long, results[j].lat, results[j].long, GeographicLib.Geodesic.DISTANCE);
// //console.log(resultObj);
// if (resultObj.s12 >= 4000) {
// console.log('near: ' + resultObj.s12)
// console.log(results[i])
// console.log(results[j])
// filtered.push(results[i]);
// filtered.push(results[j]);
// } else {
// console.log('far away: ' + resultObj.s12)
// }
// }
// }
// console.log(filtered)
// return filtered;
// });
// }
// getSuggestions(queryTerm, datasetId) {
// const { endpoint, suggestionQuery } = datasetConfig[datasetId];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment