From a08d8ceea95a7cc77f875ce671b2b0b195944a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20K=C5=99emen?= Date: Thu, 3 Nov 2022 15:10:35 +0100 Subject: [PATCH 1/2] [#1070] downgrading SnakeYml to 1.31 --- robot-core/pom.xml | 2 +- .../obolibrary/robot/ReportOperationTest.java | 54 +++++++++++++++++-- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/robot-core/pom.xml b/robot-core/pom.xml index 25534bd99..5b01797e1 100644 --- a/robot-core/pom.xml +++ b/robot-core/pom.xml @@ -183,7 +183,7 @@ org.yaml snakeyaml - 1.32 + 1.31 com.opencsv diff --git a/robot-core/src/test/java/org/obolibrary/robot/ReportOperationTest.java b/robot-core/src/test/java/org/obolibrary/robot/ReportOperationTest.java index c968b8665..72ad223ad 100644 --- a/robot-core/src/test/java/org/obolibrary/robot/ReportOperationTest.java +++ b/robot-core/src/test/java/org/obolibrary/robot/ReportOperationTest.java @@ -1,18 +1,26 @@ package org.obolibrary.robot; -import java.io.*; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.Collections; import org.apache.commons.io.IOUtils; import org.junit.Assert; import org.junit.Test; -import org.semanticweb.owlapi.model.OWLOntology; +import org.semanticweb.owlapi.apibinding.OWLManager; +import org.semanticweb.owlapi.model.*; import org.yaml.snakeyaml.error.YAMLException; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.net.URI; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.Collections; + /** Tests for the ReportOperation. */ public class ReportOperationTest extends CoreTest { + private static final String oboInOwl = "http://www.geneontology.org/formats/oboInOwl#"; + private static final String obo = "http://purl.obolibrary.org/obo/"; + /** Test report produces correct JSON. */ @Test public void testReportProducesValidJson() throws Exception { @@ -45,4 +53,40 @@ private void testReportProducesCorrectOutput(String extension) throws Exception Assert.fail(); } } + + private OWLOntology generateOntologyWithLotsOfViolations() throws OWLOntologyCreationException { + final OWLOntologyManager m = OWLManager.createOWLOntologyManager(); + final OWLDataFactory f = m.getOWLDataFactory(); + final OWLOntology o = m.createOntology(IRI.create(URI.create("https://example.org/o"))); + + final OWLAnnotationProperty pLabel = f.getRDFSLabel(); + final OWLAnnotationProperty pHasExactSynonym = f.getOWLAnnotationProperty(IRI.create(oboInOwl + "hasExactSynonym")); + final OWLAnnotationProperty pHasRelatedSynonym = f.getOWLAnnotationProperty(IRI.create(oboInOwl + "hasRelatedSynonym")); + final OWLAnnotationProperty pIAO_0000115 = f.getOWLAnnotationProperty(IRI.create(obo + "IAO_0000115")); + + for (int i = 0; i < 5000; i++) { + final IRI iriC = IRI.create("https://example.org/o/a" + i); + m.addAxiom(o, f.getOWLAnnotationAssertionAxiom(pLabel, iriC, f.getOWLLiteral(" X\tX"))); + m.addAxiom(o, f.getOWLAnnotationAssertionAxiom(pLabel, iriC, f.getOWLLiteral("obsolete X\tX"))); + m.addAxiom(o, f.getOWLAnnotationAssertionAxiom(pHasExactSynonym, iriC, f.getOWLLiteral(" X\tX"))); + m.addAxiom(o, f.getOWLAnnotationAssertionAxiom(pHasRelatedSynonym, iriC, f.getOWLLiteral(" X\tX"))); + m.addAxiom(o, f.getOWLAnnotationAssertionAxiom(pIAO_0000115, iriC, f.getOWLLiteral("x"))); + } + return o; + } + + // disabling, as the test takes a few minutes to run + // @Test + public void testReportProducesCorrectOutput() throws Exception { + try { + final IOHelper iohelper = new IOHelper(); + final File outputFile = + File.createTempFile("1070-codepoint-defaults-output", ".json"); + final OWLOntology o = generateOntologyWithLotsOfViolations(); + ReportOperation.report(o, iohelper, outputFile.toString(), Collections.emptyMap()); + } catch (YAMLException e) { + e.printStackTrace(); + Assert.fail(); + } + } } From 8fc7cc230530ba1fdf494f9d4d3f6e90ccb94640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20K=C5=99emen?= Date: Thu, 3 Nov 2022 15:12:23 +0100 Subject: [PATCH 2/2] [#1070] changelog updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf8004ddf..b01190fcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +- Downgrade SnakeYaml to 1.31 [#1070] ## [1.9.1] - 2022-10-28