n3 2.10.1 → 2.10.2
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 +10 -0
- package/browser/n3.esm.min.js +1 -1
- package/browser/n3.min.js +1 -1
- package/lib/N3Parser.js +11 -5
- package/package.json +1 -1
- package/src/N3Parser.js +11 -5
package/lib/N3Parser.js
CHANGED
|
@@ -60,6 +60,8 @@ class N3Parser {
|
|
|
60
60
|
});
|
|
61
61
|
// Disable explicit quantifiers by default
|
|
62
62
|
this._explicitQuantifiers = !!options.explicitQuantifiers;
|
|
63
|
+
// Disable formula-only blank node scoping by default
|
|
64
|
+
this._formulaScopedBlankNodes = !!options.formulaScopedBlankNodes;
|
|
63
65
|
// Disable parsing of unsupported versions by default
|
|
64
66
|
this._parseUnsupportedVersions = !!options.parseUnsupportedVersions;
|
|
65
67
|
this._version = options.version;
|
|
@@ -128,11 +130,15 @@ class N3Parser {
|
|
|
128
130
|
// Every new scope resets the predicate direction
|
|
129
131
|
this._inversePredicate = false;
|
|
130
132
|
this._expectOf = false;
|
|
131
|
-
// In N3, blank nodes are scoped to a formula
|
|
132
|
-
//
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
// In N3, blank nodes and quantifiers are scoped to a formula;
|
|
134
|
+
// with `formulaScopedBlankNodes`, lists and blank node property lists
|
|
135
|
+
// share the enclosing scope instead of rescoping
|
|
136
|
+
if (!this._formulaScopedBlankNodes || type === 'formula') {
|
|
137
|
+
// Label the scope with the enclosing formula's blank node
|
|
138
|
+
// (using a dot as separator, as a blank node label cannot start with it)
|
|
139
|
+
this._prefixes._ = this._graph ? `${this._graph.value}.` : '.';
|
|
140
|
+
this._quantified = Object.create(this._quantified);
|
|
141
|
+
}
|
|
136
142
|
// A formula starts empty and must not inherit its parent's subject
|
|
137
143
|
if (type === 'formula') {
|
|
138
144
|
this._subject = null;
|
package/package.json
CHANGED
package/src/N3Parser.js
CHANGED
|
@@ -49,6 +49,8 @@ export default class N3Parser {
|
|
|
49
49
|
this._lexer = options.lexer || new N3Lexer({ lineMode: isLineMode, n3: isN3, isImpliedBy: this._isImpliedBy });
|
|
50
50
|
// Disable explicit quantifiers by default
|
|
51
51
|
this._explicitQuantifiers = !!options.explicitQuantifiers;
|
|
52
|
+
// Disable formula-only blank node scoping by default
|
|
53
|
+
this._formulaScopedBlankNodes = !!options.formulaScopedBlankNodes;
|
|
52
54
|
// Disable parsing of unsupported versions by default
|
|
53
55
|
this._parseUnsupportedVersions = !!options.parseUnsupportedVersions;
|
|
54
56
|
this._version = options.version;
|
|
@@ -111,11 +113,15 @@ export default class N3Parser {
|
|
|
111
113
|
// Every new scope resets the predicate direction
|
|
112
114
|
this._inversePredicate = false;
|
|
113
115
|
this._expectOf = false;
|
|
114
|
-
// In N3, blank nodes are scoped to a formula
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
// In N3, blank nodes and quantifiers are scoped to a formula;
|
|
117
|
+
// with `formulaScopedBlankNodes`, lists and blank node property lists
|
|
118
|
+
// share the enclosing scope instead of rescoping
|
|
119
|
+
if (!this._formulaScopedBlankNodes || type === 'formula') {
|
|
120
|
+
// Label the scope with the enclosing formula's blank node
|
|
121
|
+
// (using a dot as separator, as a blank node label cannot start with it)
|
|
122
|
+
this._prefixes._ = (this._graph ? `${this._graph.value}.` : '.');
|
|
123
|
+
this._quantified = Object.create(this._quantified);
|
|
124
|
+
}
|
|
119
125
|
// A formula starts empty and must not inherit its parent's subject
|
|
120
126
|
if (type === 'formula') {
|
|
121
127
|
this._subject = null;
|