Module: RepositoryProxy

Included in:
Model::Ontology
Defined in:
lib/services/repository_proxy.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object

proxy everything to the repository



23
24
25
# File 'lib/services/repository_proxy.rb', line 23

def method_missing(method, *args, &block)
  repository.send(method, *args, &block)
end

Instance Method Details

#facts_onlyObject



14
15
16
17
18
19
20
# File 'lib/services/repository_proxy.rb', line 14

def facts_only
  RDF::Graph.new do |g|
    repository.statements.each do |statement|
      g << statement if statement.graph_name.nil?
    end
  end
end

#graph(name) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/services/repository_proxy.rb', line 2

def graph(name)
  graph_name = if name.is_a? Symbol; "_:#{name.to_s}"; else; name.to_s; end
  g = RDF::Graph.new
  repository.statements.each do |statement|
    next if statement.graph_name.nil?
    next unless statement.graph_name.to_s.include? graph_name

    g << [ statement.subject, statement.predicate, statement.object ]
  end
  g
end