Class: Openphar::Models::JP::Monograph

Inherits:
Monograph show all
Defined in:
lib/openphar/models/jp/monograph.rb

Overview

Base class for all Japan Pharmacopoeia monographs.

Carries JP-specific identity (japanese_name, english_name, category) on top of the harmonized Openphar::Models::Monograph. Concrete subclasses declare their semantic @type via class methods.

Direct Known Subclasses

AminoAcid, Biological, ChemicalDrug, CrudeDrug, Formulation

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Monograph

#label

Methods inherited from BaseEntity

jsonld_context, neo4j_label, neo4j_labels_string, #to_cypher, #to_cypher_match, #to_jsonld, #to_neo4j_node, #to_neo4j_properties

Class Method Details

.harmonized_typeObject



28
29
30
# File 'lib/openphar/models/jp/monograph.rb', line 28

def harmonized_type
  nil
end

.jsonld_typeObject



32
33
34
# File 'lib/openphar/models/jp/monograph.rb', line 32

def jsonld_type
  'JpMonograph'
end

.jsonld_typesObject



36
37
38
39
40
41
# File 'lib/openphar/models/jp/monograph.rb', line 36

def jsonld_types
  types = ['Monograph']
  types << harmonized_type if harmonized_type
  types << jsonld_type unless jsonld_type == 'Monograph'
  types.uniq
end

.neo4j_labelsObject



43
44
45
46
47
48
# File 'lib/openphar/models/jp/monograph.rb', line 43

def neo4j_labels
  labels = %w[Monograph JP]
  labels << harmonized_type if harmonized_type
  labels << name&.split('::')&.last
  labels.compact.uniq
end

.wire_keyObject



24
25
26
# File 'lib/openphar/models/jp/monograph.rb', line 24

def wire_key
  'monograph'
end

Instance Method Details

#iriObject



51
52
53
54
# File 'lib/openphar/models/jp/monograph.rb', line 51

def iri
  ed = (edition || 'jp18').to_s.downcase.gsub(/[^a-z0-9]/, '-')
  "#{Openphar.base_iri}/data/jp/#{ed}/#{monograph_id}"
end