Skip to content

Commit 312d5d5

Browse files
mimfajeswrTallTed
authored
chore: add comments code examples in readme (#354)
* Update README.md * Update README.md Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com> * Update README.md * Update README.md --------- Co-authored-by: Jesse Wright <63333554+jeswr@users.noreply.github.com> Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
1 parent f085fbe commit 312d5d5

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ N3.js follows the [RDF.js low-level specification](http://rdf.js.org/).
6161
const { DataFactory } = N3;
6262
const { namedNode, literal, defaultGraph, quad } = DataFactory;
6363
const myQuad = quad(
64-
namedNode('https://ruben.verborgh.org/profile/#me'),
65-
namedNode('http://xmlns.com/foaf/0.1/givenName'),
66-
literal('Ruben', 'en'),
67-
defaultGraph(),
64+
namedNode('https://ruben.verborgh.org/profile/#me'), // Subject
65+
namedNode('http://xmlns.com/foaf/0.1/givenName'), // Predicate
66+
literal('Ruben', 'en'), // Object
67+
defaultGraph(), // Graph
6868
);
6969
console.log(myQuad.termType); // Quad
7070
console.log(myQuad.value); // ''
@@ -177,16 +177,16 @@ A dedicated `prefix` event signals every prefix with `prefix` and `term` argumen
177177
Write quads through `addQuad`.
178178

179179
```JavaScript
180-
const writer = new N3.Writer({ prefixes: { c: 'http://example.org/cartoons#' } });
180+
const writer = new N3.Writer({ prefixes: { c: 'http://example.org/cartoons#' } }); // Create a writer which uses `c` as a prefix for the namespace `http://example.org/cartoons#`
181181
writer.addQuad(
182-
namedNode('http://example.org/cartoons#Tom'),
183-
namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
184-
namedNode('http://example.org/cartoons#Cat')
182+
namedNode('http://example.org/cartoons#Tom'), // Subject
183+
namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), // Predicate
184+
namedNode('http://example.org/cartoons#Cat') // Object
185185
);
186186
writer.addQuad(quad(
187-
namedNode('http://example.org/cartoons#Tom'),
188-
namedNode('http://example.org/cartoons#name'),
189-
literal('Tom')
187+
namedNode('http://example.org/cartoons#Tom'), // Subject
188+
namedNode('http://example.org/cartoons#name'), // Predicate
189+
literal('Tom') // Object
190190
));
191191
writer.end((error, result) => console.log(result));
192192
```
@@ -207,14 +207,14 @@ const writer2 = new N3.Writer({ format: 'application/trig' });
207207
```JavaScript
208208
const writer = new N3.Writer(process.stdout, { end: false, prefixes: { c: 'http://example.org/cartoons#' } });
209209
writer.addQuad(
210-
namedNode('http://example.org/cartoons#Tom'),
211-
namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),
212-
namedNode('http://example.org/cartoons#Cat')
210+
namedNode('http://example.org/cartoons#Tom'), // Subject
211+
namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), // Predicate
212+
namedNode('http://example.org/cartoons#Cat') // Object
213213
);
214214
writer.addQuad(quad(
215-
namedNode('http://example.org/cartoons#Tom'),
216-
namedNode('http://example.org/cartoons#name'),
217-
literal('Tom')
215+
namedNode('http://example.org/cartoons#Tom'), // Subject
216+
namedNode('http://example.org/cartoons#name'), // Predicate
217+
literal('Tom') // Object
218218
));
219219
writer.end();
220220
```

0 commit comments

Comments
 (0)