Skip to content

Commit febacdd

Browse files
author
tinycode2
committed
Updated documentation to reflect the use of @vocab
1 parent 3416718 commit febacdd

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ Start by creating the ld-query object:
139139

140140
```
141141
var context = LD( {
142-
"so": "http://www.schema.org/",
142+
"@vocab": "http://www.schema.org/",
143143
"foaf": "http://xmlns.com/foaf/0.1/",
144144
"ex": "http://www.example.org#"
145145
} );
@@ -150,7 +150,7 @@ var doc = context( data );
150150
or
151151
```
152152
var doc = LD( data, {
153-
"so": "http://www.schema.org/",
153+
"@vocab": "http://www.schema.org/",
154154
"foaf": "http://xmlns.com/foaf/0.1/",
155155
"ex": "http://www.example.org#"
156156
} );
@@ -163,43 +163,43 @@ The resulting object can be queried for the properties we need:
163163
doc.query("foaf:firstName"); // QueryNode object
164164
doc.query("foaf:firstName @value"); // "Andrew"
165165
166-
doc.query("so:description @value"); // "Linked person"
166+
doc.query("description @value"); // "Linked person"
167167
doc.query("@value"); // "goofballLogic"
168168
169169
doc.query("ex:friendCount @value"); // 0
170170
171171
doc.query("ex:favouriteReads"); // QueryNode object
172-
doc.query("ex:favouriteReads").query("so:author @value") // "Iain M Banks"
173-
doc.query("ex:favouriteReads so:author @value"); // "Iain M Banks"
174-
doc.query("so:author @value") // "Iain M Banks"
172+
doc.query("ex:favouriteReads").query("author @value") // "Iain M Banks"
173+
doc.query("ex:favouriteReads author @value"); // "Iain M Banks"
174+
doc.query("author @value") // "Iain M Banks"
175175
doc.query("ex:favouriteReads @value"); // "Iain M Banks"
176176
177-
doc.query("ex:favouriteReads so:author").json(); // { "http://schema.org/author": [ { "@value": "Iain M Banks" } ], http://schema.org/name": [ { "@value": "Excession" } ], "@index": "banks-exc" }
177+
doc.query("ex:favouriteReads author").json(); // { "http://schema.org/author": [ { "@value": "Iain M Banks" } ], http://schema.org/name": [ { "@value": "Excession" } ], "@index": "banks-exc" }
178178
179-
doc.queryAll("ex:favouriteReads so:author"); // array of 2 QueryNode objects
180-
doc.queryAll("ex:favouriteReads so:author @value"); // [ "Iain M Banks", "Thomas Pynchon" ]
179+
doc.queryAll("ex:favouriteReads author"); // array of 2 QueryNode objects
180+
doc.queryAll("ex:favouriteReads author @value"); // [ "Iain M Banks", "Thomas Pynchon" ]
181181
doc.queryAll("ex:favouriteReads").length; // 1
182182
183183
doc.queryAll("ex:favouriteReads")[0] // QueryNode object
184184
185-
doc.queryAll("so:firstName @value"); // [ "Andrew" ]
186-
doc.queryAll("so:firstName").length; // 1
185+
doc.queryAll("firstName @value"); // [ "Andrew" ]
186+
doc.queryAll("firstName").length; // 1
187187
188-
doc.query("so:firstName").length; // 1
188+
doc.query("firstName").length; // 1
189189
190-
doc.query("so:somepropertynotinyourdocument"); // null
191-
doc.query("so:somepropertynotinyourdocument @value") // null
190+
doc.query("somepropertynotinyourdocument"); // null
191+
doc.query("somepropertynotinyourdocument @value") // null
192192
193-
doc.queryAll("so:somepropertynotinyourdocument @value") // []
193+
doc.queryAll("somepropertynotinyourdocument @value") // []
194194
195-
doc.query("ex:favouriteReads[@index=pynchon_gp] so:name @value") // "Gravity's Rainbox"
195+
doc.query("ex:favouriteReads[@index=pynchon_gp] name @value") // "Gravity's Rainbow"
196196
197197
doc.queryAll("ex:favouriteReads @index") // [ "banks-exc", "pynchon-gr" ]
198198
doc.query("ex:favouriteReads @id") // [ "http://www.isbnsearch.org/isbn/9780553575378" ]
199199
200-
doc.queryAll("so:name @value") // [ "Excession", "Gravity's Rainbox", "Andrew Goofball" ]
201-
doc.queryAll("> so:name @value") // [ "Andrew Goofball" ]
202-
doc.queryAll("ex:favouriteReads > so:name @value") // [ "Excession", "Gravity's Rainbox" ]
200+
doc.queryAll("name @value") // [ "Excession", "Gravity's Rainbox", "Andrew Goofball" ]
201+
doc.queryAll("> name @value") // [ "Andrew Goofball" ]
202+
doc.queryAll("ex:favouriteReads > name @value") // [ "Excession", "Gravity's Rainbox" ]
203203
204204
```
205205

0 commit comments

Comments
 (0)