class RDF::Statement
Constants
- PLACEHOLDERS
Public Instance Methods
generality()
click to toggle source
# File lib/rdfs/rule.rb, line 17 def generality to_hash.values.select {|k| PLACEHOLDERS.include? k}.size end
has_placeholder?()
click to toggle source
# File lib/rdfs/rule.rb, line 21 def has_placeholder? to_hash.values.detect {|k| PLACEHOLDERS.include? k} end
specificity()
click to toggle source
# File lib/rdfs/rule.rb, line 25 def specificity 3-generality end
with_substitutions(assignment_hash)
click to toggle source
TODO: consider moving these methods into the RDF
gem instead of reopening RDF::Statement
here
# File lib/rdfs/rule.rb, line 6 def with_substitutions(assignment_hash) return self unless assignment_hash statement_hash = to_hash [:subject, :object, :predicate].each { |place_in_statement| bound_variables, variable = assignment_hash.keys, statement_hash[place_in_statement] statement_hash[place_in_statement] = assignment_hash[variable] if bound_variables.collect(&:to_s).include?(variable.to_s) #TODO: fix node equality so I don't need to use to_s above } Statement.new(statement_hash) end