Skip to content

Commit aacfa19

Browse files
Merge pull request #642 from hmottestad/FastRdfsForwardChainingSail
Fix #643: Fast rdfs forward chaining sail
2 parents 2e23ddb + 30660b4 commit aacfa19

39 files changed

Lines changed: 4615 additions & 4 deletions

benchmark/pom.xml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
6+
<parent>
7+
<groupId>org.eclipse.rdf4j</groupId>
8+
<artifactId>rdf4j</artifactId>
9+
<version>2.2-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>rdf4j-benchmark</artifactId>
13+
14+
<name>RDF4J: benchmarks</name>
15+
<description></description>
16+
17+
18+
19+
<dependencies>
20+
<dependency>
21+
<groupId>org.openjdk.jmh</groupId>
22+
<artifactId>jmh-core</artifactId>
23+
<version>${jmhVersion}</version>
24+
</dependency>
25+
<dependency>
26+
<groupId>org.openjdk.jmh</groupId>
27+
<artifactId>jmh-generator-annprocess</artifactId>
28+
<version>${jmhVersion}</version>
29+
<scope>compile</scope>
30+
</dependency>
31+
<dependency>
32+
<groupId>${project.groupId}</groupId>
33+
<artifactId>rdf4j-repository-sail</artifactId>
34+
<version>${project.version}</version>
35+
</dependency>
36+
<dependency>
37+
<groupId>${project.groupId}</groupId>
38+
<artifactId>rdf4j-sail-inferencer</artifactId>
39+
<version>${project.version}</version>
40+
</dependency>
41+
<dependency>
42+
<groupId>${project.groupId}</groupId>
43+
<artifactId>rdf4j-sail-memory</artifactId>
44+
<version>${project.version}</version>
45+
</dependency>
46+
<dependency>
47+
<groupId>${project.groupId}</groupId>
48+
<artifactId>rdf4j-rio-turtle</artifactId>
49+
<version>${project.version}</version>
50+
</dependency>
51+
</dependencies>
52+
53+
<properties>
54+
<jmhVersion>0.9.3</jmhVersion>
55+
</properties>
56+
57+
<build>
58+
<plugins>
59+
<plugin>
60+
<groupId>org.apache.maven.plugins</groupId>
61+
<artifactId>maven-shade-plugin</artifactId>
62+
<executions>
63+
<execution>
64+
<phase>package</phase>
65+
<goals>
66+
<goal>shade</goal>
67+
</goals>
68+
<configuration>
69+
<finalName>rdf4j-benchmark</finalName>
70+
<transformers>
71+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
72+
<mainClass>org.openjdk.jmh.Main</mainClass>
73+
</transformer>
74+
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
75+
</transformers>
76+
</configuration>
77+
</execution>
78+
</executions>
79+
</plugin>
80+
81+
82+
</plugins>
83+
</build>
84+
</project>

benchmark/runBenchmarks.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
mvn install && java -jar target/rdf4j-benchmark.jar -wi 10 -i 10 -f 3 -gc
3+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2016 Eclipse RDF4J contributors.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Distribution License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/org/documents/edl-v10.php.
7+
*******************************************************************************/
8+
9+
package org.eclipse.rdf4j.benchmark;
10+
11+
import org.eclipse.rdf4j.repository.sail.SailRepository;
12+
import org.eclipse.rdf4j.sail.inferencer.fc.ForwardChainingRDFSInferencer;
13+
import org.eclipse.rdf4j.sail.memory.MemoryStore;
14+
15+
/**
16+
* @author Håvard Mikkelsen Ottestad
17+
*/
18+
public class ForwardChainingRDFSInferencerBenchmark extends InitializationBenchmark {
19+
20+
@Override
21+
SailRepository getSail(SailRepository schema) {
22+
return new SailRepository(new ForwardChainingRDFSInferencer(new MemoryStore()));
23+
}
24+
25+
@Override
26+
Class getSailClass() {
27+
return ForwardChainingRDFSInferencer.class;
28+
}
29+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2016 Eclipse RDF4J contributors.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Distribution License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/org/documents/edl-v10.php.
7+
*******************************************************************************/
8+
9+
package org.eclipse.rdf4j.benchmark;
10+
11+
import org.eclipse.rdf4j.repository.sail.SailRepository;
12+
import org.eclipse.rdf4j.sail.inferencer.fc.ForwardChainingSchemaCachingRDFSInferencer;
13+
import org.eclipse.rdf4j.sail.memory.MemoryStore;
14+
15+
/**
16+
* @author Håvard Mikkelsen Ottestad
17+
*/
18+
public class ForwardChainingSchemaCachingRDFSInferencerBenchmark extends InitializationBenchmark {
19+
20+
@Override
21+
SailRepository getSail(SailRepository schema) {
22+
return new SailRepository(new ForwardChainingSchemaCachingRDFSInferencer(new MemoryStore(), schema));
23+
}
24+
25+
@Override
26+
Class getSailClass() {
27+
return ForwardChainingSchemaCachingRDFSInferencer.class;
28+
}
29+
30+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2016 Eclipse RDF4J contributors.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Distribution License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/org/documents/edl-v10.php.
7+
*******************************************************************************/
8+
9+
package org.eclipse.rdf4j.benchmark;
10+
11+
import org.eclipse.rdf4j.repository.sail.SailRepository;
12+
import org.openjdk.jmh.annotations.Benchmark;
13+
import org.openjdk.jmh.annotations.BenchmarkMode;
14+
import org.openjdk.jmh.annotations.Mode;
15+
import org.openjdk.jmh.annotations.OutputTimeUnit;
16+
import org.openjdk.jmh.annotations.Scope;
17+
import org.openjdk.jmh.annotations.State;
18+
19+
import java.util.concurrent.TimeUnit;
20+
21+
/**
22+
* @author Håvard Mikkelsen Ottestad
23+
*/
24+
25+
@State(Scope.Thread)
26+
abstract class InitializationBenchmark {
27+
28+
abstract SailRepository getSail(SailRepository schema);
29+
30+
abstract Class getSailClass();
31+
32+
@Benchmark
33+
@BenchmarkMode(Mode.AverageTime)
34+
@OutputTimeUnit(TimeUnit.MILLISECONDS)
35+
public void initialize() {
36+
37+
getSail(null).initialize();
38+
}
39+
40+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2016 Eclipse RDF4J contributors.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Distribution License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/org/documents/edl-v10.php.
7+
*******************************************************************************/
8+
9+
package org.eclipse.rdf4j.benchmark;
10+
11+
import org.eclipse.rdf4j.repository.sail.SailRepository;
12+
import org.eclipse.rdf4j.sail.memory.MemoryStore;
13+
14+
/**
15+
* @author Håvard Mikkelsen Ottestad
16+
*/
17+
public class NoReasoningBenchmark extends InitializationBenchmark {
18+
19+
@Override
20+
SailRepository getSail(SailRepository schema) {
21+
return new SailRepository(new MemoryStore());
22+
}
23+
24+
@Override
25+
Class getSailClass() {
26+
return MemoryStore.class;
27+
}
28+
}

0 commit comments

Comments
 (0)