filip.semantics.vocabulary package
Submodules
filip.semantics.vocabulary.combined_relations module
Vocabulary Models for CombinedRelations
- pydantic model filip.semantics.vocabulary.combined_relations.CombinedDataRelation[source]
Bases:
CombinedRelation
Combines all data relations of a class that share the same DataProperty Represents one Data Field of a class
- field relation_ids: List[str] = []
List of all relations of the class that are bundled; have the same property
- get_field_type(vocabulary: Vocabulary) DataFieldType [source]
Get type of CDR (command, devicedata , simple)
- Args:
vocabulary (Vocabulary): Vocabulary of the project
- Returns:
DataFieldType
- get_possible_enum_target_values(vocabulary: Vocabulary) List[str] [source]
Get all enum values that are allowed as values for this Data field
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
List[str]
- get_property_label(vocabulary: Vocabulary) str [source]
Get the label of the DataProperty
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
str
- is_device_relation(vocabulary: Vocabulary) bool [source]
Test if the CDR is a device property(command, or readings)
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
bool
- pydantic model filip.semantics.vocabulary.combined_relations.CombinedObjectRelation[source]
Bases:
CombinedRelation
Combines all object relations of a class that share the same ObjectProperty Represents one Relation Field of a class
- field relation_ids: List[str] = []
List of all relations of the class that are bundled; have the same property
- get_all_possible_target_class_iris(vocabulary) List[str] [source]
Get all iris that are valid values for this cor
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
List[str]
- get_inverse_of_labels(vocabulary: Vocabulary) List[str] [source]
Get the labels of the inverse_of properties of this COR
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
List[str]
- get_property_label(vocabulary: Vocabulary) str [source]
Get the label of the ObjectProperty
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
str
- pydantic model filip.semantics.vocabulary.combined_relations.CombinedRelation[source]
Bases:
BaseModel
Combines all relations of a class that share the same Property Represents one Field of a class. SHORT: CR
- It provides the common ground for the specialisations:
CombinedObjectRelation, CombinedDataRelation
- field relation_ids: List[str] = []
List of all relations of the class that are bundled; have the same property
- export_rule(vocabulary: Vocabulary, stringify_fields: bool) str [source]
Get the rule as string
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
stringify_fields (bool) – If true, all string delimieters will be removed
- Returns:
str
- get_all_target_iris(vocabulary: Vocabulary) Set[str] [source]
Get all iris of referenced targets
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
set(str)
- get_all_target_labels(vocabulary: Vocabulary) Set[str] [source]
Get all labels of referenced targets
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
set(str)
- get_all_targetstatements_as_string(vocabulary: Vocabulary) str [source]
Get a string stating all conditions(target statement) that need to be fulfilled, so that this CR is fulfilled
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
str
- get_property_label(vocabulary: Vocabulary) str [source]
Get the label of the Property. Overwritten by children
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
str
- get_relations(vocabulary: Vocabulary) List[Relation] [source]
filip.semantics.vocabulary.entities module
Vocabulary Models for Ontology Entities
- pydantic model filip.semantics.vocabulary.entities.Class[source]
Bases:
Entity
Representation of OWL:CLASS
A class has a set of relations that are combined into CombinedRelations
Instances are instantiations of a class
A class can represent Devices, Agents, None or both
- Fields:
- field combined_data_relation_ids: List[str] = []
All combined_data_relations ids defined for this class
- field combined_object_relation_ids: List[str] = []
All combined_object_relations ids defined for this class
- field parent_class_iris: List[str] = []
All class_iris of classes that are direct parents of this class
- get_ancestor_classes(vocabulary: Vocabulary) List[Class] [source]
Get all ancestor classes of this class
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
List[Class]
- get_combined_data_relation_with_property_iri(property_iri, vocabulary)[source]
Get the CombinedDataRelation of this class that combines the relations of the given DataProperty
- Parameters:
property_iri (str) – Iri of the DataProperty
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
CombinedDataRelation
- get_combined_data_relations(vocabulary: Vocabulary) List[CombinedDataRelation] [source]
Get all combined data relations belonging to this class
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
List[CombinedDataRelation]
- get_combined_object_relation_with_property_iri(obj_prop_iri: str, vocabulary: Vocabulary) CombinedObjectRelation [source]
Get the CombinedObjectRelation of this class that combines the relations of the given ObjectProperty
- Parameters:
obj_prop_iri (str) – Iri of the ObjectProperty
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
CombinedObjectRelation
- get_combined_object_relations(vocabulary: Vocabulary) List[CombinedObjectRelation] [source]
Get all combined object relations belonging to this class
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
List[CombinedObjectRelation]
- get_combined_relation_with_property_iri(property_iri, vocabulary) CombinedRelation | None [source]
Get the CombinedRelation of this class that combines the relations of the given Property
If possible use the more specific access functions to save runtime.
- Parameters:
property_iri (str) – Iri of the Property
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
CombinedRelation, None if iri is unknown
- get_combined_relations(vocabulary: Vocabulary) List[CombinedRelation] [source]
Get all combined relations belonging to this class
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
List[CombinedRelation]
- get_next_combined_relation_id(current_cr_id: str, object_relations: bool) str [source]
Get the alphabetically(Property label) next CombinedRelation.
If no CR is after the given one, the first is returned
- get_parent_classes(vocabulary: Vocabulary, remove_redundancy: bool = False) List[Class] [source]
Get all parent classes of this class
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
remove_redundancy (bool) – if true the parents that are child of other parents are not included
- Returns:
List[Class]
- get_previous_combined_relation_id(current_cr_id: str, object_relations: bool) str [source]
Get the alphabetically(Property label) previous CombinedRelation.
If no CR is before the given one, the last is returned
- get_relation_ids() List[str] [source]
Get all ids of relations belonging to this class
- Returns:
List[str]
- get_relations(vocabulary: Vocabulary) List[Relation] [source]
Get all relations belonging to this class
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
List[Relation]
- is_child_of_all_classes(target_list: List[str]) bool [source]
Tests if this class is a child class for each of the given classes
- Parameters:
target_list (List[str]) – List of ancestor class_iris
- Returns:
bool
- is_iot_class(vocabulary: Vocabulary) bool [source]
A class is an iot/device class if it contains one CDR, where the relation is marked as a device relation: DeviceAttribute/Command
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
bool
- is_logically_equivalent_to(class_: Class, vocabulary: Vocabulary, old_vocabulary: Vocabulary) bool [source]
Test if a class is logically equivalent in two vocabularies.
- Parameters:
class (Class) – Class to be tested against, from the old_vocabulary
vocabulary (Vocabulary) – New project vocabulary
old_vocabulary (Vocabulary) – Old project vocabulary
- Returns:
bool
- treat_dependency_statements(vocabulary: Vocabulary) List[DependencyStatement] [source]
Purge and list all pointers/iris that are not contained in the vocabulary
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
List of purged statements dicts with keys: Parent Class, class, dependency, fulfilled
- Return type:
- class filip.semantics.vocabulary.entities.DataFieldType(value)[source]
-
Type of the field that represents the DataProperty
- command = 'command'
- device_attribute = 'device_attribute'
- simple = 'simple'
- pydantic model filip.semantics.vocabulary.entities.DataProperty[source]
Bases:
Entity
Representation of OWL:DataProperty
- field field_type: DataFieldType = DataFieldType.simple
Type of the dataproperty; set by the user while configuring the vocabulary
- pydantic model filip.semantics.vocabulary.entities.Datatype[source]
Bases:
Entity
,DatatypeFields
Represents OWL:Datatype
A Datatype is the target of a DataRelation. The Datatype stats a set of values that are valid. This can be an ENUM, a number range, or a check for black/whitelisted chars
In the Parsing PostProcesseor predefined datatype_catalogue are added to the vocabulary
- Fields:
- field label: str = ''
Label (displayname) extracted from source file (multiple Entities could have the same label)
- field predefined: bool = False
Stats if the entity is not extracted from a source, but predefined in the program (Standard Datatypes)
- is_logically_equivalent_to(datatype: Datatype, vocabulary: Vocabulary, old_vocabulary: Vocabulary) bool [source]
Test if this datatype is logically equivalent to the given datatype
- Parameters:
datatype (Datatype) – Datatype to compare against
vocabulary (Vocabulary) – Not used, but needed to keep signature the same as other entities
old_vocabulary (Vocabulary) – Not used, but needed to keep signature the same as other entities
- Returns:
bool
- pydantic model filip.semantics.vocabulary.entities.DatatypeFields[source]
Bases:
BaseModel
Key Fields describing a Datatype
- Fields:
- field number_range_max: int | str = '/'
If Type==Number: Max value of the datatype range, if a range is defined
- field number_range_min: int | str = '/'
If Type==Number: Min value of the datatype range, if a range is defined
- field type: DatatypeType = DatatypeType.string
Type of the datatype
- class filip.semantics.vocabulary.entities.DatatypeType(value)[source]
-
Types of a Datatype
- date = 'date'
- enum = 'enum'
- number = 'number'
- string = 'string'
- pydantic model filip.semantics.vocabulary.entities.Entity[source]
Bases:
BaseModel
- Representing an OWL Entity (Class, Datatype, DataProperty, ObjectProperty,
Individual)
An Entity is characterised by a unique IRI and originates from a source
An Entity needs a unique Label (displayname) as it is used in FIWARE as field key. The user can overwrite the given label
- Fields:
- field label: str = ''
Label (displayname) extracted from source file (multiple Entities could have the same label)
- field predefined: bool = False
Stats if the entity is not extracted from a source, but predefined in the program (Standard Datatypes)
- get_label() str [source]
Get the label for the entity. If the user has set a label it is returned, else the label extracted from the source
- Returns:
str
- get_ontology_iri() str [source]
Get the IRI of the ontology that this entity belongs to (extracted from IRI)
- Returns:
str
- get_original_label() str [source]
Get label as defined in the source It can be that the label is empty, then extract the label from the iri
- Returns:
str
- get_source_names(vocabulary: Vocabulary) List[str] [source]
Get the names of all the sources
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
str
- get_sources(vocabulary: Vocabulary) List[Source] [source]
Get all the source objects that influenced this entity. The sources are sorted according to their names
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
str
- pydantic model filip.semantics.vocabulary.entities.Individual[source]
Bases:
Entity
Represents OWL:Individual
An individual is a predefined “instance” of a class But they are here only used as values for Relations
They are not instances, no value can be assigned to them, they are no agents or devices
- Fields:
- field parent_class_iris: List[str] = []
List of all parent class iris, an individual can have multiple parents
- get_ancestor_iris(vocabulary: Vocabulary) List[str] [source]
Get all iris of ancestor classes
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
List[str]
- get_parent_classes(vocabulary: Vocabulary) List[Class] [source]
Get all parent class objects
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
List[Class]
- is_logically_equivalent_to(individual: Individual, vocabulary: Vocabulary, old_vocabulary: Vocabulary) bool [source]
Test if this individal is logically equivalent in two vocabularies.
- Parameters:
individual (Individual) – Individual to be tested against, from the old vocabulary
vocabulary (Vocabulary) – New project vocabulary, not used but needed to keep signature the same
old_vocabulary (Vocabulary) – Old project vocabulary, not used but needed to keep signature the same
- Returns:
bool
- treat_dependency_statements(vocabulary: Vocabulary) List[DependencyStatement] [source]
Purge and list all pointers/iris that are not contained in the vocabulary
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
List of purged statements dicts with keys: Parent Class, class, dependency, fulfilled
- Return type:
- pydantic model filip.semantics.vocabulary.entities.ObjectProperty[source]
Bases:
Entity
Representation of OWL:ObjectProperty
- Fields:
- field inverse_property_iris: Set[str] = {}
List of property iris that are inverse:Of; If an instance i2 is added in an instance i1 for this property. Then i1 is added to i2 under the inverseProperty (if the class has that property)
- add_inverse_property_iri(iri: str)[source]
Add an inverse property
- Parameters:
iri (str) – Iri of the inverse objectProperty
- Returns:
None
- is_logically_equivalent_to(object_property: ObjectProperty, vocabulary: Vocabulary, old_vocabulary: Vocabulary) bool [source]
Test if this Property in the new_vocabulary is logically equivalent to the object_property in the old_vocabulary
- Parameters:
object_property (ObjectProperty) – ObjectProperty to be tested against, from the old vocabulary
vocabulary (Vocabulary) – New project vocabulary, not used but needed to keep signature the same
old_vocabulary (Vocabulary) – Old project vocabulary, not used but needed to keep signature the same
- Returns:
bool
filip.semantics.vocabulary.relation module
Vocabulary Models for Relations
- pydantic model filip.semantics.vocabulary.relation.Relation[source]
Bases:
BaseModel
A Relation is defined in the source for a class. It has the form: RestrictionType property target_statement
It defines a set of allowed/required values which each instance of this class can/should have under this property
A Relation is defined in a OWL:class, but all child classes of that class inherit it
- Fields:
- field restriction_type: RestrictionType = None
Restriction type of this relation
- field target_statement: TargetStatement = None
Complex statement which classes/datatype_catalogue are allowed/required
- export_rule(vocabulary: Vocabulary) -> (<class 'str'>, <class 'str'>)[source]
Get the rule as string
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
str
- get_all_possible_target_class_iris(vocabulary: Vocabulary) Set[str] [source]
Get a set of class iris that are possible values for an objectRelation
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
class_iris
- Return type:
Set[str]
- get_dependency_statements(vocabulary: Vocabulary, ontology_iri: str, class_iri: str) List[DependencyStatement] [source]
- Get a list of all pointers/iris that are not contained in the
vocabulary Purging is done in class
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
ontology_iri (str) – IRI of the source ontology
class_iri (str) – IRI of class (legacy)
- Returns:
- List of purged statements dicts with keys:
Parent Class, class, dependency, fulfilled
- Return type:
- get_possible_enum_target_values(vocabulary: Vocabulary) List[str] [source]
Get all allowed enum target values for a data relation
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
List[str]
- get_targets() List[List[str]] [source]
Get all targets specified in the target statement in AND-OR Notation
- Returns:
[[a,b],[c]] either a and b needs to present, or c
- Return type:
List[List[str]]
- is_fulfilled_with_iris(vocabulary: Vocabulary, values: List[str], ancestor_values: List[List[str]]) bool [source]
Test if a set of values fulfills the rules of the relation
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
values (List[str]) – List of values to check
ancestor_values (List[List[str]]) – List containing the ancestors iris for each value (linked over index)
- Returns:
bool
- is_fulfilled_with_values(vocabulary: Vocabulary, values: List[str]) bool [source]
Test if a set of values fulfills the rules of the relation. Used if property is a data property
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
values (List[str]) – List of values to check
- Returns:
bool
- is_restriction_fulfilled(number_of_fulfilling_values: int, total_number_of_values: int) bool [source]
Test if the restriction type is fulfilled by comparing the number of fulfilling values against the total number of values given
- to_string(vocabulary: Vocabulary) str [source]
Get a string representation of the relation
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
str
- class filip.semantics.vocabulary.relation.RestrictionType(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
str
,Enum
RestrictionTypes, as defined for OWL
- exactly = 'exactly'
- max = 'max'
- min = 'min'
- only = 'only'
- some = 'some'
- value = 'value'
- class filip.semantics.vocabulary.relation.StatementType(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
str
,Enum
A statement is either a leaf and holds an iri/label or it is a combination of leafs with or / and
- AND = 'and'
- LEAF = 'leaf'
- OR = 'or'
- pydantic model filip.semantics.vocabulary.relation.TargetStatement[source]
Bases:
BaseModel
A target statement is the statement the sits in a relation statement behind the restrictionType: E.g: consists_of some Device or Sensor. here Device or Sensor is the targetstatement as it sits behind “some”
A targetstatement is build recursively: It is either a Leaf: str or a union (or) or an intersection(and) of targetstatements
- the combination of statements is purely logical and not numerical: device
and device is true as soon as one device is given, it does not need two separate devices.
- Fields:
- field target_data_value: str | None = None
Holds the value if the relation is a hasValue (LEAF only)
- field target_statements: List[TargetStatement] = []
The targetstatements that are combined with this targetstatement (and/or only)
- field type: StatementType = StatementType.LEAF
Statement types
- get_all_targets() List[List[str]] [source]
Extract possible targets out of statements interpretation: [[a,b], [c]]-> (a and b) or c -> the target needs to have ancestors(or be): (both a anb b) or c
items inside the inner brackets are connected via and the innerbrackets are all connect over or
- Returns:
List[List[str]]
- get_dependency_statements(vocabulary: Vocabulary, ontology_iri: str, class_iri: str) List[DependencyStatement] [source]
Get a list of all pointers/iris that are not contained in the vocabulary. Purging is done in class
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
ontology_iri (str) – IRI of the source ontology
class_iri (str) – IRI of class (legacy)
- Returns:
List of purged statements dicts with keys: Parent Class, class, dependency, fulfilled
- Return type:
- is_fulfilled_by_data_value(value: str, vocabulary: Vocabulary) bool [source]
Test if a set of values fulfills the targetstatement; Only for dataRelations
- Parameters:
value (List[str]) – value to check
vocabulary (Vocabulary) –
- Returns:
bool
- is_fulfilled_by_iri_value(value: str, ancestor_values: List[str]) bool [source]
Test if a set of values fulfills the targetstatement; Only for objectRelations
- retrieve_label(vocabulary: Vocabulary) str [source]
Get the label of the target_iri. Only logical for Leaf statements
- Parameters:
vocabulary (Vocabulary) – Vocabulary of the project
- Returns:
str
- set_target(target_iri: str, target_data_value: str | None = None)[source]
Set target for this statement and make it a LEAF statement
- to_string(vocabulary: Vocabulary) str [source]
Get a string representation of the targetstatment
- Parameters:
vocabulary (Vocabulary) – vocabulary of the project
- Returns:
str
filip.semantics.vocabulary.source module
Vocabulary Models for Ontology Sources
- pydantic model filip.semantics.vocabulary.source.DependencyStatement[source]
Bases:
BaseModel
Information about one dependency statement in the source A dependency is a reference of one iri in an other entity definition
- Fields:
- pydantic model filip.semantics.vocabulary.source.ParsingError[source]
Bases:
BaseModel
Object represents one issue that arose while parsing a source, and holds all relevant details for that issue
- Config:
use_enum_values: bool = True
- Fields:
- pydantic model filip.semantics.vocabulary.source.Source[source]
Bases:
BaseModel
A source represent one file that was provided via file upload or link to the project and is parsed into the vocabulary
- Fields:
- field dependency_statements: List[DependencyStatement] = []
List of all statements in source
- field parsing_log: List[ParsingError] = []
Log containing all issues that were discovered while parsing
- field predefined: bool = False
Stating if the source is a predefined source; a predefined source is added to each project containing owl:Thing and predefined Datatypes
- add_parsing_log_entry(level: LoggingLevel, entity_type: IdType, entity_iri: str, msg: str)[source]
Add a parsing log entry for an entity, if an issue in parsing was discovered
- get_number_of_id_type(vocabulary: Vocabulary, id_type: IdType) int [source]
Get the number how many entities of a given type are created by or influenced by this source
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
id_type (IdType) – Idtype that should be counted
- Returns:
int
- get_parsing_log(vocabulary: Vocabulary) List[ParsingError] [source]
Get the Parsinglog, where the labels of the entities are filled in
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
List[Dict[str, Union[LoggingLevel,’IdType’,str]]]
- treat_dependency_statements(vocabulary: Vocabulary)[source]
Log and purge all pointers/iris in entities that are not contained in the vocabulary
- Parameters:
vocabulary (Vocabulary) – Vocabulary of this project
- Returns:
None
filip.semantics.vocabulary.vocabulary module
Main Vocabulary Model, and Submodels
- class filip.semantics.vocabulary.vocabulary.IdType(value)[source]
-
Type of object that is referenced by an id/iri
- class_ = 'Class'
- combined_relation = 'Combined Relation'
- data_property = 'Data Property'
- datatype = 'Datatype'
- individual = 'Individual'
- object_property = 'Object Property'
- relation = 'Relation'
- source = 'Source'
- pydantic model filip.semantics.vocabulary.vocabulary.LabelSummary[source]
Bases:
BaseModel
Model holding all information for label conflicts in a vocabulary
- Fields:
blacklisted_labels (List[Tuple[str, filip.semantics.vocabulary.entities.Entity]])
class_label_duplicates (Dict[str, List[filip.semantics.vocabulary.entities.Entity]])
datatype_label_duplicates (Dict[str, List[filip.semantics.vocabulary.entities.Entity]])
field_label_duplicates (Dict[str, List[filip.semantics.vocabulary.entities.Entity]])
labels_with_illegal_chars (List[Tuple[str, filip.semantics.vocabulary.entities.Entity]])
- field blacklisted_labels: List[Tuple[str, Entity]] [Required]
All Labels that are blacklisted, Tuple(Label, Entity with label)
- field class_label_duplicates: Dict[str, List[Entity]] [Required]
All Labels that are used more than once for class_names on export.Key: Label, Values: List of entities with key label
- field datatype_label_duplicates: Dict[str, List[Entity]] [Required]
All Labels that are used more than once for datatype on export.Key: Label, Values: List of entities with key label
- field field_label_duplicates: Dict[str, List[Entity]] [Required]
All Labels that are used more than once for property_nameson export.Key: Label, Values: List of entities with key label
- pydantic model filip.semantics.vocabulary.vocabulary.Vocabulary[source]
Bases:
BaseModel
Semantic Vocabulary of a project
This class holds all objects in a vocabulary as central unit. These objects can be accessed with the according ids/iris
The vocabulary consists out of multiple sources, that each contribute objects
From the vocabulary nothing should be added or deleted manually. The sources are added and removed through the respective methods. Everything else should be used as READ-ONLY
- Fields:
classes (Dict[str, filip.semantics.vocabulary.entities.Class])
data_properties (Dict[str, filip.semantics.vocabulary.entities.DataProperty])
datatypes (Dict[str, filip.semantics.vocabulary.entities.Datatype])
id_types (Dict[str, filip.semantics.vocabulary.vocabulary.IdType])
individuals (Dict[str, filip.semantics.vocabulary.entities.Individual])
object_properties (Dict[str, filip.semantics.vocabulary.entities.ObjectProperty])
original_label_summary (filip.semantics.vocabulary.vocabulary.LabelSummary | None)
relations (Dict[str, filip.semantics.vocabulary.relation.Relation])
settings (filip.semantics.vocabulary.vocabulary.VocabularySettings)
sources (Dict[str, filip.semantics.vocabulary.source.Source])
- field combined_data_relations: Dict[str, CombinedDataRelation] = {}
CombinedDataRelations of classes in the vocabulary.Key: combined_data_id
- field combined_object_relations: Dict[str, CombinedObjectRelation] = {}
CombinedObjectRelations of classes in the vocabulary. Key: combined_relation_id
- field data_properties: Dict[str, DataProperty] = {}
DataProperties of the vocabulary. Key: data_property_iri
- field id_types: Dict[str, IdType] = {}
Maps all entity iris and (combined)relations to their Entity/Object type, to speed up lookups
- field individuals: Dict[str, Individual] = {}
Individuals in the vocabulary. Key: individual_iri
- field object_properties: Dict[str, ObjectProperty] = {}
ObjectProperties of the vocabulary. Key: object_property_iri
- field original_label_summary: LabelSummary | None = None
Original label after parsing, before the user made changes
- field settings: VocabularySettings = VocabularySettings(pascal_case_class_labels=True, pascal_case_individual_labels=True, camel_case_property_labels=True, camel_case_datatype_labels=True, pascal_case_datatype_enum_labels=True)
Settings how to auto transform the entity labels
- get_all_individuals_of_class(class_iri: str) List[Individual] [source]
Get all individual that have the class_iri as parent
- Parameters:
class_iri (str) – iri of parent class
- Returns:
List[Individual]
- static get_base_out_of_iri(iri: str)[source]
Extract out of a given iri the base aka ontology name
- Parameters:
iri (str) –
- Returns:
str, base of iri
- get_class_by_iri(class_iri: str) Class | None [source]
Get the class belonging to the class_iri
- Parameters:
class_iri (str) – iri
- Returns:
Class or None if iri not a registered class
- get_classes_sorted_by_label() List[Class] [source]
Get all classes sorted by their labels
- Returns:
sorted classes, ascending
- Return type:
List[Class]
- get_combined_data_relation_by_id(id: str) CombinedDataRelation [source]
Get CombinedDataRelation by id
- get_combined_object_relation_by_id(id: str) CombinedObjectRelation [source]
Get CombinedObjectRelation by id
- get_combined_relation_by_id(id: str) CombinedRelation [source]
Get CombinedRelation by id
- get_data_properties_sorted_by_label() List[DataProperty] [source]
Get all data properties of the vocabulary sorted by their labels
- Returns:
List[DataProperty], sorted by ascending labels
- get_data_property(data_prop_iri: str) DataProperty [source]
Get the data property belonging to the iri
- get_datatypes_sorted_by_label() List[Datatype] [source]
Get all datatypes of the vocabulary sorted by their labels
- Returns:
List[Datatype], sorted by ascending labels
- get_entity_by_iri(iri: str) None | Entity [source]
Get the entity with the given iri Fast efficient methode
- Parameters:
iri (str) –
- Returns:
Entity or None if iri does not belong to an Entity
- get_entity_list_sorted_by_label(list: List[Entity]) List[Entity] [source]
Sort a given entity list by their labels
- get_enum_dataytypes() Dict[str, Datatype] [source]
Get all datatypes of vocabularies that are of type ENUM
- get_individual(individual_iri: str) Individual [source]
Get the individual belonging to the iri
- get_individuals_sorted_by_label() List[Individual] [source]
Get all individuals of the vocabulary sorted by their labels
- Returns:
List[Individual], sorted by ascending labels
- get_label_for_entity_iri(iri: str) str [source]
Get the label of the entity with the given iri Fast efficient methode
- Parameters:
iri (str) –
- Returns:
str, “” if iri does not belong to an entity
- get_object_properties_sorted_by_label() List[ObjectProperty] [source]
Get all object properties of the vocabulary sorted by their labels
- Returns:
List[ObjectProperty], sorted by ascending labels
- get_object_property(obj_prop_iri: str) ObjectProperty [source]
Get the object property beloning to the iri
- get_source_list() List[Source] [source]
Get all source objects of the vocabulary as list
- Returns:
List[Source]
- get_type_of_id(id: str) IdType | None [source]
Get the type (class, relation,…) of an iri/id
- Parameters:
id (str) – id/iri of which the type should be returned
- Returns:
IdType or None if id/iri not registered
- has_source(source_id: str) bool [source]
Test if the vocabulary contains a source with the given id
- Parameters:
source_id (str) – id to test
- Returns:
bool
- iri_is_predefined_datatype(iri: str) bool [source]
Test if an iri belongs to a predefined datatype
- Parameters:
iri (str) – Iri to test
- Returns:
bool
- is_id_from_individual(id: str) bool [source]
Test if an id is from an Individual. Used to distinguish between instances and individuals
- Parameters:
id (str) – id
- Returns:
bool
- pydantic model filip.semantics.vocabulary.vocabulary.VocabularySettings[source]
Bases:
BaseModel
Settings that state how labels of ontology entities should be automatically converted on parsing
- Fields:
- field camel_case_datatype_labels: bool = True
If true, convert all labels of datatypes given in the ontologies to camelCase
- field camel_case_property_labels: bool = True
If true, convert all labels of properties given in the ontologies to camelCase
- field pascal_case_class_labels: bool = True
If true, convert all class labels given in the ontologies to PascalCase