jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [11/14] jena git commit: Tidy up RiotParsers, which is now internal.
Date Tue, 17 May 2016 09:51:42 GMT
Tidy up RiotParsers, which is now internal.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/ca2c9f53
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/ca2c9f53
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/ca2c9f53

Branch: refs/heads/master
Commit: ca2c9f53c48aad5775d9e8c264e84e3bdb15952f
Parents: 9d6c8e7
Author: Andy Seaborne <andy@apache.org>
Authored: Tue May 17 09:39:34 2016 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Tue May 17 09:39:34 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/jena/riot/RDFDataMgr.java   |   4 -
 .../org/apache/jena/riot/RDFParserRegistry.java |   2 -
 .../org/apache/jena/riot/lang/RiotParsers.java  | 121 +++++--------------
 .../apache/jena/riot/lang/TestLangNTuples.java  |   1 -
 4 files changed, 28 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/ca2c9f53/jena-arq/src/main/java/org/apache/jena/riot/RDFDataMgr.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/RDFDataMgr.java b/jena-arq/src/main/java/org/apache/jena/riot/RDFDataMgr.java
index f3e5147..a750b7f 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/RDFDataMgr.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/RDFDataMgr.java
@@ -1234,12 +1234,10 @@ public class RDFDataMgr
      * @param baseIRI Base IRI
      * @return Iterator over the triples
      */
-    @SuppressWarnings("deprecation")
     public static Iterator<Triple> createIteratorTriples(InputStream input, Lang lang,
String baseIRI)
     {
         // Special case N-Triples, because the RIOT reader has a pull interface
         if ( RDFLanguages.sameLang(RDFLanguages.NTRIPLES, lang) )
-            // Should be only use. Migrate the necessary code here when removing deprecated
code.
             return new IteratorResourceClosing<>(org.apache.jena.riot.lang.RiotParsers.createIteratorNTriples(input,
null), input);
         // Otherwise, we have to spin up a thread to deal with it
         PipedRDFIterator<Triple> it = new PipedRDFIterator<>();
@@ -1256,12 +1254,10 @@ public class RDFDataMgr
      * @param baseIRI Base IRI
      * @return Iterator over the quads
      */
-    @SuppressWarnings("deprecation")
     public static Iterator<Quad> createIteratorQuads(InputStream input, Lang lang,
String baseIRI)
     {
         // Special case N-Quads, because the RIOT reader has a pull interface
         if ( RDFLanguages.sameLang(RDFLanguages.NQUADS, lang) )
-            // Should be only use. Migrate the necessary code here when removing deprecated
code.
             return new IteratorResourceClosing<>(org.apache.jena.riot.lang.RiotParsers.createIteratorNQuads(input,
null), input);
         // Otherwise, we have to spin up a thread to deal with it
         final PipedRDFIterator<Quad> it = new PipedRDFIterator<>();

http://git-wip-us.apache.org/repos/asf/jena/blob/ca2c9f53/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java b/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java
index 68b3924..65a5956 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java
@@ -170,7 +170,6 @@ public class RDFParserRegistry
 
         @Override
         public void read(InputStream in, String baseURI, ContentType ct, StreamRDF output,
Context context) {
-            @SuppressWarnings("deprecation")
             LangRIOT parser = RiotParsers.createParser(in, lang, baseURI, output) ;
             if ( parserProfile != null )
                 parser.setProfile(parserProfile);
@@ -181,7 +180,6 @@ public class RDFParserRegistry
 
         @Override
         public void read(Reader in, String baseURI, ContentType ct, StreamRDF output, Context
context) {
-            @SuppressWarnings("deprecation")
             LangRIOT parser = RiotParsers.createParser(in, lang, baseURI, output) ;
             parser.getProfile().setHandler(errorHandler) ; 
             parser.parse() ;

http://git-wip-us.apache.org/repos/asf/jena/blob/ca2c9f53/jena-arq/src/main/java/org/apache/jena/riot/lang/RiotParsers.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/lang/RiotParsers.java b/jena-arq/src/main/java/org/apache/jena/riot/lang/RiotParsers.java
index 7c3ecd0..5f3f8b9 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/lang/RiotParsers.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/lang/RiotParsers.java
@@ -44,18 +44,16 @@ import org.apache.jena.riot.tokens.Tokenizer ;
 import org.apache.jena.riot.tokens.TokenizerFactory ;
 import org.apache.jena.sparql.core.Quad ;
 
-/** @deprecated Use RDFDataMgr operations.
+/** Use RDFDataMgr operations.
  * 
  * <b>This class is internal to RIOT.</b>
  */
-@Deprecated
 public class RiotParsers {
-    private RiotParsers() {}
+    /*package*/ RiotParsers() {}
     
     /** Create a parser 
-     * @deprecated Use {@link RDFDataMgr#createReader(Lang)}
+     * Use {@link RDFDataMgr#createReader(Lang)}
      */
-    @Deprecated
     public static LangRIOT createParser(InputStream input, Lang lang, String baseIRI, StreamRDF
dest) {
         if ( lang == RDFXML )
             return createParserRDFXML(input, baseIRI, dest) ;
@@ -69,55 +67,50 @@ public class RiotParsers {
     }
 
     /** Create a parser 
-     * @deprecated Use {@link RDFDataMgr#createReader(Lang)}
      */
-    @Deprecated
     public static LangRIOT createParser(Reader input, Lang lang, String baseIRI, StreamRDF
dest) {
         if ( lang == RDFXML )
             return createParserRDFXML(input, baseIRI, dest) ;
         if ( lang == CSV)
             return new LangCSV (input, baseIRI, baseIRI, ErrorHandlerFactory.getDefaultErrorHandler(),
 dest);
         
+        @SuppressWarnings("deprecation")
         Tokenizer tokenizer = ( lang == RDFJSON ) ?
             new TokenizerJSON(PeekReader.make(input)) :
                 TokenizerFactory.makeTokenizer(input) ;
         return createParser(tokenizer, lang, baseIRI, dest) ;
     }
 
-    /** Create a parser for Turtle
-     * @deprecated use an RDFDataMgr operation with argument Lang.Turtle
-     */
-    @Deprecated
+    /** Create an iterator for parsing N-Triples. */
+    public static Iterator<Triple> createIteratorNTriples(InputStream input, StreamRDF
dest) {
+        // LangNTriples supports iterator use.
+        return createParserNTriples(input, dest) ;
+    }
+
+    /** Create an iterator for parsing N-Quads. */
+    public static Iterator<Quad> createIteratorNQuads(InputStream input, StreamRDF
dest) {
+        // LangNQuads supports iterator use.
+        return createParserNQuads(input, dest) ;
+    }
+
     /*package*/ static LangTurtle createParserTurtle(InputStream input, String baseIRI, StreamRDF
dest) {
         Tokenizer tokenizer = TokenizerFactory.makeTokenizerUTF8(input) ;
         return createParserTurtle(tokenizer, baseIRI, dest) ;
     }
 
-    /** Create a parser for Turtle
-     * @deprecated use an RDFDataMgr operation with argument Lang.Turtle
-     */
-    @Deprecated
     /*package*/ static LangTurtle createParserTurtle(Tokenizer tokenizer, String baseIRI,
StreamRDF dest) {
         ParserProfile profile = RiotLib.profile(RDFLanguages.TURTLE, baseIRI) ;
         LangTurtle parser = new LangTurtle(tokenizer, profile, dest) ;
         return parser ;
     }
 
-    /** Create a parser for RDF/XML
-     * @deprecated use an RDFDataMgr operation with argument Lang.RDFXML
-     */
-    @Deprecated
-    /* package */ static LangRDFXML createParserRDFXML(InputStream input, String baseIRI,
StreamRDF dest) {
+    /*package*/ static LangRDFXML createParserRDFXML(InputStream input, String baseIRI, StreamRDF
dest) {
         baseIRI = baseURI_RDFXML(baseIRI) ;
         LangRDFXML parser = LangRDFXML.create(input, baseIRI, baseIRI, ErrorHandlerFactory.getDefaultErrorHandler(),
dest) ;
         return parser ;
     }
 
-    /** Create a parser for RDF/XML
-     * @deprecated use an RDFDataMgr operation with argument Lang.RDFXML
-     */
-    @Deprecated
-    /* package */ static LangRDFXML createParserRDFXML(Reader input, String baseIRI, StreamRDF
dest) {
+    /*package*/ static LangRDFXML createParserRDFXML(Reader input, String baseIRI, StreamRDF
dest) {
         baseIRI = baseURI_RDFXML(baseIRI) ;
         LangRDFXML parser = LangRDFXML.create(input, baseIRI, baseIRI, ErrorHandlerFactory.getDefaultErrorHandler(),
dest) ;
         return parser ;
@@ -133,118 +126,60 @@ public class RiotParsers {
             return SysRIOT.chooseBaseIRI(baseIRI) ;
     }
 
-    /** Create parsers for RDF/JSON
-     * @deprecated use an RDFDataMgr operation with argument Lang.RDFJSON
-     */
-    @Deprecated
-    /* package */ static LangRDFJSON createParserRdfJson(Tokenizer tokenizer, StreamRDF dest)
{
+    /*package*/ static LangRDFJSON createParserRdfJson(Tokenizer tokenizer, StreamRDF dest)
{
         ParserProfile profile = RiotLib.profile(RDFLanguages.RDFJSON, null);
         LangRDFJSON parser = new LangRDFJSON(tokenizer, profile, dest) ;
     	return parser;
     }
 
-    /**
-     * @deprecated use RDFDataMgr and Lang.RDFJSON
-     */
-    @Deprecated
-    /* package */ static LangRDFJSON createParserRdfJson(InputStream input, StreamRDF dest)
{
+    /*package*/ static LangRDFJSON createParserRdfJson(InputStream input, StreamRDF dest)
{
         TokenizerJSON tokenizer = new TokenizerJSON(PeekReader.makeUTF8(input)) ;
         return createParserRdfJson(tokenizer, dest) ;
     }
 
-    /** Create a parser for TriG
-     * @deprecated use an RDFDataMgr operation with argument Lang.TRIG
-     */
-    @Deprecated
-    /* package */ static LangTriG createParserTriG(InputStream input, String baseIRI, StreamRDF
dest) {
+    /*package*/ static LangTriG createParserTriG(InputStream input, String baseIRI, StreamRDF
dest) {
         Tokenizer tokenizer = TokenizerFactory.makeTokenizerUTF8(input) ;
         return createParserTriG(tokenizer, baseIRI, dest) ;
     }
 
-    /** Create a parser for TriG.
-     * @deprecated use an RDFDataMgr operation with argument Lang.TRIG
-     */
-    @Deprecated
-    /* package */ static LangTriG createParserTriG(Tokenizer tokenizer, String baseIRI, StreamRDF
dest) {
+    /*package*/ static LangTriG createParserTriG(Tokenizer tokenizer, String baseIRI, StreamRDF
dest) {
         ParserProfile profile = RiotLib.profile(RDFLanguages.TRIG, baseIRI);
         LangTriG parser = new LangTriG(tokenizer, profile, dest) ;
         return parser ;
     }
 
-    /** Create a parser for N-Triples
-     *  @deprecated Use an RDFDataMgr operation with argument Lang.NTRIPLES
-     */
-    @Deprecated
-    /* package */ static LangNTriples createParserNTriples(InputStream input, StreamRDF dest)
{
+    /*package*/ static LangNTriples createParserNTriples(InputStream input, StreamRDF dest)
{
         return createParserNTriples(input, CharSpace.UTF8, dest);
     }
 
-    /** Create a parser for N-Triples
-     *  @deprecated Use an RDFDataMgr operation with argument Lang.NTRIPLES
-     */
-    @Deprecated
     /*package*/ static  LangNTriples createParserNTriples(InputStream input, CharSpace charSpace,
StreamRDF dest) {
         Tokenizer tokenizer = charSpace == CharSpace.ASCII
             ? TokenizerFactory.makeTokenizerASCII(input) : TokenizerFactory.makeTokenizerUTF8(input);
         return createParserNTriples(tokenizer, dest) ;
     }
 
-    /** Create a parser for N-Triples
-     *  @deprecated Use an RDFDataMgr operation with argument Lang.NTRIPLES
-     */
-    @Deprecated
-    /* package */ static LangNTriples createParserNTriples(Tokenizer tokenizer, StreamRDF
dest) {
+    /*package*/ static LangNTriples createParserNTriples(Tokenizer tokenizer, StreamRDF dest)
{
         ParserProfile profile = RiotLib.profile(RDFLanguages.NTRIPLES, null) ;
         LangNTriples parser = new LangNTriples(tokenizer, profile, dest) ;
         return parser ;
     }
 
-    /** Create an iterator for parsing N-Triples. */
-    @Deprecated
-    public static Iterator<Triple> createIteratorNTriples(InputStream input, StreamRDF
dest) {
-        // LangNTriples supports iterator use.
-        return createParserNTriples(input, dest) ;
-    }
-
-    /** Create a parser for NQuads
-     *  @deprecated Use an RDFDataMgr operation with argument Lang.NQUADS.
-     */
-    @Deprecated
-    /* package */ static LangNQuads createParserNQuads(InputStream input, StreamRDF dest)
{
+    /*package*/ static LangNQuads createParserNQuads(InputStream input, StreamRDF dest) {
         return createParserNQuads(input, CharSpace.UTF8, dest) ;
     }
 
-    /** Create an iterator for parsing N-Quads. */
-    @Deprecated
-    public static Iterator<Quad> createIteratorNQuads(InputStream input, StreamRDF
dest) {
-        // LangNQuads supports iterator use.
-        return createParserNQuads(input, dest) ;
-    }
-    
-    /** Create a parser for NQuads
-     *  @deprecated Use an RDFDataMgr operation with argument Lang.NQUADS.
-     */
-    @Deprecated
-    /* package */ static LangNQuads createParserNQuads(InputStream input, CharSpace charSpace,
StreamRDF dest) {
+    /*package*/ static LangNQuads createParserNQuads(InputStream input, CharSpace charSpace,
StreamRDF dest) {
         Tokenizer tokenizer = charSpace == CharSpace.ASCII ? TokenizerFactory.makeTokenizerASCII(input)
: TokenizerFactory.makeTokenizerUTF8(input) ;
         return createParserNQuads(tokenizer, dest) ;
     }
 
-    /** Create a parser for NQuads
-     *  @deprecated Use an RDFDataMgr operation with argument Lang.NQUADS.
-     */
-    @Deprecated
-    /* package */ static LangNQuads createParserNQuads(Tokenizer tokenizer, StreamRDF dest)
{
+    /*package*/ static LangNQuads createParserNQuads(Tokenizer tokenizer, StreamRDF dest)
{
         ParserProfile profile = RiotLib.profile(RDFLanguages.NQUADS, null) ;
         LangNQuads parser = new LangNQuads(tokenizer, profile, dest) ;
         return parser ;
     }
 
-    /** Create a parser 
-     * @deprecated Use {@link RDFDataMgr#createReader(Lang)}
-     */
-    @Deprecated
-    /* package */ static LangRIOT createParser(Tokenizer tokenizer, Lang lang, String baseIRI,
StreamRDF dest) {
+    /*package*/ static LangRIOT createParser(Tokenizer tokenizer, Lang lang, String baseIRI,
StreamRDF dest) {
         if ( RDFLanguages.sameLang(RDFXML, lang) )
             throw new RiotException("Not possible - can't parse RDF/XML from a RIOT token
stream") ;
         if ( RDFLanguages.sameLang(TURTLE, lang) || RDFLanguages.sameLang(N3,  lang) ) 

http://git-wip-us.apache.org/repos/asf/jena/blob/ca2c9f53/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTuples.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTuples.java b/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTuples.java
index d06047f..a5c9dc9 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTuples.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/lang/TestLangNTuples.java
@@ -194,7 +194,6 @@ abstract public class TestLangNTuples extends BaseTest
         String string = StrUtils.strjoin("\n", strings) ;
         Tokenizer tokenizer = tokenizer(string) ;
         StreamRDFCounting sink = StreamRDFLib.count() ;
-        @SuppressWarnings("deprecation")
         LangRIOT x = RiotParsers.createParserNQuads(tokenizer, sink) ;
         x.setProfile(RiotLib.profile(null, false, true, new ErrorHandlerEx())) ;
         x.parse() ;


Mime
View raw message