Comparing version 0.8.3 to 0.8.4
@@ -343,3 +343,3 @@ // **N3Parser** parses N3 documents. | ||
// If the blank node was empty, it could be a named graph label. | ||
return empty ? this._readPredicateOrNamedGraph : this._readPredicate; | ||
return empty ? this._readPredicateOrNamedGraph : this._readPredicateAfterBlank; | ||
// If the blank node was the object, restore previous context and read punctuation. | ||
@@ -350,2 +350,12 @@ else | ||
// ### `_readPredicateAfterBlank` reads a predicate after an anonymous blank node. | ||
_readPredicateAfterBlank: function (token) { | ||
// If a dot follows a blank node in top context, there is no predicate. | ||
if (token.type === '.' && !this._contextStack.length) { | ||
this._subject = null; // cancel the current triple | ||
return this._readPunctuation(token); | ||
} | ||
return this._readPredicate(token); | ||
}, | ||
// ### `_readDataTypeOrLang` reads an _optional_ data type or language. | ||
@@ -352,0 +362,0 @@ _readDataTypeOrLang: function (token) { |
@@ -276,11 +276,11 @@ // **N3Store** objects store N3 triples by graph in memory. | ||
// Translate IRIs to internal index keys. | ||
// Optimization: if the entity doesn't exist, no triples with it exist. | ||
if (subject && !(subjectId = ids[subject])) return quads; | ||
if (predicate && !(predicateId = ids[predicate])) return quads; | ||
if (object && !(objectId = ids[object])) return quads; | ||
for (var graphId in graphs) { | ||
// Only if the specified graph contains triples, there can be results | ||
if (graphContents = graphs[graphId]) { | ||
// Translate IRIs to internal index keys. | ||
// Optimization: if the entity doesn't exist, no triples with it exist. | ||
if (subject && !(subjectId = ids[subject])) return quads; | ||
if (predicate && !(predicateId = ids[predicate])) return quads; | ||
if (object && !(objectId = ids[object])) return quads; | ||
// Do not emit the default graph explicitly | ||
@@ -287,0 +287,0 @@ if (graphId === DEFAULT_GRAPH) |
{ | ||
"name": "n3", | ||
"version": "0.8.3", | ||
"version": "0.8.4", | ||
"description": "Lightning fast, asynchronous, streaming Turtle / N3 / RDF library.", | ||
@@ -25,2 +25,3 @@ "author": "Ruben Verborgh <ruben.verborgh@gmail.com>", | ||
"coveralls": "^2.11.14", | ||
"cross-spawn": "^5.0.1", | ||
"docco": "^0.7.0", | ||
@@ -27,0 +28,0 @@ "eslint": "^3.10.0", |
@@ -5,2 +5,3 @@ # Lightning fast, asynchronous, streaming RDF for JavaScript | ||
[](https://www.npmjs.com/package/n3) | ||
[](https://zenodo.org/badge/latestdoi/3058202) | ||
@@ -7,0 +8,0 @@ The N3.js library lets you handle [RDF](http://www.w3.org/TR/rdf-primer/) in JavaScript easily, in [Node.js](http://nodejs.org/) and the browser. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
355555
6375
394
14