Skip to content

Commit 66a60fe

Browse files
committed
README fixes.
1 parent a3376ec commit 66a60fe

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,23 @@ var levelgraph = require("levelgraph")
3333
, db = n3(levelgraph("yourdb"));
3434
```
3535

36+
### Importing n3 files
37+
38+
```js
39+
var fs = require("fs");
40+
41+
var stream = fs.createReadStream("./triples.n3")
42+
.pipe(db.n3.putStream());
43+
44+
stream.on("finish", function() {
45+
console.log("Import completed");
46+
});
47+
```
48+
3649
### Get and Put
3750

3851
Storing an N3 file in the database is extremey easy:
39-
```
52+
```js
4053
var turtle = "@prefix c: <http://example.org/cartoons#>.\n" +
4154
"c:Tom a c:Cat.\n" +
4255
"c:Jerry a c:Mouse;\n" +
@@ -49,14 +62,14 @@ db.n3.put(turtle, function(err) {
4962
```
5063

5164
Retrieving it through pattern-matching is extremely easy:
52-
```
65+
```js
5366
db.n3.get({ subject: "http://example.org/cartoons#Tom" }, function(err, turtle) {
5467
// turtle is "<http://example.org/cartoons#Tom> a <http://example.org/cartoons#Cat> .\n";
5568
});
5669
```
5770

5871
It even support a Stream interface:
59-
```
72+
```js
6073
var stream = kdb.n3.getStream({ subject: "http://example.org/cartoons#Tom" });
6174
stream.on("data", function(data) {
6275
// data is "<http://example.org/cartoons#Tom> a <http://example.org/cartoons#Cat> .\n";

0 commit comments

Comments
 (0)