Module: SADI::BaseService
- Includes:
- Converter
- Included in:
- AsynchronousService, SynchronousService
- Defined in:
- lib/sadi-rb/base_service.rb
Instance Method Summary collapse
- #input_classes ⇒ Object
- #input_objects(graph) ⇒ Object
- #output_classes ⇒ Object
-
#process_input(input, format) ⇒ Object
def self.classes @classes end.
- #process_object(owl_graph, object) ⇒ Object
- #service_description(service) ⇒ Object
- #service_name ⇒ Object
- #service_owl(service) ⇒ Object
Methods included from Converter
Instance Method Details
#input_classes ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sadi-rb/base_service.rb', line 33 def input_classes moby = RDF::Vocabulary.new('http://www.mygrid.org.uk/mygrid-moby-service#') solutions = RDF::Query.execute(service_description) do pattern [nil, moby.inputParameter, :param] pattern [:param, moby.objectType, :in_class] end solutions.map(&:in_class) end |
#input_objects(graph) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/sadi-rb/base_service.rb', line 23 def input_objects(graph) input_classes.map do |cl| solutions = RDF::Query.execute(graph) do pattern [:obj, RDF.type, cl] end solutions.map(&:obj) end.flatten end |
#output_classes ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/sadi-rb/base_service.rb', line 44 def output_classes moby = RDF::Vocabulary.new('http://www.mygrid.org.uk/mygrid-moby-service#') solutions = RDF::Query.execute(service_description) do pattern [nil, moby.outputParameter, :param] pattern [:param, moby.objectType, :out_class] end solutions.map(&:out_class) end |
#process_input(input, format) ⇒ Object
def self.classes
@classes
end
19 20 21 |
# File 'lib/sadi-rb/base_service.rb', line 19 def process_input(input, format) raise "Input processing should be implemented by service module" end |
#process_object(owl_graph, object) ⇒ Object
63 64 65 |
# File 'lib/sadi-rb/base_service.rb', line 63 def process_object(owl_graph, object) raise "Must implement a #process_input that takes an RDF::Graph or Repository as input and returns a new one" end |
#service_description(service) ⇒ Object
55 56 57 |
# File 'lib/sadi-rb/base_service.rb', line 55 def service_description(service) raise "Must implement a #service_description method returning an RDF::Graph or Repository" end |
#service_name ⇒ Object
67 68 69 |
# File 'lib/sadi-rb/base_service.rb', line 67 def service_name raise "Must define a service name" end |
#service_owl(service) ⇒ Object
59 60 61 |
# File 'lib/sadi-rb/base_service.rb', line 59 def service_owl(service) raise "Must implement a #service_owl method returning an RDF::Graph or Repository" end |