Commit 1384aab5 authored by akucera's avatar akucera
Browse files

tweaks to the testbench and global readme

parent ad6639fa
......@@ -19,26 +19,22 @@ ResearchGate profile: https://www.researchgate.net/profile/Adam_Kucera/
## How To
To deploy the application in Apache Tomcat container (tested for Tomcat 9):
* Set up the SemanticAPI to use your TDB (sample data can be created using the scripts in the testBench project)
To deploy the application in Apache Tomcat container (tested for Tomcat 9, requires Servlet 3.0 implementation):
* Create a directory named sbms in the webapps folder of your tomcat installation (e.g. C:\apache-tomcat-9.0.0.M19\webapps\sbms)
* Copy the files from the SemanticBMSClient project into the sbms/client directory
Set up the SemanticAPI to use your TDB (sample data can be created using the scripts in the testBench project)
* Update the tdb.path property in the semantics.properties file
* Build the SemanticAPI/DataAccessAPI project using maven:
```
mvn install
mvn war:exploded
mvn clean install
```
* Create a directory named sbms in the webapps folder of your tomcat installation (e.g. C:\apache-tomcat-9.0.0.M19\webapps)
* Copy the resulting build (located in <Your git repositoty>\semanticBMS\SemanticAPI\target\SemanticAPI-1.0 for the SemanticAPI)
* Copy the resulting build (located in <Your git repository>/semanticBMS/SemanticAPI/target/SemanticAPI-1.0 for the SemanticAPI)
into the new directory directory (e.g. C:\apache-tomcat-9.0.0.M19\webapps\sbms) - the WEB-INF and META-INF folders
are meant to be placed directly in the sbms directory (and merged from both projects)
* Check the ont-policy.rdf file and update paths to the local ontology definitions if needed (both in the source project and in the Tomcat deployment)
* Run the Apache Tomcat
* The APIs are available at http://localhost:8080/sbms/semantics and http://localhost:8080/sbms/data
* To test the Semantic API, visit http://localhost:8080/sbms/semantics/types/type or run the performance tests.
* The simple client for testing purposes is available at http://localhost:8080/sbms/client/query.html (default credentials are user/resu and admin/nimda)
Note: For simple testing, SemanticBMSServer can be used. However, this is discouraged option.
SemanticBMSServer is a legacy Maven project for Eclipse that can be executed using Maven Build with Goal set to exec:java.
Additional configuration is required in the server.properties, as well as in the SemanticClient scripts.js file.
(the project is based on Jersey tutorial that can be found here: https://jersey.java.net/documentation/latest/getting-started.html)
......@@ -13,6 +13,18 @@ Each room is equipped with a temperature sensor, a humidity sensor, a motion sen
For each of the data points, there are two trends defined - one in the PLC iself, the other in the archive historian database.
The benchmarking procedure consist of several API calls to the datapoints endpoint. The queries test following scenarios:
- Queryying for all available information about specific data point
- Selecting data points according to number of restrictions (e.g. specific device type and observed property at certain location)
- Selecting large number of data points based on loose criteria (all temeprature sensors located on specific site)
The aim of the benchmarking is to prove that the qeury performance is sufficent to intended purposes, as the performance was not
a primary design goal during the development.
The prerequisities to run this benchmark are:
- Apache Jena - the distribution should be downloaded and extracted to the hard drive
- Apache Tomcat 9 - the distribution should be downloaded and extracted to the hard drive. Then, The JAVA_HOME environment variable must be set manually.
Usage:
1) [Optional] Run the script Generate-CSVs.ps1
......@@ -36,9 +48,11 @@ Usage:
3) Run the script Create-TDB.ps1
The script will create the TDB triplestore using the Apache Jena framework.
Optional parameters (no need to set them if they not differ from the defaults):
-TDBPath [Default: .\NT-Data\tdb] - location of the resulting TDB directory
-TDBPath [Default: \apache-tomcat-9.0.0.M19\webapps\sbms\WEB-INF\tdb] - location of the resulting TDB directory
-NTPath [Default: .\NT-Data\data.nt] - Path to the source NT file
-JenaRoot [Default: C:\apache-jena-3.2.0] - Path to the directory with the Apache Jena distribution
-JenaRoot [Default: \apache-jena-3.2.0] - Path to the directory with the Apache Jena distribution
Statistics of the TDB can be found in the <Your tdb location>\stats.opt file
4) Set up the SemanticAPI to use the created TDB
Update the tdb.path property in the semantics.properties file
......@@ -46,7 +60,7 @@ Usage:
5) Deploy the Semantic API into the Apache Tomcat
To deploy the application:
- Build the SemanticAPI project using maven:
- Build the SemanticAPI project using maven (Note: the exloded WAR is convenient when changing the setting in the properties files):
mvn install
mvn war:exploded
- Create a directory named sbms in the webapps folder of your tomcat installation (e.g. C:\apache-tomcat-9.0.0.M19\webapps)
......
[CmdletBinding()]
Param(
[String]$TDBPath=".\NT-Data\tdb\",
[String]$TDBPath="\apache-tomcat-9.0.0.M19\webapps\sbms\WEB-INF\tdb",
[String]$NTPath=".\NT-Data\data.nt",
[String]$JenaRoot="C:\apache-jena-3.2.0"
[String]$JenaRoot="\apache-jena-3.2.0"
)
Remove-Item .\tdb\
If(Test-Path $TDBPath) {
Remove-Item $TDBPath -Recurse
}
$env:JENAROOT = $jenaRoot
$env:Path = $env:Path +";" + $jenaRoot + "\bin;" + $jenaRoot + "\bat"
tdbloader --loc=$TDBPath $NtPath
& tdbloader.bat --loc=$TDBPath $NtPath
#tdbstats --loc=$TDBPath | Out-File TDB-Stats.txt
[CmdletBinding()]
Param()
.\Nt-Converters\Convert-Sites.ps1 -Csv .\CSV-Data\rooms.csv | Out-File -Encoding utf8 .\NT-Data\data.nt
.\Nt-Converters\Convert-Buildings.ps1 -Csv .\CSV-Data\rooms.csv | Out-File -Append -Encoding utf8 .\NT-Data\data.nt
.\Nt-Converters\Convert-Floors.ps1 -Csv .\CSV-Data\rooms.csv | Out-File -Append -Encoding utf8 .\NT-Data\data.nt
.\Nt-Converters\Convert-Rooms.ps1 -Csv .\CSV-Data\rooms.csv | Out-File -Append -Encoding utf8 .\NT-Data\data.nt
.\Nt-Converters\Convert-Devices.ps1 -Csv .\CSV-Data\rooms.csv | Out-File -Append -Encoding utf8 .\NT-Data\data.nt
.\Nt-Converters\Convert-DataPoints.ps1 | Out-File -Append -Encoding utf8 .\NT-Data\data.nt
.\Nt-Converters\Convert-Trends.ps1 | Out-File -Append -Encoding utf8 .\NT-Data\data.nt
\ No newline at end of file
.\Nt-Converters\Convert-Devices.ps1 -Csv .\CSV-Data\devices.csv | Out-File -Append -Encoding utf8 .\NT-Data\data.nt
.\Nt-Converters\Convert-DataPoints.ps1 -Csv .\CSV-Data\datapoints.csv | Out-File -Append -Encoding utf8 .\NT-Data\data.nt
.\Nt-Converters\Convert-Trends.ps1 -Csv .\CSV-Data\trends.csv | Out-File -Append -Encoding utf8 .\NT-Data\data.nt
\ No newline at end of file
[CmdletBinding()]
Param([switch]$ManageTomcat,
[String]$TomcatHome = "C:\apache-tomcat-9.0.0.M19"
[String]$TomcatHome = "\apache-tomcat-9.0.0.M19"
)
#Measure-Command { Invoke-WebRequest -URI http://localhost:8080/sbms/semantics/types/type } Select-Object TotalSeconds
......@@ -17,8 +18,12 @@ Function Request($url) {
}
if($ManageTomcat) {
If($env:JAVA_HOME -eq $null -or $env:JAVA_HOME -eq "") {
"JAVA_HOME is not set - set the environment variable correctly to run Apache Tomcat"
return;
}
$env:CATALINA_HOME=$TomcatHome
& C:\apache-tomcat-9.0.0.M19\bin\startup.bat
& $TomcatHome\bin\startup.bat
Pause
}
......@@ -31,5 +36,5 @@ Request http://localhost:8080/sbms/semantics/types/type
if($ManageTomcat) {
Pause
& C:\apache-tomcat-9.0.0.M19\bin\shutdown.bat
& $TomcatHome\bin\shutdown.bat
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment