@@ -61,10 +61,10 @@ N3.js follows the [RDF.js low-level specification](http://rdf.js.org/).
6161const { DataFactory } = N3 ;
6262const { namedNode , literal , defaultGraph , quad } = DataFactory;
6363const 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);
6969console .log (myQuad .termType ); // Quad
7070console .log (myQuad .value ); // ''
@@ -177,16 +177,16 @@ A dedicated `prefix` event signals every prefix with `prefix` and `term` argumen
177177Write 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#`
181181writer .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);
186186writer .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));
191191writer .end ((error , result ) => console .log (result));
192192```
@@ -207,14 +207,14 @@ const writer2 = new N3.Writer({ format: 'application/trig' });
207207``` JavaScript
208208const writer = new N3.Writer (process .stdout , { end: false , prefixes: { c: ' http://example.org/cartoons#' } });
209209writer .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);
214214writer .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));
219219writer .end ();
220220```
0 commit comments