require 'voruby/resources/voresource/loader' # Re-use the classes unchanged from previous versions of the schema. require 'voruby/resources/voresource/voresource_v0_10' module VORuby module Resources module VOResource module V1_0 # Forward declarations class Resource; end class Organisation < Resource; end class Service < Resource; end class ValidationLevel; end class Curation; end class ResourceName < VOResource::V0_10::ResourceName; end class Creator < VOResource::V0_10::Creator; end class Contact < VOResource::V0_10::Contact; end class Content; end class Subject; end class Source < VOResource::V0_10::Source; end class Type < VOResource::V0_10::Type; end class ContentLevel < VOResource::V0_10::ContentLevel; end class Relationship; end class RelatedResource; end class Rights; end class Capability; end class Interface; end class SecurityMethod; end class AuthorityID < VOResource::V0_10::AuthorityID; end class WebBrowser < Interface; end class WebService < Interface; end class Validation < ValidationLevel; end class UTCTimestamp; end class UTCDateTime < UTCTimestamp; end class Date < UTCDateTime; end class ShortName < VOResource::V0_10::ShortName; end class AnyURI < VOResource::V0_10::AnyURI; end class IdentifierURI < VOResource::V0_10::IdentifierURI; end class AccessURL < AnyURI; end class ResourceKey < VOResource::V0_10::ResourceKey; end $CapabilityUnmarshaller = Resources::namespace_dispatcher( 'VORuby::Resources::VOResource::V1_0', 'Capability', Capability) $InterfaceUnmarshaller = Resources::namespace_dispatcher( 'VORuby::Resources::VOResource::V1_0', 'Interface', Interface) # Any entity or component of a VO application that is describable and identifiable by a IVOA Identifier. class Resource include XML::Mapping text_node :title, 'title', :optional => false date_time_node :created, '@created', :optional => true date_time_node :updated, '@updated', :optional => true text_enumeration_node :status, '@status', :optional => false, :default_value => 'active', :choices => ['active', 'inactive', 'deleted'] object_node :short_name, 'shortName', :class => ShortName, :optional => true object_node :identifier, 'identifier', :class => IdentifierURI, :optional => false object_node :curation, 'curation', :class => Curation, :optional => false object_node :content, 'content', :class => Content, :optional => false array_node :validation_levels, 'validationLevel', :class => Validation, :optional => true, :default_value => [] end # A numeric grade describing the quality of the # resource description, when applicable, # to be used to indicate the confidence an end-user # can put in the resource as part of a VO application # or research study. class ValidationLevel include XML::Mapping numeric_enumeration_node :value, '', :optional => false, :choices => [0, 1, 2, 3, 4] end # Information regarding the general curation of the resource. class Curation include XML::Mapping text_node :version, 'version', :optional => true object_node :publisher, 'publisher', :class => ResourceName, :optional => false array_node :creators, 'creator', :class => Creator, :default_value => [], :optional => true array_node :contributors, 'contributor', :class => ResourceName, :default_value => [], :optional => true array_node :dates, 'date', :class => Date, :default_value => [], :optional => true array_node :contacts, 'contact', :class => Contact, :optional => false end # Date associated with an event in the life cycle of the resource. class Date include XML::Mapping text_node :role, '@role', :optional => false, :default_value => 'representative' end # Information regarding the general content of the resource. class Content include XML::Mapping text_node :description, 'description', :optional => false object_node :source, 'source', :class => Source, :optional => true object_node :reference_url, 'referenceURL', :class => AnyURI, :optional => false array_node :subjects, 'subject', :class => Subject, :optional => false array_node :types, 'type', :class => Type, :default_value => [], :optional => true array_node :content_levels, 'contentLevel', :class => ContentLevel, :default_value => [], :optional => true array_node :relationships, 'relationship', :class => Relationship, :default_value => [], :optional => true end # A topic, object type, or other descriptive keywords about the resource. class Subject include XML::Mapping text_node :value, '', :optional => false end # A description of a relationship to another resource. class Relationship include XML::Mapping text_node :relationship_type, 'relationshipType', :optional => false array_node :related_resources, 'relatedResource', :class => RelatedResource, :optional => false end # The name of resource that this resource is related to. class RelatedResource include XML::Mapping text_node :value, '', :optional => false end # A named group of one or more persons brought together to pursue participation in VO applications. class Organisation array_node :facilities, 'facility', :class => ResourceName, :optional => true, :default_value => [] array_node :instruments, 'instrument', :class => ResourceName, :optional => true, :default_value => [] end # A resource that can be invoked by a client to perform some action on its behalf. class Service array_node :rights, 'rights', :class => Rights, :optional => true, :default_value => [] # Choose the capability based on the type. array_node :capabilities, 'capability', :unmarshaller => $CapabilityUnmarshaller, :optional => true, :default_value => [] end # Information about rights held in and over the resource. class Rights include XML::Mapping text_enumeration_node :value, '', :optional => false, :choices => ['public', 'secure', 'proprietary'] end # A description of a general capability of the service and how to use it. class Capability include XML::Mapping text_node :capability_type, '@type', :optional => true text_node :description, 'description', :optional => true object_node :standard_id, '@standardID', :class => AnyURI, :optional => true array_node :validation_levels, 'validationLevel', :class => Validation, :optional => true, :default_value => [] array_node :interfaces, 'interface', :unmarshaller => $InterfaceUnmarshaller, :optional => true, :default_value => [] end # A description of how to call the service to access this capability class Interface include XML::Mapping text_node :interface_type, '@type', :optional => false text_node :version, '@version', :optional => true, :default_value => '1.0' text_node :role, '@role', :optional => true array_node :access_urls, 'accessURL', :class => AccessURL, :optional => false array_node :security_methods, 'securityMethod', :class => SecurityMethod, :optional => true, :default_value => [] end # The URL (or base URL) that a client uses to access the service. class AccessURL text_enumeration_node :use, '@use', :optional => false, :default_value => 'full', :choices => ['full', 'base', 'post', 'dir'] end # A description of a security mechanism. class SecurityMethod include XML::Mapping object_node :standard_id, '@standardID', :class => AnyURI, :optional => false end # A (form-based) interface intended to be accesed interactively by a user via a web browser. class WebBrowser; end # A Web Service that is describable by a WSDL document. class WebService array_node :wsdl_urls, 'wsdlURL', :class => AnyURI, :optional => true, :default_value => [] end # A validation stamp combining a validation level and the ID of the validator. class Validation object_node :validated_by, '@validatedBy', :class => IdentifierURI, :optional => false end # A timestamp that is compliant with ISO8601 but disallows the use of a timezone indicator. class UTCTimestamp include XML::Mapping text_node :value, '', :optional => false def value=(timestamp) raise RuntimeError, "UTCTimestamp '#{timestamp} in wrong format" if !timestamp.strip.match('^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?$') @value = Time.parse(timestamp.strip) end end end end end end