Skip to content

Implement reading from IRI #193

@andrea-petrocchi

Description

@andrea-petrocchi

The prefLabel is not a unique string that identifies ontology entries: it is possible for different objects to have the same prefLabel. Example:

>>> import mammos_entity as me
>>> rp1, rp2 = me.mammos_ontology.search(prefLabel="RelativePermeability")

# same appearance
>>> rp1
emmo.RelativePermeability
>>> rp2
emmo.RelativePermeability

# same prefLabels
>>> rp1.prefLabel
[locstr('RelativePermeability', 'en')]
>>> rp2.prefLabel
[locstr('RelativePermeability', 'en')]

# different altLabels
>>> rp1.altLabel
[locstr('Relative Permeability', 'en')]
>>> rp2.altLabel
[]

# different elucidations
>>> rp1.elucidation
[locstr("In multiphase flow in porous media, the relative permeability of a phase is a dimensionless measure of the effective permeability of that phase. It is the ratio of the effective permeability of that phase to the absolute permeability. It can be viewed as an adaptation of Darcy's law to multiphase flow. For two-phase flow in porous media given steady-state conditions, we can write where is the flux, is the pressure drop, is the viscosity.\n\n-- QUDT", 'en')]
>>> rp2.elucidation
[locstr('Scalar quantity or tensor quantity equal to the absolute permeability divided by the magnetic constant.', 'en')]

# different ancestors
>>> rp1.ancestors()
{emmo.CausalStructure,
 emmo.Contrast,
 emmo.Data,
 emmo.DataByDiscretness,
 emmo.DimensionlessUnit,
 emmo.DiscreteData,
 emmo.EMMO,
 emmo.FractionUnit,
 emmo.Fusion,
 emmo.Item,
 emmo.Language,
 emmo.MeasurementUnit,
 emmo.MeasurementUnitByDimensionality,
 emmo.MeasurementUnitByPrefix,
 emmo.Metrological,
 emmo.MetrologicalReference,
 emmo.NonPrefixedUnit,
 emmo.NonSIUnit,
 emmo.Perspective,
 emmo.RelativePermeability,
 emmo.Symbolic,
 owl.Thing}
>>> rp2.ancestors()
{emmo.CategorizedPhysicalQuantity,
 emmo.CausalStructure,
 emmo.Coded,
 emmo.CodedByStructure,
 emmo.Conventional,
 emmo.DerivedQuantity,
 emmo.EMMO,
 emmo.ElectromagneticQuantity,
 emmo.Fusion,
 emmo.ISO80000Categorised,
 emmo.ISQDerivedQuantity,
 emmo.ISQDimensionlessQuantity,
 emmo.InternationalSystemOfQuantity,
 emmo.Item,
 emmo.Perspective,
 emmo.PhysicalQuantity,
 emmo.PhysicalQuantiyByDefinition,
 emmo.Property,
 emmo.Quantity,
 emmo.QuantityByPhysicalNature,
 emmo.RatioQuantity,
 emmo.Referent,
 emmo.RelativePermeability,
 emmo.SemioticEntity,
 emmo.Semiotics,
 emmo.Sign,
 emmo.SignByReferent,
 emmo.StandardizedPhysicalQuantity,
 owl.Thing}

# different IRIs
>>> rp1.iri
'https://w3id.org/emmo#RelativePermeability'
>>> rp2.iri
'https://w3id.org/emmo#EMMO_593ecc7c_250d_4e4d_8957_0170f3cc2154'

I think these are two valid, different entities. But independently from their validity and whether they are well-defined: it is possible to have entities with the same prefLabel especially if we were to import different domain ontologies.

At the moment creating an entity with this label is impossible, as we make it impossible to define entities whose prefLabel is ambiguous. A solution is to allow to create entities with IRIs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions