n3 2.2.1 → 2.2.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/browser/n3.esm.min.js +1 -1
- package/browser/n3.min.js +1 -1
- package/lib/N3Parser.js +5 -0
- package/package.json +1 -1
- package/src/N3Parser.js +7 -0
package/lib/N3Parser.js
CHANGED
|
@@ -689,12 +689,17 @@ class N3Parser {
|
|
|
689
689
|
break;
|
|
690
690
|
// ~ is allowed in the annotation syntax
|
|
691
691
|
case '~':
|
|
692
|
+
// Only invalidate the cache for a genuinely new triple - chained annotation blocks on the
|
|
693
|
+
// same triple (subject already null from a preceding annotation) must keep reusing it.
|
|
694
|
+
if (subject !== null) this._tripleTerm = null;
|
|
692
695
|
next = this._readReifierInAnnotation;
|
|
693
696
|
startingAnnotation = true;
|
|
694
697
|
break;
|
|
695
698
|
// {| means that the current triple is annotated with predicate-object pairs.
|
|
696
699
|
case '{|':
|
|
697
700
|
// Continue using the last triple as reified triple subject for the predicate-object pairs.
|
|
701
|
+
// Same staleness rule as ~ above.
|
|
702
|
+
if (subject !== null) this._tripleTerm = null;
|
|
698
703
|
this._subject = this._readTripleTerm();
|
|
699
704
|
this._validAnnotation = false;
|
|
700
705
|
startingAnnotation = true;
|
package/package.json
CHANGED
package/src/N3Parser.js
CHANGED
|
@@ -746,12 +746,19 @@ export default class N3Parser {
|
|
|
746
746
|
break;
|
|
747
747
|
// ~ is allowed in the annotation syntax
|
|
748
748
|
case '~':
|
|
749
|
+
// Only invalidate the cache for a genuinely new triple - chained annotation blocks on the
|
|
750
|
+
// same triple (subject already null from a preceding annotation) must keep reusing it.
|
|
751
|
+
if (subject !== null)
|
|
752
|
+
this._tripleTerm = null;
|
|
749
753
|
next = this._readReifierInAnnotation;
|
|
750
754
|
startingAnnotation = true;
|
|
751
755
|
break;
|
|
752
756
|
// {| means that the current triple is annotated with predicate-object pairs.
|
|
753
757
|
case '{|':
|
|
754
758
|
// Continue using the last triple as reified triple subject for the predicate-object pairs.
|
|
759
|
+
// Same staleness rule as ~ above.
|
|
760
|
+
if (subject !== null)
|
|
761
|
+
this._tripleTerm = null;
|
|
755
762
|
this._subject = this._readTripleTerm();
|
|
756
763
|
this._validAnnotation = false;
|
|
757
764
|
startingAnnotation = true;
|