Skip to main content

Ordered Turtle Serializer for rdflib

Project description

An extension to the rdflib Turtle serializer that adds order (at the price of speed). Useful when you need to generate diffs between Turtle files, or just to make it easier for human beings to inspect the files.

$ pip install otsrdflib

Usage:

from rdflib import graph
from otsrdflib import OrderedTurtleSerializer

my_graph = Graph()

out = open('out.ttl', 'wb')
serializer = OrderedTurtleSerializer(my_graph)
serializer.serialize(out)

Subjects are grouped by class membership. The order of classes is configured through serializer.topClasses. A default list is provided to have e.g. SKOS.ConceptScheme classes appear before SKOS.Concept:

serializer.topClasses = [SKOS.ConceptScheme,
                       FOAF.Organization,
                       SD.Service,
                       SD.Dataset,
                       SD.Graph,
                       SD.NamedGraph,
                       ISOTHES.ThesaurusArray,
                       SKOS.Concept]

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

otsrdflib-0.1.0.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file otsrdflib-0.1.0.tar.gz.

File metadata

  • Download URL: otsrdflib-0.1.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for otsrdflib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6ba431fa8ad033614494fe2af446b5f643c9aa11c9ea254c67e318a6379f2d76
MD5 574c2afe7ed24532e22383bee96e2aeb
BLAKE2b-256 fe636ade6bd30df73840bba2881b95b69f4b7cca94e5845b7cf47c6e3b58cb86

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