Usage
A python data model for OBO Graphs.
- class Definition(*, val: str | None = None, xrefs: list[str] | None = None)[source]
Represents a definition for a node.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class DomainRangeAxiom(*, predicateId: str, domainClassIds: list[str] | None = None, rangeClassIds: list[str] | None = None, allValuesFromEdges: list[Edge] | None = None, meta: Meta | None = None)[source]
Represents a domain/range axiom.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class Edge(*, sub: str, pred: str, obj: str, meta: Meta | None = None)[source]
Represents an edge in an OBO Graph.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class EquivalentNodeSet(*, representativeNodeId: str, nodeIds: list[str], meta: Meta | None = None)[source]
Represents a set of equivalent nodes.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ExistentialRestrictionExpression(*, propertyId: str, fillerId: str)[source]
Represents an existential restriction.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class Graph(*, id: str | None = None, meta: Meta | None = None, nodes: list[Node] = <factory>, edges: list[Edge] = <factory>, equivalentNodesSets: list[EquivalentNodeSet] = <factory>, logicalDefinitionAxioms: list[LogicalDefinition] = <factory>, domainRangeAxioms: list[DomainRangeAxiom] = <factory>, propertyChainAxioms: list[PropertyChainAxiom] = <factory>)[source]
A graph corresponds to an ontology.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- standardize(converter: curies.Converter, *, strict: bool = False) StandardizedGraph[source]
Standardize the graph.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class GraphDocument(*, graphs: list[Graph], meta: Meta | None = None)[source]
Represents a list of OBO graphs.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- standardize(converter: curies.Converter) StandardizedGraphDocument[source]
Standardize the graph.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class LogicalDefinition(*, definedClassId: str, genusIds: list[str] | None = None, restrictions: list[ExistentialRestrictionExpression] | None = None, meta: Meta | None = None)[source]
Represents a logical definition chain axiom.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class Meta(*, definition: Definition | None = None, subsets: list[str] | None = None, xrefs: list[Xref] | None = None, synonyms: list[Synonym] | None = None, comments: list[str] | None = None, version: str | None = None, basicPropertyValues: list[Property] | None = None, deprecated: bool = False)[source]
Represents the metadata about a node or ontology.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class Node(*, id: str, lbl: str | None = None, meta: Meta | None = None, type: Literal['CLASS', 'PROPERTY', 'INDIVIDUAL'] | None = None, propertyType: Literal['ANNOTATION', 'OBJECT', 'DATA'] | None = None)[source]
Represents a node in an OBO Graph.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class Property(**data: Any)[source]
Represent a property inside a metadata element.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class PropertyChainAxiom(*, predicateId: str, chainPredicateIds: list[str], meta: Meta | None = None)[source]
Represents a property chain axiom.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedBaseModel[source]
A standardized property.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- abstractmethod classmethod from_obograph_raw(obj: X, converter: Converter, *, strict: bool = False) Self | None[source]
Instantiate by standardizing a raw OBO Graph object.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedDefinition(*, value: str | None = None, xrefs: list[Reference] | None = None)[source]
A standardized definition.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_obograph_raw(definition: Definition | None, converter: Converter, *, strict: bool = False) Self | None[source]
Parse a raw object.
- to_raw(converter: Converter) Definition[source]
Create a raw object.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedDomainRangeAxiom(*, predicate: Reference, domains: list[Reference] = <factory>, ranges: list[Reference] = <factory>, all_values_from_edges: list[StandardizedEdge] = <factory>, meta: StandardizedMeta | None = None)[source]
Represents a domain/range axiom.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_obograph_raw(obj: DomainRangeAxiom, converter: Converter, *, strict: bool = False) Self | None[source]
Parse a raw object.
- to_raw(converter: Converter) DomainRangeAxiom[source]
Create a raw object.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedEdge(*, subject: Reference, predicate: Reference, object: Reference, meta: StandardizedMeta | None = None)[source]
A standardized edge.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_obograph_raw(edge: Edge, converter: Converter, *, strict: bool = False) Self | None[source]
Instantiate by standardizing a raw OBO Graph object.
- model_config = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedEquivalentNodeSet(*, node: Reference, equivalents: list[Reference] = <factory>, meta: StandardizedMeta | None = None)[source]
Represents an equivalence set.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_obograph_raw(obj: EquivalentNodeSet, converter: Converter, *, strict: bool = False) Self | None[source]
Parse a raw object.
- to_raw(converter: Converter) EquivalentNodeSet[source]
Create a raw object.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedExistentialRestriction(*, predicate: Reference, target: Reference)[source]
Represents an existential restriction expression.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_obograph_raw(obj: ExistentialRestrictionExpression, converter: Converter, *, strict: bool = False) Self | None[source]
Parse a raw object.
- to_raw(converter: Converter) ExistentialRestrictionExpression[source]
Create a raw object.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedGraph(*, id: str | None = None, meta: StandardizedMeta | None = None, nodes: list[StandardizedNode] = <factory>, edges: list[StandardizedEdge] = <factory>, equivalent_node_sets: list[StandardizedEquivalentNodeSet] = <factory>, logical_definition_axioms: list[StandardizedLogicalDefinition] = <factory>, domain_range_axioms: list[StandardizedDomainRangeAxiom] = <factory>, property_chain_axioms: list[StandardizedPropertyChainAxiom] = <factory>)[source]
A standardized graph.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_obograph_raw(graph: Graph, converter: Converter, *, strict: bool = False) Self[source]
Instantiate by standardizing a raw OBO Graph object.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedGraphDocument(*, graphs: list[StandardizedGraph], meta: StandardizedMeta | None = None)[source]
A standardized graph document.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_obograph_raw(graph_document: GraphDocument, converter: Converter, *, strict: bool = False) Self[source]
Instantiate by standardizing a raw OBO Graph Document object.
- to_raw(converter: Converter) GraphDocument[source]
Create a raw object.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedLogicalDefinition(*, node: Reference, geni: list[Reference] = <factory>, restrictions: list[StandardizedExistentialRestriction] = <factory>, meta: StandardizedMeta | None = None)[source]
Represents a logical definition axiom.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_obograph_raw(obj: LogicalDefinition, converter: Converter, *, strict: bool = False) Self | None[source]
Parse a raw object.
- to_raw(converter: Converter) LogicalDefinition[source]
Create a raw object.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedMeta(*, definition: StandardizedDefinition | None = None, subsets: list[Reference] | None = None, xrefs: list[StandardizedXref] | None = None, synonyms: list[StandardizedSynonym] | None = None, comments: list[str] | None = None, deprecated: bool = False, version_iri: str | None = None, properties: list[StandardizedProperty] | None = None)[source]
A standardized meta object.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_obograph_raw(meta: Meta | None, converter: Converter, flag: str = '', strict: bool = False) Self | None[source]
Instantiate by standardizing a raw OBO Graph object.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedNode(*, reference: Reference, label: str | None = None, meta: StandardizedMeta | None = None, type: Literal['CLASS', 'PROPERTY', 'INDIVIDUAL'] | None = None, property_type: Literal['ANNOTATION', 'OBJECT', 'DATA'] | None = None)[source]
A standardized node.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_obograph_raw(node: Node, converter: Converter, *, strict: bool = False) Self | None[source]
Instantiate by standardizing a raw OBO Graph object.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedProperty[source]
A standardized property.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_obograph_raw(prop: Property, converter: Converter, *, strict: bool = False) Self[source]
Instantiate by standardizing a raw OBO Graph object.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedPropertyChainAxiom(*, predicate: Reference, chain: list[Reference] = <factory>, meta: StandardizedMeta | None = None)[source]
Represents a property chain axiom.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_obograph_raw(obj: PropertyChainAxiom, converter: Converter, *, strict: bool = False) Self | None[source]
Parse a raw object.
- to_raw(converter: Converter) PropertyChainAxiom[source]
Create a raw object.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedSynonym(*, text: str, predicate: Reference, type: Reference | None = None, xrefs: list[Reference] | None = None)[source]
A standardized synonym.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_obograph_raw(synonym: Synonym, converter: Converter, *, strict: bool = False) Self[source]
Instantiate by standardizing a raw OBO Graph object.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class StandardizedXref(*, reference: Reference)[source]
A standardized database cross-reference.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- classmethod from_obograph_raw(xref: Xref, converter: Converter, *, strict: bool = False) Self[source]
Instantiate by standardizing a raw OBO Graph object.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class Synonym(**data: Any)[source]
Represents a synonym inside an object meta.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class Xref(*, val: str)[source]
Represents a cross-reference.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- guess_primary_graph(graph_document: GraphDocument, prefix: str) Graph[source]
- guess_primary_graph(graph_document: StandardizedGraphDocument, prefix: str) StandardizedGraph
Guess the primary graph from a graph document.
- read(source: str | Path, *, timeout: int | float | None = None, squeeze: Literal[False] = True, encoding: str = None) GraphDocument[source]
- read(source: str | Path, *, timeout: int | float | None = None, squeeze: Literal[True] = True, encoding: str = None) Graph
Read an OBO Graph document.
- Parameters:
source – A file path or URL to an OBO Graph JSON
timeout – The timeout for getting a URL
squeeze – By default, will unpack the first graph from a graph document that only has a single graph and return a
Graphobject. If true and multiple graphs are received, will raise an error. Set this to false to return a GraphDocument containing all graphs.encoding – The
encodingwhen reading a local filepath, passed topystow.utils.safe_open()newline – The
newlinewhen reading a local filepath, passed topystow.utils.safe_open()
- Returns:
A graph or graph document
- Raises:
ValueError – If squeeze is set to true and multiple graphs are received