/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.rdf.jena;

import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.text.ParseException;

import org.apache.commons.rdf.api.IRI;
import org.apache.commons.rdf.api.RDFParserBuilder;
import org.apache.commons.rdf.api.RDFTermFactory;
import org.apache.commons.rdf.simple.AbstractRDFParserBuilder;
import org.apache.jena.riot.Lang;
import org.apache.jena.riot.RDFDataMgr;
import org.apache.jena.riot.system.StreamRDF;

public class JenaRDFParserBuilder extends AbstractRDFParserBuilder implements RDFParserBuilder {

	protected RDFTermFactory createRDFTermFactory() {
		return new RDFTermFactoryJena();
	}

	@Override
	protected void parseSynchronusly() throws IOException, IllegalStateException, ParseException {
		StreamRDF dest = JenaCommonsRDF.streamJenaToCommonsRDF(rdfTermFactory.get(), intoGraph.get());

		Lang lang = contentTypeSyntax.flatMap(JenaCommonsRDF::rdfSyntaxToLang).orElse(null);
		String baseStr = base.map(IRI::getIRIString).orElse(null);

		if (sourceIri.isPresent()) {
			RDFDataMgr.parse(dest, sourceIri.get().toString(), baseStr, lang, null);
		} else if (sourceFile.isPresent()) {
			try (InputStream s = Files.newInputStream(sourceFile.get())) {
				RDFDataMgr.parse(dest, s, baseStr, lang, null);
			}
		} else {
			RDFDataMgr.parse(dest, sourceInputStream.get(), baseStr, lang, null);
		}
	}

}

@@ -925,41 +925,8 @@
 les;
-%0Aimport java.text.ParseException;
 %0A%0Aim
@@ -1505,47 +1505,8 @@
 tion
-, IllegalStateException, ParseException
  %7B%0A%09
@@ -1561,17 +1561,20 @@
 monsRDF(
-r
+getR
 dfTermFa
@@ -1578,24 +1578,26 @@
 mFactory
+()
 .get(), 
 intoGrap
@@ -1592,17 +1592,20 @@
 (), 
-i
+getI
 ntoGraph
 .get
@@ -1600,16 +1600,18 @@
 ntoGraph
+()
 .get());
@@ -1626,17 +1626,20 @@
  lang = 
-c
+getC
 ontentTy
@@ -1646,16 +1646,18 @@
 peSyntax
+()
 .flatMap
@@ -1723,20 +1723,25 @@
 seStr = 
-b
+getB
 ase
+()
 .map(IRI
@@ -1777,25 +1777,28 @@
 %0A%0A%09%09if (
-s
+getS
 ourceIri
 .isPrese
@@ -1789,16 +1789,18 @@
 ourceIri
+()
 .isPrese
@@ -1837,17 +1837,20 @@
 st, 
-s
+getS
 ourceIri
 .get
@@ -1845,16 +1845,18 @@
 ourceIri
+()
 .get().t
@@ -1901,17 +1901,20 @@
 lse if (
-s
+getS
 ourceFil
@@ -1914,16 +1914,18 @@
 urceFile
+()
 .isPrese
@@ -1977,17 +1977,20 @@
 tStream(
-s
+getS
 ourceFil
@@ -1990,16 +1990,18 @@
 urceFile
+()
 .get()))
@@ -2097,17 +2097,20 @@
 e(dest, 
-s
+getS
 ourceInp
@@ -2117,16 +2117,18 @@
 utStream
+()
 .get(), 

Use AbstractRDFParserBuilder getters