|
67 | 67 | end |
68 | 68 | end |
69 | 69 |
|
| 70 | + describe "merge" do |
| 71 | + { |
| 72 | + "add x dijoint" => [ |
| 73 | + RDF::Query::Solutions.new.concat([ |
| 74 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/a")), |
| 75 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/b")), |
| 76 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/c")), |
| 77 | + ]), |
| 78 | + RDF::Query::Solutions.new.concat([ |
| 79 | + RDF::Query::Solution.new(x: RDF::URI("http://example.org/x")), |
| 80 | + ]), |
| 81 | + RDF::Query::Solutions.new.concat([ |
| 82 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/a"), x: RDF::URI("http://example.org/x")), |
| 83 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/b"), x: RDF::URI("http://example.org/x")), |
| 84 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/c"), x: RDF::URI("http://example.org/x")), |
| 85 | + ]), |
| 86 | + ], |
| 87 | + "add x shared" => [ |
| 88 | + RDF::Query::Solutions.new.concat([ |
| 89 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/a"), x: RDF::URI("http://example.org/x")), |
| 90 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/b"), x: RDF::URI("http://example.org/x")), |
| 91 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/c"), x: RDF::URI("http://example.org/x")), |
| 92 | + ]), |
| 93 | + RDF::Query::Solutions.new.concat([ |
| 94 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/a"), y: RDF::URI("http://example.org/y")), |
| 95 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/b"), y: RDF::URI("http://example.org/y")), |
| 96 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/c"), y: RDF::URI("http://example.org/y")), |
| 97 | + ]), |
| 98 | + RDF::Query::Solutions.new.concat([ |
| 99 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/a"), x: RDF::URI("http://example.org/x"), y: RDF::URI("http://example.org/y")), |
| 100 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/b"), x: RDF::URI("http://example.org/x"), y: RDF::URI("http://example.org/y")), |
| 101 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/c"), x: RDF::URI("http://example.org/x"), y: RDF::URI("http://example.org/y")), |
| 102 | + ]), |
| 103 | + ], |
| 104 | + "add x disjoint" => [ |
| 105 | + RDF::Query::Solutions.new.concat([ |
| 106 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/a"), x: RDF::URI("http://example.org/x")), |
| 107 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/b"), x: RDF::URI("http://example.org/x")), |
| 108 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/c"), x: RDF::URI("http://example.org/x")), |
| 109 | + ]), |
| 110 | + RDF::Query::Solutions.new.concat([ |
| 111 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/a"), y: RDF::URI("http://example.org/y")), |
| 112 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/d"), y: RDF::URI("http://example.org/y")), |
| 113 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/e"), y: RDF::URI("http://example.org/y")), |
| 114 | + ]), |
| 115 | + RDF::Query::Solutions.new.concat([ |
| 116 | + RDF::Query::Solution.new(animal: RDF::URI("http://example.org/a"), x: RDF::URI("http://example.org/x"), y: RDF::URI("http://example.org/y")), |
| 117 | + ]), |
| 118 | + ], |
| 119 | + }.each do |name, (left, right, result)| |
| 120 | + it name do |
| 121 | + expect(left.merge(right)).to be_a(Enumerable) |
| 122 | + expect(left.merge(right)).to be_a(RDF::Query::Solutions) |
| 123 | + expect(left.merge(right).to_a).to eq result.to_a |
| 124 | + end |
| 125 | + end |
| 126 | + end |
| 127 | + |
70 | 128 | describe "#-" do |
71 | 129 | { |
72 | 130 | "subsetByExcl01" => [ |
|
0 commit comments