|
766 | 766 | end |
767 | 767 | end |
768 | 768 |
|
| 769 | + context "RDF*" do |
| 770 | + { |
| 771 | + "subject-iii": { |
| 772 | + input: RDF::Statement( |
| 773 | + RDF::Statement( |
| 774 | + RDF::URI('http://example/s1'), |
| 775 | + RDF::URI('http://example/p1'), |
| 776 | + RDF::URI('http://example/o1')), |
| 777 | + RDF::URI('http://example/p'), |
| 778 | + RDF::URI('http://example/o')), |
| 779 | + output: %([{ |
| 780 | + "@id": { |
| 781 | + "@id": "http://example/s1", |
| 782 | + "http://example/p1": [{"@id": "http://example/o1"}] |
| 783 | + }, |
| 784 | + "http://example/p": [{"@id": "http://example/o"}] |
| 785 | + }]) |
| 786 | + }, |
| 787 | + "subject-iib": { |
| 788 | + input: RDF::Statement( |
| 789 | + RDF::Statement( |
| 790 | + RDF::URI('http://example/s1'), |
| 791 | + RDF::URI('http://example/p1'), |
| 792 | + RDF::Node.new('o1')), |
| 793 | + RDF::URI('http://example/p'), |
| 794 | + RDF::URI('http://example/o')), |
| 795 | + output: %([{ |
| 796 | + "@id": { |
| 797 | + "@id": "http://example/s1", |
| 798 | + "http://example/p1": [{"@id": "_:o1"}] |
| 799 | + }, |
| 800 | + "http://example/p": [{"@id": "http://example/o"}] |
| 801 | + }]) |
| 802 | + }, |
| 803 | + "subject-iil": { |
| 804 | + input: RDF::Statement( |
| 805 | + RDF::Statement( |
| 806 | + RDF::URI('http://example/s1'), |
| 807 | + RDF::URI('http://example/p1'), |
| 808 | + RDF::Literal('o1')), |
| 809 | + RDF::URI('http://example/p'), |
| 810 | + RDF::URI('http://example/o')), |
| 811 | + output: %([{ |
| 812 | + "@id": { |
| 813 | + "@id": "http://example/s1", |
| 814 | + "http://example/p1": [{"@value": "o1"}] |
| 815 | + }, |
| 816 | + "http://example/p": [{"@id": "http://example/o"}] |
| 817 | + }]) |
| 818 | + }, |
| 819 | + "subject-bii": { |
| 820 | + input: RDF::Statement( |
| 821 | + RDF::Statement( |
| 822 | + RDF::Node('s1'), |
| 823 | + RDF::URI('http://example/p1'), |
| 824 | + RDF::URI('http://example/o1')), |
| 825 | + RDF::URI('http://example/p'), |
| 826 | + RDF::URI('http://example/o')), |
| 827 | + output: %([{ |
| 828 | + "@id": { |
| 829 | + "@id": "_:s1", |
| 830 | + "http://example/p1": [{"@id": "http://example/o1"}] |
| 831 | + }, |
| 832 | + "http://example/p": [{"@id": "http://example/o"}] |
| 833 | + }]) |
| 834 | + }, |
| 835 | + "subject-bib": { |
| 836 | + input: RDF::Statement( |
| 837 | + RDF::Statement( |
| 838 | + RDF::Node('s1'), |
| 839 | + RDF::URI('http://example/p1'), |
| 840 | + RDF::Node.new('o1')), |
| 841 | + RDF::URI('http://example/p'), RDF::URI('http://example/o')), |
| 842 | + output: %([{ |
| 843 | + "@id": { |
| 844 | + "@id": "_:s1", |
| 845 | + "http://example/p1": [{"@id": "_:o1"}] |
| 846 | + }, |
| 847 | + "http://example/p": [{"@id": "http://example/o"}] |
| 848 | + }]) |
| 849 | + }, |
| 850 | + "subject-bil": { |
| 851 | + input: RDF::Statement( |
| 852 | + RDF::Statement( |
| 853 | + RDF::Node('s1'), |
| 854 | + RDF::URI('http://example/p1'), |
| 855 | + RDF::Literal('o1')), |
| 856 | + RDF::URI('http://example/p'), |
| 857 | + RDF::URI('http://example/o')), |
| 858 | + output: %([{ |
| 859 | + "@id": { |
| 860 | + "@id": "_:s1", |
| 861 | + "http://example/p1": [{"@value": "o1"}] |
| 862 | + }, |
| 863 | + "http://example/p": [{"@id": "http://example/o"}] |
| 864 | + }]) |
| 865 | + }, |
| 866 | + "object-iii": { |
| 867 | + input: RDF::Statement( |
| 868 | + RDF::URI('http://example/s'), |
| 869 | + RDF::URI('http://example/p'), |
| 870 | + RDF::Statement( |
| 871 | + RDF::URI('http://example/s1'), |
| 872 | + RDF::URI('http://example/p1'), |
| 873 | + RDF::URI('http://example/o1'))), |
| 874 | + output: %([{ |
| 875 | + "@id": "http://example/s", |
| 876 | + "http://example/p": [{ |
| 877 | + "@id": { |
| 878 | + "@id": "http://example/s1", |
| 879 | + "http://example/p1": [{"@id": "http://example/o1"}] |
| 880 | + } |
| 881 | + }] |
| 882 | + }]) |
| 883 | + }, |
| 884 | + "object-iib": { |
| 885 | + input: RDF::Statement( |
| 886 | + RDF::URI('http://example/s'), |
| 887 | + RDF::URI('http://example/p'), |
| 888 | + RDF::Statement( |
| 889 | + RDF::URI('http://example/s1'), |
| 890 | + RDF::URI('http://example/p1'), |
| 891 | + RDF::Node.new('o1'))), |
| 892 | + output: %([{ |
| 893 | + "@id": "http://example/s", |
| 894 | + "http://example/p": [{ |
| 895 | + "@id": { |
| 896 | + "@id": "http://example/s1", |
| 897 | + "http://example/p1": [{"@id": "_:o1"}] |
| 898 | + } |
| 899 | + }] |
| 900 | + }]) |
| 901 | + }, |
| 902 | + "object-iil": { |
| 903 | + input: RDF::Statement( |
| 904 | + RDF::URI('http://example/s'), |
| 905 | + RDF::URI('http://example/p'), |
| 906 | + RDF::Statement( |
| 907 | + RDF::URI('http://example/s1'), |
| 908 | + RDF::URI('http://example/p1'), |
| 909 | + RDF::Literal('o1'))), |
| 910 | + output: %([{ |
| 911 | + "@id": "http://example/s", |
| 912 | + "http://example/p": [{ |
| 913 | + "@id": { |
| 914 | + "@id": "http://example/s1", |
| 915 | + "http://example/p1": [{"@value": "o1"}] |
| 916 | + } |
| 917 | + }] |
| 918 | + }]) |
| 919 | + }, |
| 920 | + "recursive-subject": { |
| 921 | + input: RDF::Statement( |
| 922 | + RDF::Statement( |
| 923 | + RDF::Statement( |
| 924 | + RDF::URI('http://example/s2'), |
| 925 | + RDF::URI('http://example/p2'), |
| 926 | + RDF::URI('http://example/o2')), |
| 927 | + RDF::URI('http://example/p1'), |
| 928 | + RDF::URI('http://example/o1')), |
| 929 | + RDF::URI('http://example/p'), |
| 930 | + RDF::URI('http://example/o')), |
| 931 | + output: %([{ |
| 932 | + "@id": { |
| 933 | + "@id": { |
| 934 | + "@id": "http://example/s2", |
| 935 | + "http://example/p2": [{"@id": "http://example/o2"}] |
| 936 | + }, |
| 937 | + "http://example/p1": [{"@id": "http://example/o1"}] |
| 938 | + }, |
| 939 | + "http://example/p": [{"@id": "http://example/o"}] |
| 940 | + }]) |
| 941 | + }, |
| 942 | + }.each do |name, params| |
| 943 | + it name do |
| 944 | + graph = RDF::Graph.new {|g| g << params[:input]} |
| 945 | + do_fromRdf(params.merge(input: graph, prefixes: {ex: 'http://example/'})) |
| 946 | + end |
| 947 | + end |
| 948 | + end |
| 949 | + |
769 | 950 | context "problems" do |
770 | 951 | { |
771 | 952 | "xsd:boolean as value" => { |
|
0 commit comments