diff --git a/config/solr/term_search/schema.xml b/config/solr/term_search/schema.xml index 6b18a2a1..afdd9d20 100644 --- a/config/solr/term_search/schema.xml +++ b/config/solr/term_search/schema.xml @@ -140,7 +140,19 @@ - + + + + + + + + + + + + + @@ -151,8 +163,8 @@ - - + + diff --git a/lib/ontologies_linked_data/models/class.rb b/lib/ontologies_linked_data/models/class.rb index 20d74a56..97214828 100644 --- a/lib/ontologies_linked_data/models/class.rb +++ b/lib/ontologies_linked_data/models/class.rb @@ -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)) @@ -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? diff --git a/lib/ontologies_linked_data/sample_data/ontology.rb b/lib/ontologies_linked_data/sample_data/ontology.rb index f5e6ce07..154d9741 100644 --- a/lib/ontologies_linked_data/sample_data/ontology.rb +++ b/lib/ontologies_linked_data/sample_data/ontology.rb @@ -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 @@ -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] @@ -88,7 +94,6 @@ def self.create_ontologies_and_submissions(options = {}) o.summaryOnly = true o.save end - os.save unless os.exist? end end