filip.semantics.ontology_parser package
Submodules
filip.semantics.ontology_parser.post_processer module
The PostProcessing gets called after the vocabulary was parsed from sources
The postprocessing has the goal to add predefined values, compute combinedRelations, reload user settings, and precompute information as: duplicate labels or sort relations
- class filip.semantics.ontology_parser.post_processer.PostProcessor[source]
Bases:
object
Class offering postprocessing as cls-methods for a vocabulary
- classmethod post_process_vocabulary(vocabulary: Vocabulary, old_vocabulary: Vocabulary | None = None)[source]
Main methode to be called for post processing
- Parameters:
vocabulary (Vocabulary) – Freshly parsed Vocabulary
old_vocabulary (Vocabulary) – Existing Vocabulary of which the settings should be overtaken
- Returns:
None
- classmethod transfer_settings(new_vocabulary: Vocabulary, old_vocabulary: Vocabulary)[source]
Transfer all the user made settings (labels, ..) from an old vocabulary to a new vocabulary
- Parameters:
new_vocabulary (Vocabulary) – Vocabulary to which the settings should be transferred
old_vocabulary (Vocabulary) – Vocabulary of which the settings should be transferred
- Returns:
None
filip.semantics.ontology_parser.rdfparser module
Module contains the RDFParser that can create a Vocabulary object out of a given ontology
- class filip.semantics.ontology_parser.rdfparser.RdfParser[source]
Bases:
object
Class that parses a given source into a vocabulary.
- current_class_iri
Iri of class which is currently parsed, used for Log entries
- current_source
Current source which is parsed, used for Log entries
- parse_source_into_vocabulary(source: Source, vocabulary: Vocabulary) bool [source]
Parse a Source into the given vocabulary :param source: :type source: Source :param vocabulary: :type vocabulary: Vocabulary
- Returns:
bool, True if success, False if Error occurred, as an invalid File
- class filip.semantics.ontology_parser.rdfparser.Tags(value)[source]
-
Collection of tags used as structures in ontologies, that were used more than once in the rdfparser code
- owl_individual = 'http://www.w3.org/2002/07/owl#NamedIndividual'
- owl_intersection = 'http://www.w3.org/2002/07/owl#intersectionOf'
- owl_on_class = 'http://www.w3.org/2002/07/owl#onClass'
- owl_on_data_range = 'http://www.w3.org/2002/07/owl#onDataRange'
- owl_one_of = 'http://www.w3.org/2002/07/owl#oneOf'
- owl_union = 'http://www.w3.org/2002/07/owl#unionOf'
- rdf_type = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'
- filip.semantics.ontology_parser.rdfparser.get_base_out_of_iri(iri: str) str [source]
Give an iri, returns an the ontology base name
- Parameters:
iri –
- Returns:
str
- filip.semantics.ontology_parser.rdfparser.get_iri_from_uriref(uriref: URIRef) str [source]
Give an Uriref object, returns an iri
- Parameters:
uriref – Object describing the iri
- Returns:
str
- filip.semantics.ontology_parser.rdfparser.specifier_base_iris = ['http://www.w3.org/2002/07/owl', 'http://www.w3.org/1999/02/22-rdf-syntax-ns', 'http://www.w3.org/XML/1998/namespace', 'http://www.w3.org/2001/XMLSchema', 'http://www.w3.org/2000/01/rdf-schema']
Defines a set of base iris, that describe elements that belong to the description language not the ontology itself
filip.semantics.ontology_parser.vocabulary_builder module
Wrapper module to provide manipulation functions for vocabulary that should later be hidden from the user
- class filip.semantics.ontology_parser.vocabulary_builder.IdType(value)[source]
-
An enumeration.
- 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.ontology_parser.vocabulary_builder.VocabularyBuilder[source]
Bases:
BaseModel
Wrapper class to provide manipulation functions for vocabulary that should later be hidden from the user
- Fields:
- field current_source: Source = None
Current source to which entities are added,needed while parsing
- field vocabulary: Vocabulary [Required]
Vocabulary to manipulate
- add_class(class_: Class)[source]
Add a class to the vocabulary
- Parameters:
class (Class) – class to be added
- Returns:
None
- add_combined_data_relation_for_class(class_iri: str, cdata: CombinedDataRelation)[source]
Add a combined data relation object to a class
- Parameters:
class_iri – Iri of the class to which the cd-relation should be added
cdata – CombinedDataRelation to add
- Returns:
None
- add_combined_object_relation_for_class(class_iri: str, crel: CombinedObjectRelation)[source]
Add a combined object relation object to a class
- Parameters:
class_iri – Iri of the class to which the co-relation should be added
crel – CombinedObjectRelation to add
- Returns:
None
- add_data_property(data_prop: DataProperty)[source]
Add an DataProperty to the vocabulary
- Parameters:
data_prop (DataProperty) – DataProperty to be added
- Returns:
None
- add_datatype(datatype: Datatype)[source]
Add a DataType to the vocabulary
- Parameters:
datatype (Datatype) – Datatype to be added
- Returns:
None
- add_individual(individual: Individual)[source]
Add an Individual to the vocabulary
- Parameters:
individual (Individual) – Individual to be added
- Returns:
None
- add_object_property(obj_prop: ObjectProperty)[source]
Add an ObjectProperty to the vocabulary
- Parameters:
obj_prop (ObjectProperty) – ObjectProperty to be added
- Returns:
None
- add_predefined_datatype(datatype: Datatype)[source]
- Add a DataType to the vocabulary, that belongs to the source:
Predefined
- Parameters:
datatype (Datatype) – Datatype to be added
- Returns:
None
- add_relation_for_class(class_iri: str, rel: Relation)[source]
Add a relation object to a class
- Parameters:
class_iri – Iri of the class to which the relation should be added
rel – Relation to add
- Returns:
None
- add_source(source: Source, id: str | None = None)[source]
Add a source to the vocabulary
- Parameters:
source – source to add
id – id of source, if none is given a random id is generated
- Returns:
None