rdflib 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -63,6 +63,36 @@ installed.
63
63
  npm install --save rdflib
64
64
  ```
65
65
 
66
+ ## Serializer flags
67
+
68
+ The Turtle/N3/JSON‑LD serializers accept an optional `flags` string to tweak output formatting and abbreviation behavior.
69
+
70
+ - Pass flags via the options argument to `serialize(...)`:
71
+
72
+ ```ts
73
+ import { graph, serialize, sym } from 'rdflib'
74
+
75
+ const kb = graph()
76
+ const doc = sym('http://example.com/doc')
77
+ // ... add some statements ...
78
+
79
+ // Example: prevent dotted local parts in prefixed names
80
+ const turtle = serialize(doc, kb, doc.value, 'text/turtle', undefined, { flags: 'o' })
81
+ ```
82
+
83
+ Common flags used internally (you can combine them, e.g. `'o k'`):
84
+
85
+ - `s` `i` – used by default for Turtle to suppress `=`, `=>` notations
86
+ - `d e i n p r s t u x` – used for N-Triples/N-Quads to simplify output
87
+ - `dr` – used with JSON‑LD conversion (no default, no relative prefix)
88
+ - `o` – new: do not abbreviate to a prefixed name when the local part contains a dot. This keeps IRIs like
89
+ `http://example.org/ns/subject.example` in `<...>` form instead of `ns:subject.example`.
90
+
91
+ Notes:
92
+
93
+ - For Turtle and JSON‑LD, user‑provided flags are merged with the defaults so your flags (like `o`) are honored.
94
+ - By contrast, passing `'p'` disables prefix abbreviations entirely (all terms are written as `<...>` IRIs).
95
+
66
96
  ## Contribute
67
97
 
68
98
  #### Subdirectories