n3 2.10.4 → 2.10.5

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/lib/N3Writer.js CHANGED
@@ -164,7 +164,9 @@ class N3Writer {
164
164
  if (entity.termType !== 'NamedNode') {
165
165
  // If it is a list head, pretty-print it
166
166
  if (this._lists && entity.value in this._lists) entity = this.list(this._lists[entity.value]);
167
- return entity.termType === 'Variable' ? `?${entity.value}` : 'id' in entity ? entity.id : `_:${entity.value}`;
167
+ // Terms from this library already hold their serialization as id
168
+ if (entity instanceof _N3DataFactory.Term) return entity.id;
169
+ return entity.termType === 'Variable' ? `?${entity.value}` : `_:${entity.value}`;
168
170
  }
169
171
  let iri = entity.value;
170
172
  // Use relative IRIs if requested and possible
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n3",
3
- "version": "2.10.4",
3
+ "version": "2.10.5",
4
4
  "description": "Lightning fast, asynchronous, streaming Turtle / N3 / RDF library.",
5
5
  "author": "Ruben Verborgh <ruben.verborgh@gmail.com>",
6
6
  "keywords": [
package/src/N3Writer.js CHANGED
@@ -163,8 +163,10 @@ export default class N3Writer {
163
163
  // If it is a list head, pretty-print it
164
164
  if (this._lists && (entity.value in this._lists))
165
165
  entity = this.list(this._lists[entity.value]);
166
- return entity.termType === 'Variable' ? `?${entity.value}` :
167
- 'id' in entity ? entity.id : `_:${entity.value}`;
166
+ // Terms from this library already hold their serialization as id
167
+ if (entity instanceof Term)
168
+ return entity.id;
169
+ return entity.termType === 'Variable' ? `?${entity.value}` : `_:${entity.value}`;
168
170
  }
169
171
  let iri = entity.value;
170
172
  // Use relative IRIs if requested and possible