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 QVector< QVariant > &data)
QVector< 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.


Basic normalization for e.g. renamed properties of older 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).


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.


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().


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.

Member Function Documentation

◆ process()

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

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

Definition at line 86 of file extractorpostprocessor.cpp.

◆ result()

QVector< 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 130 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 143 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

Definition at line 148 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-2022 The KDE developers.
Generated on Wed May 25 2022 03:57:40 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.