creation_from_ontology.rb revision f7adb5db6232d493fe5d82cecc9449f012acea32
end
end
end
return nil unless label_sentence
m[:label]
end
end
end
end
end
result = []
result << superclass
result += superclasses(superclass)
end
result.uniq
end
def direct_superclasses(cls)
result = []
szs_ontology.sentences.
where('text LIKE ?', "Class: #{cls}%SubClassOf:%").
each do |sentence|
m = sentence.text.match(/SubClassOf: (?<superclass>\w+)\z/)
result << m[:superclass] if m
end
result
end
def subclasses(cls)
result = []
direct_subclasses(cls).each do |subclass|
result << subclass
result += subclasses(subclass)
end
result.uniq
end
def direct_subclasses(cls)
result = []
szs_ontology.sentences.
where('text LIKE ?', "Class: %SubClassOf: #{cls}").
each do |sentence|
m = sentence.text.match(/^Class: (?<subclass>\w+)/)
result << m[:subclass] if m
end
result
end
def szs_ontology
Repository.find_by_path('meta').ontologies.where(
basepath: 'proof_statuses', file_extension: '.owl').first
end
end
end
end