Crates.io | turtlefmt |
lib.rs | turtlefmt |
version | 0.1.1 |
source | src |
created_at | 2023-01-02 15:58:34.519312 |
updated_at | 2024-01-11 14:05:19.283571 |
description | Auto-formatter for RDF Turtle |
homepage | |
repository | https://github.com/helsing-ai/turtlefmt |
max_upload_size | |
id | 749479 |
size | 130,679 |
turtlefmt
is an auto formatter for RDF Turtle under Apache 2 license.
It is currently distributed on:
Build from source requires NodeJS 6.0+ to be available in your PATH
.
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
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.
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.