KItinerary::ExtractorPostprocessor

Search for usage in LXR

KItinerary::ExtractorPostprocessor Class Reference

#include <extractorpostprocessor.h>

Public Member Functions

 ExtractorPostprocessor (const ExtractorPostprocessor &)=delete
 
 ExtractorPostprocessor (ExtractorPostprocessor &&) noexcept
 
void process (const QList< QVariant > &data)
 
QList< QVariantresult () const
 
void setContextDate (const QDateTime &dt)
 
void setValidationEnabled (bool validate)
 

Detailed Description

Post-process extracted data to filter out garbage and augment data from other sources.

In detail, this performs the tasks listed below for all data elements fed into it.

Normalization

Basic normalization for e.g. renamed properties of older schema.org versions is already covered by JsonLdImportFilter, post-processing covers the more elaborate normalization steps, such as:

  • translate human readable and possibly localized country names into ISO 3166-1 codes.
  • expand IATA BCBP ticket tokens (see IataParser).

Augmentation

That is, add additional information derived from a built-in knowledge base (see KnowledgeDb). This includes:

  • Add timezone information to arrival and departure times.
  • Add geo coordinates and country information to known airports or train stations.

Merge Duplicates

Duplicate elements that might have been the result of two overlapping extractors (e.g. when extracting two different MIME parts of an email referring to the same reservation) are merged.

Validation

At this point, all invalid elements are discarded. The definition of invalid is fairly loose though, and typically only covers elements that are explicitly considered unusable. Examples:

  • A Flight missing a departure day or destination.
  • A LodigingReservation without an attached LodgingBusiness.
  • etc.

Validation can be disabled and done separately using KItinerary::ExtractorValidator, in case you want more control over which elements are considered valid. See setValidationEnabled().

Sorting

Finally the remaining elements are sorted based on their relevant date (see SortUtil). This makes the data usable for basic display right away, but it for example doesn't do multi-traveler aggregation, that's still left for the display layer.

Definition at line 61 of file extractorpostprocessor.h.

Constructor & Destructor Documentation

◆ ExtractorPostprocessor()

ExtractorPostprocessor::ExtractorPostprocessor ( )

Definition at line 59 of file extractorpostprocessor.cpp.

Member Function Documentation

◆ process()

void ExtractorPostprocessor::process ( const QList< QVariant > & data)

This will normalize and augment the given data elements and merge them with already added data elements if applicable.

Definition at line 67 of file extractorpostprocessor.cpp.

◆ result()

QList< QVariant > ExtractorPostprocessor::result ( ) const

This returns the final result of all previously executed processing steps followed by sorting and filtering out all invalid data elements.

Definition at line 116 of file extractorpostprocessor.cpp.

◆ setContextDate()

void ExtractorPostprocessor::setContextDate ( const QDateTime & dt)

The date the reservation(s) processed here have been made, if known.

This is used for determining the year of incomplete dates provided by various sources. Therefore this has to be somewhen before the reservation becomes due.

Definition at line 175 of file extractorpostprocessor.cpp.

◆ setValidationEnabled()

void ExtractorPostprocessor::setValidationEnabled ( bool validate)

Enable or disable validation.

By default this is enabled, and will discard all unknown types and incomplete items. If you need more control over this, disable this here and pass the items through ExtractorValidator yourself (or even use an entirely different validation mechanism entirely).

See also
ExtractorValidator.
Deprecated
Has no functionality anymore, remove and use ExtractorValidator explicitly instead.

Definition at line 180 of file extractorpostprocessor.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:56:37 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.