diff --git a/lib/ontologies_linked_data/config/config.rb b/lib/ontologies_linked_data/config/config.rb index a01a9faa7..8786e3c3f 100644 --- a/lib/ontologies_linked_data/config/config.rb +++ b/lib/ontologies_linked_data/config/config.rb @@ -166,8 +166,9 @@ def goo_namespaces conf.add_namespace(:oboinowl_gen, RDF::Vocabulary.new("http://www.geneontology.org/formats/oboInOwl#")) conf.add_namespace(:obo_purl, RDF::Vocabulary.new("http://purl.obolibrary.org/obo/")) - conf.add_namespace(:umls, - RDF::Vocabulary.new("http://bioportal.bioontology.org/ontologies/umls/")) + conf.add_namespace(:umls, RDF::Vocabulary.new("http://bioportal.bioontology.org/ontologies/umls/")) + conf.add_namespace(:dcterms, RDF::Vocabulary.new("http://purl.org/dc/terms/")) + conf.id_prefix = "http://data.bioontology.org/" conf.pluralize_models(true) end diff --git a/lib/ontologies_linked_data/models/class.rb b/lib/ontologies_linked_data/models/class.rb index 20d74a56f..12841bb77 100644 --- a/lib/ontologies_linked_data/models/class.rb +++ b/lib/ontologies_linked_data/models/class.rb @@ -77,10 +77,12 @@ def self.urn_id(acronym,classId) attribute :notes, inverse: { on: :note, attribute: :relatedClass } + attribute :created, namespace: :dcterms + attribute :modified, namespace: :dcterms # Hypermedia settings embed :children, :ancestors, :descendants, :parents - serialize_default :prefLabel, :synonym, :definition, :cui, :semanticType, :obsolete, :matchType, :ontologyType, :provisional # an attribute used in Search (not shown out of context) + serialize_default :prefLabel, :synonym, :definition, :cui, :semanticType, :obsolete, :matchType, :ontologyType, :provisional, :created, :modified # an attribute used in Search (not shown out of context) serialize_methods :properties, :childrenCount, :hasChildren serialize_never :submissionAcronym, :submissionId, :submission, :descendants aggregates childrenCount: [:count, :children] diff --git a/test/data/ontology_files/BRO_v3.4.owl b/test/data/ontology_files/BRO_v3.4.owl index aee5caa9c..e8b77122c 100644 --- a/test/data/ontology_files/BRO_v3.4.owl +++ b/test/data/ontology_files/BRO_v3.4.owl @@ -618,6 +618,8 @@ Activity Activity of interest that may be related to a BRO:Resource. activities + 2015-06-29 + 2015-10-01 diff --git a/test/models/test_class.rb b/test/models/test_class.rb index d5d70cd4b..21bb18a40 100644 --- a/test/models/test_class.rb +++ b/test/models/test_class.rb @@ -351,4 +351,25 @@ def test_xml_literal_serialization assert_equal String, xml_comment.class assert_equal comment, xml_comment end + + def test_fetch_date_attributes + acronym = 'BRO' + # Create a 1st version for BRO + submission_parse(acronym, "BRO", + "./test/data/ontology_files/BRO_v3.4.owl", 1, + process_rdf: true, index_search: false, + run_metrics: false, reasoning: false, + diff: true, delete: false) + + os = LinkedData::Models::OntologySubmission.where(ontology: [ acronym: acronym ], + submissionId: 1).all + assert(os.length == 1) + os = os[0] + + class_id = RDF::URI.new "http://bioontology.org/ontologies/Activity.owl#Activity" + cls = LinkedData::Models::Class.find(class_id).in(os).include(:created, :modified).first + assert_equal '2015-06-29', cls.created + assert_equal '2015-10-01', cls.modified + + end end