Sha256: ba8dfd7d1f9d704bd30e73d1199c812e9b8b3368e9d907c4aa361b7b5be06df7

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'dowl'

module DOWL
  
  class Person < DOWL::DocObject
     def initialize(resource, schema)
       super(resource, schema)
     end
     
     def uri()
       return @resource.to_s
     end
     
     def name()
       name = get_literal(DOWL::Namespaces::FOAF.name)
       if name == nil
         name = uri()
       end
       return name
     end
     
     def <=>(other)
       return name() <=> other.name()
     end
     
  end
  
  class Ontology < DOWL::DocObject
   
    def initialize(resource, schema)
        super(resource, schema)  
    end
    
    def uri() 
        return @resource.to_s
    end
    
    def title()
      return get_literal(DOWL::Namespaces::DCTERMS.title)
    end
    
    def comment()
      return get_literal(DOWL::Namespaces::RDFS.comment)
    end
        
    def created()
      return get_literal(DOWL::Namespaces::DCTERMS.created)
    end

    def modified()
      return get_literal(DOWL::Namespaces::DCTERMS.modified)
    end
    
    def authors()      
      authors = []
      @schema.model.query( 
        RDF::Query::Pattern.new( @resource, DOWL::Namespaces::FOAF.maker ) ) do |statement|
          authors << Person.new( statement.object, @schema )
      end         
      return authors.sort     
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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