Skip to main content

N3 Format

Description​

Notation3 (N3) is a text RDF syntax related to Turtle, supporting formulas and other N3 extensions where rdflib can parse them. IterableData yields one triple record per statement (subject, predicate, object). It is read-only in this release.

File Extensions​

  • .n3 — Notation3 RDF files

Implementation Details​

Reading​

  • Loads an rdflib.Graph and parses with format="n3"
  • Accepts filename or stream text
  • Materializes all triples as string-valued dicts

Writing​

Writing is not supported. Prefer Turtle for writable RDF output.

Key Features​

  • Triple rows: simple SPO dicts
  • rdflib parser: shared with other RDF formats
  • Text + codecs: compressible as text

Usage​

from iterable import open_iterable

with open_iterable("data.n3") as source:
for triple in source:
print(triple["subject"], triple["predicate"], triple["object"])

Parameters​

No format-specific iterableargs.

Installation​

pip install 'iterabledata[rdf]'

Requires rdflib.

Limitations​

  1. Read-only
  2. Memory: full graph in memory
  3. Requires rdflib
  4. Advanced N3 features depend on rdflib support; terms are stringified

Error Handling​

  • ImportError: missing rdflib — install iterabledata[rdf]
  • Parse errors: invalid N3 from rdflib
  • I/O errors: missing or unreadable files
  • Format is registered writable=False; do not rely on write mode