Skip to content

Commit aadee9e

Browse files
committed
Fix check for variable in Pattern.
1 parent 4172e7a commit aadee9e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

lib/rdf/query/pattern.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ def initialize!
5050

5151
# Estmate cost positionally, with variables being least expensive as objects, then predicates, then subjects, then graph_names.
5252
# XXX does not consider bound variables, which would need to be dynamically calculated.
53-
@cost = (@object.nil? || @object.variable? ? 1 : 0) +
54-
(@predicate.nil? || @predicate.variable? ? 2 : 0) +
55-
(@subject.nil? || @subject.variable? ? 4 : 0) +
56-
(@graph_name && @graph_name.variable? ? 8 : 0)
53+
@cost = (@object.nil? || @object.is_a?(Variable) ? 1 : 0) +
54+
(@predicate.nil? || @predicate.is_a?(Variable) ? 2 : 0) +
55+
(@subject.nil? || @subject.is_a?(Variable) ? 4 : 0) +
56+
(@graph_name.is_a?(Variable) ? 8 : 0)
5757
super
5858
end
5959

0 commit comments

Comments
 (0)