{"id":13565297,"url":"https://github.com/atextor/turtle-formatter","last_synced_at":"2026-01-20T23:35:27.902Z","repository":{"id":57730251,"uuid":"335513644","full_name":"atextor/turtle-formatter","owner":"atextor","description":"Java library for pretty printing RDF/Turtle documents","archived":false,"fork":false,"pushed_at":"2025-03-29T05:54:11.000Z","size":266,"stargazers_count":17,"open_issues_count":19,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-29T06:28:33.798Z","etag":null,"topics":["ontology","ontology-engineering","rdf","turtle"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atextor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-03T05:07:11.000Z","updated_at":"2025-03-29T05:54:15.000Z","dependencies_parsed_at":"2024-08-01T13:22:01.060Z","dependency_job_id":"29e52bbe-50b5-49c0-9575-d9441433f2fd","html_url":"https://github.com/atextor/turtle-formatter","commit_stats":{"total_commits":141,"total_committers":1,"mean_commits":141.0,"dds":0.0,"last_synced_commit":"fe32acef1b675b5933636a2934214c8c42ef8eb0"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/atextor/turtle-formatter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atextor%2Fturtle-formatter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atextor%2Fturtle-formatter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atextor%2Fturtle-formatter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atextor%2Fturtle-formatter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atextor","download_url":"https://codeload.github.com/atextor/turtle-formatter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atextor%2Fturtle-formatter/sbom","scorecard":{"id":214461,"data":{"date":"2025-08-11","repo":{"name":"github.com/atextor/turtle-formatter","commit":"b50424f05aad822e18e6f7df51ca0adbc7ee649a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Code-Review","score":3,"reason":"Found 6/18 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/push-to-central.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/atextor/turtle-formatter/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/atextor/turtle-formatter/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/atextor/turtle-formatter/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/atextor/turtle-formatter/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/push-to-central.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/atextor/turtle-formatter/push-to-central.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/push-to-central.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/atextor/turtle-formatter/push-to-central.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/push-to-central.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/atextor/turtle-formatter/push-to-central.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/atextor/turtle-formatter/release.yml/main?enable=pin","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/push-to-central.yml:8"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T01:24:18.612Z","repository_id":57730251,"created_at":"2025-08-17T01:24:18.613Z","updated_at":"2025-08-17T01:24:18.613Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28618803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T22:24:05.405Z","status":"ssl_error","status_checked_at":"2026-01-20T22:20:31.342Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ontology","ontology-engineering","rdf","turtle"],"created_at":"2024-08-01T13:01:44.058Z","updated_at":"2026-01-20T23:35:27.895Z","avatar_url":"https://github.com/atextor.png","language":"Java","readme":"# turtle-formatter\n\n[![build](https://github.com/atextor/turtle-formatter/actions/workflows/build.yml/badge.svg)](https://github.com/atextor/turtle-formatter/actions/workflows/build.yml) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/de.atextor/turtle-formatter/badge.svg)](https://maven-badges.herokuapp.com/maven-central/de.atextor/turtle-formatter) [![codecov](https://codecov.io/gh/atextor/turtle-formatter/branch/main/graph/badge.svg?token=X2YFDI4Z4W)](https://codecov.io/gh/atextor/turtle-formatter) [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n\n**turtle-formatter** is a Java library for pretty printing\n[RDF/Turtle](https://www.w3.org/TR/turtle/) documents in a _configurable_ and _reproducible_ way.\n\nIt takes as input a formatting style and an [Apache Jena](https://jena.apache.org) Model and\nproduces as output a pretty-printed RDF/Turtle document.\n\nStarting from version 1.2.0, turtle-formatter is licensed under Apache 2.0. The\ncurrent version is 1.2.16.\n\n**Current Status**: The library is feature-complete.\n\n## Why?\n\n### Reproducible Formatting\n\nEvery RDF library comes with its own serializers, for example an Apache Jena Model can be written\n[in multiple ways](https://jena.apache.org/documentation/io/rdf-output.html), the easiest being\ncalling the write method on a model itself: `model.write(System.out, \"TURTLE\")`. However, due to the\nnature of RDF, outgoing edges of a node in the graph have no order. When serializing a model, there\nare multiple valid ways to do so. For example, the following two models are identical:\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n```turtle\n@prefix : \u003chttp://example.com/\u003e .\n\n:test\n  :blorb \"blorb\" ;\n  :floop \"floop\" .\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n```turtle\n@prefix : \u003chttp://example.com/\u003e .\n\n:test\n  :floop \"floop\" ;\n  :blorb \"blorb\" .\n```\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\nTherefore, when a model is serialized, one of many different (valid) serializations could be the\nresult. This is a problem when different versions of a model file are compared, for example when\nused as artifacts in a git repository. Additionally, serialized files are often formatted in one\nstyle hardcoded in the respective library. So while Apache Jena and for example\n[libraptor2](http://librdf.org/raptor/) both write valid RDF/Turtle, the files are formatted\ndifferently. You would not want the code of a project formatted differently in different files,\nwould you?\n**turtle-formatter** addresses these problems by taking care of serialization order and providing a\nway to customize the formatting style.\n\n### Nice and Configurable Formatting\n\nMost serializers, while creating valid RDF/Turtle, create _ugly_ formatting. Obviously, what is ugly\nand what isn't is highly subjective, so this should be configurable. **turtle-formatter** addresses\nthis by making the formatting style configurable, e.g. how alignment should be done, where extra\nspaces should be inserted and even if indendation is using tabs or spaces. A default style is\nprovided that reflects sane settings (i.e., the author's opinion). An RDF document formatted using\nthe default style could look like this:\n\n```turtle\n@prefix rdfs: \u003chttp://www.w3.org/2000/01/rdf-schema#\u003e . ①\n@prefix owl: \u003chttp://www.w3.org/2002/07/owl#\u003e .\n@prefix : \u003chttp://example.com/relations#\u003e .\n\n:Male a owl:Class ; ②\n  owl:disjointWith :Female ; ③\n  owl:equivalentClass [ ④\n    a owl:Restriction ;\n    owl:hasSelf true ; ⑤\n    owl:onProperty :isMale ;\n  ] ;\n  rdfs:subClassOf :Person .\n\n:hasBrother a owl:ObjectProperty ;\n  owl:propertyChainAxiom ( :hasSibling :isMale ) ; ⑥\n  rdfs:range :Male .\n\n:hasUncle a owl:ObjectProperty, owl:IrreflexiveProperty ; ⑦\n  owl:propertyChainAxiom ( :hasParent :hasSibling :hasHusband ) ; ⑦\n  owl:propertyChainAxiom ( :hasParent :hasBrother ) ;\n  rdfs:range :Male .\n```\n\n* ① Prefixes are sorted by common, then custom. They are _not_ aligned on the colon because that\n  looks bad when one prefix string is much longer than the others.\n* ② `rdf:type` is always written as `a`. It is always the first predicate and written in the same\n  line as the subject.\n* ③ Indentation is done using a fixed size, like in any other format or language. Predicates are not\n  aligned to subjects with an arbitrary length.\n* ④ Anonymous nodes are written using the `[ ]` notation whenever possible.\n* ⑤ Literal shortcuts are used where possible (e.g. no `\"true\"^^xsd:boolean`).\n* ⑥ RDF Lists are always written using the `( )` notation, no blank node IDs or\n  `rdf:next`/`rdf:first` seen here.\n* ⑦ The same predicates on the same subjects are repeated rather than using the `,` notation,\n  because especially when the objects are longer (nested anonymous nodes), it is difficult to\n  understand. The exception to this rule is for different `rdf:type`s.\n\n## Usage\n\n### Usage as a CLI (command line interface)\n\nturtle-formatter itself is only a library and thus intended to be used programmatically, which is\nexplained in the following sections. However, in the sibling project\n[owl-cli](https://github.com/atextor/owl-cli), turtle-formatter is used and can be called using a\ncommand line interface to pretty-print any OWL or RDF document. See owl-cli's [Getting\nStarted](https://atextor.de/owl-cli/main/snapshot/index.html) to get the tool and the [write command\ndocumentation](https://atextor.de/owl-cli/main/snapshot/usage.html#write-command) to see which\ncommand line switches are available to adjust the formatting.\n\n### Usage as a library\n\nAdd the following dependency to your Maven `pom.xml`:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ede.atextor\u003c/groupId\u003e\n  \u003cartifactId\u003eturtle-formatter\u003c/artifactId\u003e\n  \u003cversion\u003e1.2.16\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nGradle/Groovy: `implementation 'de.atextor:turtle-formatter:1.2.16'`\n\nGradle/Kotlin: `implementation(\"de.atextor:turtle-formatter:1.2.16\")`\n\n### Calling the formatter\n\n```java\nimport java.io.FileInputStream;\nimport de.atextor.turtle.formatter.FormattingStyle;\nimport de.atextor.turtle.formatter.TurtleFormatter;\nimport org.apache.jena.rdf.model.Model;\nimport org.apache.jena.rdf.model.ModelFactory;\n\n// ...\n\n// Determine formatting style\nFormattingStyle style = FormattingStyle.DEFAULT;\nTurtleFormatter formatter = new TurtleFormatter(style);\n// Build or load a Jena Model.\n// Use the style's base URI for loading the model.\nModel model = ModelFactory.createDefaultModel();\nmodel.read(new FileInputStream(\"data.ttl\"), style.emptyRdfBase, \"TURTLE\");\n// Either create a string...\nString prettyPrintedModel = formatter.apply(model);\n// ...or write directly to an OutputStream\nformatter.accept(model, System.out);\n```\n\n### Customizing the style\n\nInstead of passing `FormattingStyle.DEFAULT`, you can create a custom `FormattingStyle` object.\n\n```java\nFormattingStyle style = FormattingStyle.builder(). ... .build();\n```\n\nThe following options can be set on the FormattingStyle builder:\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003eOption\u003c/td\u003e\n\u003ctd\u003eDescription\u003c/td\u003e\n\u003ctd\u003eDefault\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`emptyRdfBase`\n\n\u003c/td\u003e\n\u003ctd\u003eSet the URI that should be left out in formatting. If you don't care about\nthis, don't change it and use the FormattingStyle's emptyRdfBase field as the\nbase URI when loading/creating the model that will be formatted, see\n\u003ca href=\"#calling-the-formatter\"\u003ecalling the formatter\u003c/a\u003e.\n\n\u003c/td\u003e\n\u003ctd\u003eurn:turtleformatter:internal\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`alignPrefixes`\n\n\u003c/td\u003e\n\u003ctd\u003eBoolean. Example:\n\n```turtle\n# true\n@prefix rdf:     \u003chttp://www.w3.org/1999/02/22-rdf-syntax-ns#\u003e .\n@prefix example: \u003chttp://example.com/\u003e .\n\n# false\n@prefix rdf: \u003chttp://www.w3.org/1999/02/22-rdf-syntax-ns#\u003e .\n@prefix example: \u003chttp://example.com/\u003e .\n```\n\n\u003c/td\u003e\n\u003ctd\u003efalse\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`alignPredicates`\n`firstPredicate`-\n`InNewLine`\n\n\u003c/td\u003e\n\u003ctd\u003e\nBoolean. Example:\n\n```turtle\n# firstPredicateInNewLine false\n# alignPredicates true\n:test a rdf:Resource ;\n      :blorb \"blorb\" ;\n      :floop \"floop\" .\n\n# firstPredicateInNewLine false\n# alignPredicates false\n:test a rdf:Resource ;\n  :blorb \"blorb\" ;\n  :floop \"floop\" .\n\n# firstPredicateInNewLine true\n# alignPredicates does not matter\n:test\n  a rdf:Resource ;\n  :blorb \"blorb\" ;\n  :floop \"floop\" .\n```\n\n\u003c/td\u003e\n\u003ctd\u003efalse (for both)\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`alignObjects`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nBoolean. Example:\n```turtle\n# alignObjects true\n:test\n  a           rdf:Resource ;\n  :blorb      \"blorb\" ;\n  :floopfloop \"floopfloop\" .\n\n# alignObjects false\n:test\n  a rdf:Resource ;\n  :blorb \"blorb\" ;\n  :floopfloop \"floopfloop\" .\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\nfalse\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`charset`\\*\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nOne of `LATIN1`, `UTF_16_BE`, `UTF_16_LE`, `UTF_8`, `UTF_8_BOM`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n`UTF_8`\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n`doubleFormat`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nA [NumberFormat](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/NumberFormat.html) that describes how `xsd:double` literals are formatted if `enableDoubleFormatting` is `true`.\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n`0.####E0`\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n`enableDoubleFormatting`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nEnables formatting of `xsd:double` values (see `doubleFormat` option)\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n`false`\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`endOfLine`\\*\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nOne of `LF`, `CR`, `CRLF`. If unsure, please see [Newline](https://en.wikipedia.org/wiki/Newline)\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n`LF`\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n`indentStyle`\\*\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n`SPACE` or `TAB`. Note that when choosing `TAB`, `alignPredicates` and `alignObjects` are\nautomatically treated as `false`.\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n`SPACE`\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n`quoteStyle`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n`ALWAYS_SINGLE_QUOTES`, `TRIPLE_QUOTES_FOR_MULTILINE` or `ALWAYS_TRIPLE_QUOTES`.\nDetermines which quotes should be used for literals. Triple-quoted strings can\ncontain literal quotes and line breaks.\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n`TRIPLE_QUOTES_FOR_MULTILINE`\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\n\n`indentSize`\\*\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nInteger. When using `indentStyle` `SPACE`, defines the indentation size.\n\n\u003c/td\u003e\n\u003ctd\u003e\n2\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`insertFinalNewLine`\\*\n\n\u003c/td\u003e\n\u003ctd\u003e\nBoolean. Determines whether there is a line break after the last line\n\u003c/td\u003e\n\u003ctd\u003e\ntrue\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`useAForRdfType`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nBoolean. Determines whether `rdf:type` is written as `a` or as `rdf:type`.\n\n\u003c/td\u003e\n\u003ctd\u003e\ntrue\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`keepUnusedPrefixes`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nBoolean. If `true`, keeps prefixes that are not part of any statement.\n\n\u003c/td\u003e\n\u003ctd\u003e\nfalse\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`useCommaByDefault`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nBoolean. Determines whether to use commas for identical predicates. Example:\n```turtle\n# useCommaByDefault false\n:test a rdf:Resource ;\n  :blorb \"someBlorb\" ;\n  :blorb \"anotherBlorb\" .\n\n# useCommaByDefault true\n:test a rdf:Resource ;\n  :blorb \"someBlorb\", \"anotherBlorb\" .\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\nfalse\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`commaForPredicate`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nA set of predicates that, when used multiple times, are separated by commas, even when\n`useCommaByDefault` is `false`. Example:\n\n```turtle\n# useCommaByDefault false, commaForPredicate contains\n# 'rdf:type', firstPredicateInNewLine true\n:test a ex:something, owl:NamedIndividual ;\n  :blorb \"someBlorb\" ;\n  :blorb \"anotherBlorb\" .\n\n# useCommaByDefault false, commaForPredicate is empty,\n# firstPredicateInNewLine false\n:test\n  a ex:something ;\n  a owl:NamedIndividual ;\n  :blorb \"someBlorb\" ;\n  :blorb \"anotherBlorb\" .\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nSet.of(`rdf:type`)\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`noCommaForPredicate`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nAnalogous to `commaForPredicate`: A set of predicates that, when used multiple times, are _not_\nseparated by commas, even when `useCommaByDefault` is `true`.\n\n\u003c/td\u003e\n\u003ctd\u003e\nEmpty\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`prefixOrder`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nA list of namespace prefixes that defines the order of `@prefix` directives. Namespaces from the\nlist always appear first (in this order), every other prefix will appear afterwards,\nlexicographically sorted. Example:\n\n```turtle\n# prefixOrder contains \"rdf\" and \"owl\" (in this order), so\n# they will appear in this order at the top (when the model\n# contains them!), followed by all other namespaces\n@prefix rdf: \u003chttp://www.w3.org/1999/02/22-rdf-syntax-ns#\u003e .\n@prefix owl: \u003chttp://www.w3.org/2002/07/owl#\u003e .\n@prefix example: \u003chttp://example.com/\u003e .\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nList.of(`rdf` `rdfs` `xsd` `owl`)\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`subjectOrder`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nA list of resources that determines the order in which subjects appear. For a subject `s` there must\nexist a statement `s rdf:type t` in the model and an entry for `t` in the `subjectOrder` list for\nthe element to be considered in the ordering, i.e., when `subjectOrder` contains `:Foo` and `:Bar`\nin that order, the pretty-printed model will show first all `:Foo`s, then all `:Bar`s, then\neverything else lexicographically sorted.\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nList.of(`rdfs:Class` `owl:Ontology` `owl:Class` `rdf:Property` `owl:ObjectProperty`\n`owl:DatatypeProperty` `owl:AnnotationProperty` `owl:NamedIndividual` `owl:AllDifferent`\n`owl:Axiom`)\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`predicateOrder`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nA list of properties that determine the order in which predicates appear for a subject. First all\nproperties that are in the list are shown in that order, then everything else lexicographically\nsorted. For example, when `predicateOrder` contains `:z`, `:y`, `:x` in that order and the subject\nhas statements for the properties `:a`, `:x` and `:z`:\n\n```turtle\n:test\n  :z \"z\" ;\n  :x \"x\" ;\n  :a \"a\" .\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nList.of(`rdf:type` `rdfs:label` `rdfs:comment` `dcterms:description`)\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`objectOrder`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nA list of RDFNodes (i.e. resources or literals) that determine the order in which objects appear for\na predicate, when there are multiple statements with the same subject and the same predicate. First\nall objects that are in the list are shown in that order, then everything else lexicographically\nsorted. For example, when `objectOrder` contains `:Foo` and `:Bar` in that order:\n\n```turtle\n:test a :Foo, :Bar .\n```\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nList.of(`owl:NamedIndividual` `owl:ObjectProperty` `owl:DatatypeProperty` `owl:AnnotationProperty` `owl:FunctionalProperty` `owl:InverseFunctionalProperty` `owl:TransitiveProperty` `owl:SymmetricProperty` `owl:AsymmetricProperty` `owl:ReflexiveProperty` `owl:IrreflexiveProperty`)\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`anonymousNode`-\n`IdGenerator`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nA `BiFunction` that takes a resource (blank node) and an integer (counter) and determines the name\nfor a blank node in the formatted output, if it needs to be locally named. Consider the following\nmodel:\n\n```turtle\n:test :foo _:b0 .\n:test2 :bar _:b0 .\n```\n\nThere is no way to serialize this model in RDF/Turtle while using the inline blank node syntax `[ ]`\nfor the anonymous node `_:b0`. If, as in this example, the node in question already has a label, the label is re-used.\nOtherwise, the anonymousNodeIdGenerator is used to generate it.\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n`(r, i) -\u003e \"gen\" + i`\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n{`after`,`before`}\n{`Opening`, `Closing`}\n{`Parenthesis`, `SquareBrackets`},\n\n{`after`,`before`}\n{`Comma`, `Dot`, `Semicolon` }\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n`NEWLINE`, `NOTHING` or `SPACE`. Various options for formatting gaps and line breaks. It is not\nrecommended to change those, as the default style represents the commonly accepted best practices\nfor formatting turtle already.\n\n\u003c/td\u003e\n\u003ctd\u003e\n\nVaried\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\n\n`wrapListItems`\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n`ALWAYS`, `NEVER` or `FOR_LONG_LINES`. Controls how line breaks are added after\nelements in RDF lists.\n\n\u003c/td\u003e\n\u003ctd\u003e\n\n`FOR_LONG_LINES`\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\n\u003c/table\u003e\n\n\\* Adapted from [EditorConfig](https://editorconfig.org/#file-format-details)\n\n## Release Notes\n* Unreleased\n  * Replace Platform-dependent line terminators in multiline strings with unix style newlines (`\\n`, `\\r`, and `\\r\\n` -\u003e `\\n`) \n* 1.2.16:\n  * Bugfix: Empty RDF lists are formatted as empty set of parenthesis again\n* 1.2.15:\n  * Bugfix: RDF list nodes containing other properties than `rdf:rest` and\n    `rdf:first` are formatted correctly\n* 1.2.14:\n  * Bugfix: xsd:double numbers are correctly typed even when lexically\n    equivalent to decimals\n* 1.2.13: \n  * Feature: Skip double formatting\n* 1.2.12:\n  * Bugfix: Handle RDF lists that start with a non-anonymous node\n  * Bugfix: Handle blank node cycles\n  * Bugfix: Ensure constant blank node ordering\n  * Bugfix: Set Locale for NumberFormat to US\n  * Change default `subjectOrder` to show `rdfs:Class` after `owl:Ontology`\n* 1.2.11:\n  * Bugfix: `rdf:type` is not printed as `a` when used as an object\n  * Update all dependencies, including Apache Jena to 4.10.0\n* 1.2.10:\n  * Configured endOfLine style is honored in prefix formatting\n* 1.2.9:\n  * The dummy base URI is now configurable in the formatting style. Its default\n    value was changed (to `urn:turtleformatter:internal`) to make it a valid URI.\n* 1.2.8:\n  * Bugfix: Quotes that are the last character in a triple-quoted string are\n    escaped correctly\n  * New style switch: `FormattingStyle.quoteStyle`\n* 1.2.7:\n  * Bugfix: URIs and local names are formatted using Jena RIOT; no invalid local\n    names are printed any longer\n* 1.2.6:\n  * Fix typo in FormattingStyle property (`indentPredicates`)\n  * Fix alignment of repeated identical predicates\n* 1.2.5:\n  * Dashes, underscores and full stops in the name part of local names are not\n    escaped any more. Technically not a bug fix since both is valid, but it's\n    nicer to read\n* 1.2.4:\n  * Bugfix: Dashes in prefixes of local names are not escaped any more\n* 1.2.3:\n  * Bugfix: Special characters in local names (curies) and literals are properly escaped\n* 1.2.2:\n  * Enable writing URIs with an empty base: use `TurtleFormatter.EMPTY_BASE` as\n    value for \"base\" when reading a model using Jena's `model.read()`\n  * Update build to Java 17\n* 1.2.1:\n  * Improve formatting for blank nodes nested in lists\n  * Use triple quotes for literals containing line breaks\n  * Use Jena's mechanisms for escaping special characters in literals\n* 1.2.0:\n  * Add `wrapListItems` configuration option\n  * Change license from LGPL 3.0 to Apache 2.0\n* 1.1.1:\n  * Make fields of `FormattingStyle` public, so that `DEFAULT` config is readable\n* 1.1.0:\n  * Bugfix: Subjects with a `rdf:type` not in `subjectOrder` are rendered correctly\n  * Adjust default `subjectOrder` and `predicateOrder`\n  * Add new option `keepUnusedPrefixes` and by default render only used prefixes\n* 1.0.1: Fix POM so that dependency can be used as jar\n* 1.0.0: First version\n\n## Contact\n\n**turtle-formatter** is developed by Andreas Textor \u003c\u003cmail@atextor.de\u003e\u003e.\n","funding_links":[],"categories":["Java"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatextor%2Fturtle-formatter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatextor%2Fturtle-formatter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatextor%2Fturtle-formatter/lists"}