Maybe you can take some inspiration from
https://github.com/buda-base/jena-stable-turtle/ 

On Mon, 2023-06-19 at 23:35 +0000, Shaw, Ryan wrote:
> I would like to create a custom Turtle pretty printer that does not
> try to align things like the current pretty printer does. I just want
> a standard indentation width (e.g. two spaces).
> 
> So, instead of:
> 
> ```
> [ a                            time:ProperInterval ;
>   time:hasBeginning            [ a                time:Instant ;
>                                  time:inDateTime  [ a             
> time:DateTimeDescription ;
>                                                     time:day       "-
> --12"^^xsd:gDay ;
>                                                     time:hour     
> "23"^^xsd:nonNegativeInteger ;
>                                                     time:minute   
> "20"^^xsd:nonNegativeInteger ;
>                                                     time:month     "-
> -04"^^xsd:gMonth ;
>                                                     time:second   
> "30"^^xsd:decimal ;
>                                                     time:timeZone 
> bipm:UTC ;
>                                                     time:unitType 
> time:unitSecond ;
>                                                     time:year     
> "1985"^^xsd:gYear
>                                                   ]
>                                ] ;
>   time:hasDurationDescription  [ a           time:DurationDescription
> ;
>                                  time:hours 
> "04"^^xsd:nonNegativeInteger
>                                ] ;
>   time:hasEnd                  :when2
> ] .
> ```
> 
> I would instead like:
> 
> ```
> [
>   a time:ProperInterval ;
>   time:hasBeginning :when1 ;
>   time:hasDurationDescription [
>     a time:DurationDescription ;
>     time:hours  "04"^^xsd:nonNegativeInteger
>   ] ;
>   time:hasEnd [
>     a time:Instant ;
>     time:inDateTime [
>       a time:DateTimeDescription ;
>       time:day "---12"^^xsd:gDay ;
>       time:hour "23"^^xsd:nonNegativeInteger ;
>       time:minute "20"^^xsd:nonNegativeInteger ;
>       time:month "--04"^^xsd:gMonth ;
>       time:second "30"^^xsd:decimal ;
>       time:timeZone bipm:UTC ;
>       time:unitType time:unitSecond ;
>       time:year "1985"^^xsd:gYear
>     ]
>   ]
> ] .
> ```
> 
> (Note how much easier the 2nd is to read without a super-wide
> window!)
> 
> I know that I can add a new writer for a new language, but how do I
> add a new pretty-printed format for an existing language?
> 
> Thanks,
> Ryan
> 

Reply via email to