SOLI Models#
This module contains the OWLClass model and related Pydantic models for the SOLI package.
Module Contents#
This module contains the OWLClass model and related pydantic models for the SOLI package.
- class soli.models.OWLClass(*, iri: str, label: str | None = None, sub_class_of: List[str] = None, parent_class_of: List[str] = None, is_defined_by: str | None = None, see_also: List[str] = None, comment: str | None = None, deprecated: bool = False, preferred_label: str | None = None, alternative_labels: List[str] = None, translations: Dict[str, str] = None, hidden_label: str | None = None, definition: str | None = None, examples: List[str] = None, notes: List[str] = None, history_note: str | None = None, editorial_note: str | None = None, in_scheme: str | None = None, identifier: str | None = None, description: str | None = None, source: str | None = None, country: str | None = None)#
OWLClass model for the SOLI package, which represents an OWL class in the SOLI ontology/taxonomy style.
TODO: think about future-proofing for next-gen roadmap.
- classmethod from_json(json_string: str) OWLClass#
Create an OWL class from a JSON string. This is just a wrapper around the pydantic method for consistency.
- Args:
json_string (str): The JSON string representing the OWL class.
- Returns:
OWLClass: The OWL class created from the JSON string.
- is_valid() bool#
Check if the OWL class is valid.
- Returns:
bool: True if the OWL class is valid, False otherwise.
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'alternative_labels': FieldInfo(annotation=List[str], required=False, default_factory=list, description='{http://www.w3.org/2004/02/skos/core#}altLabel'), 'comment': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='{http://www.w3.org/2000/01/rdf-schema#}comment'), 'country': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='{http://www.loc.gov/mads/rdf/v1#}country'), 'definition': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='{http://www.w3.org/2004/02/skos/core#}definition'), 'deprecated': FieldInfo(annotation=bool, required=False, default=False, description='{http://www.w3.org/2002/07/owl#}deprecated'), 'description': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='{http://purl.org/dc/elements/1.1/}description'), 'editorial_note': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='{http://www.w3.org/2004/02/skos/core#}editorialNote'), 'examples': FieldInfo(annotation=List[str], required=False, default_factory=list, description='{http://www.w3.org/2004/02/skos/core#}example'), 'hidden_label': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='{http://www.w3.org/2004/02/skos/core#}hiddenLabel'), 'history_note': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='{http://www.w3.org/2004/02/skos/core#}historyNote'), 'identifier': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='{http://purl.org/dc/elements/1.1/}identifier'), 'in_scheme': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='{http://www.w3.org/2004/02/skos/core#}inScheme'), 'iri': FieldInfo(annotation=str, required=True, description='{http://www.w3.org/2002/07/owl#}Class'), 'is_defined_by': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='{http://www.w3.org/2000/01/rdf-schema#}isDefinedBy'), 'label': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='{http://www.w3.org/2000/01/rdf-schema#}label'), 'notes': FieldInfo(annotation=List[str], required=False, default_factory=list, description='{http://www.w3.org/2004/02/skos/core#}note'), 'parent_class_of': FieldInfo(annotation=List[str], required=False, default_factory=list, description='{http://www.w3.org/2000/01/rdf-schema#}subClassOf'), 'preferred_label': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='{http://www.w3.org/2004/02/skos/core#}prefLabel'), 'see_also': FieldInfo(annotation=List[str], required=False, default_factory=list, description='{http://www.w3.org/2000/01/rdf-schema#}seeAlso'), 'source': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, description='{http://purl.org/dc/elements/1.1/}source'), 'sub_class_of': FieldInfo(annotation=List[str], required=False, default_factory=list, description='{http://www.w3.org/2000/01/rdf-schema#}subClassOf'), 'translations': FieldInfo(annotation=Dict[str, str], required=False, default_factory=dict, description='translations from other languages')}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- to_json() str#
Convert the OWL class to a JSON string. This is just a wrapper around the pydantic method for consistency.
- Returns:
str: The JSON string representing the OWL class.
- to_markdown() str#
Convert the OWL class to a markdown string.
- Returns:
str: The markdown string representing the OWL class.
- to_owl_element() Element#
Convert the OWL class to an XML element.
- Returns:
lxml.etree.Element: The XML element representing the OWL class.
- to_owl_xml() str#
Convert the OWL class to an XML string.
- Returns:
str: The XML string representing the OWL class.