Github user hartig commented on the issue:

    https://github.com/apache/jena/pull/299
  
    I agree. Making `checkTriple` protected in `ParserProfileStd` would be an 
even better idea. Please do it.
    
    While we are at it, can you add another constructor to `TurtleShell` that 
allows me to pass my own `NodeFormatter` (in addition to the other arguments 
that are passed to the existing constructor)?
    This extension would allow me to develop a `TurtleStarWriter` simply by 
using `TurtleShell` instead of having to create a copy of it.
    I mean, in terms of source code, my proposal is to add the following new 
constructor:
    ```
    protected TurtleShell(IndentedWriter out, PrefixMap pmap, String baseURI, 
NodeFormatter nodeFmt, Context context) {
        this.out = out ;
        if ( pmap == null )
            pmap = PrefixMapFactory.emptyPrefixMap() ;
        this.prefixMap = pmap ;
        this.baseURI = baseURI ;
        this.nodeFmt = nodeFmt ;
    }
    ```
    ...and then modify the existing constructor as follows:
    ```
    protected TurtleShell(IndentedWriter out, PrefixMap pmap, String baseURI, 
Context context) {
        this(out, pmap, baseURI, createNodeFormatter(pmap,baseURI,context), 
context) ;
    }
    
    static public NodeFormatter createNodeFormatter(PrefixMap pmap, String 
baseURI, Context context) {
        if ( context != null && context.isTrue(RIOT.multilineLiterals) )
            return new NodeFormatterTTL_MultiLine(baseURI, pmap, 
NodeToLabel.createScopeByDocument()) ;
        else
            return new NodeFormatterTTL(baseURI, pmap, 
NodeToLabel.createScopeByDocument()) ;
    }
    ```


---

Reply via email to