|
25 | 25 | _:bpa <http://example.org/p1> _:bpas . |
26 | 26 | _:bpb <http://example.org/l> "b" . |
27 | 27 | ) |
| 28 | + EXAMPLE_1 = %( |
| 29 | + <http://example.org/#> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> . |
| 30 | + <http://example.org/#> <http://schema.org/alternateName> "TimBL" . |
| 31 | + <http://example.org/#> <http://ogp.me/ns/profile#first_name> "Tim" . |
| 32 | + <http://example.org/#> <http://ogp.me/ns/profile#last_name> "Berners-Lee" . |
| 33 | + _:g70241628916320 <http://schema.org/name> "W3C/MIT" . |
| 34 | + <http://example.org/#> <http://schema.org/workLocation> _:g70241628916320 . |
| 35 | + <http://example.org/#> <http://schema.org/performerIn> _:b1 . |
| 36 | + <http://example.org/#> <http://schema.org/performerIn> _:b2 . |
| 37 | + _:g70241628160100 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "en" . |
| 38 | + _:g70241628160100 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70241628162580 . |
| 39 | + _:g70241628162580 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "fr" . |
| 40 | + _:g70241628162580 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . |
| 41 | + <http://example.org/#> <http://example.org/vocab#preferredLanguages> _:g70241628160100 . |
| 42 | + _:b1 <http://schema.org/name> "F2F5 - Linked Data Platform" . |
| 43 | + _:b1 <http://schema.org/url> <https://www.w3.org/2012/ldp/wiki/F2F5> . |
| 44 | + _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Event> . |
| 45 | + _:b2 <http://schema.org/name> "TED 2009" . |
| 46 | + _:b2 <http://schema.org/startDate> "2009-02-04" . |
| 47 | + _:b2 <http://schema.org/url> <http://conferences.ted.com/TED2009/> . |
| 48 | + ) |
28 | 49 | EXAMPLE_4 = %( |
29 | 50 | _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "lorem" . |
30 | 51 | _:a <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b . |
|
38 | 59 | _:e <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . |
39 | 60 | <http://example.org/#> <http://example.org/vocab#preferredLanguages> _:a . |
40 | 61 | ) |
| 62 | + EXAMPLE_24 = %( |
| 63 | + <http://example.org/#> <http://xmlns.com/foaf/0.1/name> "Alice" . |
| 64 | + <http://example.org/#> <http://xmlns.com/foaf/0.1/knows> _:b1 . |
| 65 | + <http://example.org/#> <http://xmlns.com/foaf/0.1/knows> _:b2 . |
| 66 | + _:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> . |
| 67 | + _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> . |
| 68 | + _:b2 <http://schema.org/workLocation> _:b3 . |
| 69 | + _:b3 <http://schema.org/name> "W3C/MIT" . |
| 70 | + ) |
41 | 71 |
|
42 | 72 | describe "positive evaluation" do |
43 | 73 | { |
|
193 | 223 | <http://example.org/something> <http://example.org/completely> <http://example.org/different> . |
194 | 224 | ) |
195 | 225 | }, |
| 226 | + "spec_examples-1-2-3" => { |
| 227 | + data: EXAMPLE_1, |
| 228 | + patch: %( |
| 229 | + @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . |
| 230 | + @prefix schema: <http://schema.org/> . |
| 231 | + @prefix profile: <http://ogp.me/ns/profile#> . |
| 232 | + @prefix ex: <http://example.org/vocab#> . |
| 233 | +
|
| 234 | + Delete { <http://example.org/#> profile:first_name "Tim" } . |
| 235 | + Add { |
| 236 | + <http://example.org/#> profile:first_name "Timothy" ; |
| 237 | + profile:image <https://example.org/timbl.jpg> . |
| 238 | + } . |
| 239 | +
|
| 240 | + Bind ?workLocation <http://example.org/#> / schema:workLocation . |
| 241 | + Cut ?workLocation . |
| 242 | +
|
| 243 | + UpdateList <http://example.org/#> ex:preferredLanguages 1..2 ( "fr-CH" ) . |
| 244 | +
|
| 245 | + Bind ?event <http://example.org/#> / schema:performerIn [ / schema:url = <https://www.w3.org/2012/ldp/wiki/F2F5> ] . |
| 246 | + Add { ?event rdf:type schema:Event } . |
| 247 | +
|
| 248 | + Bind ?ted <http://conferences.ted.com/TED2009/> / ^schema:url ! . |
| 249 | + Delete { ?ted schema:startDate "2009-02-04" } . |
| 250 | + Add { |
| 251 | + ?ted schema:location [ |
| 252 | + schema:name "Long Beach, California" ; |
| 253 | + schema:geo [ |
| 254 | + schema:latitude "33.7817" ; |
| 255 | + schema:longitude "-118.2054" |
| 256 | + ] |
| 257 | + ] |
| 258 | + } . |
| 259 | + ), |
| 260 | + result: %( |
| 261 | + <http://example.org/#> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> . |
| 262 | + <http://example.org/#> <http://schema.org/alternateName> "TimBL" . |
| 263 | + <http://example.org/#> <http://ogp.me/ns/profile#first_name> "Timothy" . |
| 264 | + <http://example.org/#> <http://ogp.me/ns/profile#last_name> "Berners-Lee" . |
| 265 | + <http://example.org/#> <http://ogp.me/ns/profile#image> <https://example.org/timbl.jpg> . |
| 266 | + <http://example.org/#> <http://schema.org/performerIn> _:b1 . |
| 267 | + <http://example.org/#> <http://schema.org/performerIn> _:b2 . |
| 268 | + _:g70201382063060 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "en" . |
| 269 | + _:g70201382063060 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70201382065840 . |
| 270 | + _:g70201382065840 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "fr-CH" . |
| 271 | + _:g70201382065840 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . |
| 272 | + <http://example.org/#> <http://example.org/vocab#preferredLanguages> _:g70201382063060 . |
| 273 | + _:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Event> . |
| 274 | + _:b1 <http://schema.org/name> "F2F5 - Linked Data Platform" . |
| 275 | + _:b1 <http://schema.org/url> <https://www.w3.org/2012/ldp/wiki/F2F5> . |
| 276 | + _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Event> . |
| 277 | + _:b2 <http://schema.org/name> "TED 2009" . |
| 278 | + _:b2 <http://schema.org/url> <http://conferences.ted.com/TED2009/> . |
| 279 | + _:g70201381047840 <http://schema.org/name> "Long Beach, California" . |
| 280 | + _:g70201380929840 <http://schema.org/latitude> "33.7817" . |
| 281 | + _:g70201380929840 <http://schema.org/longitude> "-118.2054" . |
| 282 | + _:g70201381047840 <http://schema.org/geo> _:g70201380929840 . |
| 283 | + _:b2 <http://schema.org/location> _:g70201381047840 . |
| 284 | + ) |
| 285 | + }, |
| 286 | + "spec_examples-4-5-6" => { |
| 287 | + data: EXAMPLE_4, |
| 288 | + patch: %(UpdateList <http://example.org/#> <http://example.org/vocab#preferredLanguages> 1..2 ( "fr" ) .), |
| 289 | + result: %( |
| 290 | + _:g70355537922820 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "lorem" . |
| 291 | + _:g70355537922820 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70355537924860 . |
| 292 | + _:g70355537924860 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "fr" . |
| 293 | + _:g70355537924860 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70355537927900 . |
| 294 | + _:g70355537927900 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "dolor" . |
| 295 | + _:g70355537927900 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70355538003480 . |
| 296 | + _:g70355538003480 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "sit" . |
| 297 | + _:g70355538003480 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70355538007220 . |
| 298 | + _:g70355538007220 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "amet" . |
| 299 | + _:g70355538007220 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . |
| 300 | + <http://example.org/#> <http://example.org/vocab#preferredLanguages> _:g70355537922820 . |
| 301 | + ) |
| 302 | + }, |
| 303 | + "spec_examples-4-7-8" => { |
| 304 | + data: EXAMPLE_4, |
| 305 | + patch: %(UpdateList <http://example.org/#> <http://example.org/vocab#preferredLanguages> 2..2 ( "en" "fr" ) .), |
| 306 | + result: %( |
| 307 | + _:g70103492264460 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "lorem" . |
| 308 | + _:g70103492264460 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70103492266260 . |
| 309 | + _:g70103492266260 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "ipsum" . |
| 310 | + _:g70103492266260 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70103492268360 . |
| 311 | + _:g70103492268360 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "en" . |
| 312 | + _:g70103492268360 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70103492270100 . |
| 313 | + _:g70103492270100 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "fr" . |
| 314 | + _:g70103492270100 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70103492282080 . |
| 315 | + _:g70103492282080 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "dolor" . |
| 316 | + _:g70103492282080 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70103492284900 . |
| 317 | + _:g70103492284900 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "sit" . |
| 318 | + _:g70103492284900 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70103492297500 . |
| 319 | + _:g70103492297500 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "amet" . |
| 320 | + _:g70103492297500 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . |
| 321 | + <http://example.org/#> <http://example.org/vocab#preferredLanguages> _:g70103492264460 . |
| 322 | + ) |
| 323 | + }, |
| 324 | + "spec_examples-4-9-10" => { |
| 325 | + data: EXAMPLE_4, |
| 326 | + patch: %(UpdateList <http://example.org/#> <http://example.org/vocab#preferredLanguages> .. ( "en" "fr" ) .), |
| 327 | + result: %( |
| 328 | + _:g70243947791520 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "lorem" . |
| 329 | + _:g70243947791520 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70243947793380 . |
| 330 | + _:g70243947793380 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "ipsum" . |
| 331 | + _:g70243947793380 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70243947795500 . |
| 332 | + _:g70243947795500 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "dolor" . |
| 333 | + _:g70243947795500 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70243947797260 . |
| 334 | + _:g70243947797260 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "sit" . |
| 335 | + _:g70243947797260 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70243947809080 . |
| 336 | + _:g70243947809080 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "amet" . |
| 337 | + _:g70243947809080 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70243947812000 . |
| 338 | + _:g70243947812000 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "en" . |
| 339 | + _:g70243947812000 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70243947856740 . |
| 340 | + _:g70243947856740 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "fr" . |
| 341 | + _:g70243947856740 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . |
| 342 | + <http://example.org/#> <http://example.org/vocab#preferredLanguages> _:g70243947791520 . |
| 343 | + ) |
| 344 | + }, |
| 345 | + "spec_examples-4-11-12" => { |
| 346 | + data: EXAMPLE_4, |
| 347 | + patch: %(UpdateList <http://example.org/#> <http://example.org/vocab#preferredLanguages> 2.. ( "en" "fr" ) .), |
| 348 | + result: %( |
| 349 | + _:g70272918507700 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "lorem" . |
| 350 | + _:g70272918507700 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70272918507320 . |
| 351 | + _:g70272918507320 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "ipsum" . |
| 352 | + _:g70272918507320 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70272918552980 . |
| 353 | + _:g70272918552980 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "en" . |
| 354 | + _:g70272918552980 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70272918557500 . |
| 355 | + _:g70272918557500 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "fr" . |
| 356 | + _:g70272918557500 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . |
| 357 | + <http://example.org/#> <http://example.org/vocab#preferredLanguages> _:g70272918507700 . |
| 358 | + ) |
| 359 | + }, |
| 360 | + "spec_examples-4-13-14" => { |
| 361 | + data: EXAMPLE_4, |
| 362 | + patch: %(UpdateList <http://example.org/#> <http://example.org/vocab#preferredLanguages> -3.. ( "en" "fr" ) .), |
| 363 | + result: %( |
| 364 | + _:g70165773774620 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "lorem" . |
| 365 | + _:g70165773774620 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70165773777100 . |
| 366 | + _:g70165773777100 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "ipsum" . |
| 367 | + _:g70165773777100 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70165773844780 . |
| 368 | + _:g70165773844780 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "en" . |
| 369 | + _:g70165773844780 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70165773847640 . |
| 370 | + _:g70165773847640 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "fr" . |
| 371 | + _:g70165773847640 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . |
| 372 | + <http://example.org/#> <http://example.org/vocab#preferredLanguages> _:g70165773774620 . |
| 373 | + ) |
| 374 | + }, |
| 375 | + "spec_examples-4-15-16" => { |
| 376 | + data: EXAMPLE_4, |
| 377 | + patch: %(UpdateList <http://example.org/#> <http://example.org/vocab#preferredLanguages> 1..3 ( ) .), |
| 378 | + result: %( |
| 379 | + _:g70106772858120 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "lorem" . |
| 380 | + _:g70106772858120 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70106772862780 . |
| 381 | + _:g70106772862780 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "sit" . |
| 382 | + _:g70106772862780 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:g70106767753500 . |
| 383 | + _:g70106767753500 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "amet" . |
| 384 | + _:g70106767753500 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . |
| 385 | + <http://example.org/#> <http://example.org/vocab#preferredLanguages> _:g70106772858120 . |
| 386 | + ) |
| 387 | + }, |
196 | 388 | "spec_examples-4-17-18" => { |
197 | 389 | data: EXAMPLE_4, |
198 | 390 | patch: %(UpdateList <http://example.org/#> <http://example.org/vocab#preferredLanguages> 0.. ( ) .), |
199 | 391 | result: %(<http://example.org/#> <http://example.org/vocab#preferredLanguages> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .) |
200 | | - } |
| 392 | + }, |
| 393 | + "spec_example24_positive" => { |
| 394 | + data: EXAMPLE_24, |
| 395 | + patch: %( |
| 396 | + @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . |
| 397 | + @prefix schema: <http://schema.org/> . |
| 398 | +
|
| 399 | + Bind ?b3 "W3C/MIT" / ^schema:name . |
| 400 | + Bind ?b2 ?b3 / ^schema:workLocation . |
| 401 | +
|
| 402 | + Add { |
| 403 | + ?b2 rdfs:label "b2" . |
| 404 | + ?b3 rdfs:label "b3" . |
| 405 | + } . |
| 406 | + ), |
| 407 | + result: %( |
| 408 | + <http://example.org/#> <http://xmlns.com/foaf/0.1/name> "Alice" . |
| 409 | + <http://example.org/#> <http://xmlns.com/foaf/0.1/knows> _:b1 . |
| 410 | + <http://example.org/#> <http://xmlns.com/foaf/0.1/knows> _:b2 . |
| 411 | + _:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> . |
| 412 | + _:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> . |
| 413 | + _:b2 <http://schema.org/workLocation> _:b3 . |
| 414 | + _:b2 <http://www.w3.org/2000/01/rdf-schema#label> "b2" . |
| 415 | + _:b3 <http://schema.org/name> "W3C/MIT" . |
| 416 | + _:b3 <http://www.w3.org/2000/01/rdf-schema#label> "b3" . |
| 417 | + ) |
| 418 | + }, |
201 | 419 | }.each do |name, props| |
202 | 420 | it name do |
203 | 421 | graph = RDF::Graph.new << RDF::NTriples::Reader.new(props[:data]) |
|
0 commit comments