n3 2.2.3 → 2.2.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/browser/n3.esm.min.js +1 -1
- package/browser/n3.min.js +1 -1
- package/lib/N3Parser.js +13 -2
- package/package.json +1 -1
- package/src/N3Parser.js +14 -2
package/lib/N3Parser.js
CHANGED
|
@@ -711,7 +711,7 @@ class N3Parser {
|
|
|
711
711
|
if (!this._validAnnotation) return this._error('Annotation block can not be empty', token);
|
|
712
712
|
this._subject = null;
|
|
713
713
|
this._annotation = false;
|
|
714
|
-
next = this.
|
|
714
|
+
next = this._getContextEndReader();
|
|
715
715
|
break;
|
|
716
716
|
default:
|
|
717
717
|
// An entity means this is a quad (only allowed if not already inside a graph)
|
|
@@ -745,9 +745,20 @@ class N3Parser {
|
|
|
745
745
|
case ',':
|
|
746
746
|
next = this._readObject;
|
|
747
747
|
break;
|
|
748
|
+
// Annotation syntax applies to the quad just read, exactly as it does
|
|
749
|
+
// outside of a blank node property list. `|}` arrives here too, because
|
|
750
|
+
// the objects inside the annotation block are themselves read within the
|
|
751
|
+
// enclosing blank node context.
|
|
752
|
+
case '~':
|
|
753
|
+
case '{|':
|
|
754
|
+
case '|}':
|
|
755
|
+
return this._readPunctuation(token);
|
|
748
756
|
default:
|
|
749
757
|
return this._error(`Expected punctuation to follow "${this._object.id}"`, token);
|
|
750
758
|
}
|
|
759
|
+
// An annotation block consumes the subject it annotates, so there is
|
|
760
|
+
// nothing left to share with a following predicate-object pair
|
|
761
|
+
if (this._subject === null) return this._error('Expected ] to follow annotation', token);
|
|
751
762
|
// A quad has been completed now, so return it
|
|
752
763
|
this._emit(this._subject, this._predicate, this._object, this._graph);
|
|
753
764
|
return next;
|
|
@@ -1053,7 +1064,7 @@ class N3Parser {
|
|
|
1053
1064
|
const reifier = this._reifier || this._factory.blankNode();
|
|
1054
1065
|
this._reifier = null;
|
|
1055
1066
|
this._tripleTerm = this._tripleTerm || this._factory.quad(this._subject, this._predicate, this._object);
|
|
1056
|
-
this._emit(reifier, this.RDF_REIFIES, this._tripleTerm, parentGraph || this.DEFAULTGRAPH);
|
|
1067
|
+
this._emit(reifier, this.RDF_REIFIES, this._tripleTerm, parentGraph || this._graph || this.DEFAULTGRAPH);
|
|
1057
1068
|
return reifier;
|
|
1058
1069
|
}
|
|
1059
1070
|
|
package/package.json
CHANGED
package/src/N3Parser.js
CHANGED
|
@@ -772,7 +772,7 @@ export default class N3Parser {
|
|
|
772
772
|
return this._error('Annotation block can not be empty', token);
|
|
773
773
|
this._subject = null;
|
|
774
774
|
this._annotation = false;
|
|
775
|
-
next = this.
|
|
775
|
+
next = this._getContextEndReader();
|
|
776
776
|
break;
|
|
777
777
|
default:
|
|
778
778
|
// An entity means this is a quad (only allowed if not already inside a graph)
|
|
@@ -808,9 +808,21 @@ export default class N3Parser {
|
|
|
808
808
|
case ',':
|
|
809
809
|
next = this._readObject;
|
|
810
810
|
break;
|
|
811
|
+
// Annotation syntax applies to the quad just read, exactly as it does
|
|
812
|
+
// outside of a blank node property list. `|}` arrives here too, because
|
|
813
|
+
// the objects inside the annotation block are themselves read within the
|
|
814
|
+
// enclosing blank node context.
|
|
815
|
+
case '~':
|
|
816
|
+
case '{|':
|
|
817
|
+
case '|}':
|
|
818
|
+
return this._readPunctuation(token);
|
|
811
819
|
default:
|
|
812
820
|
return this._error(`Expected punctuation to follow "${this._object.id}"`, token);
|
|
813
821
|
}
|
|
822
|
+
// An annotation block consumes the subject it annotates, so there is
|
|
823
|
+
// nothing left to share with a following predicate-object pair
|
|
824
|
+
if (this._subject === null)
|
|
825
|
+
return this._error('Expected ] to follow annotation', token);
|
|
814
826
|
// A quad has been completed now, so return it
|
|
815
827
|
this._emit(this._subject, this._predicate, this._object, this._graph);
|
|
816
828
|
return next;
|
|
@@ -1140,7 +1152,7 @@ export default class N3Parser {
|
|
|
1140
1152
|
const reifier = this._reifier || this._factory.blankNode();
|
|
1141
1153
|
this._reifier = null;
|
|
1142
1154
|
this._tripleTerm = this._tripleTerm || this._factory.quad(this._subject, this._predicate, this._object);
|
|
1143
|
-
this._emit(reifier, this.RDF_REIFIES, this._tripleTerm, parentGraph || this.DEFAULTGRAPH);
|
|
1155
|
+
this._emit(reifier, this.RDF_REIFIES, this._tripleTerm, parentGraph || this._graph || this.DEFAULTGRAPH);
|
|
1144
1156
|
return reifier;
|
|
1145
1157
|
}
|
|
1146
1158
|
|