Sha256: 99a9688997e25dcfb5afbb6eee36183b4cd8173a8c6ca9e93d120308a4c142ee

Contents?: true

Size: 978 Bytes

Versions: 1

Compression:

Stored size: 978 Bytes

Contents

module DOWL
  
  class DocObject
    attr_reader :resource
    attr_reader :schema  
    def initialize(resource, schema)
      @resource = resource
      @schema = schema
    end  
    
    def get_literal(property)
      return @schema.model.first_value(RDF::Query::Pattern.new( @resource, property ) )
    end
    
  end
  
  class LabelledDocObject < DOWL::DocObject
    
    def initialize(resource, schema)
       super(resource, schema)
    end
     
    def short_name()
      uri = @resource.to_s
      ontology_uri = @schema.ontology.uri
      return uri.gsub(ontology_uri, "")
    end
     
    def label()
      return get_literal(DOWL::Namespaces::RDFS.label)
    end
        
    def comment()
      return get_literal(DOWL::Namespaces::RDFS.comment)
    end
    
    def status()      
      return get_literal(DOWL::Namespaces::VS.status)
    end
         
    def <=>(other)
      return label().downcase <=> other.label().downcase
    end    
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dowl-0.2 lib/dowl/util.rb