Comparing version 0.2.6 to 0.2.7
@@ -8,3 +8,3 @@ // **N3Lexer** tokenizes N3 documents. | ||
_langcode: /^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i, | ||
_prefix: /^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\.\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=\s)/, | ||
_prefix: /^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\.\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=\s|<)/, | ||
_qname: /^((?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\.\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?=[\s;,)#]|\.[\s#\(\[<"'])/, | ||
@@ -11,0 +11,0 @@ _number: /^[\-+]?(?:\d+\.?\d*([eE](?:[\-\+])?\d+)|\d+\.\d+|\.\d+|\d+)(?=\s*[\s\.;,)#])/, |
@@ -454,8 +454,15 @@ // **N3Parser** parses N3 documents. | ||
switch (uri[0]) { | ||
// An empty relative URI indicates the base URI | ||
case undefined: | ||
return this._baseURI; | ||
// Resolve relative fragment URIs against the base URI | ||
case '#': | ||
return this._baseURI + uri; | ||
// Resolve relative query string URIs by replacing the query string | ||
case '?': | ||
return this._baseURI.replace(/(?:\?.*)?$/, uri); | ||
// Resolve root relative URIs at the root of the base URI | ||
case '/': | ||
return this._baseURIRoot + uri; | ||
// Resolve all other URIs at the base URI's path | ||
default: | ||
@@ -462,0 +469,0 @@ return this._baseURIPath + uri; |
{ | ||
"name": "n3", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "Lightning fast, asynchronous, streaming Turtle / N3 / RDF library.", | ||
@@ -5,0 +5,0 @@ "author": "Ruben Verborgh <ruben.verborgh@gmail.com>", |
@@ -366,3 +366,3 @@ var N3Lexer = require('../N3').Lexer; | ||
it('should tokenize @prefix declarations', | ||
shouldTokenize('@prefix : <http://uri.org/#>.\n@prefix abc: <http://uri.org/#>.', | ||
shouldTokenize('@prefix : <http://uri.org/#>.\n@prefix abc:<http://uri.org/#>.', | ||
{ type: '@prefix', line: 1 }, | ||
@@ -369,0 +369,0 @@ { type: 'prefix', value: '', line: 1 }, |
@@ -370,2 +370,13 @@ var N3Parser = require('../N3').Parser; | ||
it('should resolve URIs with query string against @base', | ||
shouldParse('@base <http://ex.org/>.\n' + | ||
'<?> <?a> <?a=b>.\n' + | ||
'@base <d>.\n' + | ||
'<?> <?a> <?a=b>.' + | ||
'@base <?e>.\n' + | ||
'<> <?a> <?a=b>.', | ||
['http://ex.org/?', 'http://ex.org/?a', 'http://ex.org/?a=b'], | ||
['http://ex.org/d?', 'http://ex.org/d?a', 'http://ex.org/d?a=b'], | ||
['http://ex.org/d?e', 'http://ex.org/d?a', 'http://ex.org/d?a=b'])); | ||
it('should not parse base declarations without IRI', | ||
@@ -372,0 +383,0 @@ shouldNotParse('@base a: ', |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
175566
3549