|
3388 | 3388 | }), |
3389 | 3389 | exception: JSON::LD::JsonLdError::InvalidIdValue |
3390 | 3390 | }, |
| 3391 | + "node object with @annotation property is ignored without rdfstar option": { |
| 3392 | + input: %({ |
| 3393 | + "@id": "ex:bob", |
| 3394 | + "ex:knows": { |
| 3395 | + "@id": "ex:fred", |
| 3396 | + "@annotation": { |
| 3397 | + "ex:certainty": 0.8 |
| 3398 | + } |
| 3399 | + } |
| 3400 | + }), |
| 3401 | + output: %([{ |
| 3402 | + "@id": "ex:bob", |
| 3403 | + "ex:knows": [{"@id": "ex:fred"}] |
| 3404 | + }]) |
| 3405 | + }, |
| 3406 | + "value object with @annotation property is ignored without rdfstar option": { |
| 3407 | + input: %({ |
| 3408 | + "@id": "ex:bob", |
| 3409 | + "ex:age": { |
| 3410 | + "@value": 23, |
| 3411 | + "@annotation": { |
| 3412 | + "ex:certainty": 0.8 |
| 3413 | + } |
| 3414 | + } |
| 3415 | + }), |
| 3416 | + output: %([{ |
| 3417 | + "@id": "ex:bob", |
| 3418 | + "ex:age": [{"@value": 23}] |
| 3419 | + }]) |
| 3420 | + }, |
3391 | 3421 | }.each do |title, params| |
3392 | 3422 | it(title) {run_expand params} |
3393 | 3423 | end |
|
3569 | 3599 | }] |
3570 | 3600 | }]) |
3571 | 3601 | }, |
3572 | | - "illegal node with embedded object having properties": { |
| 3602 | + "node with embedded object having properties": { |
3573 | 3603 | input: %({ |
3574 | 3604 | "@id": "ex:subj", |
3575 | 3605 | "ex:value": { |
|
3619 | 3649 | }] |
3620 | 3650 | }]) |
3621 | 3651 | }, |
| 3652 | + "node with @annotation property on value object": { |
| 3653 | + input: %({ |
| 3654 | + "@id": "ex:bob", |
| 3655 | + "ex:age": { |
| 3656 | + "@value": 23, |
| 3657 | + "@annotation": {"ex:certainty": 0.8} |
| 3658 | + } |
| 3659 | + }), |
| 3660 | + output: %([{ |
| 3661 | + "@id": "ex:bob", |
| 3662 | + "ex:age": [{ |
| 3663 | + "@value": 23, |
| 3664 | + "@annotation": [{"ex:certainty": [{"@value": 0.8}]}] |
| 3665 | + }] |
| 3666 | + }]) |
| 3667 | + }, |
| 3668 | + "node with @annotation property on node object": { |
| 3669 | + input: %({ |
| 3670 | + "@id": "ex:bob", |
| 3671 | + "ex:name": "Bob", |
| 3672 | + "ex:knows": { |
| 3673 | + "@id": "ex:fred", |
| 3674 | + "ex:name": "Fred", |
| 3675 | + "@annotation": {"ex:certainty": 0.8} |
| 3676 | + } |
| 3677 | + }), |
| 3678 | + output: %([{ |
| 3679 | + "@id": "ex:bob", |
| 3680 | + "ex:name": [{"@value": "Bob"}], |
| 3681 | + "ex:knows": [{ |
| 3682 | + "@id": "ex:fred", |
| 3683 | + "ex:name": [{"@value": "Fred"}], |
| 3684 | + "@annotation": [{"ex:certainty": [{"@value": 0.8}]}] |
| 3685 | + }] |
| 3686 | + }]) |
| 3687 | + }, |
| 3688 | + "node with @annotation property multiple values": { |
| 3689 | + input: %({ |
| 3690 | + "@id": "ex:bob", |
| 3691 | + "ex:name": "Bob", |
| 3692 | + "ex:knows": { |
| 3693 | + "@id": "ex:fred", |
| 3694 | + "ex:name": "Fred", |
| 3695 | + "@annotation": [{ |
| 3696 | + "ex:certainty": 0.8 |
| 3697 | + }, { |
| 3698 | + "ex:source": {"@id": "http://example.org/"} |
| 3699 | + }] |
| 3700 | + } |
| 3701 | + }), |
| 3702 | + output: %([{ |
| 3703 | + "@id": "ex:bob", |
| 3704 | + "ex:name": [{"@value": "Bob"}], |
| 3705 | + "ex:knows": [{ |
| 3706 | + "@id": "ex:fred", |
| 3707 | + "ex:name": [{"@value": "Fred"}], |
| 3708 | + "@annotation": [{ |
| 3709 | + "ex:certainty": [{"@value": 0.8}] |
| 3710 | + }, { |
| 3711 | + "ex:source": [{"@id": "http://example.org/"}] |
| 3712 | + }] |
| 3713 | + }] |
| 3714 | + }]) |
| 3715 | + }, |
| 3716 | + "node with @annotation property that is on the top-level is invalid": { |
| 3717 | + input: %({ |
| 3718 | + "@id": "ex:bob", |
| 3719 | + "ex:name": "Bob", |
| 3720 | + "@annotation": {"ex:prop": "value2"} |
| 3721 | + }), |
| 3722 | + exception: JSON::LD::JsonLdError::InvalidAnnotation |
| 3723 | + }, |
| 3724 | + "node with @annotation property on a top-level graph node is invalid": { |
| 3725 | + input: %({ |
| 3726 | + "@id": "ex:bob", |
| 3727 | + "ex:name": "Bob", |
| 3728 | + "@graph": { |
| 3729 | + "@id": "ex:fred", |
| 3730 | + "ex:name": "Fred", |
| 3731 | + "@annotation": {"ex:prop": "value2"} |
| 3732 | + } |
| 3733 | + }), |
| 3734 | + exception: JSON::LD::JsonLdError::InvalidAnnotation |
| 3735 | + }, |
| 3736 | + "node with @annotation property having @id is invalid": { |
| 3737 | + input: %({ |
| 3738 | + "@id": "ex:bob", |
| 3739 | + "ex:knows": { |
| 3740 | + "@id": "ex:fred", |
| 3741 | + "@annotation": { |
| 3742 | + "@id": "ex:invalid-ann-id", |
| 3743 | + "ex:prop": "value2" |
| 3744 | + } |
| 3745 | + } |
| 3746 | + }), |
| 3747 | + exception: JSON::LD::JsonLdError::InvalidAnnotation |
| 3748 | + }, |
| 3749 | + "node with @annotation property with value object value is invalid": { |
| 3750 | + input: %({ |
| 3751 | + "@id": "ex:bob", |
| 3752 | + "ex:knows": { |
| 3753 | + "@id": "fred", |
| 3754 | + "@annotation": "value2" |
| 3755 | + } |
| 3756 | + }), |
| 3757 | + exception: JSON::LD::JsonLdError::InvalidAnnotation |
| 3758 | + }, |
| 3759 | + "node with @annotation on a list": { |
| 3760 | + input: %({ |
| 3761 | + "@id": "ex:bob", |
| 3762 | + "ex:knows": { |
| 3763 | + "@list": [{"@id": "ex:fred"}], |
| 3764 | + "@annotation": "value2" |
| 3765 | + } |
| 3766 | + }), |
| 3767 | + exception: JSON::LD::JsonLdError::InvalidSetOrListObject |
| 3768 | + }, |
| 3769 | + "node with @annotation on a list value": { |
| 3770 | + input: %({ |
| 3771 | + "@id": "ex:bob", |
| 3772 | + "ex:knows": { |
| 3773 | + "@list": [ |
| 3774 | + { |
| 3775 | + "@id": "ex:fred", |
| 3776 | + "@annotation": "value2" |
| 3777 | + } |
| 3778 | + ] |
| 3779 | + } |
| 3780 | + }), |
| 3781 | + exception: JSON::LD::JsonLdError::InvalidAnnotation |
| 3782 | + }, |
| 3783 | + "node with @annotation property on a top-level @included node is invalid": { |
| 3784 | + input: %({ |
| 3785 | + "@id": "ex:bob", |
| 3786 | + "ex:name": "Bob", |
| 3787 | + "@included": [{ |
| 3788 | + "@id": "ex:fred", |
| 3789 | + "ex:name": "Fred", |
| 3790 | + "@annotation": {"ex:prop": "value2"} |
| 3791 | + }] |
| 3792 | + }), |
| 3793 | + exception: JSON::LD::JsonLdError::InvalidAnnotation |
| 3794 | + }, |
| 3795 | + "node with @annotation property on embedded subject": { |
| 3796 | + input: %({ |
| 3797 | + "@id": { |
| 3798 | + "@id": "ex:rei", |
| 3799 | + "ex:prop": {"@id": "_:value"} |
| 3800 | + }, |
| 3801 | + "ex:prop": { |
| 3802 | + "@value": "value2", |
| 3803 | + "@annotation": {"ex:certainty": 0.8} |
| 3804 | + } |
| 3805 | + }), |
| 3806 | + output: %([{ |
| 3807 | + "@id": { |
| 3808 | + "@id": "ex:rei", |
| 3809 | + "ex:prop": [{"@id": "_:value"}] |
| 3810 | + }, |
| 3811 | + "ex:prop": [{ |
| 3812 | + "@value": "value2", |
| 3813 | + "@annotation": [{ |
| 3814 | + "ex:certainty": [{"@value": 0.8}] |
| 3815 | + }] |
| 3816 | + }] |
| 3817 | + }]) |
| 3818 | + }, |
| 3819 | + "node with @annotation property on embedded object": { |
| 3820 | + input: %({ |
| 3821 | + "@id": "ex:subj", |
| 3822 | + "ex:value": { |
| 3823 | + "@id": { |
| 3824 | + "@id": "ex:rei", |
| 3825 | + "ex:prop": "value" |
| 3826 | + }, |
| 3827 | + "@annotation": {"ex:certainty": 0.8} |
| 3828 | + } |
| 3829 | + }), |
| 3830 | + output: %([{ |
| 3831 | + "@id": "ex:subj", |
| 3832 | + "ex:value": [{ |
| 3833 | + "@id": { |
| 3834 | + "@id": "ex:rei", |
| 3835 | + "ex:prop": [{"@value": "value"}] |
| 3836 | + }, |
| 3837 | + "@annotation": [{ |
| 3838 | + "ex:certainty": [{"@value": 0.8}] |
| 3839 | + }] |
| 3840 | + }] |
| 3841 | + }]) |
| 3842 | + }, |
3622 | 3843 | }.each do |title, params| |
3623 | 3844 | it(title) {run_expand params.merge(rdfstar: true)} |
3624 | 3845 | end |
|
0 commit comments