LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
EntityType.h
Go to the documentation of this file.
1// Copyright 2002-2013 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6/************************************************************************
7 *
8 * @file entityType.h
9 * @author Romaric Besancon (romaric.besancon@cea.fr)
10 * @date Mon Jan 22 2007
11 * copyright Copyright (C) 2007-2012 by CEA LIST
12 * Project InformationExtraction
13 *
14 * @brief
15 *
16 *
17 ***********************************************************************/
18
19#ifndef ENTITYTYPE_H
20#define ENTITYTYPE_H
21
22#include "common/LimaCommon.h"
23
24#include <iostream>
25#include <map>
26
27#include <boost/serialization/strong_typedef.hpp>
28
29namespace Lima {
30namespace Common {
31namespace MediaticData {
32
33BOOST_STRONG_TYPEDEF(unsigned short, EntityTypeId);
34BOOST_STRONG_TYPEDEF(unsigned short, EntityGroupId);
35
38{
39 public:
40 EntityType();
41 EntityType(EntityTypeId id, EntityGroupId groupId);
42 EntityType& operator=(const EntityType& et);
43 EntityType(const EntityType& et);
45
46 bool operator==(const EntityType& other) const;
47 bool operator!=(const EntityType& other) const;
48 bool operator<(const EntityType& other) const;
49
50 bool isNull() const;
51
52 EntityTypeId getTypeId() const;
53 EntityGroupId getGroupId() const;
54
55 void setTypeId(EntityTypeId id);
56 void setGroupId(EntityGroupId groupId);
57
58 friend LIMA_MEDIATICDATA_EXPORT QTextStream& operator << (QTextStream&, const EntityType&);
59 friend LIMA_MEDIATICDATA_EXPORT std::ostream& operator << (std::ostream&, const EntityType&);
60 friend LIMA_MEDIATICDATA_EXPORT QDebug& operator << (QDebug&, const EntityType&);
61
62private:
64};
65
66// hierarchy of entity types
69{
70public:
73
74 void addParentLink(const EntityType& child, const EntityType& parent);
75 bool isParent(const EntityType& child, const EntityType& parent) const;
76 bool isAncestor(const EntityType& child, const EntityType& parent) const;
77 // get highest ancestor in the hierarchy (return child itself if has no parent)
78 EntityType getAncestor(const EntityType& child) const;
79 // get first ancestor in the hierarchy (return child itself if has no parent)
80 EntityType getParent(const EntityType& child) const;
81 // get the list of nodes under the given ancestor as a map of child-firstParent tuples
82 bool getChildren(const EntityType& ancestor, std::map<EntityType,EntityType>& childList) const;
83
84private:
86};
87
88} // end namespace
89} // end namespace
90} // end namespace
91
92#endif
QDebug & operator<<(QDebug &qd, const std::string &str)
Definition QsLog.cpp:39
#define LIMA_MEDIATICDATA_EXPORT
Definition LimaCommon.h:132
BOOST_STRONG_TYPEDEF(unsigned short, EntityTypeId)
NAUTITIA.
static bool operator<(const QStringView &entityStr, const TextHtmlEntity &entity)