# ttlser
[![PyPI version](https://badge.fury.io/py/ttlser.svg)](https://pypi.org/project/ttlser/)
Deterministic turtle serialization for rdflib.
## Documentation
See the [docs](./docs/ttlser.md) for the full specification and
details on the implemention.
`ttlser` also includes a number of other turtle serializers for
specific rendering needs.
## ttlfmt
`ttlser` provides a `ttlfmt` script that can convert any rdflib supported
format into the output format supported by the serializers or any other
rdflib serializer. If you want to use it you should install with `ttlser[ttlfmt]`.
## Known issues
1. symmetric predicates: If you have symmetric predicates like `owl:disjointWith` then
ttlser needs to know about them so that it can do the reordering those cases appropriately,
otherwise you will end up with situations where another tool reorders the serialization and
ttlser has to assume that the ordering is semantically meaningful. See
[`symmetric_predicates`](https://github.com/tgbugs/pyontutils/blob/89789653f51b77b13e32dc4f27e231ab00769429/ttlser/ttlser/serializers.py#L234)
in [serializers.py](./ttlser/serializers.py).
2. multiple prefixes: If there is more than one curie prefix for the same iri prefix
then the one that is selected will depend on the dicationary ordering (which while
stable in newer version of python is not guranteed to be the same based on the
contents of the data, rather on the history of the additions and removals).
3. rdflib version: ttlser cannot produce deterministic results without the changes
added in https://github.com/RDFLib/rdflib/pull/649. Hopefully those will be merged
for rdflib-5.0.0, in the mean time ttlser depends on neurdflib which includes those
changes. Once it is merged then ttlser will depend on versions of rdflib that come
after and neurdflib will be deprecated.
4. Random failures. Every once in awhile list serialization fails specatcuarly.
The cause is not obvious (same input file every time for testing), but it is probably
because the fixed point function used to implement bnode ranking has a bug.
5. scottl is a broken mess. In principle this orders by the `rdfs:subClassOf` hierarchy
and then `natsort`, however in practice it currently does whatever it wants. I'm also
fairly certain that the test template [scogood.ttl](./test/scogood.ttl) is not correct.
Raw data
{
"_id": null,
"home_page": "https://github.com/tgbugs/pyontutils/tree/master/ttlser",
"name": "ttlser",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": "",
"keywords": "rdflib rdf deterministic turtle ttl",
"author": "Tom Gillespie",
"author_email": "tgbugs@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/7f/71/309b9106dea24c9c2f5ddc1e80d45666a11ac7f1f3f7355df9ca08e1cc56/ttlser-1.1.5.tar.gz",
"platform": null,
"description": "# ttlser\n[![PyPI version](https://badge.fury.io/py/ttlser.svg)](https://pypi.org/project/ttlser/)\n\nDeterministic turtle serialization for rdflib.\n\n## Documentation\nSee the [docs](./docs/ttlser.md) for the full specification and\ndetails on the implemention.\n\n`ttlser` also includes a number of other turtle serializers for\nspecific rendering needs.\n\n## ttlfmt\n`ttlser` provides a `ttlfmt` script that can convert any rdflib supported\nformat into the output format supported by the serializers or any other\nrdflib serializer. If you want to use it you should install with `ttlser[ttlfmt]`.\n\n## Known issues\n1. symmetric predicates: If you have symmetric predicates like `owl:disjointWith` then\nttlser needs to know about them so that it can do the reordering those cases appropriately,\notherwise you will end up with situations where another tool reorders the serialization and\nttlser has to assume that the ordering is semantically meaningful. See\n[`symmetric_predicates`](https://github.com/tgbugs/pyontutils/blob/89789653f51b77b13e32dc4f27e231ab00769429/ttlser/ttlser/serializers.py#L234)\nin [serializers.py](./ttlser/serializers.py).\n2. multiple prefixes: If there is more than one curie prefix for the same iri prefix\nthen the one that is selected will depend on the dicationary ordering (which while\nstable in newer version of python is not guranteed to be the same based on the\ncontents of the data, rather on the history of the additions and removals).\n3. rdflib version: ttlser cannot produce deterministic results without the changes\nadded in https://github.com/RDFLib/rdflib/pull/649. Hopefully those will be merged\nfor rdflib-5.0.0, in the mean time ttlser depends on neurdflib which includes those\nchanges. Once it is merged then ttlser will depend on versions of rdflib that come\nafter and neurdflib will be deprecated.\n4. Random failures. Every once in awhile list serialization fails specatcuarly.\nThe cause is not obvious (same input file every time for testing), but it is probably\nbecause the fixed point function used to implement bnode ranking has a bug.\n5. scottl is a broken mess. In principle this orders by the `rdfs:subClassOf` hierarchy\nand then `natsort`, however in practice it currently does whatever it wants. I'm also\nfairly certain that the test template [scogood.ttl](./test/scogood.ttl) is not correct.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Deterministic turtle serialization for rdflib.",
"version": "1.1.5",
"split_keywords": [
"rdflib",
"rdf",
"deterministic",
"turtle",
"ttl"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "75892cf95c50aa52aea42dc245c7941b446a69a18a97510276ea9d5c2e7d7cc3",
"md5": "b5212764fae620f96a34912f891bb985",
"sha256": "24900bdd8212813c3bdddebf5cad2213401ba8881d6fe258fb8c1a7b51ffb760"
},
"downloads": -1,
"filename": "ttlser-1.1.5-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "b5212764fae620f96a34912f891bb985",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.5",
"size": 23884,
"upload_time": "2023-01-16T20:13:28",
"upload_time_iso_8601": "2023-01-16T20:13:28.079453Z",
"url": "https://files.pythonhosted.org/packages/75/89/2cf95c50aa52aea42dc245c7941b446a69a18a97510276ea9d5c2e7d7cc3/ttlser-1.1.5-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7f71309b9106dea24c9c2f5ddc1e80d45666a11ac7f1f3f7355df9ca08e1cc56",
"md5": "0ec62991f645af6b3bb661822f06ab4b",
"sha256": "d832e7c51c5a01407e50b0e8cb9bbec55642bfee2cbe593d234929deddcf01d9"
},
"downloads": -1,
"filename": "ttlser-1.1.5.tar.gz",
"has_sig": false,
"md5_digest": "0ec62991f645af6b3bb661822f06ab4b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 30128,
"upload_time": "2023-01-16T20:13:30",
"upload_time_iso_8601": "2023-01-16T20:13:30.216125Z",
"url": "https://files.pythonhosted.org/packages/7f/71/309b9106dea24c9c2f5ddc1e80d45666a11ac7f1f3f7355df9ca08e1cc56/ttlser-1.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-16 20:13:30",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "ttlser"
}