Skip to content

Commit 420e416

Browse files
committed
Merge pull request #18 from transcranial/master
bump levelgraph to 1.0.0
2 parents 383159d + 2322022 commit 420e416

5 files changed

Lines changed: 30 additions & 41 deletions

File tree

.travis.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
language: node_js
22
node_js:
3-
- 0.10
3+
- "0.10"
4+
- "0.12"
5+
- iojs-1
6+
- iojs-2
47
script:
5-
- npm run coverage
6-
- npm run publish-coverage
7-
- test $SAUCE_USERNAME && npm run zuul || echo 'not running on saucelabs'
8+
- npm run coverage
9+
- npm run publish-coverage
10+
- test $SAUCE_USERNAME && npm run zuul || echo 'not running on saucelabs'
811
env:
912
global:
1013
- secure: TXxHtCdOAk9AQRyntLTCRLP968OVX3V25bkAKmJvIDbppvuqwftQ+HbsyeuWY/QiTXSpDIis6yoq+3JVtP344IVMHn9gZg22n4idVfHL9TKzcJn0C6Sio49SKFbxKXL7PXIBiceGCyPHO0l8ljA7lt6PFLYpgHmKVYMsotpi+v4=

README.md

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,54 +13,37 @@ __LevelGraph-N3__ is a plugin for
1313
[LevelGraph](http://github.com/mcollina/levelgraph) that adds the
1414
ability to store, fetch and process N3 and turtle files.
1515

16-
## Install
16+
## Install
1717

1818
### Node.js
1919

2020
Adding support for N3 to LevelGraph is easy:
2121
```shell
22-
$ npm install levelgraph levelgraph-n3 --save
22+
$ npm install level levelgraph levelgraph-n3 --save
2323
```
2424
Then in your code:
2525
```js
26-
var levelgraph = require('levelgraph'),
26+
var level = require('level'),
27+
levelgraph = require('levelgraph'),
2728
levelgraphN3 = require('levelgraph-n3'),
28-
db = levelgraphN3(levelgraph('yourdb'));
29+
db = levelgraphN3(levelgraph(level('yourdb')));
2930
```
3031

3132

32-
At the moment it requires node v0.10.x, but the port to node v0.8.x
33-
should be straighforward.
34-
If you need it, just open a pull request.
3533

3634
### Browser
3735

3836
If you use [browserify](http://browserify.org/) you can use this package
3937
in a browser just as in node.js. Please also take a look at [Browserify
4038
section in LevelGraph package](https://github.com/mcollina/levelgraph#browserify)
4139

42-
You can also use standalone browserified version from `./build`
43-
directory or use [bower](http://bower.io)
44-
45-
```shell
46-
$ bower install levelgraph-n3 --save
47-
```
48-
It will also install its dependency levelgraph! Now you can simply:
49-
50-
```html
51-
<script src="bower_components/levelgraph/build/levelgraph.js"></script>
52-
<script src="bower_components/levelgraph-n3/build/levelgraph-n3.js"></script>
53-
<script>
54-
var db = levelgraphN3(levelgraph('yourdb'));
55-
</script>
56-
```
5740

5841
## Usage
5942

6043
We assume in following examples that you created database as explained
6144
above!
6245
```js
63-
var db = levelgraphN3(levelgraph("yourdb"));
46+
var db = levelgraphN3(levelgraph(level("yourdb")));
6447
```
6548

6649
### Importing n3 files
@@ -137,7 +120,7 @@ db.search([{
137120
subject: db.v("s"),
138121
predicate: "http://example.org/cartoons#smarterThan",
139122
object: db.v("o")
140-
}], {
123+
}], {
141124
n3: {
142125
subject: db.v("o"),
143126
predicate: "http://example.org/cartoons#dumberThan",
@@ -174,7 +157,7 @@ It also supported by the `searchStream` method.
174157

175158
## LICENSE - "MIT License"
176159

177-
Copyright (c) 2013 Matteo Collina (http://matteocollina.com)
160+
Copyright (c) 2013-2015 Matteo Collina (http://matteocollina.com)
178161

179162
Permission is hereby granted, free of charge, to any person
180163
obtaining a copy of this software and associated documentation

import.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env node
22

33
var levelgraph = require('levelgraph')
4+
, level = require('level')
45
, levelgraphN3 = require('./')
56
, fs = require('fs')
67
, path = require('path')
@@ -27,7 +28,7 @@ try {
2728
console.log('Error: bad output folder specified.')
2829
process.exit(0);
2930
}
30-
31+
3132
dbCreate = mkdirp.sync(dbPath);
3233
if (!dbCreate) {
3334
if (!options.quiet) console.log('\nExisting LevelGraph database at: ' + dbPath);
@@ -36,7 +37,7 @@ try {
3637
}
3738

3839
// initialize levelgraph-n3
39-
var db = levelgraphN3(levelgraph(dbPath));
40+
var db = levelgraphN3(levelgraph(level(dbPath)));
4041

4142
} catch (err) {
4243
console.error(err);
@@ -65,7 +66,7 @@ try {
6566
if (path.extname(n3file) !== '.nt' && path.extname(n3file) !== '.n3') {
6667
console.log('Invalid file. Must be .nt or .n3 file.');
6768
} else {
68-
69+
6970
if (!options.quiet) console.log('\nImporting RDF N-triple file: ' + n3file);
7071

7172
var fileStats = fs.statSync(n3file);

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "levelgraph-n3",
3-
"version": "0.5.0",
3+
"version": "1.0.0",
44
"description": "LevelGraph plugin that add the ability to load and store n3/turtle files.",
55
"main": "index.js",
66
"scripts": {
@@ -33,18 +33,19 @@
3333
"concat-stream": "~1.4.6",
3434
"end-of-stream": "^1.1.0",
3535
"glob": "^5.0.3",
36+
"level": "^1.1.0",
3637
"mkdirp": "^0.5.0",
37-
"n3": "^0.4.2",
38+
"n3": "^0.4.3",
3839
"progress-stream": "^1.0.1",
3940
"readable-stream": ">= 1.1.13 < 2.0.0"
4041
},
4142
"peerDependencies": {
42-
"levelgraph": "~>= 0.10 < 0.11"
43+
"levelgraph": ">= 1.0 < 2.0"
4344
},
4445
"devDependencies": {
4546
"mocha": "~2.0.1",
46-
"levelgraph": "~0.10.1",
47-
"level-test": "~1.6.6",
47+
"levelgraph": "^1.0.0",
48+
"level-test": "^2.0.0",
4849
"chai": "~1.10.0",
4950
"coveralls": "~2.11.2",
5051
"istanbul": "~0.3.2",

test/import_spec.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var exec = require('child_process').exec
22
, fs = require('fs')
33
, graph = require('levelgraph')
4+
, level = require('level')
45
, n3 = require('../');
56

67
describe("CLI: import n3 file(s)", function() {
@@ -20,7 +21,7 @@ describe("CLI: import n3 file(s)", function() {
2021
import_stderr = stderr;
2122
done();
2223
});
23-
});
24+
});
2425

2526
after(function(done) {
2627
exec('rm -r import_test_db_0123',
@@ -44,12 +45,12 @@ describe("CLI: import n3 file(s)", function() {
4445
});
4546

4647
it("should allow triples to then be queried", function(done) {
47-
var db = n3(graph(test_db_path));
48-
db.search({
48+
var db = n3(graph(level(test_db_path)));
49+
db.search([{
4950
subject: "http://dbpedia.org/resource/Abraham_Lincoln"
5051
, predicate: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'
5152
, object: db.v('type')
52-
}, {}, function (err, result) {
53+
}], {}, function (err, result) {
5354
expect(result[0]['type']).to.equal('http://xmlns.com/foaf/0.1/Person');
5455
done();
5556
});

0 commit comments

Comments
 (0)