Mercurial > repos > mikel-egana-aranguren > sadi_generic
comparison galaxy-dist/test-data/localhost_SADI.py @ 2:977c838e3442 draft default tip
New dir structure, README improved, tests added and RDF merge tool created
author | mikel-egana-aranguren <mikel.egana.aranguren@gmail.com> |
---|---|
date | Fri, 25 Apr 2014 14:41:12 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1:bb17b69a74c5 | 2:977c838e3442 |
---|---|
1 import sadi | |
2 from rdflib import * | |
3 | |
4 hello=Namespace("http://sadiframework.org/examples/hello.owl#") | |
5 foaf=Namespace("http://xmlns.com/foaf/0.1/") | |
6 | |
7 class ExampleService(sadi.Service): | |
8 label = "Hello, world" | |
9 serviceDescriptionText = 'A simple "Hello, World" service that reads a name and attaches a greeting.' | |
10 comment = 'A simple "Hello, World" service that reads a name and attaches a greeting.' | |
11 serviceNameText = "Hello, world (python)" | |
12 name = "example" | |
13 | |
14 def getOrganization(self): | |
15 result = self.Organization() | |
16 result.add(RDFS.label,Literal("Example Organization")) | |
17 result.add(sadi.mygrid.authoritative, Literal(False)) | |
18 result.add(sadi.dc.creator, URIRef('mailto:john.smith@example.com')) | |
19 return result | |
20 | |
21 def getInputClass(self): | |
22 return hello.NamedIndividual | |
23 | |
24 def getOutputClass(self): | |
25 return hello.GreetedIndividual | |
26 | |
27 def process(self, input, output): | |
28 output.set(hello.greeting, Literal("Hello, "+input.value(foaf.name).value)) | |
29 | |
30 resource = ExampleService() | |
31 | |
32 if __name__ == "__main__": | |
33 sadi.serve(resource, port=9090) |