Class: LoadModelLazyWriter

Inherits:
Object show all
Defined in:
lib/ontomde-core/helper.rb

Overview

Internal use.

Instance Method Summary collapse

Constructor Details

#initialize(fn, ft) ⇒ LoadModelLazyWriter

Internal use.



10
11
12
13
14
15
# File 'lib/ontomde-core/helper.rb', line 10

def initialize (fn,ft)
  @fileName=fn
  @fileType=ft
  @model=nil
  @usedResources=nil
end

Instance Method Details

#[](key) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ontomde-core/helper.rb', line 28

def [](key)
  if @model.nil?
    @model=Crdf_Repository.new
    @model.mtk_retrieveProtected(@fileName,fileType)
  end
  if @usedResources.nil?
    @usedResources=Array.new
  end
  ret=@model[key]
  @usedResources << key unless ret.nil?
  return ret
end

#fileTypeObject



16
17
18
19
20
21
# File 'lib/ontomde-core/helper.rb', line 16

def fileType
  if @fileType.nil?
    @fileType=FileType.getFileType(@fileName)
  end
  return @fileType
end

#protectedMode?Boolean

Internal use.

Returns:

  • (Boolean)


24
25
26
# File 'lib/ontomde-core/helper.rb', line 24

def protectedMode?
  return !@model.nil?
end

#unusedDataObject



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/ontomde-core/helper.rb', line 41

def unusedData
  return nil if @model.nil?
  ret=nil
  @model.each { |k,c|
    next if @usedResources.include?(k)
    # c is either a String or a bootstrap element.
    next if c.kind_of?(Mrdf_Resource) && c.ext_isBootstrap?
    ret=Array.new if ret.nil?
    ret << k
  }
  return ret
end