filip.semantics package
Subpackages
- filip.semantics.ontology_parser package
- Submodules
- filip.semantics.ontology_parser.post_processer module
- filip.semantics.ontology_parser.rdfparser module
- filip.semantics.ontology_parser.vocabulary_builder module
IdType
VocabularyBuilder
VocabularyBuilder.current_source
VocabularyBuilder.vocabulary
VocabularyBuilder.add_class()
VocabularyBuilder.add_combined_data_relation_for_class()
VocabularyBuilder.add_combined_object_relation_for_class()
VocabularyBuilder.add_data_property()
VocabularyBuilder.add_datatype()
VocabularyBuilder.add_individual()
VocabularyBuilder.add_object_property()
VocabularyBuilder.add_predefined_datatype()
VocabularyBuilder.add_relation_for_class()
VocabularyBuilder.add_source()
VocabularyBuilder.clear()
VocabularyBuilder.entity_is_known()
VocabularyBuilder.set_current_source()
- filip.semantics.vocabulary package
- Submodules
- filip.semantics.vocabulary.combined_relations module
CombinedDataRelation
CombinedObjectRelation
CombinedRelation
CombinedRelation.class_iri
CombinedRelation.id
CombinedRelation.property_iri
CombinedRelation.relation_ids
CombinedRelation.export_rule()
CombinedRelation.get_all_target_iris()
CombinedRelation.get_all_target_labels()
CombinedRelation.get_all_targetstatements_as_string()
CombinedRelation.get_property_label()
CombinedRelation.get_relations()
- filip.semantics.vocabulary.entities module
Class
Class.ancestor_class_iris
Class.child_class_iris
Class.combined_data_relation_ids
Class.combined_object_relation_ids
Class.comment
Class.iri
Class.label
Class.parent_class_iris
Class.predefined
Class.relation_ids
Class.source_ids
Class.user_set_label
Class.get_ancestor_classes()
Class.get_combined_data_relation_with_property_iri()
Class.get_combined_data_relations()
Class.get_combined_object_relation_with_property_iri()
Class.get_combined_object_relations()
Class.get_combined_relation_with_property_iri()
Class.get_combined_relations()
Class.get_next_combined_relation_id()
Class.get_parent_classes()
Class.get_previous_combined_relation_id()
Class.get_relation_ids()
Class.get_relations()
Class.is_child_of_all_classes()
Class.is_iot_class()
Class.is_logically_equivalent_to()
Class.treat_dependency_statements()
DataFieldType
DataProperty
Datatype
Datatype.allowed_chars
Datatype.comment
Datatype.enum_values
Datatype.forbidden_chars
Datatype.iri
Datatype.label
Datatype.number_decimal_allowed
Datatype.number_has_range
Datatype.number_range_max
Datatype.number_range_min
Datatype.predefined
Datatype.source_ids
Datatype.type
Datatype.user_set_label
Datatype.export()
Datatype.is_logically_equivalent_to()
Datatype.value_is_valid()
DatatypeFields
DatatypeType
Entity
Individual
Individual.comment
Individual.iri
Individual.label
Individual.parent_class_iris
Individual.predefined
Individual.source_ids
Individual.user_set_label
Individual.get_ancestor_iris()
Individual.get_parent_classes()
Individual.is_logically_equivalent_to()
Individual.to_string()
Individual.treat_dependency_statements()
ObjectProperty
- filip.semantics.vocabulary.relation module
Relation
Relation.id
Relation.property_iri
Relation.restriction_cardinality
Relation.restriction_type
Relation.target_statement
Relation.export_rule()
Relation.get_all_possible_target_class_iris()
Relation.get_all_target_iris()
Relation.get_dependency_statements()
Relation.get_possible_enum_target_values()
Relation.get_targets()
Relation.is_fulfilled_with_iris()
Relation.is_fulfilled_with_values()
Relation.is_restriction_fulfilled()
Relation.to_string()
RestrictionType
StatementType
TargetStatement
TargetStatement.target_data_value
TargetStatement.target_iri
TargetStatement.target_statements
TargetStatement.type
TargetStatement.get_all_targets()
TargetStatement.get_dependency_statements()
TargetStatement.is_fulfilled_by_data_value()
TargetStatement.is_fulfilled_by_iri_value()
TargetStatement.retrieve_label()
TargetStatement.set_target()
TargetStatement.to_string()
- filip.semantics.vocabulary.source module
DependencyStatement
ParsingError
Source
Source.content
Source.dependency_statements
Source.id
Source.ontology_iri
Source.parsing_log
Source.predefined
Source.source_name
Source.timestamp
Source.add_parsing_log_entry()
Source.clear()
Source.get_name()
Source.get_number_of_id_type()
Source.get_parsing_log()
Source.treat_dependency_statements()
- filip.semantics.vocabulary.vocabulary module
IdType
LabelSummary
Vocabulary
Vocabulary.classes
Vocabulary.combined_data_relations
Vocabulary.combined_object_relations
Vocabulary.data_properties
Vocabulary.datatypes
Vocabulary.id_types
Vocabulary.individuals
Vocabulary.object_properties
Vocabulary.original_label_summary
Vocabulary.relations
Vocabulary.settings
Vocabulary.sources
Vocabulary.get_all_entities()
Vocabulary.get_all_individuals_of_class()
Vocabulary.get_base_out_of_iri()
Vocabulary.get_class_by_iri()
Vocabulary.get_classes()
Vocabulary.get_classes_sorted_by_label()
Vocabulary.get_combined_data_relation_by_id()
Vocabulary.get_combined_object_relation_by_id()
Vocabulary.get_combined_relation_by_id()
Vocabulary.get_data_properties_sorted_by_label()
Vocabulary.get_data_property()
Vocabulary.get_datatype()
Vocabulary.get_datatypes_sorted_by_label()
Vocabulary.get_entity_by_iri()
Vocabulary.get_entity_list_sorted_by_label()
Vocabulary.get_enum_dataytypes()
Vocabulary.get_individual()
Vocabulary.get_individuals_sorted_by_label()
Vocabulary.get_label_for_entity_iri()
Vocabulary.get_object_properties_sorted_by_label()
Vocabulary.get_object_property()
Vocabulary.get_relation_by_id()
Vocabulary.get_source()
Vocabulary.get_source_list()
Vocabulary.get_type_of_id()
Vocabulary.has_source()
Vocabulary.iri_is_predefined_datatype()
Vocabulary.is_id_from_individual()
Vocabulary.is_id_of_type()
Vocabulary.is_iri_registered()
Vocabulary.set_label_for_entity()
VocabularySettings
Submodules
filip.semantics.semantics_manager module
filip.semantics.semantics_models module
filip.semantics.vocabulary_configurator module
Module providing an interface to manipulate the sources of a vocabulary, and to ability to export it to models
- exception filip.semantics.vocabulary_configurator.ParsingException(value)[source]
Bases:
Exception
Error Class that is raised if parsing of an ontology was unsuccessful
- class filip.semantics.vocabulary_configurator.VocabularyConfigurator[source]
Bases:
object
Class that provides static interfaces to manipulate the sources of a vocabulary, validate and save it.
- classmethod add_ontology_to_vocabulary_as_file(vocabulary: Vocabulary, path_to_file: str, source_name: str | None = None) Vocabulary [source]
Add a source to the vocabulary with via a file path. Source name will be extracted from path, if no name is given
- Parameters:
vocabulary (Vocabulary) – Vocabulary to which the source should
added (be) –
path_to_file (str) – Path to the source file
source_name (Optional[str]) – Name for the source
- Raises:
ParsingException – If the given source was not valid and could not
be parsed –
- Returns:
New Vocabulary with the given source added to it
- classmethod add_ontology_to_vocabulary_as_link(vocabulary: Vocabulary, link: str, source_name: str | None = None) Vocabulary [source]
Add a source to the vocabulary with via a weblink. Source name will be extracted from link, if no name is given
- Parameters:
vocabulary (Vocabulary) – Vocabulary to which the source should
added (be) –
link (str) – Weblink to the source
source_name (Optional[str]) – Name for the source
- Raises:
ParsingException – If the given source was not valid and could not
be parsed –
- Returns:
New Vocabulary with the given source added to it
- classmethod add_ontology_to_vocabulary_as_string(vocabulary: Vocabulary, source_name: str, source_content: str) Vocabulary [source]
Add a source to the vocabulary by giving the source content as string. Source name needs to be given
- Parameters:
vocabulary (Vocabulary) – Vocabulary to which the source should
added (be) –
source_content (str) – Content of source
source_name (str) – Name for the source
- Raises:
ParsingException – If the given source was not valid and could not
be parsed –
- Returns:
New Vocabulary with the given source added to it
- classmethod create_vocabulary(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)) Vocabulary [source]
Create a new blank vocabulary with given settings
- Parameters:
settings – VocabularySettings
- Returns:
Vocabulary
- classmethod delete_source_from_vocabulary(vocabulary: Vocabulary, source_id: str) Vocabulary [source]
Delete a source from the vocabulary
- Parameters:
vocabulary (Vocabulary) – Vocabulary from which the source should
removed (be) –
source_id (str) – Id of source to remove
- Raises:
ValueError – If no source with given Id exists in Vocabulary
- Returns:
New Vocabulary without the given source
- classmethod generate_vocabulary_models(vocabulary: Vocabulary, path: str | None = None, filename: str | None = None, alternative_manager_name: str | None = None) str | None [source]
Export the given vocabulary as python model file. All vocabulary classes will be converted to python classes, with their CRs as property fields. If path and filename are given, the generated file will be saved, else the file content is returned as string.
- Parameters:
vocabulary (Vocabulary) – Vocabulary to export
path (Optional[str]) – Path where the file should be saved
filename (Optional[str]) – Name of the file
alternative_manager_name (Optional[str]) – alternative name for the semantic_manager. The manager of the model can than also be referenced over the object with this name
- Raises:
- Returns:
Optional[str], generated content if path or filename not given
- classmethod get_label_conflicts_in_vocabulary(vocabulary: Vocabulary) LabelSummary [source]
Compute a summary for all labels present in the vocabulary. The summary contains all naming clashes and illegal labels.
- Parameters:
vocabulary (Vocabulary) – Vocabulary to analyse
- Returns:
LabelSummary
- classmethod get_missing_dependencies(vocabulary: Vocabulary) List[str] [source]
Get a list of all Dependencies that are currently missing in the vocabulary in form of iris
- Parameters:
vocabulary (Vocabulary) – Vocabulary to analyse
- Returns:
List of missing iris
- Return type:
List[str]
- classmethod get_missing_dependency_statements(vocabulary: Vocabulary) List[DependencyStatement] [source]
Get a list of all Dependencies that are currently missing in the vocabulary in form of DependencyStatements
- Parameters:
vocabulary (Vocabulary) – Vocabulary to analyse
- Returns:
List[DependencyStatement]
- classmethod get_parsing_logs(vocabulary: Vocabulary) List[ParsingError] [source]
Get the parsing logs of a vocabulary
- Parameters:
vocabulary (Vocabulary) – Vocabulary to analyse
- Returns:
List[ParsingError]
- classmethod is_label_blacklisted(label: str) bool [source]
Checks if the given label is forbidden for an entity to possess
- Parameters:
label (str) – label to check
- Returns:
bool
- classmethod is_label_illegal(label: str) bool [source]
Checks if the given label contains a forbidden char
- Parameters:
label (str) – label to check
- Returns:
bool, True if label forbidden
- classmethod is_vocabulary_valid(vocabulary: Vocabulary) bool [source]
Test if the given vocabulary is valid -> all labels are unique and correct
- Parameters:
vocabulary (Vocabulary) – Vocabulary to analyse
- Returns:
bool