Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #280

Merged
merged 8 commits into from
Oct 1, 2024
Merged
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
61 changes: 34 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@
<build.version>0</build.version>

<java.version>17</java.version>
<jena.version>4.2.0</jena.version>
<jena.version>5.1.0</jena.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compile.target>17</maven.compile.target>
<maven.compile.source>17</maven.compile.source>

<log4j.version>2.19.0</log4j.version>
</properties>

<distributionManagement>
Expand Down Expand Up @@ -76,38 +74,48 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.14</version>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.12.5</version>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.12.5</version>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>com.networknt</groupId>
<artifactId>json-schema-validator</artifactId>
<version>1.0.78</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.2</version>
<version>5.10.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>5.7.1</version>
<version>5.9</version>
</dependency>
<dependency>
<groupId>org.lz4</groupId>
Expand All @@ -117,7 +125,7 @@
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-common</artifactId>
<version>2.5.5</version>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>com.beust</groupId>
Expand All @@ -127,13 +135,13 @@
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<version>2.35.1</version>
<version>2.35.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.3</version>
<version>5.3.1</version>
</dependency>
</dependencies>

Expand All @@ -142,7 +150,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.13.0</version>
<configuration>
<source>17</source>
<target>17</target>
Expand All @@ -159,7 +167,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<version>3.3.1</version>
<configuration>
<argLine>-Xmx16384M</argLine>
</configuration>
Expand All @@ -169,7 +177,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<version>3.6.0</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<finalName>iguana</finalName>
Expand All @@ -195,17 +203,16 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.0</version>
<version>3.8.0</version>
<configuration>
<doclint>-html</doclint>
<reportOutputDirectory>javadoc/${revision}/</reportOutputDirectory>
<destDir></destDir>
</configuration>
</plugin>

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<version>3.3.1</version>
<executions>
<execution>
<id>copy-resources</id>
Expand Down Expand Up @@ -239,7 +246,7 @@
<!-- needs to be correct version fitting to junit-jupiter -->
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.9.2</version>
<version>1.10.3</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand All @@ -248,7 +255,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<version>3.4.1</version>
<executions>
<execution>
<id>run-script</id>
Expand Down Expand Up @@ -283,7 +290,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<version>3.2.5</version>
</plugin>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
package org.aksw.iguana.cc.lang.impl;

import com.fasterxml.jackson.core.JsonFactory;
import org.aksw.iguana.cc.lang.LanguageProcessor;
import org.json.simple.parser.ContentHandler;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.slf4j.Logger;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;

import static org.json.simple.parser.ParseException.ERROR_UNEXPECTED_EXCEPTION;

/**
* SAX Parser for SPARQL JSON Results.
Expand All @@ -30,22 +24,31 @@ public class SaxSparqlJsonResultCountingParser extends LanguageProcessor {

@Override
public LanguageProcessingData process(InputStream inputStream, long hash) {
var parser = new JSONParser();
var handler = new SaxSparqlJsonResultContentHandler();
try {
parser.parse(new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)), handler);
if (handler.isAskResult())
return new BooleanResultData(hash, handler.booleanResult(), handler.links(), null);
return new ResultCountData(hash, handler.solutions(), handler.boundValues(), handler.variables(), handler.links(), null);
JsonFactory factory = new JsonFactory();
try (var parser = factory.createParser(inputStream)) {
while (parser.nextToken() != null) {
switch (parser.getCurrentToken()) {
case START_OBJECT -> handler.startObject();
case END_OBJECT -> handler.endObject();
case START_ARRAY -> handler.startArray();
case END_ARRAY -> handler.endArray();
case FIELD_NAME -> handler.startObjectEntry(parser.getCurrentName());
case VALUE_STRING, VALUE_NUMBER_INT, VALUE_NUMBER_FLOAT, VALUE_NULL -> handler.primitive(parser.getValueAsString());
case VALUE_TRUE, VALUE_FALSE -> handler.primitive(parser.getBooleanValue());
}
}
} catch (IOException e) {
throw new RuntimeException(e);
} catch (ParseException e) {
LOGGER.error("Error while parsing SPARQL XML Results.", e);
LOGGER.error("Error while parsing SPARQL JSON Results.", e);
return new ResultCountData(hash, -1, -1, null, null, e);
}

if (handler.isAskResult())
return new BooleanResultData(hash, handler.booleanResult(), handler.links(), null);
return new ResultCountData(hash, handler.solutions(), handler.boundValues(), handler.variables(), handler.links(), null);
}

private static class SaxSparqlJsonResultContentHandler implements ContentHandler {
private static class SaxSparqlJsonResultContentHandler {
// TODO: code is unnecessary complicated

private boolean headFound = false;
Expand All @@ -64,18 +67,6 @@ private static class SaxSparqlJsonResultContentHandler implements ContentHandler
private final List<String> variables = new ArrayList<>();
private final List<String> links = new ArrayList<>();


@Override
public void startJSON() {
}

@Override
public void endJSON() throws ParseException {
if (inResults || inBindings || inBindingsArray || !headFound || objectDepth != 0)
throw new ParseException(ERROR_UNEXPECTED_EXCEPTION, "SPARQL Json Response was malformed.");
}

@Override
public boolean startObject() {
objectDepth += 1;
if (inBindingsArray) {
Expand All @@ -87,7 +78,6 @@ public boolean startObject() {
return true;
}

@Override
public boolean endObject() {
switch (objectDepth) {
case 1:
Expand All @@ -104,15 +94,13 @@ public boolean endObject() {
return true;
}

@Override
public boolean startArray() {
if (objectDepth == 2 && inResults && inBindings && !inBindingsArray) {
inBindingsArray = true;
}
return true;
}

@Override
public boolean endArray() {
if (inVars)
inVars = false;
Expand All @@ -125,7 +113,6 @@ public boolean endArray() {
}


@Override
public boolean startObjectEntry(String key) {
switch (objectDepth) {
case 1 -> {
Expand Down Expand Up @@ -156,11 +143,6 @@ public boolean startObjectEntry(String key) {
return true;
}

@Override
public boolean endObjectEntry() {
return true;
}

public boolean primitive(Object value) {
if (inVars)
variables.add(value.toString());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
package org.aksw.iguana.cc.lang.impl;

import org.aksw.iguana.cc.lang.LanguageProcessor;
import org.aksw.iguana.cc.storage.Storable;
import org.aksw.iguana.commons.rdf.IPROP;
import org.aksw.iguana.commons.rdf.IRES;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.rdf.model.ResourceFactory;
import org.slf4j.Logger;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
Expand All @@ -22,8 +15,6 @@
import java.util.List;
import java.util.Objects;

import static org.json.simple.parser.ParseException.ERROR_UNEXPECTED_EXCEPTION;

/**
* SAX Parser for SPARQL XML Results.
* For correct SPARQL XML Results it returns the number of solutions, bound values, the names of the variables and links.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/aksw/iguana/cc/metrics/impl/AvgQPS.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public Number calculateTaskMetric(List<HttpWorker> workers, List<HttpWorker.Exec
.reduce(BigDecimal.ZERO, BigDecimal::add);

try {
return sum.divide(BigDecimal.valueOf(data.length), 10, RoundingMode.HALF_UP);
return sum.divide(BigDecimal.valueOf(data.length), 10, RoundingMode.HALF_UP).stripTrailingZeros();
} catch (ArithmeticException e) {
return BigDecimal.ZERO;
}
Expand All @@ -37,7 +37,7 @@ public Number calculateWorkerMetric(HttpWorker.Config worker, List<HttpWorker.Ex
}

try {
return sum.divide(BigDecimal.valueOf(data.length), 10, RoundingMode.HALF_UP);
return sum.divide(BigDecimal.valueOf(data.length), 10, RoundingMode.HALF_UP).stripTrailingZeros();
} catch (ArithmeticException e) {
return BigDecimal.ZERO;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/aksw/iguana/cc/metrics/impl/NoQPH.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public Number calculateTaskMetric(List<HttpWorker> workers, List<HttpWorker.Exec
final var sum = workers.stream()
.map(worker -> (BigDecimal) this.calculateWorkerMetric(worker.config(), data[(int) worker.getWorkerID()]))
.reduce(BigDecimal.ZERO, BigDecimal::add);
return sum;
return sum.stripTrailingZeros();
}

@Override
Expand All @@ -39,7 +39,7 @@ public Number calculateWorkerMetric(HttpWorker.Config worker, List<HttpWorker.Ex
BigDecimal tt = (new BigDecimal(BigInteger.valueOf(totalTime.toNanos()), 9)).divide(BigDecimal.valueOf(3600), 20, RoundingMode.HALF_UP);

try {
return successes.divide(tt, 10, RoundingMode.HALF_UP);
return successes.divide(tt, 10, RoundingMode.HALF_UP).stripTrailingZeros();
} catch (ArithmeticException e) {
return BigDecimal.ZERO;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/aksw/iguana/cc/metrics/impl/PAvgQPS.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public Number calculateTaskMetric(List<HttpWorker> workers, List<HttpWorker.Exec
.reduce(BigDecimal.ZERO, BigDecimal::add);

try {
return sum.divide(BigDecimal.valueOf(data.length), 10, RoundingMode.HALF_UP);
return sum.divide(BigDecimal.valueOf(data.length), 10, RoundingMode.HALF_UP).stripTrailingZeros();
} catch (ArithmeticException e) {
return BigDecimal.ZERO;
}
Expand All @@ -44,7 +44,7 @@ public Number calculateWorkerMetric(HttpWorker.Config worker, List<HttpWorker.Ex
}

try {
return sum.divide(BigDecimal.valueOf(data.length), 10, RoundingMode.HALF_UP);
return sum.divide(BigDecimal.valueOf(data.length), 10, RoundingMode.HALF_UP).stripTrailingZeros();
} catch (ArithmeticException e) {
return BigDecimal.ZERO;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/aksw/iguana/cc/metrics/impl/PQPS.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Number calculateQueryMetric(List<HttpWorker.ExecutionStats> data) {
BigDecimal tt = (new BigDecimal(BigInteger.valueOf(totalTime.toNanos()), 9));

try {
return numberOfExecutions.divide(tt, 10, RoundingMode.HALF_UP);
return numberOfExecutions.divide(tt, 10, RoundingMode.HALF_UP).stripTrailingZeros();
} catch (ArithmeticException e) {
return BigDecimal.ZERO;
}
Expand Down
Loading
Loading