owlcs / owlapi

OWL API main repository
822 stars 315 forks source link

Issue #1145: Upgrade to RDF4J 5.x #1146

Closed reckart closed 1 month ago

reckart commented 1 month ago
reckart commented 1 month ago

@ignazio1977 @cmungall @hmottestad I am trying to upgrade owlapi to RDF4J and for the most part that is quite straightforward. However, it appears that there was a change in the JSON-LD format support in RDF4J 5 that doesn't seem to play well with the owlapi test suite.

For example, when I am trying to run org.semanticweb.owlapi.api.test.individuals.NoQNameRoundTripTestCase.testFormat(OWLDocumentFormat) against RDF4J 5.0.1, I get a failure.

The test constructs this document, then serializes it and loads it back again. This is how it should look like with RDF4J 4.3.x:

TestBase.roundTripOntology() ontology originally
ObjectPropertyAssertion(<http://example.com/place/123> <http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A> <http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B>)
Declaration(ObjectProperty(<http://example.com/place/123>))
Declaration(NamedIndividual(<http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A>))
Declaration(NamedIndividual(<http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B>))
Original document (begin) ================
[[ {
  "@id" : "_:genid1",
  "@type" : [ "http://www.w3.org/2002/07/owl#Ontology" ]
}, {
  "@id" : "http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A",
  "@type" : [ "http://www.w3.org/2002/07/owl#NamedIndividual" ],
  "http://example.com/place/123" : [ {
    "@id" : "http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B"
  } ]
}, {
  "@id" : "http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B",
  "@type" : [ "http://www.w3.org/2002/07/owl#NamedIndividual" ]
}, {
  "@id" : "http://example.com/place/123",
  "@type" : [ "http://www.w3.org/2002/07/owl#ObjectProperty" ]
} ]
Original document (end) ================

TestBase.roundTripOntology() ontology parsed
Declaration(NamedIndividual(<http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A>))
Declaration(NamedIndividual(<http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B>))
Declaration(ObjectProperty(<http://example.com/place/123>))
ObjectPropertyAssertion(<http://example.com/place/123> <http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A> <http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B>)
Parsed document (begin) ===================
[ {
  "@id" : "_:genid1",
  "@type" : [ "http://www.w3.org/2002/07/owl#Ontology" ]
}, {
  "@id" : "http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A",
  "@type" : [ "http://www.w3.org/2002/07/owl#NamedIndividual" ],
  "http://example.com/place/123" : [ {
    "@id" : "http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B"
  } ]
}, {
  "@id" : "http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B",
  "@type" : [ "http://www.w3.org/2002/07/owl#NamedIndividual" ]
}, {
  "@id" : "http://example.com/place/123",
  "@type" : [ "http://www.w3.org/2002/07/owl#ObjectProperty" ]
} ]
Parsed document (end) ===================

However, when running the same test againast RDF4J 5.0.1, a property seems to get lost:

TestBase.roundTripOntology() ontology originally
Declaration(ObjectProperty(<http://example.com/place/123>))
Declaration(NamedIndividual(<http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A>))
Declaration(NamedIndividual(<http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B>))
ObjectPropertyAssertion(<http://example.com/place/123> <http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A> <http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B>)
Original document (begin) ================
[
    {
        "@id": "_:genid1",
        "@type": [
            "http://www.w3.org/2002/07/owl#Ontology"
        ]
    },
    {
        "@id": "http://example.com/place/123",
        "@type": [
            "http://www.w3.org/2002/07/owl#ObjectProperty"
        ]
    },
    {
        "@id": "http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A",
        "@type": [
            "http://www.w3.org/2002/07/owl#NamedIndividual"
        ],
        "http://example.com/place/123": [
            {
                "@id": "http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B"
            }
        ]
    },
    {
        "@id": "http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B",
        "@type": [
            "http://www.w3.org/2002/07/owl#NamedIndividual"
        ]
    }
]
Original document (end) ==================

TestBase.roundTripOntology() ontology parsed
Declaration(NamedIndividual(<http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A>))
Declaration(NamedIndividual(<http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B>))
Declaration(ObjectProperty(<http://example.com/place/123>))
Parsed document (begin) =================
[
    {
        "@id": "_:genid1",
        "@type": [
            "http://www.w3.org/2002/07/owl#Ontology"
        ]
    },
    {
        "@id": "http://example.com/place/123",
        "@type": [
            "http://www.w3.org/2002/07/owl#ObjectProperty"
        ]
    },
    {
        "@id": "http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A",
        "@type": [
            "http://www.w3.org/2002/07/owl#NamedIndividual"
        ]
    },
    {
        "@id": "http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B",
        "@type": [
            "http://www.w3.org/2002/07/owl#NamedIndividual"
        ]
    }
]
Parsed document (end) ===================
NoQNameRoundTripTestCase roundTripOntology() Failing to match axioms: 
Rem axiom: ObjectPropertyAssertion(<http://example.com/place/123> <http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A> <http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B>)

@hmottestad I can see that you have replace the JSON-LD format support in RDF4J 5 with a new implementation based on hasmac-json-ld. I have tried debugging the failing tests through RDF4J and down into hasmac-json-ld, but so far, I couldn't really find out what is happening. Does the new format support have any specific options or known behavior changes compared to the old one?

@ignazio1977 @cmungall Maybe you have an idea from the owlapi side of things?

ignazio1977 commented 1 month ago

Looks like an actual regression, I'll see if I can debug it later

hmottestad commented 1 month ago

Dunno exactly what the test is supposed to do.

Since there are blank nodes involved I wonder if maybe there is some assumption of stable blank node identifiers?

The new json-ld library is a lot stricter about following the spec and when the spec says to drop invalid data it will do so pretty much silently. I think I added some logging for some of that, but I'm not exactly sure.

You could try the legacy json-ld implementation to double check that the issue is with the new one: https://mvnrepository.com/artifact/org.eclipse.rdf4j/rdf4j-rio-jsonld-legacy/5.0.1

reckart commented 1 month ago

@hmottestad do you have a pointer on how to switch the new against the old json-ld implementation? I looked at the RDFFormat, but didn't find one that referred to the old implementation. There seems to be some loose coupling involved here.

hmottestad commented 1 month ago

@hmottestad do you have a pointer on how to switch the new against the old json-ld implementation? I looked at the RDFFormat, but didn't find one that referred to the old implementation. There seems to be some loose coupling involved here.

Just switch out the dependency for the legacy one that I linked.

ignazio1977 commented 1 month ago

The test is about roundtrip of properties with no qname, i.e., whose IRI make it impossible to use them in rdf/xml. I think the point was that other formats would work - off the top of my head, anyway.

There's probably a bit of history behind that.

hmottestad commented 1 month ago

The test is about roundtrip of properties with no qname, i.e., whose IRI make it impossible to use them in rdf/xml. I think the point was that other formats would work - off the top of my head, anyway.

There's probably a bit of history behind that.

Then it might be explained by the JSON-LD 1.1 spec being very strict on what is legal and what isn't and that the default behaviour is to silently drop that data.

I don't really see anything wrong with the IRI that is missing:

Declaration(ObjectProperty(<http://example.com/place/123>))
ignazio1977 commented 1 month ago
 http://example.com/place/123

It does not have a suffix portion that starts with a letter or underscore and has no reserved characters in it (i.e., it ends with numbers and a slash, and if we were to pick any of the letters in "place" as starting point, the qname would have a slash.

The rule really applies only because in rdf/xml you'd have the qname as the tag name :-( can't say that rule has made my life any easier.

reckart commented 1 month ago

If I replace the rdf4j-rio-jsonld dependency with rdf4j-rio-jsonld-legacy in owlapi-rio and then re-run the tests in owlapi-contract, all tests come up green.

I also tried "testing" at the level of hasmac-json-ld with the following code:

    @Test
    void test() throws Exception {
        var original = "[\n"
                + "   {\n"
                + "      \"@id\":\"_:genid1\",\n"
                + "      \"@type\":[\n"
                + "         \"http://www.w3.org/2002/07/owl#Ontology\"\n"
                + "      ]\n"
                + "   },\n"
                + "   {\n"
                + "      \"@id\":\"http://example.com/place/123\",\n"
                + "      \"@type\":[\n"
                + "         \"http://www.w3.org/2002/07/owl#ObjectProperty\"\n"
                + "      ]\n"
                + "   },\n"
                + "   {\n"
                + "      \"@id\":\"http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A\",\n"
                + "      \"@type\":[\n"
                + "         \"http://www.w3.org/2002/07/owl#NamedIndividual\"\n"
                + "      ],\n"
                + "      \"http://example.com/place/123\":[\n"
                + "         {\n"
                + "            \"@id\":\"http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B\"\n"
                + "         }\n"
                + "      ]\n"
                + "   },\n"
                + "   {\n"
                + "      \"@id\":\"http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B\",\n"
                + "      \"@type\":[\n"
                + "         \"http://www.w3.org/2002/07/owl#NamedIndividual\"\n"
                + "      ]\n"
                + "   }\n"
                + "]";
        Document document = JsonDocument.of(new StringReader(original));
        var rdfDataset = JsonLd.toRdf(document).get();
        var jsonAgain = JsonLd.fromRdf(RdfDocument.of(rdfDataset)).get();
        System.out.println(jsonAgain);
    }

The result produced by that code looks reasonably similar to the original input, so I believe the problem must lie either in the new RDF4J JSON-LD RIO or in the way owlapi calls the RDF4J code (or in the test data itself).

[
   {
      "@id":"_:b0",
      "@type":[
         "http://www.w3.org/2002/07/owl#Ontology"
      ]
   },
   {
      "@id":"http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395A",
      "@type":[
         "http://www.w3.org/2002/07/owl#NamedIndividual"
      ],
      "http://example.com/place/123":[
         {
            "@id":"http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B"
         }
      ]
   },
   {
      "@id":"http://example.com/place/112013e2-df48-4a34-8a9d-99ef572a395B",
      "@type":[
         "http://www.w3.org/2002/07/owl#NamedIndividual"
      ]
   },
   {
      "@id":"http://example.com/place/123",
      "@type":[
         "http://www.w3.org/2002/07/owl#ObjectProperty"
      ]
   }
]
hmottestad commented 1 month ago

I've been looking into the issue here and it looks like the new json-ld implementation doesn't call rdfHandler.startRdf() and .endRdf(). I'm trying to fix that now to see if it helps.

hmottestad commented 1 month ago

@reckart I've released RDF4J 5.0.2 with a fix for the json-ld issue.

There is still a failing test IRITestCase#shouldParseIRIAndSkipPrefixedSpaceJSONLD which I believe should just be disabled. The JSON-LD 1.1 spec is quite strict that invalid data should just be logger and then ignored. In HASMAC JSON-LD I've added an option to throw an exception instead, but that won't help much in this case since the test is assuming that the JSON-LD parser will either allow the data through or do some kind of clean up.

hmottestad commented 1 month ago

I'm not very good at any osgi stuff, but with some help from chat gpt I've figured out a bit more of how it works and made changes so that jakarta.json is treated the same way as jakarta.xml and no.hasmac (json-ld) is treated the same way as jsonld-java.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>owlapi-osgidistribution</artifactId>
    <packaging>bundle</packaging>
    <name>OWLAPI :: OSGi and Compatibility Distribution</name>

    <parent>
        <groupId>net.sourceforge.owlapi</groupId>
        <artifactId>owlapi-parent</artifactId>
        <version>5.5.1-SNAPSHOT</version>
    </parent>
    <properties>
        <inherited.rdf4j.version>${rdf4j.version}</inherited.rdf4j.version>
    </properties>

    <!-- NOTE: These dependency declarations are only required to sort this
        project to the end of the line in the multimodule build. -->
    <dependencies>
        <dependency><groupId>${project.groupId}</groupId><artifactId>owlapi-apibinding</artifactId><version>${project.version}</version></dependency>
        <dependency><groupId>${project.groupId}</groupId><artifactId>owlapi-tools</artifactId><version>${project.version}</version></dependency>
        <dependency><groupId>${project.groupId}</groupId><artifactId>owlapi-impl</artifactId><version>${project.version}</version></dependency>
        <dependency><groupId>${project.groupId}</groupId><artifactId>owlapi-parsers</artifactId><version>${project.version}</version></dependency>
        <dependency><groupId>${project.groupId}</groupId><artifactId>owlapi-oboformat</artifactId><version>${project.version}</version></dependency>
        <dependency><groupId>${project.groupId}</groupId><artifactId>owlapi-rio</artifactId><version>${project.version}</version></dependency>
        <dependency><groupId>${project.groupId}</groupId><artifactId>owlapi-api</artifactId><version>${project.version}</version></dependency>
        <dependency><groupId>${project.groupId}</groupId><artifactId>owlapi-compatibility</artifactId><version>${project.version}</version></dependency>
        <dependency><groupId>com.google.code.findbugs</groupId><artifactId>jsr305</artifactId><version>3.0.2</version></dependency>
        <dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-core</artifactId><version>2.16.1</version></dependency>
        <dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>2.16.1</version></dependency>
        <dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-annotations</artifactId><version>2.16.1</version></dependency>
        <dependency><groupId>org.apache.commons</groupId><artifactId>commons-rdf-api</artifactId><version>0.5.0</version></dependency>
        <dependency><groupId>org.tukaani</groupId><artifactId>xz</artifactId><version>1.9</version></dependency>
        <dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>1.7.30</version></dependency>
        <dependency><groupId>org.slf4j</groupId><artifactId>jcl-over-slf4j</artifactId><version>1.7.30</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-rio-api</artifactId><version>${inherited.rdf4j.version}</version>
            <exclusions>
                <exclusion><groupId>javax.xml.bind</groupId><artifactId>jaxb-api</artifactId></exclusion>
                <exclusion><groupId>jakarta.xml.bind</groupId><artifactId>jakarta.xml.bind-api</artifactId></exclusion>
            </exclusions>
        </dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-rio-languages</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-rio-datatypes</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-rio-binary</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-rio-n3</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-rio-nquads</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-rio-ntriples</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-rio-rdfjson</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-rio-jsonld</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-rio-rdfxml</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-rio-trix</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-rio-turtle</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-rio-trig</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-rio-hdt</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-common-annotation</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-common-exception</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-model-vocabulary</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-model-api</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-common-text</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-common-io</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-common-iterator</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-model</artifactId><version>${inherited.rdf4j.version}</version></dependency>
        <dependency><groupId>org.eclipse.rdf4j</groupId><artifactId>rdf4j-common-xml</artifactId><version>${inherited.rdf4j.version}</version></dependency>

        <dependency><groupId>com.github.jsonld-java</groupId><artifactId>jsonld-java</artifactId><version>0.13.6</version></dependency>
        <dependency><groupId>no.hasmac</groupId><artifactId>hasmac-json-ld</artifactId><version>0.9.0</version></dependency> <!-- Add explicit hasmac json-ld dependency, same as json-ld -->
        <dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>4.5.14</version></dependency>
        <dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient-cache</artifactId><version>4.5.14</version></dependency>
        <dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpcore</artifactId><version>4.4.16</version></dependency>
        <dependency><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId><version>1.16.0</version></dependency>
        <dependency><groupId>commons-logging</groupId><artifactId>commons-logging</artifactId><version>1.3.0</version></dependency>
        <dependency><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.15.1</version></dependency>
        <dependency><groupId>com.github.vsonnier</groupId><artifactId>hppcrt</artifactId><version>0.7.5</version></dependency>
        <dependency><groupId>com.google.guava</groupId><artifactId>guava</artifactId><version>33.0.0-jre</version>
            <exclusions>
                <exclusion><groupId>com.google.guava</groupId><artifactId>failureaccess</artifactId></exclusion>
                <exclusion><groupId>com.google.guava</groupId><artifactId>listenablefuture</artifactId></exclusion>
                <exclusion><groupId>com.google.code.findbugs</groupId><artifactId>jsr305</artifactId></exclusion>
                <exclusion><groupId>org.checkerframework</groupId><artifactId>checker-qual</artifactId></exclusion>
                <exclusion><groupId>com.google.errorprone</groupId><artifactId>error_prone_annotations</artifactId></exclusion>
                <exclusion><groupId>com.google.j2objc</groupId><artifactId>j2objc-annotations</artifactId></exclusion>
            </exclusions>
        </dependency>
        <dependency><groupId>com.github.ben-manes.caffeine</groupId><artifactId>caffeine</artifactId><version>3.1.8</version></dependency>
        <!--  Disable until updated to use RDF4J
        <dependency><groupId>org.semarglproject</groupId><artifactId>semargl-sesame</artifactId><version>0.7</version></dependency>
        <dependency><groupId>org.semarglproject</groupId><artifactId>semargl-core</artifactId><version>0.7</version></dependency>
        <dependency><groupId>org.semarglproject</groupId><artifactId>semargl-rdfa</artifactId><version>0.7</version></dependency>
        <dependency><groupId>org.semarglproject</groupId><artifactId>semargl-rdf</artifactId><version>0.7</version></dependency -->
        <dependency><groupId>org.apache.felix</groupId><artifactId>org.apache.felix.framework</artifactId><version>7.0.5</version><scope>test</scope></dependency>
        <dependency><groupId>org.apache.felix</groupId><artifactId>org.osgi.core</artifactId><version>1.4.0</version><scope>test</scope></dependency>
        <dependency><groupId>org.apache.servicemix.bundles</groupId><artifactId>org.apache.servicemix.bundles.javax-inject</artifactId><version>1_3</version></dependency>
        <dependency><groupId>org.slf4j</groupId><artifactId>slf4j-simple</artifactId><version>1.7.30</version><scope>test</scope></dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Creates binary distribution. -->
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>5.1.9</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Implementation-Title>${project.name}</Implementation-Title>
                        <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
                        <Implementation-Version>${project.version}.${maven.build.timestamp}</Implementation-Version>
                        <Bundle-SymbolicName>org.semanticweb.owl.owlapi</Bundle-SymbolicName>
                        <Bundle-Version>${project.version}</Bundle-Version>
                        <Embed-Dependency>
                            groupId=${project.groupId};inline=true;scope=compile|runtime|provided,
                            jcl-over-slf4j;scope=compile|runtime|provided;inline=false,
                            groupId=org.tukaani;scope=compile|runtime|provided;inline=false,
                            groupId=com.fasterxml.jackson.core;scope=compile|runtime|provided;inline=false,
                            groupId=com.github.vsonnier;scope=compile|runtime|provided;inline=false,
                            groupId=org.apache.httpcomponents;scope=compile|runtime|provided;inline=false,
                            commons-rdf-api;scope=compile|runtime|provided;inline=false,
                            groupId=org.eclipse.rdf4j;scope=compile|runtime|provided;inline=false,
                            groupId=org.semarglproject;scope=compile|runtime|provided;inline=false,
                            groupId=com.github.jsonld-java;scope=compile|runtime|provided;inline=false,
                            groupId=no.hasmac;scope=compile|runtime|provided;inline=false, <!-- Treat hasmac json-ld the same way as jsonld-java -->
                            jsr305;scope=compile|runtime|provided;inline=false,
                            caffeine;scope=compile|runtime|provided;inline=false
                        </Embed-Dependency>
                        <excludeDependencies>
                            groupId=commons-*;scope=compile|runtime|provided,
                            groupId=com.google.guava;scope=compile|runtime|provided,
                            groupId=com.google.common.*;scope=compile|runtime|provided,
                            slf4j-api;scope=compile|runtime|provided,
                            slf4j-simple;scope=compile|runtime|provided,
                            groupId=javax.xml.*;scope=compile|runtime|provided,
                            groupId=jakarta.xml.*;scope=compile|runtime|provided,
                            groupId=jakarta.json.*;scope=compile|runtime|provided, <!-- treat jakarta.json the same way as jakarta.xml -->
                            android.os;scope=compile|runtime|provided,
                            org.osgi.core;scope=compile|runtime|provided|test,
                            failureaccess;scope=compile|runtime|provided,
                            listenablefuture;scope=compile|runtime|provided,
                            checker-qual;scope=compile|runtime|provided,
                            error_prone_annotations;scope=compile|runtime|provided,
                            j2objc-annotations;scope=compile|runtime|provided
                        </excludeDependencies>
                        <Embed-Directory>lib</Embed-Directory>
                        <_exportcontents>
                            !org.semanticweb.owlapi.test.*,
                            com.clarkparsia.*,
                            org.semanticweb.owlapi.*;-split-package:=merge-first,
                            org.semanticweb.owlapitools.*;-split-package:=merge-first,
                            uk.ac.manchester.*;-split-package:=merge-first,
                            org.obolibrary.*;-split-package:=merge-first,
                            org.coode.*;-split-package:=merge-first,
                            de.uulm.*;-split-package:=merge-first
                        </_exportcontents>
                        <Import-Package>
                            !sun.misc,
                            !javax.servlet,
                            !javax.xml.*,
                            !jakarta.xml.*,
                            !jakarta.json.*, <!-- treat jakarta.json the same way as jakarta.xml -->
                            !org.apache.avalon.framework.logger,
                            !org.apache.log*,
                            !javax.annotation,
                            !com.clarkparsia.*,
                            !org.obolibrary.*,
                            !org.semanticweb.owlapi.*,
                            !uk.ac.manchester.cs.*,
                            !com.google.errorprone.*,
                            !com.google.common.io.*,
                            !com.google.common.util.*,
                            !com.google.common.util.concurrent.internal.*,
                            !com.github.jsonldjava.shaded.com.google.common.collect.*;resolution:=optional,
                            !com.github.jsonldjava.shaded.com.google.common.util.concurrent.internal.*;resolution:=optional,
                            !com.google.common.cache.*,
                            !org.checkerframework.*,
                            !osgi.*,
                            !android.os.*,
                            !org.slf4j.spi.*,
                            net.sf.ehcache.*;resolution:=optional,
                            net.spy.memcached.*;resolution:=optional,
                            com.google.common.hash;version="[18.0,34)";resolution:=optional,
                            com.google.common.base;version="[18.0,34)";resolution:=optional,
                            com.google.common.collect;version="[18.0,34)";resolution:=optional,
                            javax.inject;version="[1.0,2)",
                            javax.annotation;version=!,
                            !com.google.appengine.*,
                            !com.google.apphosting.*,
                            *
                        </Import-Package>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.5.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <artifactSet>
                                <includes>
                                    <include>net.sourceforge.owlapi:owlapi-api</include>
                                    <include>net.sourceforge.owlapi:owlapi-apibinding</include>
                                    <include>net.sourceforge.owlapi:owlapi-impl</include>
                                    <include>net.sourceforge.owlapi:owlapi-oboformat</include>
                                    <include>net.sourceforge.owlapi:owlapi-parsers</include>
                                    <include>net.sourceforge.owlapi:owlapi-rio</include>
                                    <include>net.sourceforge.owlapi:owlapi-compatibility</include>
                                    <include>net.sourceforge.owlapi:owlapi-tools</include>
                                </includes>
                                <excludes>
                                    <exclude>org.apache.felix:org.osgi.core</exclude>
                                    <exclude>org.eclipse.rdf4j:*</exclude>
                                    <exclude>com.fasterxml.jackson.core:*</exclude>
                                    <exclude>com.github.jsonld-java:*</exclude>
                                    <exclude>no.hasmac:*</exclude> <!-- treat hasmac json-ld the same way as jsonld-java -->
                                    <exclude>com.fasterxml.jackson.core:*</exclude>
                                    <exclude>org.apache.httpcomponents:*</exclude>
                                    <exclude>commons-codec:commons-codec:*</exclude>
                                    <exclude>org.slf4j:*</exclude>
                                    <exclude>org.semarglproject:*</exclude>
                                    <exclude>com.github.ben-manes.caffeine:*</exclude>
                                    <exclude>com.google.guava:*</exclude>
                                    <exclude>com.google.code.findbugs:*</exclude>
                                    <exclude>org.slf4j:slf4j-api</exclude>
                                    <exclude>commons-io:*</exclude>
                                    <exclude>org.tukaani:*</exclude>
                                    <exclude>com.github.vsonnier:*</exclude>
                                    <exclude>javax.xml.bind:*</exclude>
                                    <exclude>jakarta.xml.bind:*</exclude>
                                    <exclude>jakarta.json:*</exclude> <!-- treat jakarta.json the same way as jakarta.xml.bind -->
                                </excludes>
                            </artifactSet>
                            <transformers>
                                <transformer
                                    implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.2.5</version>
                <dependencies>
                    <dependency><groupId>org.junit.jupiter</groupId><artifactId>junit-jupiter-engine</artifactId><version>5.10.1</version></dependency>
                </dependencies>
                <configuration>
                    <includes>
                        <include>**/*.java</include>
                    </includes>
                    <groups>IntegrationTest</groups>
                    <forkCount>0</forkCount>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.6.3</version>
                <configuration>
                    <show>public</show>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadoc</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <skip>${no-javadoc}</skip>
                            <show>public</show>
                            <includeDependencySources>true</includeDependencySources>
                            <dependencySourceIncludes>
                                <dependencySourceInclude>net.sourceforge.owlapi:owlapi-api</dependencySourceInclude>
                                <dependencySourceInclude>net.sourceforge.owlapi:owlapi-apibinding</dependencySourceInclude>
                                <dependencySourceInclude>net.sourceforge.owlapi:owlapi-parsers</dependencySourceInclude>
                                <dependencySourceInclude>net.sourceforge.owlapi:owlapi-tools</dependencySourceInclude>
                                <dependencySourceInclude>net.sourceforge.owlapi:owlapi-impl</dependencySourceInclude>
                                <dependencySourceInclude>net.sourceforge.owlapi:owlapi-oboformat</dependencySourceInclude>
                                <dependencySourceInclude>net.sourceforge.owlapi:owlapi-compatibility</dependencySourceInclude>
                            </dependencySourceIncludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.6.0</version>
                <configuration>
                    <attach>true</attach>
                    <descriptors>
                        <descriptor>src/assembly/sources.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
hmottestad commented 1 month ago

Btw. I'm a bit invested in updating owl-api since ontop depends on it and I'm working on updating ontop to use RDF4J 5.

@reckart If you want to give me write access to your fork I can commit my proposed changes directly.

reckart commented 1 month ago

@hmottestad any idea how I would do that? I mean giving you access to the PR?

hmottestad commented 1 month ago

@hmottestad any idea how I would do that? I mean giving you access to the PR?

You should be able to give me write access to your branch. https://github.com/reckart/owlapi/tree/refactoring/1145-Upgrade-to-RDF4J-5.x

Settings -> Collaborators

reckart commented 1 month ago

Added you.

hmottestad commented 1 month ago

Added you.

Thanks :)

I've pushed my changes. On my machine mvn verify runs without any errors.

reckart commented 1 month ago

@hmottestad Thanks. Builds for me as well.

@ignazio1977 care to merge?

ignazio1977 commented 1 month ago

I've fetched the merge request locally to have a proper look.

Looks good to me but I think the test should be extended to cover the "ignore bad data silently" and "throw exception on bad data" instead of being ignored.

It will also add a reminder of how to trigger the exception behaviour.

I'm not sure if the next release should be a patch (5.5.1) or a minor (5.6.0), given that this is a slight behaviour change. I don't expect this to affect a lot of real ontologies, but it might be better to mark it as a minor patch, to have users downstream warned.

Changes merged in version5 branch now.