Class: DOWL::Class
Instance Attribute Summary collapse
Attributes inherited from DocObject
#schema
Instance Method Summary
collapse
#<=>, #comment, #label, #short_name, #status
Methods inherited from DocObject
#get_literal
Constructor Details
#initialize(resource, schema) ⇒ Class
Returns a new instance of Class.
8
9
10
|
# File 'lib/dowl/class.rb', line 8
def initialize(resource, schema)
super(resource, schema)
end
|
Instance Attribute Details
#resource ⇒ Object
Returns the value of attribute resource.
6
7
8
|
# File 'lib/dowl/class.rb', line 6
def resource
@resource
end
|
Instance Method Details
#see_alsos ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/dowl/class.rb', line 30
def see_alsos()
links = []
@schema.model.query(
RDF::Query::Pattern.new( @resource, DOWL::Namespaces::RDFS.seeAlso ) ) do |statement|
links << statement.object.to_s
end
return links
end
|
#sub_class_of ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/dowl/class.rb', line 16
def sub_class_of()
parent = @schema.model.first_value(
RDF::Query::Pattern.new( @resource, DOWL::Namespaces::RDFS.subClassOf ) )
if parent
uri = parent.to_s
if @schema.classes[uri]
return @schema.classes[uri]
else
return uri
end
end
return nil
end
|
#sub_classes ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'lib/dowl/class.rb', line 43
def sub_classes()
list = []
@schema.model.query(
RDF::Query::Pattern.new( nil, DOWL::Namespaces::RDFS.subClassOf, @resource) ) do |statement|
list << DOWL::Class.new(statement.subject, @schema)
end
return list
end
|
#to_s ⇒ Object
39
40
41
|
# File 'lib/dowl/class.rb', line 39
def to_s
return short_name
end
|
#uri ⇒ Object
12
13
14
|
# File 'lib/dowl/class.rb', line 12
def uri
return @resource.to_s
end
|