{ "info": { "author": "Dan Michael O. Hegg\u00f8", "author_email": "danmichaelo@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": ".. image:: https://img.shields.io/travis/scriptotek/otsrdflib.svg\n :target: https://travis-ci.org/scriptotek/otsrdflib\n :alt: Build status\n\n.. image:: https://landscape.io/github/scriptotek/otsrdflib/master/landscape.svg?style=flat\n :target: https://landscape.io/github/scriptotek/otsrdflib/master\n :alt: Code health\n\n.. image:: https://img.shields.io/pypi/v/otsrdflib.svg\n :target: https://pypi.python.org/pypi/otsrdflib\n :alt: Latest version\n\n.. image:: https://img.shields.io/github/license/scriptotek/otsrdflib.svg\n :target: http://opensource.org/licenses/MIT\n :alt: MIT license\n\nOrdered Turtle Serializer for rdflib\n====================================\n\nAn extension to the `rdflib `_ Turtle serializer\nthat adds order (at the price of speed).\nUseful when you need to generate diffs between Turtle files, or just to make it\neasier for human beings to inspect the files.\n\n.. code-block:: console\n\n $ pip install otsrdflib\n\nUsage:\n\n.. code-block:: python\n\n from rdflib import graph\n from otsrdflib import OrderedTurtleSerializer\n\n my_graph = Graph()\n\n out = open('out.ttl', 'wb')\n serializer = OrderedTurtleSerializer(my_graph)\n serializer.serialize(out)\n\n\nClass order\n-----------\n\nBy default, classes are ordered alphabetically by their URIS.\n\nA custom order can be imposed by adding classes to the `class_order` attribute.\nFor a SKOS vocabulary, for instance, you might want to sort the concept scheme first,\nfollowed by the other elements of the vocabulary:\n\n.. code-block:: python\n\n serializer.class_order = [\n SKOS.ConceptScheme,\n SKOS.Concept,\n ISOTHES.ThesaurusArray,\n ]\n\nAny class not included in the `class_order` list will be sorted alphabetically\nat the end, after the classes included in the list.\n\nInstance order\n--------------\n\nBy default, instances of a class are ordered alphabetically by their URIS.\n\nA custom order can be imposed by defining functions that generate sort keys\nfrom the URIs. For instance, you could define a function that returns the\nnumeric last part of an URI to be sorted numerically:\n\n.. code-block:: python\n\n serializer.sorters = [\n ('.*?/[^0-9]*([0-9.]+)$', lambda x: float(x[0])),\n ]\n\nThe first element of the tuple (`'.*?/[^0-9]*([0-9.]+)$'`) is the regexp pattern\nto be matched against the URIs, while the second element (`lambda x: float(x[0])`)\nis the sort key generating function. In this case, it returns the first\nbackreference as a float.\n\nThe patterns in `sorters` will be attempted matched against instances\nof any class. You can also define patterns that will only be matched against\ninstances of a specific class. Let's say you only wanted to sort instances\nof `SKOS.Concept` this way:\n\n.. code-block:: python\n\n from rdflib.namespace import SKOS\n\n serializer.sorters_by_class = {\n SKOS.Concept: [\n ('.*?/[^0-9]*([0-9.]+)$', lambda x: float(x[0])),\n ]\n }\n\nFor a slightly more complicated example, let's look at Dewey. Classes\nin the main schedules are describes by URIs like\n`http://dewey.info/class/001.433/e23/`, and we will use the class number\n(001.433) for sorting. But there's also table classes\nlike `http://dewey.info/class/1--0901/e23/`.\nWe want to sort these at the end, after the main schedules.\nTo achieve this, we define two sorters, one that matches the table classes\nand one that matches the main schedule classes:\n\n.. code-block:: python\n\n serializer.sorters = [\n ('/([0-9A-Z\\-]+)\\-\\-([0-9.\\-;:]+)/e', lambda x: 'T{}--{}'.format(x[0], x[1])), # table numbers\n ('/([0-9.\\-;:]+)/e', lambda x: 'A' + x[0]), # main schedule numbers\n ]\n\nBy prefixing the table numbers with 'T' and the main schedule numbers with 'A',\nwe ensure the table numbers are sorted after the main schedule numbers.\n\n\nChanges in version 0.5\n----------------------\n\n* The `topClasses` attribute was renamed to `class_order` to better reflect\n its content and comply with PEP8. It was also changed to be empty by default,\n since the previous default list was rather random.\n* A `sorters_by_class` attribute was added to allow sorters to be defined per class.\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/scriptotek/otsrdflib", "keywords": "rdflib turtle serializer", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "otsrdflib", "package_url": "https://pypi.org/project/otsrdflib/", "platform": "", "project_url": "https://pypi.org/project/otsrdflib/", "project_urls": { "Homepage": "https://github.com/scriptotek/otsrdflib" }, "release_url": "https://pypi.org/project/otsrdflib/0.5.0/", "requires_dist": [ "rdflib", "six" ], "requires_python": "", "summary": "Ordered Turtle Serializer for rdflib", "version": "0.5.0" }, "last_serial": 3527404, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "574c2afe7ed24532e22383bee96e2aeb", "sha256": "6ba431fa8ad033614494fe2af446b5f643c9aa11c9ea254c67e318a6379f2d76" }, "downloads": -1, "filename": "otsrdflib-0.1.0.tar.gz", "has_sig": false, "md5_digest": "574c2afe7ed24532e22383bee96e2aeb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2428, "upload_time": "2015-08-03T10:45:20", "url": "https://files.pythonhosted.org/packages/fe/63/6ade6bd30df73840bba2881b95b69f4b7cca94e5845b7cf47c6e3b58cb86/otsrdflib-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "aad79b94e2f4b49ff453c87618e116d5", "sha256": "69a228702ca1b7ff3f4cb4583ce2201b666c882aeff1f1b5598c8b63400b5349" }, "downloads": -1, "filename": "otsrdflib-0.2.0.tar.gz", "has_sig": false, "md5_digest": "aad79b94e2f4b49ff453c87618e116d5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2738, "upload_time": "2015-08-03T12:46:21", "url": "https://files.pythonhosted.org/packages/38/45/4f7b1b263d311c82c5d885434bbd8377cecaf927a8bbcee569dc47cc7123/otsrdflib-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "75352d3730d93481e7fe52112fc8e3ab", "sha256": "c319d0d497bf41085c6feb38ad0cbe9e01662f9b9da9c884207bd9292e1aef43" }, "downloads": -1, "filename": "otsrdflib-0.2.1.tar.gz", "has_sig": false, "md5_digest": "75352d3730d93481e7fe52112fc8e3ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2955, "upload_time": "2015-08-03T13:12:58", "url": "https://files.pythonhosted.org/packages/00/54/9bf7b972e29b15ae08d01ebd6038f8769ae1c4fdafc9f8b18eb0c82efdf4/otsrdflib-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "72a032222405fe6d75c4cecaf0791eb8", "sha256": "7cf46022d8848c9d98c7720277009b34f97fd5bdad8d2036853fb2de0b00867b" }, "downloads": -1, "filename": "otsrdflib-0.2.2.tar.gz", "has_sig": false, "md5_digest": "72a032222405fe6d75c4cecaf0791eb8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3822, "upload_time": "2015-08-04T21:45:42", "url": "https://files.pythonhosted.org/packages/9e/2d/37c5e8371c737571a3608db867270ee7216125191671fca8ff2fdf50211e/otsrdflib-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "ba5eef9095489ba8a1382c2051de69ce", "sha256": "c12f72ea93b0c40d7898e0c31836ef209117ef75ee7a07217cdbbb0bd262d4db" }, "downloads": -1, "filename": "otsrdflib-0.2.3.tar.gz", "has_sig": false, "md5_digest": "ba5eef9095489ba8a1382c2051de69ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3918, "upload_time": "2015-11-27T20:05:23", "url": "https://files.pythonhosted.org/packages/3a/1a/60abe26055695e79c560453aa96c6a4ff29b7c31c8888351e3af4dbf148b/otsrdflib-0.2.3.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "46d9087df5149a7d0ece0b799e0d7b04", "sha256": "d962ed1adf2a745e972499ab38dc58cb30edbaafe0de8205e2f1b10c810d695a" }, "downloads": -1, "filename": "otsrdflib-0.3.1.tar.gz", "has_sig": false, "md5_digest": "46d9087df5149a7d0ece0b799e0d7b04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3922, "upload_time": "2015-11-27T20:56:21", "url": "https://files.pythonhosted.org/packages/f1/b5/ba59bbfb5ffe727d4ab3bd49d2e4facc4ba49d80fde6b8d10517bc2eb9ed/otsrdflib-0.3.1.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "c59696cbdd1835221c1169e832d7ce60", "sha256": "1c17143b2f158edb5518aaa463522b70ab6734cae8e3b9cf205a4a2e6bdb5cfc" }, "downloads": -1, "filename": "otsrdflib-0.4.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c59696cbdd1835221c1169e832d7ce60", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7162, "upload_time": "2016-05-24T17:58:56", "url": "https://files.pythonhosted.org/packages/d4/8f/a16c467c89643d147787bba032914a837eb58f730c24ce37b5588aebc4d4/otsrdflib-0.4.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d9ecac3ef518c7a91e627d4fab5d5999", "sha256": "42d11cbdc26852f3ea0dac1b9057e659fe6e62e279b9543dc1b4932b8c9d5545" }, "downloads": -1, "filename": "otsrdflib-0.4.1.tar.gz", "has_sig": false, "md5_digest": "d9ecac3ef518c7a91e627d4fab5d5999", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4188, "upload_time": "2016-05-24T17:59:11", "url": "https://files.pythonhosted.org/packages/79/7e/c2cef566753efcd6321bd661388a2e125662605ae42b4486461227e11799/otsrdflib-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "7989f3fc4c2e8980944156689467d010", "sha256": "8400505dd8edbe5a8795611c138b5a90d6a15c52bc3f7ba130100554b8e4a094" }, "downloads": -1, "filename": "otsrdflib-0.4.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "7989f3fc4c2e8980944156689467d010", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7160, "upload_time": "2016-08-15T17:51:43", "url": "https://files.pythonhosted.org/packages/83/1d/e8708184f786fbd7993dfa579dd778f20e8cbd1cbc939bfaef37d3bda886/otsrdflib-0.4.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0a78131f1cf2e3751d26c544df6fbcf7", "sha256": "2486e7f26919896b6c35b0095a66af27bb4cbe162379c61096f7c99479bb423e" }, "downloads": -1, "filename": "otsrdflib-0.4.2.tar.gz", "has_sig": false, "md5_digest": "0a78131f1cf2e3751d26c544df6fbcf7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4198, "upload_time": "2016-08-15T17:51:46", "url": "https://files.pythonhosted.org/packages/b4/71/f168e3a53eaf2bf33098b1f45b7e4077124f1e0cc2a7230c1c700ceff468/otsrdflib-0.4.2.tar.gz" } ], "0.4.3": [ { "comment_text": "", "digests": { "md5": "96968ad74595a04f0b9c4c5c89221d5e", "sha256": "5ad75aa5fb1d1dbe163ef26d2ec86f47800e16ca1bb29c74f5af1be49ab0742b" }, "downloads": -1, "filename": "otsrdflib-0.4.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "96968ad74595a04f0b9c4c5c89221d5e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7207, "upload_time": "2018-01-18T23:54:39", "url": "https://files.pythonhosted.org/packages/c4/11/f43f95fd3b24bf20e0b7c775f201b66c82b0d0fdbc5b10c87bba7f1f05a1/otsrdflib-0.4.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "82e703ded5572e3d6b628408d7196c19", "sha256": "771c2f47146841d888b998619c9ccf6c2f05ab62cbbdd3251afc341e5655d839" }, "downloads": -1, "filename": "otsrdflib-0.4.3.tar.gz", "has_sig": false, "md5_digest": "82e703ded5572e3d6b628408d7196c19", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4313, "upload_time": "2018-01-18T23:54:40", "url": "https://files.pythonhosted.org/packages/17/29/41cb9ed78c14ceb7e450a0365c0cf48f2f10161f0f2b315bdfcb2035c3f6/otsrdflib-0.4.3.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "57fde7f25f28cac729e3bba59e810912", "sha256": "c05605d093b0263c5500e852f81d185ce14dabbcbc323a600c6ca24bd7b7bfca" }, "downloads": -1, "filename": "otsrdflib-0.5.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "57fde7f25f28cac729e3bba59e810912", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6913, "upload_time": "2018-01-27T18:26:20", "url": "https://files.pythonhosted.org/packages/23/d3/c9e172abeb9a043154f44cffaadc079bea37fb604cf59beee536e543a61e/otsrdflib-0.5.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e3eb7b0ae3d0c813f4643a7a1e616a18", "sha256": "937f02cd655487c0632aa1dcab6f7aabd956fa9c3415ec30bb90726a8011d626" }, "downloads": -1, "filename": "otsrdflib-0.5.0.tar.gz", "has_sig": false, "md5_digest": "e3eb7b0ae3d0c813f4643a7a1e616a18", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4702, "upload_time": "2018-01-27T18:26:27", "url": "https://files.pythonhosted.org/packages/15/1f/c8b55fcb049714e4fe443c9c6a280b5915ff63bc347a142e304bf641b714/otsrdflib-0.5.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "57fde7f25f28cac729e3bba59e810912", "sha256": "c05605d093b0263c5500e852f81d185ce14dabbcbc323a600c6ca24bd7b7bfca" }, "downloads": -1, "filename": "otsrdflib-0.5.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "57fde7f25f28cac729e3bba59e810912", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6913, "upload_time": "2018-01-27T18:26:20", "url": "https://files.pythonhosted.org/packages/23/d3/c9e172abeb9a043154f44cffaadc079bea37fb604cf59beee536e543a61e/otsrdflib-0.5.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e3eb7b0ae3d0c813f4643a7a1e616a18", "sha256": "937f02cd655487c0632aa1dcab6f7aabd956fa9c3415ec30bb90726a8011d626" }, "downloads": -1, "filename": "otsrdflib-0.5.0.tar.gz", "has_sig": false, "md5_digest": "e3eb7b0ae3d0c813f4643a7a1e616a18", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4702, "upload_time": "2018-01-27T18:26:27", "url": "https://files.pythonhosted.org/packages/15/1f/c8b55fcb049714e4fe443c9c6a280b5915ff63bc347a142e304bf641b714/otsrdflib-0.5.0.tar.gz" } ] }