|
393 | 393 | expect(graph).to be_equivalent_graph(expected, about: "http://example.com/", logger: logger) |
394 | 394 | end |
395 | 395 | end |
| 396 | + |
| 397 | + context :parseType do |
| 398 | + { |
| 399 | + "Literal (xml-canon/test001)": { |
| 400 | + input: %( |
| 401 | + <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
| 402 | + xmlns:eg="http://example.org/"> |
| 403 | + <rdf:Description rdf:about="http://www.example.org/a"> |
| 404 | + <eg:prop rdf:parseType="Literal">Foo</eg:prop> |
| 405 | + </rdf:Description> |
| 406 | + </rdf:RDF> |
| 407 | + ), |
| 408 | + expected: %( |
| 409 | + <http://www.example.org/a> <http://example.org/prop> "Foo"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral> . |
| 410 | + ) |
| 411 | + }, |
| 412 | + "Resource": { |
| 413 | + input: %( |
| 414 | + <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
| 415 | + xmlns:random="http://random.ioctl.org/#"> |
| 416 | +
|
| 417 | + <rdf:Description rdf:about="http://random.ioctl.org/#bar"> |
| 418 | + <random:someProperty rdf:parseType="Resource" /> |
| 419 | + </rdf:Description> |
| 420 | +
|
| 421 | + </rdf:RDF> |
| 422 | + ), |
| 423 | + expected: %( |
| 424 | + <http://random.ioctl.org/#bar> <http://random.ioctl.org/#someProperty> _:a1 . |
| 425 | + ) |
| 426 | + }, |
| 427 | + "Collection": { |
| 428 | + input: %( |
| 429 | + <rdf:RDF |
| 430 | + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
| 431 | + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" |
| 432 | + xmlns:eg="http://example.org/eg#"> |
| 433 | +
|
| 434 | + <rdf:Description rdf:about="http://example.org/eg#eric"> |
| 435 | + <rdf:type rdf:parseType="Resource"> |
| 436 | + <eg:intersectionOf rdf:parseType="Collection"> |
| 437 | + <rdf:Description rdf:about="http://example.org/eg#Person"/> |
| 438 | + <rdf:Description rdf:about="http://example.org/eg#Male"/> |
| 439 | + </eg:intersectionOf> |
| 440 | + </rdf:type> |
| 441 | + </rdf:Description> |
| 442 | + </rdf:RDF> |
| 443 | + ), |
| 444 | + expected: %( |
| 445 | + <http://example.org/eg#eric> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> _:a0 . |
| 446 | + _:a0 <http://example.org/eg#intersectionOf> _:a1 . |
| 447 | + _:a1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/eg#Person> . |
| 448 | + _:a1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:a2 . |
| 449 | + _:a2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/eg#Male> . |
| 450 | + _:a2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . |
| 451 | + ) |
| 452 | + }, |
| 453 | + "Collection (with rdf:resource)": { |
| 454 | + input: %( |
| 455 | + <rdf:RDF |
| 456 | + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
| 457 | + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" |
| 458 | + xmlns:eg="http://example.org/eg#"> |
| 459 | +
|
| 460 | + <rdf:Description rdf:about="http://example.org/eg#eric"> |
| 461 | + <rdf:type rdf:parseType="Resource"> |
| 462 | + <eg:intersectionOf rdf:parseType="Collection"> |
| 463 | + <rdf:Description rdf:resource="http://example.org/eg#Person"/> |
| 464 | + <rdf:Description rdf:resource="http://example.org/eg#Male"/> |
| 465 | + </eg:intersectionOf> |
| 466 | + </rdf:type> |
| 467 | + </rdf:Description> |
| 468 | + </rdf:RDF> |
| 469 | + ), |
| 470 | + expected: %( |
| 471 | + <http://example.org/eg#eric> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> _:a0 . |
| 472 | + _:a0 <http://example.org/eg#intersectionOf> _:a1 . |
| 473 | + _:a1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/eg#Person> . |
| 474 | + _:a1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:a2 . |
| 475 | + _:a2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://example.org/eg#Male> . |
| 476 | + _:a2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . |
| 477 | + ) |
| 478 | + }, |
| 479 | + }.each do |name, params| |
| 480 | + it name do |
| 481 | + graph = parse(params[:input], base_uri: "http://example.com", validate: true) |
| 482 | + expect(graph).to be_equivalent_graph(params[:expected], about: "http://example.com/", logger: logger) |
| 483 | + end |
| 484 | + end |
| 485 | + end |
396 | 486 | end |
397 | 487 | end |
398 | 488 |
|
|
0 commit comments