Skip to content

Commit

Permalink
Reduced the size of the dependencies download
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Emmons committed Mar 8, 2019
1 parent 41f092b commit cffec9b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
6 changes: 2 additions & 4 deletions jena/JenaGraph/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,9 @@
</classpath>
<formatter type="xml"/>
<batchtest fork="yes" todir="${reportsDir}/${ant.project.name}">
<fileset dir="${basedir}/test" includes="**/*Test.java"
excludes="**/ComplexUnionGraphTest.java"/>
<!--fileset dir="${basedir}/test" includes="**/IndexExecutionTest.java"/-->
<fileset dir="${basedir}/test" includes="**/*Test.java"/>
<!--fileset dir="${basedir}/test" includes="**/KbOpExecutorDAWGTest.java"/-->
<!--fileset dir="${basedir}/test" includes="**/KbUnionGraphTest.java"/-->
<!--fileset dir="${basedir}/test" includes="**/ComplexUnionGraphTest.java"/-->
</batchtest>
</junit>
</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
public class ComplexUnionGraphTest {
private static final String ONT_RSRC = "univ-bench.owl";
private static final File INPUT_DATA_FILE = new File(
System.getProperty("test.data.path"), "gendata-80.zip");
System.getProperty("test.data.path"), "univ-bench-03.zip");
private static final File KB_DATA_DIR = new File("./union-test-kb-data");

@SuppressWarnings("unused")
private static final String QUERY1 = "" +
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
"PREFIX ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#> " +
Expand All @@ -62,6 +63,7 @@ public class ComplexUnionGraphTest {
" ub:emailAddress ?y2 ; " +
" ub:telephone ?y3 . " +
"}";
@SuppressWarnings("unused")
private static final String QUERY3 = "" +
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " +
"PREFIX ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#> " +
Expand All @@ -80,13 +82,18 @@ public class ComplexUnionGraphTest {
" ?x a ub:GraduateStudent ; " +
" ub:name ?y . " +
"}";
private static final String[] QUERYS = { QUERY1, QUERY2, QUERY3, QUERY4 };
private static final String[] QUERYS = {
//QUERY1,
QUERY2,
//QUERY3,
QUERY4
};

private static final Logger LOG = LoggerFactory.getLogger(ComplexUnionGraphTest.class);

@SuppressWarnings("static-method")
@Test
public void testCreateUnionGraph() throws IOException {
public void testComplexUnionGraph() throws IOException {
try (
KbGraph bigGraph = createGraph(KB_DATA_DIR, "big");
KbGraph graph0 = createGraph(KB_DATA_DIR, "0");
Expand Down Expand Up @@ -134,8 +141,13 @@ private static KbGraph createGraph(File rootDir, String relativeDirectory) {
File dir = new File(rootDir, relativeDirectory);
dir.mkdirs();
KbConfig config = new KbConfig();
KbConfig defaultConfig = new KbConfig();
config.readFromFile();
config.m_kbDirectoryPath = dir.getPath();
config.m_initialRsrcCapacity = defaultConfig.m_initialRsrcCapacity;
config.m_initialStmtCapacity = defaultConfig.m_initialStmtCapacity;
config.m_rsrcGrowthIncrement = defaultConfig.m_rsrcGrowthIncrement;
config.m_stmtGrowthIncrement = defaultConfig.m_stmtGrowthIncrement;
KbInstance.deleteKb(config, null);
return new KbGraph(config, relativeDirectory, OptimizationMethod.DefaultOptimization);
}
Expand All @@ -155,6 +167,7 @@ private static Model createModel(KbGraph g) throws IOException {

private static void loadUniversityData(Model m1, Model m2, int univNum) throws IOException {
LOG.info("Loading university #{}:", univNum);
long start = System.currentTimeMillis();
Pattern pattern = Pattern.compile(
String.format("^.*/University%1$d_.*$", univNum), Pattern.CASE_INSENSITIVE);
try (ZipFile zipFile = new ZipFile(INPUT_DATA_FILE)) {
Expand All @@ -164,15 +177,22 @@ private static void loadUniversityData(Model m1, Model m2, int univNum) throws I
if (!zipEntry.isDirectory() && pattern.matcher(zipEntry.getName()).matches()) {
Model tmpModel = ModelFactory.createDefaultModel();
RDFFormat rdfFmt = RDFFormat.parseFilename(zipEntry.getName());
long parseStart = System.currentTimeMillis();
try (InputStream strm = zipFile.getInputStream(zipEntry)) {
tmpModel.read(strm, null, rdfFmt.toString());
}
long parseDuration = System.currentTimeMillis() - parseStart;
long addStart = System.currentTimeMillis();
m1.add(tmpModel);
m2.add(tmpModel);
LOG.info(" Loaded {} statements from file '{}'", tmpModel.size(), zipEntry.getName());
long addDuration = System.currentTimeMillis() - addStart;
LOG.info(" Loaded {} statements from file '{}' in {} ms, added in {} ms",
tmpModel.size(), zipEntry.getName(), parseDuration, addDuration);
}
}
}
long duration = System.currentTimeMillis() - start;
LOG.info("Loaded university #{} in {} ms", univNum, duration);
}

private static long timeCount(String modelName, String query, Model model) {
Expand Down
3 changes: 2 additions & 1 deletion jena/TemporalIndexProcessor_old/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/JenaParliament"/>
<classpathentry combineaccessrules="false" kind="src" path="/Parliament"/>
<classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?project=TemporalIndexProcessor_old&amp;ivyXmlPath=ivy.xml&amp;confs=*"/>
<classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?project=TemporalIndexProcessor_old&amp;ivyXmlPath=ivy.xml&amp;confs=*&amp;ivySettingsPath=%24%7Bworkspace_loc%3Aivy-conf%2Fivysettings.xml%7D&amp;loadSettingsOnDemand=false&amp;ivyUserDir=&amp;propertyFiles=&amp;acceptedTypes=jar%2Cbundle%2Cejb%2Cmaven-plugin&amp;alphaOrder=false&amp;resolveInWorkspace=false&amp;transitiveResolve=true&amp;readOSGiMetadata=false&amp;retrievedClasspath=true&amp;retrievedClasspathPattern=lib%2F%5Bconf%5D%2F%5Bartifact%5D-%5Brevision%5D.%5Bext%5D&amp;retrievedClasspathSync=false&amp;retrievedClasspathTypes=jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/JosekiParliamentClient"/>
<classpathentry kind="output" path="bin"/>
</classpath>

0 comments on commit cffec9b

Please sign in to comment.