Sha256: a2d6671c65fa0fa0b7ff7224d5ae99deaa303ded1200e1f802a32702e7fbe39b

Contents?: true

Size: 812 Bytes

Versions: 2

Compression:

Stored size: 812 Bytes

Contents

module Jena
  module Util
    # Return the given prefix map object as a `PrefixMapping`. Convert a hash
    # to a `PrefixMapping` if necessary
    def self.as_prefix_map( map )
      return nil unless map
      return map if map.is_a? com.hp.hpl.jena.shared.PrefixMapping
      pm = com.hp.hpl.jena.shared.impl.PrefixMappingImpl.new
      map.each_pair do |k,v|
        pm.setNsPrefix k.to_s, v.to_s
      end
      pm
    end

    # Return a new resource URN made from a UUID
    def self.uuid_resource
      Core::ResourceFactory.createResource( Util::JenaUUID.factory.generate.asURN )
    end

    # Return the current time as a literal
    def self.now
      cal = java.util.Calendar.getInstance
      cal.setTime( java.util.Date.new )
      Core::ResourceFactory.createTypedLiteral( cal )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jena-jruby-0.4.0-java lib/jena_jruby/utils.rb
jena-jruby-0.3.0-java lib/jena_jruby/utils.rb