Class: DOWL::Property
Instance Attribute Summary
Attributes inherited from DocObject
#resource, #schema
Instance Method Summary
collapse
#<=>, #comment, #label, #short_name, #status
Methods inherited from DocObject
#get_literal
Constructor Details
#initialize(resource, schema) ⇒ Property
Returns a new instance of Property.
7
8
9
|
# File 'lib/dowl/property.rb', line 7
def initialize(resource, schema)
super(resource, schema)
end
|
Instance Method Details
#domain ⇒ Object
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/dowl/property.rb', line 53
def domain()
domains = []
@schema.model.query(RDF::Query::Pattern.new( @resource, DOWL::Namespaces::RDFS.domain ) ) do |statement|
domains << statement.object
end
classes = []
domains.each do |o|
if o.resource?
uri = o.to_s
if @schema.classes[uri]
classes << @schema.classes[uri]
else
classes << uri
end
end
end
return classes
end
|
#range ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/dowl/property.rb', line 34
def range()
ranges = []
@schema.model.query(RDF::Query::Pattern.new( @resource, DOWL::Namespaces::RDFS.range ) ) do |statement|
ranges << statement.object
end
classes = []
ranges.each do |o|
if o.resource?
uri = o.to_s
if @schema.classes[uri]
classes << @schema.classes[uri]
else
classes << uri
end
end
end
return classes
end
|
#see_alsos ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/dowl/property.rb', line 11
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_properties ⇒ Object
73
74
75
76
77
78
79
|
# File 'lib/dowl/property.rb', line 73
def sub_properties()
list = []
@schema.model.query(RDF::Query::Pattern.new( nil, DOWL::Namespaces::RDFS.subPropertyOf, @resource ) ) do |statement|
list << DOWL::Property.new( statement.subject, @schema )
end
return list
end
|
#sub_property_of ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/dowl/property.rb', line 20
def sub_property_of()
parent = @schema.model.first_value(
RDF::Query::Pattern.new( @resource, DOWL::Namespaces::RDFS.subPropertyOf) )
if parent
uri = parent.to_s
if @schema.properties[uri]
return @schema.properties[uri]
else
return uri
end
end
return nil
end
|