Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-2353

Update outdated documentation to remove deprecated method warnings

    XMLWordPrintableJSON

Details

    • Task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • Jena 4.7.0, Jena 4.8.0
    • None
    • Jena
    • Ubuntu Linux, JDK 17, Maven

    Description

      The documentation on the Jena page states at several places (i.e. in the "Jena RDF/XML How-To" at https://jena.apache.org/documentation/io/rdfxml_howto.html) some code like

      Model m = ModelFactory.createDefaultModel();
      RDFReader arp = m.getReader(); 

      or

      Model m = ModelFactory.createDefaultModel();
      RDFReader arp = m.getReader("RDF/XML"); 

      However, according to the Javadoc of "Model" (see https://jena.apache.org/documentation/javadoc/jena/org.apache.jena.core/org/apache/jena/rdf/model/Model.html#getReader() and https://jena.apache.org/documentation/javadoc/jena/org.apache.jena.core/org/apache/jena/rdf/model/Model.html#getReader(java.lang.String)) these methods as well as their corresponding "getWriter()" methods are "deprecated".

      There is no documentation (neiter in the Javadoc itself nor on the website) on the proper new replacement.

      IDEs like IntelliJ complain about this deprecation (see screenshot).

      Please update the Javadoc as well as the documentation on how to properly get a Reader and Writer object, or whether to ignore the deprecation warning (i.e. because only the overwritten method in "Model" is deprecated).

       

      Reproducer

      JenaTest.java

      package de.playground.jenatests;
      
      import org.apache.jena.rdf.model.Model;
      import org.apache.jena.rdf.model.ModelFactory;
      import org.apache.jena.rdf.model.RDFReaderI;
      
      public class JenaTest {
      
          public static void main(String[] args) {
              Model model = ModelFactory.createDefaultModel();
              RDFReaderI r = model.getReader("RDF/XML");
          }
      } 

      Maven pom.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <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/xsd/maven-4.0.0.xsd">
      
          <modelVersion>4.0.0</modelVersion>
      
          <groupId>de.playground</groupId>
          <artifactId>jena-test</artifactId>
          <version>1.0.0</version>
          <build>
              <sourceDirectory>src</sourceDirectory>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-compiler-plugin</artifactId>
                      <version>3.7.0</version>
                  </plugin>
              </plugins>
          </build>
      
          <dependencies>
            <dependency>
              <groupId>org.apache.jena</groupId>
              <artifactId>jena-core</artifactId>
              <version>4.7.0</version>
            </dependency>
          </dependencies>
      </project> 

       

      Attachments

        1. JenaDeprecated.png
          96 kB
          Jan Hendriks

        Activity

          People

            Unassigned Unassigned
            dahoc Jan Hendriks
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: