@@ -65,7 +65,7 @@ def containers
65
65
end
66
66
67
67
it "notes non-existing @context" do
68
- expect { subject . parse ( StringIO . new ( "{}" ) ) } . to raise_error
68
+ expect { subject . parse ( StringIO . new ( "{}" ) ) } . to raise_error ( JSON :: LD :: JsonLdError :: InvalidRemoteContext )
69
69
end
70
70
71
71
it "parses a referenced context at a relative URI" do
@@ -262,7 +262,7 @@ def containers
262
262
"@type as object" => { "foo" => { "@type" => { } } } ,
263
263
"@type as array" => { "foo" => { "@type" => [ ] } } ,
264
264
"@type as @list" => { "foo" => { "@type" => "@list" } } ,
265
- "@type as @list " => { "foo" => { "@type" => "@set" } } ,
265
+ "@type as @set " => { "foo" => { "@type" => "@set" } } ,
266
266
"@container as object" => { "foo" => { "@container" => { } } } ,
267
267
"@container as array" => { "foo" => { "@container" => [ ] } } ,
268
268
"@container as string" => { "foo" => { "@container" => "true" } } ,
@@ -364,130 +364,130 @@ def containers
364
364
it "@type with dependent prefixes in a single context" do
365
365
expect ( subject . parse ( {
366
366
'xsd' => "http://www.w3.org/2001/XMLSchema#" ,
367
- 'homepage' => { '@id' => RDF ::FOAF . homepage . to_s , '@type' => '@id' }
367
+ 'homepage' => { '@id' => RDF ::Vocab :: FOAF . homepage . to_s , '@type' => '@id' }
368
368
} ) .
369
369
send ( :clear_provided_context ) .
370
370
serialize ) . to produce ( {
371
371
"@context" => {
372
372
"xsd" => RDF ::XSD . to_uri . to_s ,
373
- "homepage" => { "@id" => RDF ::FOAF . homepage . to_s , "@type" => "@id" }
373
+ "homepage" => { "@id" => RDF ::Vocab :: FOAF . homepage . to_s , "@type" => "@id" }
374
374
}
375
375
} , @debug )
376
376
end
377
377
378
378
it "@list with @id definition in a single context" do
379
379
expect ( subject . parse ( {
380
- 'knows' => { '@id' => RDF ::FOAF . knows . to_s , '@container' => '@list' }
380
+ 'knows' => { '@id' => RDF ::Vocab :: FOAF . knows . to_s , '@container' => '@list' }
381
381
} ) .
382
382
send ( :clear_provided_context ) .
383
383
serialize ) . to produce ( {
384
384
"@context" => {
385
- "knows" => { "@id" => RDF ::FOAF . knows . to_s , "@container" => "@list" }
385
+ "knows" => { "@id" => RDF ::Vocab :: FOAF . knows . to_s , "@container" => "@list" }
386
386
}
387
387
} , @debug )
388
388
end
389
389
390
390
it "@set with @id definition in a single context" do
391
391
expect ( subject . parse ( {
392
- "knows" => { "@id" => RDF ::FOAF . knows . to_s , "@container" => "@set" }
392
+ "knows" => { "@id" => RDF ::Vocab :: FOAF . knows . to_s , "@container" => "@set" }
393
393
} ) .
394
394
send ( :clear_provided_context ) .
395
395
serialize ) . to produce ( {
396
396
"@context" => {
397
- "knows" => { "@id" => RDF ::FOAF . knows . to_s , "@container" => "@set" }
397
+ "knows" => { "@id" => RDF ::Vocab :: FOAF . knows . to_s , "@container" => "@set" }
398
398
}
399
399
} , @debug )
400
400
end
401
401
402
402
it "@language with @id definition in a single context" do
403
403
expect ( subject . parse ( {
404
- "name" => { "@id" => RDF ::FOAF . name . to_s , "@language" => "en" }
404
+ "name" => { "@id" => RDF ::Vocab :: FOAF . name . to_s , "@language" => "en" }
405
405
} ) .
406
406
send ( :clear_provided_context ) .
407
407
serialize ) . to produce ( {
408
408
"@context" => {
409
- "name" => { "@id" => RDF ::FOAF . name . to_s , "@language" => "en" }
409
+ "name" => { "@id" => RDF ::Vocab :: FOAF . name . to_s , "@language" => "en" }
410
410
}
411
411
} , @debug )
412
412
end
413
413
414
414
it "@language with @id definition in a single context and equivalent default" do
415
415
expect ( subject . parse ( {
416
416
"@language" => 'en' ,
417
- "name" => { "@id" => RDF ::FOAF . name . to_s , "@language" => 'en' }
417
+ "name" => { "@id" => RDF ::Vocab :: FOAF . name . to_s , "@language" => 'en' }
418
418
} ) .
419
419
send ( :clear_provided_context ) .
420
420
serialize ) . to produce ( {
421
421
"@context" => {
422
422
"@language" => 'en' ,
423
- "name" => { "@id" => RDF ::FOAF . name . to_s , "@language" => 'en' }
423
+ "name" => { "@id" => RDF ::Vocab :: FOAF . name . to_s , "@language" => 'en' }
424
424
}
425
425
} , @debug )
426
426
end
427
427
428
428
it "@language with @id definition in a single context and different default" do
429
429
expect ( subject . parse ( {
430
430
"@language" => 'en' ,
431
- "name" => { "@id" => RDF ::FOAF . name . to_s , "@language" => "de" }
431
+ "name" => { "@id" => RDF ::Vocab :: FOAF . name . to_s , "@language" => "de" }
432
432
} ) .
433
433
send ( :clear_provided_context ) .
434
434
serialize ) . to produce ( {
435
435
"@context" => {
436
436
"@language" => 'en' ,
437
- "name" => { "@id" => RDF ::FOAF . name . to_s , "@language" => "de" }
437
+ "name" => { "@id" => RDF ::Vocab :: FOAF . name . to_s , "@language" => "de" }
438
438
}
439
439
} , @debug )
440
440
end
441
441
442
442
it "null @language with @id definition in a single context and default" do
443
443
expect ( subject . parse ( {
444
444
"@language" => 'en' ,
445
- "name" => { "@id" => RDF ::FOAF . name . to_s , "@language" => nil }
445
+ "name" => { "@id" => RDF ::Vocab :: FOAF . name . to_s , "@language" => nil }
446
446
} ) .
447
447
send ( :clear_provided_context ) .
448
448
serialize ) . to produce ( {
449
449
"@context" => {
450
450
"@language" => 'en' ,
451
- "name" => { "@id" => RDF ::FOAF . name . to_s , "@language" => nil }
451
+ "name" => { "@id" => RDF ::Vocab :: FOAF . name . to_s , "@language" => nil }
452
452
}
453
453
} , @debug )
454
454
end
455
455
456
456
it "prefix with @type and @list" do
457
457
expect ( subject . parse ( {
458
- "knows" => { "@id" => RDF ::FOAF . knows . to_s , "@type" => "@id" , "@container" => "@list" }
458
+ "knows" => { "@id" => RDF ::Vocab :: FOAF . knows . to_s , "@type" => "@id" , "@container" => "@list" }
459
459
} ) .
460
460
send ( :clear_provided_context ) .
461
461
serialize ) . to produce ( {
462
462
"@context" => {
463
- "knows" => { "@id" => RDF ::FOAF . knows . to_s , "@type" => "@id" , "@container" => "@list" }
463
+ "knows" => { "@id" => RDF ::Vocab :: FOAF . knows . to_s , "@type" => "@id" , "@container" => "@list" }
464
464
}
465
465
} , @debug )
466
466
end
467
467
468
468
it "prefix with @type and @set" do
469
469
expect ( subject . parse ( {
470
- "knows" => { "@id" => RDF ::FOAF . knows . to_s , "@type" => "@id" , "@container" => "@set" }
470
+ "knows" => { "@id" => RDF ::Vocab :: FOAF . knows . to_s , "@type" => "@id" , "@container" => "@set" }
471
471
} ) .
472
472
send ( :clear_provided_context ) .
473
473
serialize ) . to produce ( {
474
474
"@context" => {
475
- "knows" => { "@id" => RDF ::FOAF . knows . to_s , "@type" => "@id" , "@container" => "@set" }
475
+ "knows" => { "@id" => RDF ::Vocab :: FOAF . knows . to_s , "@type" => "@id" , "@container" => "@set" }
476
476
}
477
477
} , @debug )
478
478
end
479
479
480
480
it "CURIE with @type" do
481
481
expect ( subject . parse ( {
482
- "foaf" => RDF ::FOAF . to_uri . to_s ,
482
+ "foaf" => RDF ::Vocab :: FOAF . to_uri . to_s ,
483
483
"foaf:knows" => {
484
484
"@container" => "@list"
485
485
}
486
486
} ) .
487
487
send ( :clear_provided_context ) .
488
488
serialize ) . to produce ( {
489
489
"@context" => {
490
- "foaf" => RDF ::FOAF . to_uri . to_s ,
490
+ "foaf" => RDF ::Vocab :: FOAF . to_uri . to_s ,
491
491
"foaf:knows" => {
492
492
"@container" => "@list"
493
493
}
@@ -498,20 +498,20 @@ def containers
498
498
it "does not use aliased @id in key position" do
499
499
expect ( subject . parse ( {
500
500
"id" => "@id" ,
501
- "knows" => { "@id" => RDF ::FOAF . knows . to_s , "@container" => "@list" }
501
+ "knows" => { "@id" => RDF ::Vocab :: FOAF . knows . to_s , "@container" => "@list" }
502
502
} ) .
503
503
send ( :clear_provided_context ) .
504
504
serialize ) . to produce ( {
505
505
"@context" => {
506
506
"id" => "@id" ,
507
- "knows" => { "@id" => RDF ::FOAF . knows . to_s , "@container" => "@list" }
507
+ "knows" => { "@id" => RDF ::Vocab :: FOAF . knows . to_s , "@container" => "@list" }
508
508
}
509
509
} , @debug )
510
510
end
511
511
512
512
it "does not use aliased @id in value position" do
513
513
expect ( subject . parse ( {
514
- "foaf" => RDF ::FOAF . to_uri . to_s ,
514
+ "foaf" => RDF ::Vocab :: FOAF . to_uri . to_s ,
515
515
"id" => "@id" ,
516
516
"foaf:homepage" => {
517
517
"@type" => "@id"
@@ -520,7 +520,7 @@ def containers
520
520
send ( :clear_provided_context ) .
521
521
serialize ) . to produce ( {
522
522
"@context" => {
523
- "foaf" => RDF ::FOAF . to_uri . to_s ,
523
+ "foaf" => RDF ::Vocab :: FOAF . to_uri . to_s ,
524
524
"id" => "@id" ,
525
525
"foaf:homepage" => {
526
526
"@type" => "@id"
@@ -531,14 +531,14 @@ def containers
531
531
532
532
it "does not use aliased @type" do
533
533
expect ( subject . parse ( {
534
- "foaf" => RDF ::FOAF . to_uri . to_s ,
534
+ "foaf" => RDF ::Vocab :: FOAF . to_uri . to_s ,
535
535
"type" => "@type" ,
536
536
"foaf:homepage" => { "@type" => "@id" }
537
537
} ) .
538
538
send ( :clear_provided_context ) .
539
539
serialize ) . to produce ( {
540
540
"@context" => {
541
- "foaf" => RDF ::FOAF . to_uri . to_s ,
541
+ "foaf" => RDF ::Vocab :: FOAF . to_uri . to_s ,
542
542
"type" => "@type" ,
543
543
"foaf:homepage" => { "@type" => "@id" }
544
544
}
@@ -548,13 +548,13 @@ def containers
548
548
it "does not use aliased @container" do
549
549
expect ( subject . parse ( {
550
550
"container" => "@container" ,
551
- "knows" => { "@id" => RDF ::FOAF . knows . to_s , "@container" => "@list" }
551
+ "knows" => { "@id" => RDF ::Vocab :: FOAF . knows . to_s , "@container" => "@list" }
552
552
} ) .
553
553
send ( :clear_provided_context ) .
554
554
serialize ) . to produce ( {
555
555
"@context" => {
556
556
"container" => "@container" ,
557
- "knows" => { "@id" => RDF ::FOAF . knows . to_s , "@container" => "@list" }
557
+ "knows" => { "@id" => RDF ::Vocab :: FOAF . knows . to_s , "@container" => "@list" }
558
558
}
559
559
} , @debug )
560
560
end
@@ -881,7 +881,6 @@ def containers
881
881
"unmapped" => [ "foo" , "foo" ] ,
882
882
"bnode" => [ "_:a" , RDF ::Node ( "a" ) ] ,
883
883
"relative" => [ "foo/bar" , "http://base/foo/bar" ] ,
884
- "odd CURIE" => [ "exp:s" , "http://example.org/perts" ] ,
885
884
"odd CURIE" => [ "ex:perts" , "http://example.org/perts" ]
886
885
} . each do |title , ( result , input ) |
887
886
it title do
@@ -1044,9 +1043,9 @@ def containers
1044
1043
describe "#expand_value" do
1045
1044
subject {
1046
1045
ctx = context . parse ( {
1047
- "dc" => RDF ::DC . to_uri . to_s ,
1046
+ "dc" => RDF ::Vocab :: DC . to_uri . to_s ,
1048
1047
"ex" => "http://example.org/" ,
1049
- "foaf" => RDF ::FOAF . to_uri . to_s ,
1048
+ "foaf" => RDF ::Vocab :: FOAF . to_uri . to_s ,
1050
1049
"xsd" => "http://www.w3.org/2001/XMLSchema#" ,
1051
1050
"foaf:age" => { "@type" => "xsd:integer" } ,
1052
1051
"foaf:knows" => { "@type" => "@id" } ,
@@ -1136,9 +1135,9 @@ def containers
1136
1135
describe "#compact_value" do
1137
1136
let ( :ctx ) do
1138
1137
c = context . parse ( {
1139
- "dc" => RDF ::DC . to_uri . to_s ,
1138
+ "dc" => RDF ::Vocab :: DC . to_uri . to_s ,
1140
1139
"ex" => "http://example.org/" ,
1141
- "foaf" => RDF ::FOAF . to_uri . to_s ,
1140
+ "foaf" => RDF ::Vocab :: FOAF . to_uri . to_s ,
1142
1141
"xsd" => RDF ::XSD . to_s ,
1143
1142
"langmap" => { "@id" => "http://example.com/langmap" , "@container" => "@language" } ,
1144
1143
"list" => { "@id" => "http://example.org/list" , "@container" => "@list" } ,
@@ -1158,7 +1157,7 @@ def containers
1158
1157
"integer" => [ "foaf:age" , "54" , { "@value" => "54" , "@type" => RDF ::XSD . integer . to_s } ] ,
1159
1158
"date " => [ "dc:created" , "2011-12-27Z" , { "@value" => "2011-12-27Z" , "@type" => RDF ::XSD . date . to_s } ] ,
1160
1159
"no IRI" => [ "foo" , { "@id" => "http://example.com/" } , { "@id" => "http://example.com/" } ] ,
1161
- "no IRI (CURIE)" => [ "foo" , { "@id" => RDF ::FOAF . Person . to_s } , { "@id" => RDF ::FOAF . Person . to_s } ] ,
1160
+ "no IRI (CURIE)" => [ "foo" , { "@id" => RDF ::Vocab :: FOAF . Person . to_s } , { "@id" => RDF :: Vocab ::FOAF . Person . to_s } ] ,
1162
1161
"no boolean" => [ "foo" , { "@value" => "true" , "@type" => RDF ::XSD . boolean . to_s } , { "@value" => "true" , "@type" => RDF ::XSD . boolean . to_s } ] ,
1163
1162
"no integer" => [ "foo" , { "@value" => "54" , "@type" => RDF ::XSD . integer . to_s } , { "@value" => "54" , "@type" => RDF ::XSD . integer . to_s } ] ,
1164
1163
"no date " => [ "foo" , { "@value" => "2011-12-27Z" , "@type" => RDF ::XSD . date . to_s } , { "@value" => "2011-12-27Z" , "@type" => RDF ::XSD . date . to_s } ] ,
0 commit comments