Class: YOWL::LabelledDocObject
Instance Attribute Summary
Attributes inherited from DocObject
#resource, #schema
Instance Method Summary
collapse
Methods inherited from DocObject
#escaped_short_name, #escaped_uri, #get_literal, #hasOtherNamespace?, #hasUri?, #ns, #ontology, #repository, #short_name, #to_s, #uri
Constructor Details
Returns a new instance of LabelledDocObject.
110
111
112
|
# File 'lib/yowl/util.rb', line 110
def initialize(resource, schema)
super(resource, schema)
end
|
Instance Method Details
#<=>(other) ⇒ Object
178
179
180
|
# File 'lib/yowl/util.rb', line 178
def <=>(other)
return label().downcase <=> other.label().downcase
end
|
125
126
127
|
# File 'lib/yowl/util.rb', line 125
def ()
return get_literal(YOWL::Namespaces::RDFS.)
end
|
129
130
131
132
133
134
|
# File 'lib/yowl/util.rb', line 129
def ()
if
return
end
return label
end
|
#definition ⇒ Object
141
142
143
|
# File 'lib/yowl/util.rb', line 141
def definition()
return get_literal(YOWL::Namespaces::SKOS.definition)
end
|
#editorialNotes ⇒ Object
150
151
152
153
154
155
156
157
158
|
# File 'lib/yowl/util.rb', line 150
def editorialNotes()
notes = []
@schema.model.query(
RDF::Query::Pattern.new(@resource, YOWL::Namespaces::SKOS.editorialNote)
) do |statement|
notes << statement.object.to_s
end
return notes
end
|
136
137
138
139
|
# File 'lib/yowl/util.rb', line 136
def
= ()
return ( and not .empty?)
end
|
#hasDefinition? ⇒ Boolean
145
146
147
148
|
# File 'lib/yowl/util.rb', line 145
def hasDefinition?
definition = definition()
return (definition and not definition.empty?)
end
|
#hasDifferentLabel? ⇒ Boolean
119
120
121
122
123
|
# File 'lib/yowl/util.rb', line 119
def hasDifferentLabel?
return short_name() != label()
end
|
#hasEditorialNotes? ⇒ Boolean
160
161
162
|
# File 'lib/yowl/util.rb', line 160
def hasEditorialNotes?
return editorialNotes.length > 0
end
|
#label ⇒ Object
114
115
116
117
|
# File 'lib/yowl/util.rb', line 114
def label()
label = get_literal(YOWL::Namespaces::RDFS.label)
return label.nil? ? short_name() : label
end
|
#see_alsos ⇒ Object
164
165
166
167
168
169
170
171
172
|
# File 'lib/yowl/util.rb', line 164
def see_alsos()
links = []
@schema.model.query(
RDF::Query::Pattern.new(@resource, YOWL::Namespaces::RDFS.seeAlso)
) do |statement|
links << statement.object.to_s
end
return links
end
|
#status ⇒ Object
174
175
176
|
# File 'lib/yowl/util.rb', line 174
def status()
return get_literal(YOWL::Namespaces::VS.status)
end
|