# Extract OccurrenceSetID occurrenceSet = input.value(LM.specifiesOccurrenceSet) occurrenceSetID = occurrenceSet.value(LM.hasOccurrenceSetID) lmClient.postExperiment(algorithmCode, occurrenceSetID, scenarioID) #resultURL = "http://somedomain.com/testURL" #get experimentURL and id experimentURL = lmClient.getExperimentURL() experimentID = lmClient.getExperimentID() print "experiment result URL %s " % experimentURL # The URI generator resourceURI = ResourceURI() # Create the experiment result experimentResult = RDFLibResource(output.graph, resourceURI.getURI("experimentResult")) experimentResultClass = RDFLibResource(output.graph, LM.ExperimentResult) experimentResult.set(RDF.type, experimentResultClass) experimentResult.set(LM.hasExperimentResultURL, Literal(experimentURL)) experimentResult.set(LM.hasExperimentResultID, Literal(experimentID)) # Add the experiment result to the executed specification output.set(LM.hasExperimentResult, experimentResult) # main function for testing application = ExperimentPosterService() if __name__ == "__main__": sadi.serve(application, port=9090)
async_resource = ExampleAsyncService() class ExampleService(sadi.Service): label = "Hello, world" serviceDescriptionText = 'A simple "Hello, World" service that reads a name and attaches a greeting.' comment = 'A simple "Hello, World" service that reads a name and attaches a greeting.' serviceNameText = "Hello, world (python)" name = "example" def getOrganization(self): result = self.Organization() result.add(RDFS.label,Literal("Tetherless World Constellation, RPI")) result.add(sadi.mygrid.authoritative, Literal(False)) result.add(sadi.dc.creator, URIRef('mailto:[email protected]')) return result def getInputClass(self): return hello.NamedIndividual def getOutputClass(self): return hello.GreetedIndividual def process(self, input, output): print input output.set(hello.greeting, Literal("Hello, "+input.value(foaf.name).value)) resource = ExampleService() if __name__ == "__main__": sadi.serve(resource, port=9090)