Class: YOWL::Import

Inherits:
LabelledDocObject show all
Defined in:
lib/yowl/import.rb

Instance Attribute Summary collapse

Attributes inherited from DocObject

#resource, #schema

Instance Method Summary collapse

Methods inherited from LabelledDocObject

#<=>, #comment, #commentOrLabel, #definition, #editorialNotes, #hasComment?, #hasDefinition?, #hasDifferentLabel?, #hasEditorialNotes?, #label, #see_alsos, #status

Methods inherited from DocObject

#escaped_short_name, #escaped_uri, #get_literal, #hasOtherNamespace?, #hasUri?, #ns, #ontology, #repository, #short_name, #to_s, #uri

Constructor Details

#initialize(resource_, schema_) ⇒ Import

Returns a new instance of Import.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/yowl/import.rb', line 10

def initialize(resource_, schema_)
  super(resource_, schema_)
  
  @importedSchema = schema_.repository.getSchemaForImport(self)
  @importedOntology = @importedSchema ? @importedSchema.ontology : nil
  
  if @importedSchema.nil?
    puts "WARNING: #{@schema.fileName}: Created Import #{uri} but did not find schema for it "
  end
  if @importedOntology.nil?
    puts "WARNING: #{@schema.fileName}: Created Import #{uri} but did not find ontology for it "
  end
end

Instance Attribute Details

#importedOntologyObject (readonly)

Returns the value of attribute importedOntology.



8
9
10
# File 'lib/yowl/import.rb', line 8

def importedOntology
  @importedOntology
end

#importedSchemaObject (readonly)

Returns the value of attribute importedSchema.



7
8
9
# File 'lib/yowl/import.rb', line 7

def importedSchema
  @importedSchema
end

Instance Method Details

#classWithURI(uri_) ⇒ Object

See YOWL::Individual::classWithURI(uri)



50
51
52
53
54
55
56
57
58
59
# File 'lib/yowl/import.rb', line 50

def classWithURI(uri_)
  if isExternal?
    return nil
  end
  if @importedSchema
    return @importedSchema.classWithURI(uri_)
  end
  puts "WARNING: Cannot check whether class #{uri_.to_s} exists in imported ontology #{uri} as this ontology is not loaded"
  return nil
end

#importsObject



39
40
41
# File 'lib/yowl/import.rb', line 39

def imports
  return @importedOntology ? @importedOntology.imports : []
end

#isExternal?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/yowl/import.rb', line 43

def isExternal?
  return (@importedSchema.nil? and @importedOntology.nil?)
end

#nameObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/yowl/import.rb', line 24

def name
  if @importedSchema
    return @importedSchema.name
  end
  prefix, ns = @schema.prefixForNamespace(uri)
  if prefix
    return prefix
  end
  return short_name
end

#resourceNameHtmlObject



35
36
37
# File 'lib/yowl/import.rb', line 35

def resourceNameHtml
  return "#{@name}.html"
end