Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mdorf committed Feb 13, 2024
1 parent 4b6b7f4 commit c0f9d00
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 7 deletions.
18 changes: 15 additions & 3 deletions config/solr/term_search/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,19 @@
<field name="synonymSuggestEdge" type="text_suggest_edge" indexed="true" stored="true" multiValued="true" />
<field name="synonymSuggestNgram" type="text_suggest_ngram" indexed="true" stored="true" omitNorms="true" multiValued="true" />

<field name="notation" type="text_general" indexed="true" stored="true" multiValued="false" />


<field name="notation" type="string_ci" indexed="true" stored="true" multiValued="false" />





<field name="shortId" type="string_ci" indexed="true" stored="true" multiValued="false" />





<field name="definition" type="string" indexed="true" stored="true" multiValued="true" />
<field name="submissionAcronym" type="string" indexed="true" stored="true" multiValued="false" />
Expand All @@ -151,8 +163,8 @@
<field name="childCount" type="int" indexed="true" stored="true" multiValued="false" />

<!-- Added cui and tui (semanticType) - NCBO-695 -->
<field name="cui" type="text_general" indexed="true" stored="true" multiValued="true" />
<field name="semanticType" type="text_general" indexed="true" stored="true" multiValued="true" />
<field name="cui" type="string_ci" indexed="true" stored="true" multiValued="true" />
<field name="semanticType" type="string_ci" indexed="true" stored="true" multiValued="true" />

<field name="property" type="text_general" indexed="true" stored="true" multiValued="true" />
<field name="propertyRaw" type="text_general" indexed="false" stored="true" multiValued="false" />
Expand Down
26 changes: 26 additions & 0 deletions lib/ontologies_linked_data/models/class.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ def index_doc(to_set=nil)
doc[:semanticType] = []
all_attrs[:semanticType].each { |semType| doc[:semanticType] << semType.split("/").last }
end

# special handling for :notation field because some ontologies have it defined as :prefixIRI
if !doc[:notation] || doc[:notation].empty?
if all_attrs[:prefixIRI] && !all_attrs[:prefixIRI].empty?
doc[:notation] = all_attrs[:prefixIRI].strip
else
doc[:notation] = LinkedData::Utils::Triples::last_iri_fragment(doc[:id])
end
end
end

if to_set.nil? || (to_set.is_a?(Array) && to_set.include?(:properties))
Expand All @@ -210,9 +219,26 @@ def index_doc(to_set=nil)
end
end

# binding.pry

doc
end
















def properties_for_indexing()
self_props = self.properties
return nil if self_props.nil?
Expand Down
13 changes: 9 additions & 4 deletions lib/ontologies_linked_data/sample_data/ontology.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ def self.create_ontologies_and_submissions(options = {})
process_submission = options[:process_submission] || false
submissions_to_process = options[:submissions_to_process]
acronym = options[:acronym] || "TEST-ONT"
pref_label_property = options[:pref_label_property] || false
synonym_property = options[:synonym_property] || false
definition_property = options[:synonym_property] || false
name = options[:name]
# set ontology type
ontology_type = nil
Expand Down Expand Up @@ -60,14 +63,17 @@ def self.create_ontologies_and_submissions(options = {})
max.times do
#refresh submission to get new next submission ID after saving in a loop
o.bring(:submissions)
os = LinkedData::Models::OntologySubmission.new({
sub_options = {
ontology: o,
hasOntologyLanguage: of,
submissionId: o.next_submission_id,
definitionProperty: (RDF::IRI.new "http://bioontology.org/ontologies/biositemap.owl#definition"),
contact: [contact],
released: DateTime.now - 3
})
}
sub_options[:prefLabelProperty] = RDF::IRI.new(pref_label_property) if pref_label_property
sub_options[:synonymProperty] = RDF::IRI.new(synonym_property) if synonym_property
sub_options[:definitionProperty] = RDF::IRI.new(definition_property) if definition_property
os = LinkedData::Models::OntologySubmission.new(sub_options)

if (submissions_to_process.nil? || submissions_to_process.include?(os.submissionId))
file_path = options[:file_path]
Expand All @@ -88,7 +94,6 @@ def self.create_ontologies_and_submissions(options = {})
o.summaryOnly = true
o.save
end

os.save unless os.exist?
end
end
Expand Down

0 comments on commit c0f9d00

Please sign in to comment.