Skip to content
This repository was archived by the owner on Apr 22, 2022. It is now read-only.

Commit a9853e9

Browse files
jjjj
authored andcommitted
Fixed TripleGeo database upload configuration
1 parent ea1c5fb commit a9853e9

File tree

6 files changed

+151
-42
lines changed

6 files changed

+151
-42
lines changed

src/main/webapp/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<div ng-controller="NavbarCtrl">
3737
<ul class="nav navbar-nav navbar-left">
3838
<li ng-class="getClass('/home')"><a href="#/"><div class="glyphicon glyphicon-cog"></div> Workbench </a></li>
39+
<!-- <li ng-class="getClass('/batch')""><a href="#/batch"><div class="glyphicon glyphicon-list"></div> Batch job </a></li> -->
3940
<li ng-class="getClass('/settings')"><a href="#/settings"><div class="glyphicon glyphicon-wrench"></div> Settings </a></li>
4041
</ul>
4142
<ul class="nav navbar-nav navbar-right">
@@ -86,6 +87,5 @@
8687
<script src="lib/angular-file-upload-master/angular-file-upload.min.js"></script>
8788
<script src="lib/angular-file-upload-master/FileAPI.min.js"></script>
8889
<script src="lib/angular-flash.min.js"></script>
89-
9090
</body>
9191
</html>

src/main/webapp/js/controllers.js

Lines changed: 123 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ app.controller('NavbarCtrl', function($scope, $location) {
7575
//}
7676
$scope.getClass = function(path) {
7777
if ($location.path().substr(0, path.length) === path) {
78-
return "active"
78+
return "active";
7979
} else {
80-
return ""
80+
return "";
8181
}
82-
}
82+
};
8383
});
8484

8585
app.controller('SidebarCtrl', function($scope, $location) {
@@ -137,7 +137,7 @@ var DataSourceTabCtrl = function($scope, $window, $location) {
137137
$scope.tabs.index = 0;
138138
$scope.tabs.active = function() {
139139
return $scope.tabs[$scope.tabs.index];
140-
}
140+
};
141141

142142
};
143143

@@ -405,15 +405,16 @@ var LimesCtrl = function($scope, $http, ConfigurationService, flash, ServerError
405405
idx : 0,
406406
source: "geom:geometry/geos:asWKT RENAME polygon",
407407
target: "geom:geometry/geos:asWKT RENAME polygon"
408-
},
408+
}
409+
/*
409410
{
410411
idx : 1,
411412
source: "geom:geometry/geos:asWKT RENAME polygon",
412413
target: "geom:geometry/geos:asWKT RENAME polygon"
413-
}]
414+
}*/]
414415
}];
415-
idx++;
416-
numberOfProps++;
416+
//idx++;
417+
//numberOfProps++;
417418

418419
}
419420
};
@@ -456,7 +457,6 @@ $scope.LaunchLimes = function(){
456457
}
457458

458459
numberOfProps = $scope.propsCopy[0].inputs.length;
459-
console.log(numberOfProps);
460460

461461
var params = {};
462462

@@ -540,6 +540,7 @@ $scope.LaunchLimes = function(){
540540
dataType: "json",
541541
contentType: "application/json; charset=utf-8"
542542
}).then(function(data){
543+
console.log(data);
543544
var result = data.data[0];
544545
if (result.length<3){
545546
$scope.limes.reviewResults = "No results to review";
@@ -558,7 +559,8 @@ $scope.LaunchLimes = function(){
558559
$scope.showProgress = false;
559560
$scope.inputForm = false;
560561
$scope.reviewForm = true;
561-
}, function (response){ // in the case of an error
562+
}, function (response){ // in the case of an error
563+
console.log(response);
562564
$scope.startLimes = false;
563565
$scope.showProgress = false;
564566
$scope.inputForm = true;
@@ -586,6 +588,7 @@ $scope.LaunchLimes = function(){
586588
params: {file : filename}})
587589

588590
.then(function(data) {
591+
589592
$scope.limes = {
590593
SourceServiceURI : data.data[0][0],
591594
TargetServiceURI : data.data[1][0],
@@ -628,9 +631,9 @@ $scope.LaunchLimes = function(){
628631
$scope.enterConfig = true;
629632
$scope.startLimes = true;
630633

631-
}, function (response){ // in the case of an error
632-
flash.error = ServerErrorResponse.getMessage(response.status);
633-
});
634+
}, function (response){ // in the case of an error
635+
flash.error = "Invalid LIMES Configuration file: " +response.data;
636+
});
634637

635638
if(response.data.status=="FAIL"){
636639
uploadError = true;
@@ -1299,9 +1302,19 @@ var GeoliftCtrl = function($scope, $http, ConfigurationService, flash, ServerErr
12991302
$scope.params[0].inputs[i].index = parseInt($('#indexid'+i).val());
13001303
}
13011304

1305+
var predicateCounter = 1;
1306+
var parameterText = null;
1307+
13021308
for(var i=0; i<$scope.params[0].inputs.length; i++){
1309+
if($('#parameter'+i+' option:selected').text() == "predicate"){
1310+
parameterText = $('#parameter'+i+' option:selected').text()+predicateCounter++;
1311+
}
1312+
if($('#parameter'+i+' option:selected').text() != "predicate"){
1313+
parameterText = $('#parameter'+i+' option:selected').text();
1314+
}
13031315
params[i+3] = $scope.params[0].inputs[i].index + " " + $('#module'+i+' option:selected').text() +
1304-
" " + $('#parameter'+i+' option:selected').text() + " " + $('#paramVal'+i+' option:selected').text();
1316+
" " + parameterText + " " + $('#paramVal'+i+' option:selected').text();
1317+
console.log(params[i+3]);
13051318
}
13061319

13071320
window.$windowScope = $scope;
@@ -1397,6 +1410,7 @@ var TripleGeoCtrl = function($scope, $http, ConfigurationService, flash, ServerE
13971410
var services = ConfigurationService.getComponentServices(":TripleGeo");
13981411
var serviceUrl = services[0].serviceUrl;
13991412
var configArray = new Array();
1413+
var dbConfigArray = new Array();
14001414

14011415
$scope.inputForm = true;
14021416
$scope.configOptions = true;
@@ -1430,15 +1444,39 @@ var TripleGeoCtrl = function($scope, $http, ConfigurationService, flash, ServerE
14301444
configArray[13] = ['targetRS', ''];
14311445
configArray[14] = ['defaultLang', ''];
14321446

1447+
dbConfigArray[0] = ['format', ''];
1448+
dbConfigArray[1] = ['targetStore', ''];
1449+
dbConfigArray[2] = ['dbType', ''];
1450+
dbConfigArray[3] = ['dbName', ''];
1451+
dbConfigArray[4] = ['dbUserName', ''];
1452+
dbConfigArray[5] = ['dbPassword', ''];
1453+
dbConfigArray[6] = ['dbHost', ''];
1454+
dbConfigArray[7] = ['dbPort', ''];
1455+
dbConfigArray[8] = ['resourceName', ''];
1456+
dbConfigArray[9] = ['tableName', ''];
1457+
dbConfigArray[10] = ['condition', ''];
1458+
dbConfigArray[11] = ['labelColumnName', ''];
1459+
dbConfigArray[12] = ['nameColumnName', ''];
1460+
dbConfigArray[13] = ['classColumnName', ''];
1461+
dbConfigArray[14] = ['geometryColumnName', ''];
1462+
dbConfigArray[15] = ['ignore', ''];
1463+
dbConfigArray[16] = ['nsPrefix', ''];
1464+
dbConfigArray[17] = ['nsURI', ''];
1465+
dbConfigArray[18] = ['ontologyNSPrefix', ''];
1466+
dbConfigArray[19] = ['ontologyNS', ''];
1467+
dbConfigArray[20] = ['sourceRS', ''];
1468+
dbConfigArray[21] = ['targetRS', ''];
1469+
dbConfigArray[22] = ['defaultLang', ''];
1470+
14331471
$scope.tooltips = { files: "When the file upload dialog opens, select the .shp, .shx, and .dbf files " +
14341472
"you wish to upload and process. Only these 3 files are necessary.",
14351473
data: "Change parameters to reflect the shapefile contents that will be extracted - case sensitive!",
14361474
ns: "Optional parameters. Change these parameters if you want to use different"+
1437-
"values for the namespaces and prefixes nsPrefix=georesource",
1438-
spatial: "Optional parameters. These fields should be filled in if a transformation between EPSG reference systems is needed"+
1439-
"If not specified, geometries are assumedto be WGS84 reference system (EPSG:4326).",
1475+
" values for the namespaces and prefixes nsPrefix=georesource",
1476+
spatial: "Optional parameters. These fields should be filled in if a transformation between EPSG reference systems is needed. "+
1477+
"If not specified, geometries are assumed to be WGS84 reference system (EPSG:4326).",
14401478
other: "Optional parameter. Default languages for the labels created in the output RDF. By default, the value is English - en."
1441-
}
1479+
};
14421480

14431481
$scope.options = {
14441482
database: false,
@@ -1514,12 +1552,12 @@ var TripleGeoCtrl = function($scope, $http, ConfigurationService, flash, ServerE
15141552

15151553
};
15161554
}
1517-
}
1555+
};
15181556

15191557
$scope.FillForm = function(example, name){
15201558

15211559
var params = {};
1522-
console.log(example + ' ' + name);
1560+
//console.log(example + ' ' + name);
15231561

15241562
if(example === "fileExample" && name === "Points shape file extraction"){
15251563

@@ -1549,7 +1587,7 @@ var TripleGeoCtrl = function($scope, $http, ConfigurationService, flash, ServerE
15491587
nsURI: "http://geoknow.eu/geodata#",
15501588
ontologyNSPrefix: "geo",
15511589
ontologyNS: "http://www.opengis.net/ont/geosparql#"
1552-
}
1590+
};
15531591
}
15541592

15551593
if(example === "database"){
@@ -1569,7 +1607,6 @@ var TripleGeoCtrl = function($scope, $http, ConfigurationService, flash, ServerE
15691607
format : $scope.options.format[2],
15701608
targetStore : $scope.options.targetStore[0],
15711609

1572-
15731610
dbtype: $scope.databases[i].dbType,
15741611
dbName: $scope.databases[i].dbName,
15751612
dbUserName: $scope.databases[i].dbUser,
@@ -1589,7 +1626,7 @@ var TripleGeoCtrl = function($scope, $http, ConfigurationService, flash, ServerE
15891626
nsURI: "http://geoknow.eu/geodata#",
15901627
ontologyNSPrefix: "geo",
15911628
ontologyNS: "http://www.opengis.net/ont/geosparql#"
1592-
}
1629+
};
15931630
}
15941631
}
15951632
}
@@ -1636,7 +1673,7 @@ var TripleGeoCtrl = function($scope, $http, ConfigurationService, flash, ServerE
16361673

16371674
}
16381675

1639-
}
1676+
};
16401677

16411678
$scope.loadShapeFile = function($files){
16421679
if($files.length!=3){
@@ -1675,6 +1712,7 @@ var TripleGeoCtrl = function($scope, $http, ConfigurationService, flash, ServerE
16751712
shp: inputFileName
16761713
}
16771714
}).then(function(data) {
1715+
if($scope.options.file == true){
16781716
for(var i=0; i<configArray.length; i++){
16791717
for(var j=0; j<data.data.length; j++){
16801718
if(configArray[i][0] === data.data[j][0]){
@@ -1704,7 +1742,62 @@ var TripleGeoCtrl = function($scope, $http, ConfigurationService, flash, ServerE
17041742
targetRS: configArray[13][1],
17051743

17061744
defaultLang: configArray[14][1],
1707-
}
1745+
};
1746+
}
1747+
1748+
if($scope.options.database == true){
1749+
1750+
for(var i=0; i<dbConfigArray.length; i++){
1751+
for(var j=0; j<data.data.length; j++){
1752+
if(dbConfigArray[i][0] === data.data[j][0]){
1753+
dbConfigArray[i][1] = data.data[j][1];
1754+
}
1755+
}
1756+
}
1757+
1758+
var inputDisplay = $scope.tripleGeoConfig.inputDisplay;
1759+
1760+
dbConfigArray[2][1] = $scope.tripleGeoConfig.dbtype;
1761+
dbConfigArray[3][1] = $scope.tripleGeoConfig.dbName;
1762+
dbConfigArray[4][1] = $scope.tripleGeoConfig.dbUserName;
1763+
dbConfigArray[5][1] = $scope.tripleGeoConfig.dbPassword;
1764+
dbConfigArray[6][1] = $scope.tripleGeoConfig.dbHost;
1765+
dbConfigArray[7][1] = $scope.tripleGeoConfig.dbPort;
1766+
1767+
$scope.tripleGeoConfig = {
1768+
1769+
inputDisplay: inputDisplay,
1770+
1771+
format: dbConfigArray[0][1],
1772+
targetStore: dbConfigArray[1][1],
1773+
1774+
dbtype: dbConfigArray[2][1],
1775+
dbName: dbConfigArray[3][1],
1776+
dbUserName: dbConfigArray[4][1],
1777+
dbPassword: dbConfigArray[5][1],
1778+
dbHost: dbConfigArray[6][1],
1779+
dbPort: dbConfigArray[7][1],
1780+
1781+
resourceName: dbConfigArray[8][1],
1782+
tableName: dbConfigArray[9][1],
1783+
condition: dbConfigArray[10][1],
1784+
labelColumnName: dbConfigArray[11][1],
1785+
nameColumnName: dbConfigArray[12][1],
1786+
classColumnName: dbConfigArray[13][1],
1787+
geometryColumnName: dbConfigArray[14][1],
1788+
ignore: dbConfigArray[15][1],
1789+
1790+
nsPrefix: dbConfigArray[16][1],
1791+
nsURI: dbConfigArray[17][1],
1792+
ontologyNSPrefix: dbConfigArray[18][1],
1793+
ontologyNS: dbConfigArray[19][1],
1794+
1795+
sourceRS: dbConfigArray[20][1],
1796+
targetRS: dbConfigArray[21][1],
1797+
1798+
defaultLang: dbConfigArray[22][1],
1799+
};
1800+
}
17081801

17091802
}, function (response){ // in the case of an error
17101803
flash.error = ServerErrorResponse.getMessage(response.status);
@@ -1720,7 +1813,7 @@ var TripleGeoCtrl = function($scope, $http, ConfigurationService, flash, ServerE
17201813
}
17211814
});
17221815
}
1723-
}
1816+
};
17241817

17251818
$scope.LaunchTripleGeo = function(){
17261819

@@ -1789,7 +1882,7 @@ var TripleGeoCtrl = function($scope, $http, ConfigurationService, flash, ServerE
17891882
var newWindow = $window.open('popup.html#/popup-triplegeo', 'frame', 'resizeable,height=600,width=800');
17901883
//$window.open('popup.html#/popup-limes', 'frame', 'resizeable,top=100,left=100,height=400,width=400');
17911884
newWindow.params = params;
1792-
}
1885+
};
17931886

17941887
$scope.startTripleGeo= function(){
17951888

@@ -1813,7 +1906,7 @@ var TripleGeoCtrl = function($scope, $http, ConfigurationService, flash, ServerE
18131906
flash.error = ServerErrorResponse.getMessage(response.status);
18141907
});
18151908

1816-
}
1909+
};
18171910

18181911
$scope.reviewTripleGeoResult = function(filetype){
18191912

@@ -1874,7 +1967,7 @@ var TripleGeoCtrl = function($scope, $http, ConfigurationService, flash, ServerE
18741967
});
18751968
};
18761969

1877-
}
1970+
};
18781971

18791972

18801973
/****************************************************************************************************
@@ -2040,7 +2133,7 @@ var ImportFormCtrl = function($scope, $http, ConfigurationService, flash) {
20402133
$scope.importFile = {file:"", graph:"?"};
20412134
$scope.importUrl = {url:"", graph:"?"};
20422135
$scope.importSparql = {endpoint:"", sparqlQuery:"", graph:"?"};
2043-
}
2136+
};
20442137
};
20452138

20462139

src/main/webapp/js/directives.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,5 @@ app.directive('uniqueIdentifier', ['$compile', 'ConfigurationService', function(
149149
return value;
150150
});
151151
}
152-
}
152+
};
153153
}]);

src/main/webapp/partials/enriching-and-cleaning/geolift.html

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
<script>
2-
$( "#clickme" ).click(function() {
3-
4-
$( this ).slideUp();
5-
//$( "#module0" ).remove();
6-
7-
});
8-
</script>
9-
101
<div class="contents" ng-controller="GeoliftCtrl">
112
<!-- Subscribe to all flash messages. -->
123
<div flash-alert active-class="in" class="alert fade" duration="10000">

src/main/webapp/partials/linking/limes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h5 class="green bold">LIMES Configuration</h5>
2929
<br>
3030
<div ng-show="configOptions">
3131
<div class="row" ng-controller="ImportFormCtrl">
32-
<label for="inputFile" class="col-xs-2 control-label">Upload a File</label>
32+
<label for="inputFile" class="col-xs-2 control-label">Upload a LIMES Configuration File (XML)</label>
3333
<div class="col-xs-8">
3434
<input id="lefile" class="form-control input-sm" type="file" ng-file-select="loadLimesXML($files)"
3535
multiple name="fileName" accept=".xml" style="display:none">

0 commit comments

Comments
 (0)