Class: RoadForest::Augment::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/roadforest/augment/augmentation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_graph) ⇒ Process

Returns a new instance of Process.



79
80
81
# File 'lib/roadforest/augment/augmentation.rb', line 79

def initialize(base_graph)
  @base_graph = base_graph
end

Instance Attribute Details

#base_graphObject

Returns the value of attribute base_graph.



77
78
79
# File 'lib/roadforest/augment/augmentation.rb', line 77

def base_graph
  @base_graph
end

#subjectsObject

Returns the value of attribute subjects.



77
78
79
# File 'lib/roadforest/augment/augmentation.rb', line 77

def subjects
  @subjects
end

Instance Method Details

#object_resources(router) ⇒ Object



108
109
110
111
112
# File 'lib/roadforest/augment/augmentation.rb', line 108

def object_resources(router)
  objects.map do |uri|
    LazyResource.new(uri, router)
  end
end

#objectsObject



98
99
100
# File 'lib/roadforest/augment/augmentation.rb', line 98

def objects
  @objects ||= base_graph.objects.select{|obj| ::RDF::URI === obj}
end

#subject_resources(router) ⇒ Object



102
103
104
105
106
# File 'lib/roadforest/augment/augmentation.rb', line 102

def subject_resources(router)
  subjects.map do |uri|
    LazyResource.new(uri, router)
  end
end

#target_graphObject



83
84
85
86
87
88
89
90
91
92
# File 'lib/roadforest/augment/augmentation.rb', line 83

def target_graph
  @target_graph ||=
    begin
      ::RDF::Repository.new.tap do |graph|
        base_graph.each_statement do |stmt|
          graph << stmt
        end
      end
    end
end