Commit 6df34663 authored by akucera's avatar akucera
Browse files

changes to the test bench + update to apache jena 3.2.0

parent d392ad5c
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
package cz.muni.fi.lasaris.sbms.semantics.logic;
package cz.muni.fi.lasaris.sbms.semantics.logic;


import java.util.LinkedList;
import java.util.List;
import java.util.List;


import org.apache.jena.graph.NodeFactory;
import org.apache.jena.graph.NodeFactory;
@@ -26,7 +25,7 @@ import cz.muni.fi.lasaris.sbms.semantics.api.request.GroupableRequest;
import cz.muni.fi.lasaris.sbms.semantics.api.request.TrendsRequest;
import cz.muni.fi.lasaris.sbms.semantics.api.request.TrendsRequest;


public class BodyBuilders {
public class BodyBuilders {
	
	/*
	private static class TypeClauseContainer {
	private static class TypeClauseContainer {
		public String f1;
		public String f1;
		public String f2;
		public String f2;
@@ -40,7 +39,7 @@ public class BodyBuilders {
			this.f4 = f4;
			this.f4 = f4;
		}
		}
	}
	}
	
	*/
	public static ElementGroup getQueryBody(DataPointsRequest request) {
	public static ElementGroup getQueryBody(DataPointsRequest request) {
		return getQueryBody(request.getDataPoint(), request);
		return getQueryBody(request.getDataPoint(), request);
	}
	}
@@ -48,6 +47,8 @@ public class BodyBuilders {
	private static ElementGroup getQueryBody(DataPoint dp, GroupableRequest request) {
	private static ElementGroup getQueryBody(DataPoint dp, GroupableRequest request) {
		ElementGroup body = new ElementGroup();
		ElementGroup body = new ElementGroup();
		
		
		// https://gregheartsfield.com/2012/08/26/jena-arq-query-performance.html
		
		// type clauses moved to the end of the query as it significantly decreases performance
		// type clauses moved to the end of the query as it significantly decreases performance
		//List<TypeClauseContainer> tcc = new LinkedList<TypeClauseContainer>();
		//List<TypeClauseContainer> tcc = new LinkedList<TypeClauseContainer>();
		
		
+0 −1
Original line number Original line Diff line number Diff line
@@ -142,7 +142,6 @@ public class TdbConnector {
			throw new IllegalStateException("Path not set");
			throw new IllegalStateException("Path not set");
		}
		}
		logger.debug("Opening writable model...");
		logger.debug("Opening writable model...");
		dataset.close();
		dataset.begin(ReadWrite.WRITE);
		dataset.begin(ReadWrite.WRITE);
		return dataset.getDefaultModel();
		return dataset.getDefaultModel();
	}
	}
+17 −10
Original line number Original line Diff line number Diff line
@@ -22,11 +22,13 @@ The aim of the benchmarking is to prove that the qeury performance is sufficent
a primary design goal during the development.
a primary design goal during the development.


The prerequisities to run this benchmark are:
The prerequisities to run this benchmark are:
 - Apache Jena - the distribution should be downloaded and extracted to the hard drive
 - Apache Jena 3.2.0 - 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.
 - Apache Tomcat 8.5 or higher - the distribution should be downloaded and extracted to the hard drive. Then, The JAVA_HOME environment variable must be set manually.


Usage:
Usage:


0) If you intend to use the provided pre-generated data or custom dataset, proceed directly to step 3 and use the optional parameter to specify the correct input file.

1)  [Optional] Run the script Generate-CSVs.ps1
1)  [Optional] Run the script Generate-CSVs.ps1
    The script generates CSV files into the CSV-Data folder.
    The script generates CSV files into the CSV-Data folder.
    Optional parameters:
    Optional parameters:
@@ -35,24 +37,27 @@ Usage:
        -Floors [Default: 3] - number of floors in each building 
        -Floors [Default: 3] - number of floors in each building 
        -Rooms [Default: 10] - number of rooms in each floor    
        -Rooms [Default: 10] - number of rooms in each floor    


    Pre-generated CSV files for the default configuration are available in the CSV-Data folder.

2)  [Optional] Run the script Generate-Triples.ps1
2)  [Optional] Run the script Generate-Triples.ps1
    The script generates an N-Triples file into the NT-Data folder, based on the CSV files located in the .\CSV-Data folder.
    The script generates an N-Triples file into the NT-Data folder, based on the CSV files located in the .\CSV-Data folder.

    Optional parameters:
    Pre-generated NT file for the default test mock-up is available in the NT-Data folder.
        -InFolder [Default: .\CSV-Data] - location of the source CSV files generated by Generate-CSVs script

        -OutFile [Default: .\NT-Data\data.nt] - location of the output NT File
    The process of Triples generation is universal and can be performed with existing CSV when using real facility data 
    The process of Triples generation is universal and can be performed with existing CSV when using real facility data 
    instead of a generated mock-up created by Generate-CSVs script.
    instead of a generated mock-up created by Generate-CSVs script.


    Pre-generated NT file for the test mock-up with the default size is available in the NT-Data folder as sample.nt.

3)  Run the script Create-TDB.ps1
3)  Run the script Create-TDB.ps1
    The script will create the TDB triplestore using the Apache Jena framework.
    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):
    Optional parameters:
        -TDBPath [Default: \apache-tomcat-9.0.0.M19\webapps\sbms\WEB-INF\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
        -NTPath [Default: .\NT-Data\data.nt] - Path to the source NT file
        -JenaRoot [Default: \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
    If you intend to use pre-generated sample dataset, run the command as follows:
    Create-TDB.ps1 -NTPath .\NT-Data\sample.nt

    Statistics of the TDB can be found in the <Your tdb location>\stats.opt file.


4)  Deploy the Semantic API into the Apache Tomcat (see Readme on the project site)
4)  Deploy the Semantic API into the Apache Tomcat (see Readme on the project site)


@@ -71,6 +76,8 @@ Usage:
    If you did not start the Apache Tomcat in the previous step, use the -ManageTomcat switch. You can also set the path to 
    If you did not start the Apache Tomcat in the previous step, use the -ManageTomcat switch. You can also set the path to 
    the Apache Tomcat installation directory by the -TomcatHome param (Default is C:\apache-tomcat-9.0.0.M19)
    the Apache Tomcat installation directory by the -TomcatHome param (Default is C:\apache-tomcat-9.0.0.M19)


    

8)  [Optional] Stop the Apache Tomcat
8)  [Optional] Stop the Apache Tomcat
    Execute the bin\shutdown.bat script if you did not use the -ManageTomcat option and started the server manually in the step 6) 
    Execute the bin\shutdown.bat script if you did not use the -ManageTomcat option and started the server manually in the step 6) 
 
 
+3 −3
Original line number Original line Diff line number Diff line
NT-Data/
/NT-Data/data.nt
CSV-Data/
/CSV-Data/
test_runs.txt

TestBench/CSV-Data/datapoints.csv

deleted100644 → 0
+0 −3051

File deleted.

Preview size limit exceeded, changes collapsed.

Loading