Class: Openphar::Models::Monograph
- Inherits:
-
BaseEntity
- Object
- Lutaml::Model::Serializable
- BaseEntity
- Openphar::Models::Monograph
- Defined in:
- lib/openphar/models/monograph.rb
Overview
Represents a pharmacopoeia monograph
This is the base class for all monograph types. Each monograph knows how to serialize itself to Neo4j and JSON-LD formats.
Direct Known Subclasses
AHP::Monograph, API::Bhasma, API::Dravya, API::Monograph, BiologicalSubstanceMonograph, ChemicalDrugMonograph, Chp::Biologic, Chp::Monograph, CrudeDrugMonograph, FormulationMonograph, HKCMMS::Monograph, JP::Excipient, JP::Mineral, JP::Monograph, JP::Vitamin, PhInt::DosageFormMonograph, THP::Monograph
Class Method Summary collapse
-
.harmonized_type ⇒ String?
Override in subclasses to declare the cross-publisher semantic type (e.g., "CrudeDrug", "ChemicalDrug").
- .jsonld_type ⇒ Object
-
.jsonld_types ⇒ Array<String>
Array of types to emit in JSON-LD @type.
- .neo4j_labels ⇒ Object
-
.wire_key ⇒ String
Override in subclasses to declare the publisher-specific snake_case routing key (e.g., "tcm_crude_drug", "dravya").
Instance Method Summary collapse
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_type ⇒ String?
Override in subclasses to declare the cross-publisher semantic type (e.g., "CrudeDrug", "ChemicalDrug"). Returns nil when the subclass is publisher-specific with no harmonized equivalent.
53 54 55 |
# File 'lib/openphar/models/monograph.rb', line 53 def harmonized_type nil end |
.jsonld_type ⇒ Object
44 45 46 |
# File 'lib/openphar/models/monograph.rb', line 44 def jsonld_type 'Monograph' end |
.jsonld_types ⇒ Array<String>
Array of types to emit in JSON-LD @type. Computed from harmonized_type + jsonld_type + the base 'Monograph'.
69 70 71 72 73 74 |
# File 'lib/openphar/models/monograph.rb', line 69 def jsonld_types types = ['Monograph'] types << harmonized_type if harmonized_type types << jsonld_type unless jsonld_type == 'Monograph' types.uniq end |
.neo4j_labels ⇒ Object
40 41 42 |
# File 'lib/openphar/models/monograph.rb', line 40 def neo4j_labels ['Monograph'] end |
.wire_key ⇒ String
Override in subclasses to declare the publisher-specific snake_case routing key (e.g., "tcm_crude_drug", "dravya").
61 62 63 |
# File 'lib/openphar/models/monograph.rb', line 61 def wire_key 'monograph' end |
Instance Method Details
#iri ⇒ Object
77 78 79 |
# File 'lib/openphar/models/monograph.rb', line 77 def iri "#{Openphar.base_iri}/data/monograph/#{id}" end |
#label(lang = 'en') ⇒ Object
81 82 83 |
# File 'lib/openphar/models/monograph.rb', line 81 def label(lang = 'en') pref_label[lang] || pref_label.values.first end |