TripalVocabService_v0_1.inc 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. class TripalVocabService_v0_1 extends TripalWebService {
  3. /**
  4. * The human-readable label for this web service.
  5. */
  6. public static $label = 'Vocabulary';
  7. /**
  8. * A bit of text to describe what this service provides.
  9. */
  10. public static $description = 'Provides access to vocabulary terms that are in use by this site.';
  11. /**
  12. * A machine-readable type for this service. This name must be unique
  13. * among all Tripal web services and is used to form the URL to access
  14. * this service.
  15. */
  16. public static $type = 'vocab';
  17. /**
  18. * @see TripalWebService::handleRequest()
  19. */
  20. public function handleRequest() {
  21. $this->resource->addContextItem('ApiDocumentation', 'hydra:ApiDocumentation');
  22. $this->resource->addContextItem('supportedClass', 'hydra:supportedClass');
  23. $this->resource->setType('ApiDocumentation');
  24. // Iterate through all of the web services and get their documentation
  25. $services = tripal_get_web_services();
  26. foreach ($services as $service_class) {
  27. tripal_load_include_web_service_class($service_class);
  28. $service = new $service_class($this->base_path);
  29. $supported_classes = $service->getSupportedClasses();
  30. foreach ($supported_classes as $supported) {
  31. $this->resource->addProperty('supportedClass', $supported);
  32. }
  33. }
  34. }
  35. }