Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ select ?time ?value {
## Building
* This is a plain Maven project
* a full build can be executed via `mvn package`
* KVIN ingestion benchmark instructions are in [docs/benchmarks/kvin-ingestion.md](docs/benchmarks/kvin-ingestion.md)

## Running
* change to the folder `launch/equinox`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;

import static org.junit.Assert.*;
Expand Down Expand Up @@ -148,4 +149,26 @@ public void shouldParseCsvDoubleValues() throws IOException {
assertFalse(tuples.hasNext());
}

@Test
public void shouldInterpretCsvValueTypes() throws IOException {
CsvFormatParser csvParser = new CsvFormatParser(URIs.createURI("urn:base:"), ';',
new ByteArrayInputStream("time;value\n123;42\n124;3.25\n125;TrUe\n126;\"quoted\"\n127;plain\n128;1.234,56\n"
.getBytes(StandardCharsets.UTF_8)));
IExtendedIterator<KvinTuple> tuples = csvParser.parse();
assertNotNull(tuples);

assertValue(tuples.next(), Long.class, 42L);
assertValue(tuples.next(), Double.class, 3.25d);
assertValue(tuples.next(), Boolean.class, true);
assertValue(tuples.next(), String.class, "quoted");
assertValue(tuples.next(), String.class, "plain");
assertValue(tuples.next(), Double.class, 1234.56d);
assertFalse(tuples.hasNext());
}

private static void assertValue(KvinTuple tuple, Class<?> type, Object expected) {
assertEquals(type, tuple.value.getClass());
assertEquals(expected, tuple.value);
}

}
51 changes: 51 additions & 0 deletions bundles/io.github.linkedfactory.service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,55 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>jmh</id>
<properties>
<jmh.includes>io.github.linkedfactory.service.benchmark.KvinIngestionBenchmark</jmh.includes>
<jmh.result.format>json</jmh.result.format>
<jmh.result.file>${project.build.directory}/jmh-result.json</jmh.result.file>
<jmh.warmups>3</jmh.warmups>
<jmh.warmup.time>3s</jmh.warmup.time>
<jmh.measurements>5</jmh.measurements>
<jmh.measurement.time>3s</jmh.measurement.time>
<jmh.forks>2</jmh.forks>
<jmh.temp.root></jmh.temp.root>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<executable>${java.home}/bin/java</executable>
<classpathScope>test</classpathScope>
<arguments>
<argument>-Djmh.temp.root=${jmh.temp.root}</argument>
<argument>-cp</argument>
<classpath/>
<argument>org.openjdk.jmh.Main</argument>
<argument>${jmh.includes}</argument>
<argument>-wi</argument>
<argument>${jmh.warmups}</argument>
<argument>-w</argument>
<argument>${jmh.warmup.time}</argument>
<argument>-i</argument>
<argument>${jmh.measurements}</argument>
<argument>-r</argument>
<argument>${jmh.measurement.time}</argument>
<argument>-f</argument>
<argument>${jmh.forks}</argument>
<argument>-rf</argument>
<argument>${jmh.result.format}</argument>
<argument>-rff</argument>
<argument>${jmh.result.file}</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,17 @@ public Function0<Box<LiftResponse>> apply(Req in) {
}

@BeforeClass
public static void setupClass() throws ClassNotFoundException {
public static void setupClass() {
// create configuration and a model set factory
KommaModule module = ModelPlugin.createModelSetModule(Class.forName("net.enilink.komma.model.ModelPlugin").getClassLoader());
IModelSetFactory factory = (IModelSetFactory) Guice.createInjector(new ModelSetModule(module)).getInstance(Class.forName("net.enilink.komma.model.IModelSetFactory"));
KommaModule module = ModelPlugin.createModelSetModule(ModelPlugin.class.getClassLoader());
IModelSetFactory factory =
Guice.createInjector(new ModelSetModule(module))
.getInstance(IModelSetFactory.class);
// create a model set with an in-memory repository
modelSet = factory.createModelSet(MODELS.NAMESPACE_URI.appendFragment("MemoryModelSet"));
Globals.contextModelSet().theDefault().set(VendorJ.vendor(new Full(modelSet)));
}

@AfterClass
public static void tearDownClass() {
modelSet.dispose();
Expand Down
Loading