Skip to main content

pyOTTR

Manipulate OTTR Reasonable Ontology Templates in Python.

Package documentation

OTTR documentation

Supported features:

In development:

Installation

Manual installation

git clone
cd pyOTTR/
python setup.py install

Getting started

The main class to manipulate is OttrGenerator, which is used to load OTTR templates and expand template instances. So, in practice, you only need to create a new generator, load some templates and then execute your instances to produce RDF triples.

By default, all templates from the OTTR template library are loaded when the generator is created.

from ottr import OttrGenerator
# An OttrGenerator is used to load templates and expand instances
generator = OttrGenerator()

# Load a simple OTTR template definition
generator.load_templates("""
  @prefix ex: <http://example.org#>.

  ex:FirstName [ottr:IRI ?uri, ?firstName] :: {
    ottr:Triple (?uri, foaf:firstName, ?firstName )
  } .

  ex:Person[ ?firstName ] :: {
    ottr:Triple (_:person, rdf:type, foaf:Person ),
    ex:FirstName (_:person, ?firstName)
  } .
""")

# Parse and prepare an instance for execution
instances = generator.instanciate("""
  @prefix ex: <http://example.org#>.

  ex:Person("Ann").
""")

# Execute the instance, which yield RDF triples
# The following prints (_:person0, rdf:type, foaf:Person) and (_:person0, foaf:firstName, "Ann")
for s, p, o in instances.execute(as_nt=True):
  print("# ----- RDF triple ----- #")
  print((s, p, o)

Metadata

Release files for ottr 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ottr 0.0.1
File Size Uploaded Provenance Actions
ottr-0.0.1.tar.gz 11.4 kB Without provenance Details for ottr-0.0.1.tar.gz

Release files / ottr-0.0.1.tar.gz

Download URL ottr-0.0.1.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5050f20ce329fc3ccee5aa9c9603d4853961d572bcd1aae15e7245c6d37c06aa
BLAKE2b-256 checksum
How to use checksums
c55a249ef88441ffcb64a198cb1c7f743cb7e7d278a56e1181903f19b02ee4fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.3

Security for ottr 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page