From ba4b0c687d8ea59728628faa6bedfca3564073f8 Mon Sep 17 00:00:00 2001 From: Martin Ledvinka Date: Wed, 19 Dec 2018 08:34:48 +0100 Subject: [PATCH] [Upd] Updated dependencies. --- pom.xml | 32 ++++++------- .../environment/StatementCopyingHandler.java | 32 +++++++------ .../environment/model/Organization.java | 24 +++++----- .../serialization/JacksonJsonWriterTest.java | 4 +- .../JsonLdSerializationTest.java | 45 +++++++++---------- 5 files changed, 64 insertions(+), 73 deletions(-) diff --git a/pom.xml b/pom.xml index 0fefeda..8639b88 100644 --- a/pom.xml +++ b/pom.xml @@ -16,12 +16,13 @@ 1.8 1.8 - 0.3.6 + 0.3.7 4.12 1.10.19 - 1.1.6 - 2.8.1 - 0.11.1 + 1.2.3 + 2.9.8 + 0.12.3 + 2.4.2 @@ -82,21 +83,15 @@ test - com.github.jsonld-java - jsonld-java-sesame - 0.5.1 - test - - - org.openrdf.sesame - sesame-runtime - 2.8.9 + org.eclipse.rdf4j + rdf4j-runtime + ${org.eclipse.rdf4j.version} test - org.openrdf.sesame - sesame-model - 2.8.9 + org.eclipse.rdf4j + rdf4j-model + ${org.eclipse.rdf4j.version} test @@ -183,6 +178,11 @@ maven-compiler-plugin 3.7.0 + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.1 + diff --git a/src/test/java/cz/cvut/kbss/jsonld/jackson/environment/StatementCopyingHandler.java b/src/test/java/cz/cvut/kbss/jsonld/jackson/environment/StatementCopyingHandler.java index bc80971..20e45a9 100644 --- a/src/test/java/cz/cvut/kbss/jsonld/jackson/environment/StatementCopyingHandler.java +++ b/src/test/java/cz/cvut/kbss/jsonld/jackson/environment/StatementCopyingHandler.java @@ -1,26 +1,24 @@ /** * Copyright (C) 2017 Czech Technical University in Prague - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any - * later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. You should have received a copy of the GNU General Public License - * along with this program. If not, see . + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later + * version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. You should have received a copy of the GNU General Public License along with this program. If not, see + * . */ package cz.cvut.kbss.jsonld.jackson.environment; -import org.openrdf.model.Statement; -import org.openrdf.repository.RepositoryConnection; -import org.openrdf.repository.RepositoryException; -import org.openrdf.rio.RDFHandlerException; -import org.openrdf.rio.helpers.RDFHandlerBase; +import org.eclipse.rdf4j.model.Statement; +import org.eclipse.rdf4j.repository.RepositoryConnection; +import org.eclipse.rdf4j.repository.RepositoryException; +import org.eclipse.rdf4j.rio.RDFHandlerException; +import org.eclipse.rdf4j.rio.helpers.AbstractRDFHandler; -public class StatementCopyingHandler extends RDFHandlerBase { +public class StatementCopyingHandler extends AbstractRDFHandler { private final RepositoryConnection connection; diff --git a/src/test/java/cz/cvut/kbss/jsonld/jackson/environment/model/Organization.java b/src/test/java/cz/cvut/kbss/jsonld/jackson/environment/model/Organization.java index 55043dc..216db6c 100644 --- a/src/test/java/cz/cvut/kbss/jsonld/jackson/environment/model/Organization.java +++ b/src/test/java/cz/cvut/kbss/jsonld/jackson/environment/model/Organization.java @@ -1,21 +1,19 @@ /** * Copyright (C) 2017 Czech Technical University in Prague - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any - * later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. You should have received a copy of the GNU General Public License - * along with this program. If not, see . + *

+ * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later + * version. + *

+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. You should have received a copy of the GNU General Public License along with this program. If not, see + * . */ package cz.cvut.kbss.jsonld.jackson.environment.model; -import cz.cvut.kbss.jopa.CommonVocabulary; import cz.cvut.kbss.jopa.model.annotations.*; +import cz.cvut.kbss.jopa.vocabulary.RDFS; import cz.cvut.kbss.jsonld.jackson.environment.Vocabulary; import java.net.URI; @@ -35,7 +33,7 @@ public class Organization { @OWLAnnotationProperty(iri = Vocabulary.DATE_CREATED) private Date dateCreated; - @OWLAnnotationProperty(iri = CommonVocabulary.RDFS_LABEL) + @OWLAnnotationProperty(iri = RDFS.LABEL) private String name; @OWLDataProperty(iri = Vocabulary.BRAND) diff --git a/src/test/java/cz/cvut/kbss/jsonld/jackson/serialization/JacksonJsonWriterTest.java b/src/test/java/cz/cvut/kbss/jsonld/jackson/serialization/JacksonJsonWriterTest.java index b2e9af2..cc210fe 100644 --- a/src/test/java/cz/cvut/kbss/jsonld/jackson/serialization/JacksonJsonWriterTest.java +++ b/src/test/java/cz/cvut/kbss/jsonld/jackson/serialization/JacksonJsonWriterTest.java @@ -69,14 +69,14 @@ public void writeNumberLongWritesLong() throws Exception { @Test public void writeNumberFloatWritesFloat() throws Exception { - final Float number = Float.MIN_VALUE; + final float number = Float.MIN_VALUE; writer.writeNumber(number); verify(generator).writeNumber(number); } @Test public void writeNumberDoubleWritesDouble() throws Exception { - final Double number = Double.MAX_VALUE; + final double number = Double.MAX_VALUE; writer.writeNumber(number); verify(generator).writeNumber(number); } diff --git a/src/test/java/cz/cvut/kbss/jsonld/jackson/serialization/JsonLdSerializationTest.java b/src/test/java/cz/cvut/kbss/jsonld/jackson/serialization/JsonLdSerializationTest.java index fdeb032..a539b0b 100644 --- a/src/test/java/cz/cvut/kbss/jsonld/jackson/serialization/JsonLdSerializationTest.java +++ b/src/test/java/cz/cvut/kbss/jsonld/jackson/serialization/JsonLdSerializationTest.java @@ -13,11 +13,11 @@ package cz.cvut.kbss.jsonld.jackson.serialization; import com.fasterxml.jackson.databind.ObjectMapper; -import com.github.jsonldjava.sesame.SesameJSONLDParserFactory; import cz.cvut.kbss.jopa.model.annotations.Id; import cz.cvut.kbss.jopa.model.annotations.OWLDataProperty; import cz.cvut.kbss.jopa.model.annotations.Types; import cz.cvut.kbss.jopa.vocabulary.RDF; +import cz.cvut.kbss.jopa.vocabulary.RDFS; import cz.cvut.kbss.jsonld.exception.MissingTypeInfoException; import cz.cvut.kbss.jsonld.jackson.JsonLdModule; import cz.cvut.kbss.jsonld.jackson.environment.Generator; @@ -26,23 +26,19 @@ import cz.cvut.kbss.jsonld.jackson.environment.model.Employee; import cz.cvut.kbss.jsonld.jackson.environment.model.Organization; import cz.cvut.kbss.jsonld.jackson.environment.model.User; +import org.eclipse.rdf4j.model.Value; +import org.eclipse.rdf4j.model.ValueFactory; +import org.eclipse.rdf4j.repository.Repository; +import org.eclipse.rdf4j.repository.RepositoryConnection; +import org.eclipse.rdf4j.repository.RepositoryException; +import org.eclipse.rdf4j.repository.sail.SailRepository; +import org.eclipse.rdf4j.rio.*; +import org.eclipse.rdf4j.sail.memory.MemoryStore; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.openrdf.model.Value; -import org.openrdf.model.ValueFactory; -import org.openrdf.model.vocabulary.RDFS; -import org.openrdf.repository.Repository; -import org.openrdf.repository.RepositoryConnection; -import org.openrdf.repository.RepositoryException; -import org.openrdf.repository.sail.SailRepository; -import org.openrdf.rio.RDFHandlerException; -import org.openrdf.rio.RDFParseException; -import org.openrdf.rio.RDFParser; -import org.openrdf.rio.RDFParserFactory; -import org.openrdf.sail.memory.MemoryStore; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -68,24 +64,23 @@ public class JsonLdSerializationTest { private ObjectMapper objectMapper; @Before - public void setUp() throws Exception { + public void setUp() { initRepository(); - final RDFParserFactory factory = new SesameJSONLDParserFactory(); - this.parser = factory.getParser(); + this.parser = Rio.createParser(RDFFormat.JSONLD); parser.setRDFHandler(new StatementCopyingHandler(connection)); this.objectMapper = new ObjectMapper(); objectMapper.registerModule(new JsonLdModule()); } - private void initRepository() throws Exception { + private void initRepository() { this.repository = new SailRepository(new MemoryStore()); repository.initialize(); this.connection = repository.getConnection(); } @After - public void tearDown() throws Exception { + public void tearDown() { connection.close(); repository.shutDown(); } @@ -107,11 +102,11 @@ private void serializeAndStore(Object instance) connection.commit(); } - private boolean contains(URI subject, String property, Object value) throws Exception { + private boolean contains(URI subject, String property, Object value) { final ValueFactory vf = connection.getValueFactory(); Value rdfVal = null; if (value instanceof URI) { - rdfVal = vf.createURI(value.toString()); + rdfVal = vf.createIRI(value.toString()); } else if (value instanceof Integer) { rdfVal = vf.createLiteral((Integer) value); } else if (value instanceof Long) { @@ -125,11 +120,11 @@ private boolean contains(URI subject, String property, Object value) throws Exce } else if (value instanceof String) { rdfVal = vf.createLiteral(value.toString()); } - return connection - .getStatements(vf.createURI(subject.toString()), vf.createURI(property), rdfVal, false).hasNext(); + return connection.getStatements(vf.createIRI(subject.toString()), vf.createIRI(property), rdfVal, false) + .hasNext(); } - private void verifyUserAttributes(User user) throws Exception { + private void verifyUserAttributes(User user) { assertTrue(contains(user.getUri(), RDF.TYPE, URI.create(Vocabulary.PERSON))); assertTrue(contains(user.getUri(), RDF.TYPE, URI.create(Vocabulary.USER))); assertTrue(contains(user.getUri(), Vocabulary.FIRST_NAME, user.getFirstName())); @@ -148,8 +143,8 @@ public void testSerializeInstanceWithSingularReference() throws Exception { verifyOrganizationAttributes(org); } - private void verifyOrganizationAttributes(Organization org) throws Exception { - assertTrue(contains(org.getUri(), RDFS.LABEL.stringValue(), org.getName())); + private void verifyOrganizationAttributes(Organization org) { + assertTrue(contains(org.getUri(), RDFS.LABEL, org.getName())); // There is currently a grey zone of representing dates - we're using long timestamp, but RDF4J parses it XML integer assertTrue(contains(org.getUri(), Vocabulary.DATE_CREATED, null)); for (String brand : org.getBrands()) {