rdflib 2.3.0-3d052249 → 2.3.0

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/esm/n3parser.js CHANGED
@@ -183,19 +183,9 @@ var ws = new RegExp("^[ \\t]*", 'g');
183
183
  var signed_integer = new RegExp("^[-+]?[0-9]+", 'g');
184
184
  var number_syntax = new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?([eE][-+]?[0-9]+)?", 'g');
185
185
  var datetime_syntax = new RegExp('^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\\.[0-9]*)?)?)?Z?');
186
-
187
- // Reused in tight loops to detect whitespace or comment after a dot
188
- var wsOrHash = new RegExp("[\\s#]");
189
186
  var digitstring = new RegExp("^[0-9]+", 'g');
190
187
  var interesting = new RegExp("[\\\\\\r\\n\\\"]", 'g');
191
188
  var langcode = new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*", 'g');
192
-
193
- // Returns true when a dot at position i should terminate a name,
194
- // i.e., when the next character is whitespace, a comment start, or EOF
195
- function dotTerminatesName(str, i) {
196
- var next = str.charAt(i + 1);
197
- return next === '' || wsOrHash.test(next);
198
- }
199
189
  function createSinkParser(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why) {
200
190
  return new SinkParser(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why);
201
191
  }
@@ -684,16 +674,6 @@ export class SinkParser {
684
674
  if (j < 0) {
685
675
  throw BadSyntax(this._thisDoc, this.lines, str, i, "EOF when ']' expected after [ <propertyList>");
686
676
  }
687
- if (str.slice(j, j + 1) == ".") {
688
- // If a dot is found after a blank node, treat it as a statement terminator.
689
- // Do NOT consume the '.' here: statement terminators are handled centrally by
690
- // checkDot() (called by directiveOrStatement after statement()). Consuming the dot
691
- // locally would bypass that unified logic and could cause inconsistencies.
692
- // We do consume ']' below because it is a structural closer of the blank node,
693
- // not a statement terminator.
694
- res.push(subj);
695
- return j; // leave '.' for checkDot()
696
- }
697
677
  if (str.slice(j, j + 1) != "]") {
698
678
  throw BadSyntax(this._thisDoc, this.lines, str, j, "']' expected");
699
679
  }
@@ -1142,17 +1122,7 @@ export class SinkParser {
1142
1122
  return -1;
1143
1123
  }
1144
1124
  var i = j;
1145
- while (i < pyjslib_len(str)) {
1146
- var c = str.charAt(i);
1147
- if (c === '.') {
1148
- if (dotTerminatesName(str, i)) {
1149
- break; // treat as statement terminator, not part of name
1150
- }
1151
- // else: accept '.' as part of name
1152
- } else if (_notNameChars.indexOf(c) >= 0) {
1153
- // Other invalid characters terminate the name
1154
- break;
1155
- }
1125
+ while (i < pyjslib_len(str) && _notNameChars.indexOf(str.charAt(i)) < 0) {
1156
1126
  var i = i + 1;
1157
1127
  }
1158
1128
  res.push(str.slice(j, i));
@@ -1178,15 +1148,12 @@ export class SinkParser {
1178
1148
  var i = i + 1;
1179
1149
  while (i < pyjslib_len(str)) {
1180
1150
  var c = str.charAt(i);
1181
- if (c === '.') {
1182
- if (dotTerminatesName(str, i)) {
1183
- break; // dot ends the name here
1184
- }
1185
- } else if (_notNameChars.indexOf(c) >= 0) {
1151
+ if (_notNameChars.indexOf(c) < 0) {
1152
+ var ln = ln + c;
1153
+ var i = i + 1;
1154
+ } else {
1186
1155
  break;
1187
1156
  }
1188
- var ln = ln + c;
1189
- var i = i + 1;
1190
1157
  }
1191
1158
  } else {
1192
1159
  var ln = "";
@@ -1197,15 +1164,12 @@ export class SinkParser {
1197
1164
  var ln = "";
1198
1165
  while (i < pyjslib_len(str)) {
1199
1166
  var c = str.charAt(i);
1200
- if (c === '.') {
1201
- if (dotTerminatesName(str, i)) {
1202
- break; // dot ends the name here
1203
- }
1204
- } else if (_notNameChars.indexOf(c) >= 0) {
1167
+ if (_notNameChars.indexOf(c) < 0) {
1168
+ var ln = ln + c;
1169
+ var i = i + 1;
1170
+ } else {
1205
1171
  break;
1206
1172
  }
1207
- var ln = ln + c;
1208
- var i = i + 1;
1209
1173
  }
1210
1174
  res.push(new pyjslib_Tuple([pfx, ln]));
1211
1175
  return i;
package/esm/serializer.js CHANGED
@@ -21,7 +21,6 @@ export default function createSerializer(store) {
21
21
  export class Serializer {
22
22
  constructor(store) {
23
23
  _defineProperty(this, "_notQNameChars", '\t\r\n !"#$%&\'()*.,+/;<=>?@[\\]^`{|}~');
24
- // issue#228
25
24
  _defineProperty(this, "_notNameChars", this._notQNameChars + ':');
26
25
  // stringToN3: String escaping for N3
27
26
  _defineProperty(this, "validPrefix", new RegExp(/^[a-zA-Z][a-zA-Z0-9]*$/));
package/lib/n3parser.js CHANGED
@@ -191,19 +191,9 @@ var ws = new RegExp("^[ \\t]*", 'g');
191
191
  var signed_integer = new RegExp("^[-+]?[0-9]+", 'g');
192
192
  var number_syntax = new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?([eE][-+]?[0-9]+)?", 'g');
193
193
  var datetime_syntax = new RegExp('^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\\.[0-9]*)?)?)?Z?');
194
-
195
- // Reused in tight loops to detect whitespace or comment after a dot
196
- var wsOrHash = new RegExp("[\\s#]");
197
194
  var digitstring = new RegExp("^[0-9]+", 'g');
198
195
  var interesting = new RegExp("[\\\\\\r\\n\\\"]", 'g');
199
196
  var langcode = new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*", 'g');
200
-
201
- // Returns true when a dot at position i should terminate a name,
202
- // i.e., when the next character is whitespace, a comment start, or EOF
203
- function dotTerminatesName(str, i) {
204
- var next = str.charAt(i + 1);
205
- return next === '' || wsOrHash.test(next);
206
- }
207
197
  function createSinkParser(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why) {
208
198
  return new SinkParser(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why);
209
199
  }
@@ -692,16 +682,6 @@ class SinkParser {
692
682
  if (j < 0) {
693
683
  throw BadSyntax(this._thisDoc, this.lines, str, i, "EOF when ']' expected after [ <propertyList>");
694
684
  }
695
- if (str.slice(j, j + 1) == ".") {
696
- // If a dot is found after a blank node, treat it as a statement terminator.
697
- // Do NOT consume the '.' here: statement terminators are handled centrally by
698
- // checkDot() (called by directiveOrStatement after statement()). Consuming the dot
699
- // locally would bypass that unified logic and could cause inconsistencies.
700
- // We do consume ']' below because it is a structural closer of the blank node,
701
- // not a statement terminator.
702
- res.push(subj);
703
- return j; // leave '.' for checkDot()
704
- }
705
685
  if (str.slice(j, j + 1) != "]") {
706
686
  throw BadSyntax(this._thisDoc, this.lines, str, j, "']' expected");
707
687
  }
@@ -1150,17 +1130,7 @@ class SinkParser {
1150
1130
  return -1;
1151
1131
  }
1152
1132
  var i = j;
1153
- while (i < pyjslib_len(str)) {
1154
- var c = str.charAt(i);
1155
- if (c === '.') {
1156
- if (dotTerminatesName(str, i)) {
1157
- break; // treat as statement terminator, not part of name
1158
- }
1159
- // else: accept '.' as part of name
1160
- } else if (_notNameChars.indexOf(c) >= 0) {
1161
- // Other invalid characters terminate the name
1162
- break;
1163
- }
1133
+ while (i < pyjslib_len(str) && _notNameChars.indexOf(str.charAt(i)) < 0) {
1164
1134
  var i = i + 1;
1165
1135
  }
1166
1136
  res.push(str.slice(j, i));
@@ -1186,15 +1156,12 @@ class SinkParser {
1186
1156
  var i = i + 1;
1187
1157
  while (i < pyjslib_len(str)) {
1188
1158
  var c = str.charAt(i);
1189
- if (c === '.') {
1190
- if (dotTerminatesName(str, i)) {
1191
- break; // dot ends the name here
1192
- }
1193
- } else if (_notNameChars.indexOf(c) >= 0) {
1159
+ if (_notNameChars.indexOf(c) < 0) {
1160
+ var ln = ln + c;
1161
+ var i = i + 1;
1162
+ } else {
1194
1163
  break;
1195
1164
  }
1196
- var ln = ln + c;
1197
- var i = i + 1;
1198
1165
  }
1199
1166
  } else {
1200
1167
  var ln = "";
@@ -1205,15 +1172,12 @@ class SinkParser {
1205
1172
  var ln = "";
1206
1173
  while (i < pyjslib_len(str)) {
1207
1174
  var c = str.charAt(i);
1208
- if (c === '.') {
1209
- if (dotTerminatesName(str, i)) {
1210
- break; // dot ends the name here
1211
- }
1212
- } else if (_notNameChars.indexOf(c) >= 0) {
1175
+ if (_notNameChars.indexOf(c) < 0) {
1176
+ var ln = ln + c;
1177
+ var i = i + 1;
1178
+ } else {
1213
1179
  break;
1214
1180
  }
1215
- var ln = ln + c;
1216
- var i = i + 1;
1217
1181
  }
1218
1182
  res.push(new pyjslib_Tuple([pfx, ln]));
1219
1183
  return i;
package/lib/serializer.js CHANGED
@@ -31,7 +31,6 @@ function createSerializer(store) {
31
31
  class Serializer {
32
32
  constructor(store) {
33
33
  (0, _defineProperty2.default)(this, "_notQNameChars", '\t\r\n !"#$%&\'()*.,+/;<=>?@[\\]^`{|}~');
34
- // issue#228
35
34
  (0, _defineProperty2.default)(this, "_notNameChars", this._notQNameChars + ':');
36
35
  // stringToN3: String escaping for N3
37
36
  (0, _defineProperty2.default)(this, "validPrefix", new RegExp(/^[a-zA-Z][a-zA-Z0-9]*$/));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rdflib",
3
3
  "description": "an RDF library for node.js. Suitable for client and server side.",
4
- "version": "2.3.0-3d052249",
4
+ "version": "2.3.0",
5
5
  "private": false,
6
6
  "browserslist": [
7
7
  "> 0.5%"
package/src/n3parser.js CHANGED
@@ -212,20 +212,10 @@ var signed_integer = new RegExp("^[-+]?[0-9]+", 'g');
212
212
  var number_syntax = new RegExp("^([-+]?[0-9]+)(\\.[0-9]+)?([eE][-+]?[0-9]+)?", 'g');
213
213
  var datetime_syntax = new RegExp('^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9](T[0-9][0-9]:[0-9][0-9](:[0-9][0-9](\\.[0-9]*)?)?)?Z?');
214
214
 
215
- // Reused in tight loops to detect whitespace or comment after a dot
216
- var wsOrHash = new RegExp("[\\s#]");
217
-
218
215
  var digitstring = new RegExp("^[0-9]+", 'g');
219
216
  var interesting = new RegExp("[\\\\\\r\\n\\\"]", 'g');
220
217
  var langcode = new RegExp("^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*", 'g');
221
218
 
222
- // Returns true when a dot at position i should terminate a name,
223
- // i.e., when the next character is whitespace, a comment start, or EOF
224
- function dotTerminatesName(str, i) {
225
- var next = str.charAt(i + 1);
226
- return next === '' || wsOrHash.test(next);
227
- }
228
-
229
219
  function createSinkParser(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why) {
230
220
  return new SinkParser(store, openFormula, thisDoc, baseURI, genPrefix, metaURI, flags, why);
231
221
  }
@@ -564,7 +554,7 @@ export class SinkParser {
564
554
  <- prop -<
565
555
  _operator_*/
566
556
 
567
- var j = this.skipSpace(str, i);
557
+ var j = this.skipSpace(str, i);
568
558
  if ((j < 0)) {
569
559
  return j;
570
560
  }
@@ -713,17 +703,22 @@ export class SinkParser {
713
703
  if ((j >= 0)) {
714
704
  var subj = objs[0];
715
705
  if ((pyjslib_len(objs) > 1)) {
706
+
716
707
  var __obj = new pyjslib_Iterator(objs);
717
708
  try {
718
709
  while (true) {
719
710
  var obj = __obj.next();
711
+
712
+
720
713
  this.makeStatement(new pyjslib_Tuple([this._context, this._store.sym(DAML_sameAs_URI), subj, obj]));
714
+
721
715
  }
722
716
  } catch (e) {
723
717
  if (e != StopIteration) {
724
718
  throw e;
725
719
  }
726
720
  }
721
+
727
722
  }
728
723
  var j = this.skipSpace(str, j);
729
724
  if ((j < 0)) {
@@ -748,16 +743,6 @@ export class SinkParser {
748
743
  if ((j < 0)) {
749
744
  throw BadSyntax(this._thisDoc, this.lines, str, i, "EOF when ']' expected after [ <propertyList>");
750
745
  }
751
- if ((str.slice( j, ( j + 1 ) ) == ".")) {
752
- // If a dot is found after a blank node, treat it as a statement terminator.
753
- // Do NOT consume the '.' here: statement terminators are handled centrally by
754
- // checkDot() (called by directiveOrStatement after statement()). Consuming the dot
755
- // locally would bypass that unified logic and could cause inconsistencies.
756
- // We do consume ']' below because it is a structural closer of the blank node,
757
- // not a statement terminator.
758
- res.push(subj);
759
- return j; // leave '.' for checkDot()
760
- }
761
746
  if ((str.slice( j, ( j + 1 ) ) != "]")) {
762
747
  throw BadSyntax(this._thisDoc, this.lines, str, j, "']' expected");
763
748
  }
@@ -1223,17 +1208,7 @@ export class SinkParser {
1223
1208
  return -1;
1224
1209
  }
1225
1210
  var i = j;
1226
- while ((i < pyjslib_len(str))) {
1227
- var c = str.charAt(i);
1228
- if (c === '.') {
1229
- if (dotTerminatesName(str, i)) {
1230
- break; // treat as statement terminator, not part of name
1231
- }
1232
- // else: accept '.' as part of name
1233
- } else if (_notNameChars.indexOf(c) >= 0) {
1234
- // Other invalid characters terminate the name
1235
- break;
1236
- }
1211
+ while ((i < pyjslib_len(str)) && (_notNameChars.indexOf(str.charAt(i)) < 0)) {
1237
1212
  var i = ( i + 1 ) ;
1238
1213
  }
1239
1214
  res.push(str.slice( j, i));
@@ -1260,15 +1235,13 @@ export class SinkParser {
1260
1235
  var i = ( i + 1 ) ;
1261
1236
  while ((i < pyjslib_len(str))) {
1262
1237
  var c = str.charAt(i);
1263
- if (c === '.') {
1264
- if (dotTerminatesName(str, i)) {
1265
- break; // dot ends the name here
1266
- }
1267
- } else if (_notNameChars.indexOf(c) >= 0) {
1238
+ if ((_notNameChars.indexOf(c) < 0)) {
1239
+ var ln = ( ln + c ) ;
1240
+ var i = ( i + 1 ) ;
1241
+ }
1242
+ else {
1268
1243
  break;
1269
1244
  }
1270
- var ln = ( ln + c ) ;
1271
- var i = ( i + 1 ) ;
1272
1245
  }
1273
1246
  }
1274
1247
  else {
@@ -1280,15 +1253,13 @@ export class SinkParser {
1280
1253
  var ln = "";
1281
1254
  while ((i < pyjslib_len(str))) {
1282
1255
  var c = str.charAt(i);
1283
- if (c === '.') {
1284
- if (dotTerminatesName(str, i)) {
1285
- break; // dot ends the name here
1286
- }
1287
- } else if (_notNameChars.indexOf(c) >= 0) {
1256
+ if ((_notNameChars.indexOf(c) < 0)) {
1257
+ var ln = ( ln + c ) ;
1258
+ var i = ( i + 1 ) ;
1259
+ }
1260
+ else {
1288
1261
  break;
1289
1262
  }
1290
- var ln = ( ln + c ) ;
1291
- var i = ( i + 1 ) ;
1292
1263
  }
1293
1264
  res.push(new pyjslib_Tuple([pfx, ln]));
1294
1265
  return i;
package/src/serializer.js CHANGED
@@ -251,7 +251,7 @@ export class Serializer {
251
251
  return this.statementsToN3(f.statements)
252
252
  }
253
253
 
254
- _notQNameChars = '\t\r\n !"#$%&\'()*.,+/;<=>?@[\\]^`{|}~' // issue#228
254
+ _notQNameChars = '\t\r\n !"#$%&\'()*.,+/;<=>?@[\\]^`{|}~'
255
255
  _notNameChars =
256
256
  (this._notQNameChars + ':')
257
257