protected T prepareForParsing()

in commons-rdf-simple/src/main/java/org/apache/commons/rdf/simple/experimental/AbstractRDFParser.java [489:509]


    protected T prepareForParsing() throws IOException, IllegalStateException {
        checkSource();
        checkBaseRequired();
        checkContentType();
        checkTarget();

        // We'll make a clone of our current state which will be passed to
        // parseSynchronously()
        final AbstractRDFParser<T> c = clone();

        // Use a fresh SimpleRDF for each parse
        c.rdfTermFactory = c.getRdfTermFactory().orElse(createRDFTermFactory());
        // sourceFile, but no base? Let's follow any symlinks and use
        // the file:/// URI
        if (c.getSourceFile().isPresent() && !c.getBase().isPresent()) {
            final URI baseUri = c.getSourceFile().get().toRealPath().toUri();
            c.base = internalRdfTermFactory.createIRI(baseUri.toString());
        }

        return c.asT();
    }