Class | Redland::MergedModel |
In: | rdf/redland/model.rb |
Parent: | Model |
A non-context-aware model used for the purpose of merging
canonical | [R] | |
global_rewrites | [R] |
Constructor - needs a master model to use
# File rdf/redland/model.rb, line 447 def initialize(master_model) @hooks = {} @count = {} @inverse_functional_properties = [] @identifiers = [] # list of inverse functional properties to smush @canonical = {} #rewrites to perform on local level @global_rewrites = {} #rewrites to apply globally @transactions = [] @master = master_model @pred_identifiers = {} super() end
Locate predicates for smushing
# File rdf/redland/model.rb, line 475 def find_canonical(predlist) predlist.each do |pred| identifier = {} self.find(nil,pred,nil) do |subj,pred,obj| master_id = self.find_subject_in_master(pred,obj) if not master_id if not identifier.has_key?(obj.to_s) identifier[obj.to_s] = subj elsif identifier[obj.to_s] != subj #already an identifying URI new_value = identifier[obj.to_s] if not @canonical.has_key?(subj.to_s) @canonical[subj.to_s] = new_value end end else # master_id if identifier.has_key?(obj.to_s) if identifier[obj.to_s] != master_id @canonical[subj.to_s] = master_id identifier[obj.to_s] = master_id end else # master_id not in identifier identifier[obj.to_s] = master_id if @canonical.has_key?(subj.to_s) if @canonical[subj.to_s] != master_id @global_rewrites[master_id] = @canonical[subj.to_s] end else if subj != master_id @canonical[subj.to_s] = master_id end end end end end # self.find @pred_identifiers[pred] = identifier end #predlist.each end
(C) Copyright 2004-2011 Dave Beckett, (C) Copyright 2004-2005 University of Bristol