Skip to content

Commit

Permalink
Merge pull request #41 from edmcouncil/40-fix-slf4j-warning
Browse files Browse the repository at this point in the history
Fix SLF4J warning
  • Loading branch information
mereolog authored Nov 29, 2022
2 parents 8f950fb + b8c5ae8 commit f6780c1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
29 changes: 20 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@

<groupId>org.edmcouncil</groupId>
<artifactId>rdf-toolkit</artifactId>
<version>1.14.0</version>
<version>1.14.1</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>

<!-- Versions -->
<slf4j.version>2.0.4</slf4j.version>
<logback.version>1.4.4</logback.version>
<junit.jupiter.version>5.9.0</junit.jupiter.version>
</properties>
Expand All @@ -39,6 +40,22 @@
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand All @@ -47,14 +64,14 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.9</version>
<version>1.10.0</version>
</dependency>

<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.5.0</version>
</dependency>

<dependency>
<groupId>org.eclipse.rdf4j</groupId>
<artifactId>rdf4j-storage</artifactId>
Expand Down Expand Up @@ -83,12 +100,6 @@
<version>2.3.3</version>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public class SortedTurtleWriter extends SortedRdfWriter {
// Turtle allows "values" in RDF collections
private static final Class<Value> COLLECTION_CLASS = Value.class;

/**
* RDF Types that are preferred to be used first.
*/
private final List<IRI> preferredRdfTypes = new ArrayList<>(PREFERRED_RDF_TYPES);

/** Output stream for this Turtle writer. */
private final IndentingWriter output;

Expand Down Expand Up @@ -143,6 +148,10 @@ public void startRDF() throws RDFHandlerException {
*/
@Override
public void endRDF() throws RDFHandlerException {
if (suppressNamedIndividuals) {
preferredRdfTypes.remove(Constants.owlNamedIndividual);
}

try {
// Sort triples, etc.
sortedOntologies = unsortedOntologies.toSorted(COLLECTION_CLASS, comparisonContext);
Expand Down Expand Up @@ -254,7 +263,7 @@ protected void writeSubjectTriples(Writer out, Resource subject) throws Exceptio
List<Value> valuesList = new ArrayList<>();
if (values != null && !values.isEmpty()) {
if (predicate == Constants.RDF_TYPE) {
for (IRI preferredType : PREFERRED_RDF_TYPES) {
for (IRI preferredType : preferredRdfTypes) {
if (values.contains(preferredType)) {
valuesList.add(preferredType);
values.remove(preferredType);
Expand Down

0 comments on commit f6780c1

Please sign in to comment.