Class: SDL::Exporters::RDFExporter
Constant Summary
collapse
- @@s =
RDF::Vocabulary('http://www.open-service-compendium.org/')
Instance Attribute Summary
Attributes inherited from Exporter
#options
Instance Method Summary
collapse
#export_service_to_file
Methods inherited from Exporter
#export_to_file, #initialize
Instance Method Details
#expand_properties(type_instance, graph) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/sdl/exporters/rdf_exporter.rb', line 15
def expand_properties(type_instance, graph)
type_instance.property_values.each do |property, value|
[value].flatten.each do |v|
graph << [RDF::URI.new(type_instance.uri), @@s["#{property.name.underscore}"], v.rdf_object] unless v.nil?
end
if property.type < SDL::Base::Type
[value].flatten.each do |v| expand_properties(v, graph) end
end
end
end
|
#export_service(service) ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/sdl/exporters/rdf_exporter.rb', line 7
def export_service(service)
graph = RDF::Graph.new
expand_properties(service, graph)
graph.dump(:rdf)
end
|