Skip to main content

Auto-formatter for RDF Turtle

Project description

TurtleFmt

turtlefmt is an auto formatter for RDF Turtle under Apache 2 license.

Installation

It is currently distributed on:

  • Crates.io: cargo install turtlefmt
  • Pypi: pipx install turtlefmt

Build from source requires NodeJS 6.0+ to be available in your PATH.

Usage

To use it:

turtlefmt MY_TURTLE_FILE.ttl

It is also possible to check if formatting of a given file is valid according to the formatter using:

turtlefmt --check MY_TURTLE_FILE.ttl

If the formatting is not valid, a patch to properly format the file is written to the standard output.

It is also possible to check a complete directory (and its subdirectories):

turtlefmt MY_DIR

Format

turtlefmt is in development and its output format is not stable yet.

Example:

@prefix ex: <http://example.com/> . # Prefix
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

# Some facts

<s> a ex:Foo ;
    <p> "foo"@en , ( +01 +1.0 1.0e0 ) . # Foo

# An anonymous blank node
[ ex:p ex:o , ex:o2 ; ex:p2 ex:o3 ] ex:p3 true . # Bar

For now, it:

  • Validates that the file is valid.
  • Maintains consistent indentation and line jumps.
  • Normalises string and IRI escapes to reduce their number as much as possible.
  • Enforces the use of " instead of ' in literals.
  • Uses literals short notation for booleans, integers, decimals and doubles when it keeps the lexical representation unchanged.
  • Uses a for rdf:type where possible.

License

Copyright 2022 Helsing GmbH

Licensed 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

turtlefmt-0.1.1.tar.gz (35.1 kB view details)

Uploaded Source

Built Distributions

turtlefmt-0.1.1-py3-none-win_amd64.whl (408.5 kB view details)

Uploaded Python 3 Windows x86-64

turtlefmt-0.1.1-py3-none-musllinux_1_2_x86_64.whl (1.5 MB view details)

Uploaded Python 3 musllinux: musl 1.2+ x86-64

turtlefmt-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ x86-64

turtlefmt-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

turtlefmt-0.1.1-py3-none-macosx_11_0_arm64.whl (567.5 kB view details)

Uploaded Python 3 macOS 11.0+ ARM64

turtlefmt-0.1.1-py3-none-macosx_10_12_x86_64.whl (579.0 kB view details)

Uploaded Python 3 macOS 10.12+ x86-64

File details

Details for the file turtlefmt-0.1.1.tar.gz.

File metadata

  • Download URL: turtlefmt-0.1.1.tar.gz
  • Upload date:
  • Size: 35.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for turtlefmt-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8d674ec6653f9cb352d8ab02c9438e548fc75bf863c89547d4fe966810c90272
MD5 66f64d39c619df77c02bc3ee17cf4bb3
BLAKE2b-256 14abb306aa6ed9ecd6fa37416a4a72a30460190384cf4929e0634c6a3c5159ee

See more details on using hashes here.

File details

Details for the file turtlefmt-0.1.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: turtlefmt-0.1.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 408.5 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for turtlefmt-0.1.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 c92baf412b5871331a227769bc20ae1185a2165561f90c574e4876c464e9b3ec
MD5 64381fa7c314cd7292e505fc1fe21aba
BLAKE2b-256 64beb1be72f3d1f19d26285dac2dfa9011ced87295a994be9bd1952991b395eb

See more details on using hashes here.

File details

Details for the file turtlefmt-0.1.1-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for turtlefmt-0.1.1-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 26ad0385fd04d6a2aa54989f9bfa6aec42d51e71d56b52d1b570ff4476c2c63b
MD5 eea9ee8447deed6463fcbb217e995f47
BLAKE2b-256 60561f27e5411eca00c7512503f990e3ceec2356e440b7566f56d709196f044c

See more details on using hashes here.

File details

Details for the file turtlefmt-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for turtlefmt-0.1.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 666dde740d2f695b94f356ac852f9e3c505dd5d59caf46bf7f701319ce14f58e
MD5 e2043fde98ca00cc91cac7450632b78b
BLAKE2b-256 bfe87b9218a208dae8595308b35e2f0da77f8e91c1ae07f90934b5535609910a

See more details on using hashes here.

File details

Details for the file turtlefmt-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for turtlefmt-0.1.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 96e783f9a62b8c0beea99df14c89a72ea16a17681b3d341b806bc83d99fdae91
MD5 f6899091146ab1fa89f64b07376170f6
BLAKE2b-256 869b81a193c05ad2ff16e9bd186f7a50ab946d2090d792f127e001b0c1f756df

See more details on using hashes here.

File details

Details for the file turtlefmt-0.1.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for turtlefmt-0.1.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 85c82cec7029447f2f4aa7f3acf719ea7126d46395996d42760ce0758edc212b
MD5 36bb31418c4c15f04417ad3daae02fde
BLAKE2b-256 a4d99b80c66b245e29df3fde1e083aa27bd331c9ef9dc52c4695f5dcf6f4cbd1

See more details on using hashes here.

File details

Details for the file turtlefmt-0.1.1-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for turtlefmt-0.1.1-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a840e1a584075c0d98b29c3e9e5ab03a5c9cbc17e04e58822924df68b6991125
MD5 5a1bd25dd16c7b8cb18776732ad0a8fb
BLAKE2b-256 2b1bddf4e04820eb1d7b4727441702296a0c8aeb58f653db67c08d41fd22b59a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page