n3 0.4.2 → 0.5.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/.eslintrc +173 -0
- package/.travis.yml +3 -6
- package/README.md +43 -8
- package/lib/N3Lexer.js +22 -45
- package/lib/N3Parser.js +120 -54
- package/lib/N3Store.js +97 -81
- package/lib/N3Util.js +33 -4
- package/lib/N3Writer.js +85 -26
- package/package.json +9 -9
- package/perf/.eslintrc +5 -0
- package/perf/N3Parser-perf.js +5 -4
- package/perf/N3Store-perf.js +66 -11
- package/spec/.eslintrc +10 -0
- package/spec/SpecTester.js +16 -17
- package/spec/trig/LICENSE +48 -0
- package/spec/turtle/LICENSE +117 -0
- package/test/.eslintrc +15 -0
- package/test/N3Lexer-test.js +4 -4
- package/test/N3Parser-test.js +480 -12
- package/test/N3Store-test.js +190 -71
- package/test/N3StreamParser-test.js +1 -1
- package/test/N3StreamWriter-test.js +1 -2
- package/test/N3Util-test.js +71 -5
- package/test/N3Writer-test.js +246 -5
- package/.jshintrc +0 -20
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
Summary
|
|
2
|
+
=======
|
|
3
|
+
|
|
4
|
+
Distributed under both the W3C Test Suite License[1] and the W3C 3-clause BSD
|
|
5
|
+
License[2]. To contribute to a W3C Test Suite, see the policies and contribution
|
|
6
|
+
forms [3]
|
|
7
|
+
|
|
8
|
+
1. http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
|
|
9
|
+
2. http://www.w3.org/Consortium/Legal/2008/03-bsd-license
|
|
10
|
+
3. http://www.w3.org/2004/10/27-testcases
|
|
11
|
+
|
|
12
|
+
DISCLAIMER
|
|
13
|
+
|
|
14
|
+
UNDER BOTH MUTUALLY EXCLUSIVE LICENSES, THIS DOCUMENT AND ALL DOCUMENTS, TESTS
|
|
15
|
+
AND SOFTWARE THAT LINK THIS STATEMENT ARE PROVIDED "AS IS," AND COPYRIGHT
|
|
16
|
+
HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING,
|
|
17
|
+
BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
18
|
+
PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE
|
|
19
|
+
SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT
|
|
20
|
+
INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
|
|
21
|
+
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
|
|
22
|
+
CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE
|
|
23
|
+
OR IMPLEMENTATION OF THE CONTENTS THEREOF.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
W3C Test Suite License
|
|
27
|
+
======================
|
|
28
|
+
|
|
29
|
+
This document, Test Suites and other documents that link to this statement are
|
|
30
|
+
provided by the copyright holders under the following license: By using and/or
|
|
31
|
+
copying this document, or the W3C document from which this statement is linked,
|
|
32
|
+
you (the licensee) agree that you have read, understood, and will comply with
|
|
33
|
+
the following terms and conditions:
|
|
34
|
+
|
|
35
|
+
Permission to copy, and distribute the contents of this document, or the W3C
|
|
36
|
+
document from which this statement is linked, in any medium for any purpose and
|
|
37
|
+
without fee or royalty is hereby granted, provided that you include the
|
|
38
|
+
following on ALL copies of the document, or portions thereof, that you use:
|
|
39
|
+
|
|
40
|
+
1 A link or URL to the original W3C document.
|
|
41
|
+
|
|
42
|
+
2 The pre-existing copyright notice of the original author, or if it doesn't
|
|
43
|
+
exist, a notice (hypertext is preferred, but a textual representation is
|
|
44
|
+
permitted) of the form: "Copyright © [$date-of-document] World Wide Web
|
|
45
|
+
Consortium, (Massachusetts Institute of Technology, European Research
|
|
46
|
+
Consortium for Informatics and Mathematics, Keio University) and others. All
|
|
47
|
+
Rights
|
|
48
|
+
Reserved. http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html"
|
|
49
|
+
|
|
50
|
+
3 If it exists, the STATUS of the W3C document.
|
|
51
|
+
|
|
52
|
+
4 When space permits, inclusion of the full text of this NOTICE should be
|
|
53
|
+
provided. We request that authorship attribution be provided in any software,
|
|
54
|
+
documents, or other items or products that you create pursuant to the
|
|
55
|
+
implementation of the contents of this document, or any portion thereof.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
No right to create modifications or derivatives of W3C documents is granted
|
|
59
|
+
pursuant to this license. However, if additional requirements (documented in the
|
|
60
|
+
Copyright FAQ) are satisfied, the right to create modifications or derivatives
|
|
61
|
+
is sometimes granted by the W3C to individuals complying with those
|
|
62
|
+
requirements.
|
|
63
|
+
|
|
64
|
+
If a Test Suite distinguishes the test harness (or, framework for navigation)
|
|
65
|
+
and the actual tests, permission is given to remove or alter the harness or
|
|
66
|
+
navigation if the Test Suite in question allows to do so. The tests themselves
|
|
67
|
+
shall NOT be changed in any way.
|
|
68
|
+
|
|
69
|
+
The name and trademarks of W3C and other copyright holders may NOT be used in
|
|
70
|
+
advertising or publicity pertaining to this document or other documents that
|
|
71
|
+
link to this statement without specific, written prior permission. Title to
|
|
72
|
+
copyright in this document will at all times remain with copyright
|
|
73
|
+
holders. Permission is given to use the trademarked string W3C within claims of
|
|
74
|
+
performance concerning W3C Specifications or features described therein, and
|
|
75
|
+
there only, if the test suite so authorizes.
|
|
76
|
+
|
|
77
|
+
THIS WORK IS PROVIDED BY W3C, MIT, ERCIM, KEIO UNIVERSITY, THE COPYRIGHT HOLDERS
|
|
78
|
+
AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
|
|
79
|
+
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
|
80
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL W3C, MIT, ERCIM, KEIO
|
|
81
|
+
UNIVERSITY, THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
82
|
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
83
|
+
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
84
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
85
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
86
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
87
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
W3C 3-clause BSD License
|
|
91
|
+
========================
|
|
92
|
+
|
|
93
|
+
Redistribution and use in source and binary forms, with or without modification,
|
|
94
|
+
are permitted provided that the following conditions are met:
|
|
95
|
+
|
|
96
|
+
1 Redistributions of works must retain the original copyright notice, this list
|
|
97
|
+
of conditions and the following disclaimer.
|
|
98
|
+
|
|
99
|
+
2 Redistributions in binary form must reproduce the original copyright notice,
|
|
100
|
+
this list of conditions and the following disclaimer in the documentation
|
|
101
|
+
and/or other materials provided with the distribution.
|
|
102
|
+
|
|
103
|
+
3 Neither the name of the W3C nor the names of its contributors may be used to
|
|
104
|
+
endorse or promote products derived from this work without specific prior
|
|
105
|
+
written permission.
|
|
106
|
+
|
|
107
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
108
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
109
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
110
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
111
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
112
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
113
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
|
114
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
115
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
116
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
117
|
+
|
package/test/.eslintrc
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
globals: {
|
|
3
|
+
describe: true,
|
|
4
|
+
it: true,
|
|
5
|
+
before: true,
|
|
6
|
+
after: true,
|
|
7
|
+
beforeEach: true,
|
|
8
|
+
afterEach: true,
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
rules: {
|
|
12
|
+
max-nested-callbacks: 0, // Mocha works with deeply nested callbacks
|
|
13
|
+
new-cap: 0, // test constructors as regular functions
|
|
14
|
+
},
|
|
15
|
+
}
|
package/test/N3Lexer-test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var N3Lexer = require('../N3').Lexer;
|
|
2
2
|
var chai = require('chai'),
|
|
3
|
-
expect = chai.expect,
|
|
4
3
|
events = require('events');
|
|
4
|
+
var expect = chai.expect;
|
|
5
5
|
chai.should();
|
|
6
6
|
|
|
7
7
|
describe('N3Lexer', function () {
|
|
@@ -363,9 +363,9 @@ describe('N3Lexer', function () {
|
|
|
363
363
|
it('should tokenize a double literal',
|
|
364
364
|
shouldTokenize('10e20, +30.40E+50. -60.70e-80. ',
|
|
365
365
|
{ type: 'literal', value: '"10e20"^^http://www.w3.org/2001/XMLSchema#double', line: 1 },
|
|
366
|
-
{ type: ',', line: 1},
|
|
366
|
+
{ type: ',', line: 1 },
|
|
367
367
|
{ type: 'literal', value: '"+30.40E+50"^^http://www.w3.org/2001/XMLSchema#double', line: 1 },
|
|
368
|
-
{ type: '.', line: 1},
|
|
368
|
+
{ type: '.', line: 1 },
|
|
369
369
|
{ type: 'literal', value: '"-60.70e-80"^^http://www.w3.org/2001/XMLSchema#double', line: 1 },
|
|
370
370
|
{ type: '.', line: 1 },
|
|
371
371
|
{ type: 'eof', line: 1 }));
|
|
@@ -721,7 +721,7 @@ function shouldNotTokenize(input, expectedError) {
|
|
|
721
721
|
done();
|
|
722
722
|
}
|
|
723
723
|
else if (token.type === 'eof')
|
|
724
|
-
throw new Error(
|
|
724
|
+
throw new Error('Expected error ' + expectedError);
|
|
725
725
|
}
|
|
726
726
|
};
|
|
727
727
|
}
|