Senzing C++ SDK
C++ SDK for Senzing v4, patterned after the official C# SDK
Loading...
Searching...
No Matches
SzEngine.hpp
Go to the documentation of this file.
1// SzEngine.hpp -- abstract interface mirroring C# Senzing.Sdk.SzEngine.
2//
3// Full public surface. Flag parameters default to the per-method default
4// constant from SzFlags.hpp (generated from szflags.json), exactly as the C#
5// SDK does. The export handle mirrors the C# `IntPtr` as an opaque raw handle.
6//
7// Methods marked `[SzConfigRetryable]` may throw SzConfigurationException when
8// the active config is stale; the call is safe to retry after reinitialization.
9// (In C# this is an attribute; here it is a documented convention.)
10#ifndef SENZING_SDK_SZENGINE_HPP
11#define SENZING_SDK_SZENGINE_HPP
12
13#include <cstdint>
14#include <set>
15#include <string>
16#include <utility>
17
18#include "senzing/sdk/SzFlags.hpp"
19
20namespace senzing::sdk {
21
25using SzExportHandle = std::uintptr_t;
26
28class SzEngine {
29public:
30 virtual ~SzEngine() = default;
31
33 virtual void PrimeEngine() = 0;
34
36 virtual std::string GetStats() = 0;
37
38 // ---- Data manipulation ----
39 // [SzConfigRetryable]
40 virtual std::string AddRecord(const std::string& dataSourceCode,
41 const std::string& recordID,
42 const std::string& recordDefinition,
43 SzFlags flags = SzAddRecordDefaultFlags) = 0;
44
45 // [SzConfigRetryable]
46 virtual std::string GetRecordPreview(
47 const std::string& recordDefinition,
48 SzFlags flags = SzRecordPreviewDefaultFlags) = 0;
49
50 // [SzConfigRetryable]
51 virtual std::string DeleteRecord(
52 const std::string& dataSourceCode, const std::string& recordID,
53 SzFlags flags = SzDeleteRecordDefaultFlags) = 0;
54
55 // [SzConfigRetryable]
56 virtual std::string ReevaluateRecord(
57 const std::string& dataSourceCode, const std::string& recordID,
58 SzFlags flags = SzReevaluateRecordDefaultFlags) = 0;
59
60 // [SzConfigRetryable]
61 virtual std::string ReevaluateEntity(
62 int64_t entityID, SzFlags flags = SzReevaluateEntityDefaultFlags) = 0;
63
64 // ---- Search ----
65 // [SzConfigRetryable]
66 virtual std::string SearchByAttributes(
67 const std::string& attributes, const std::string& searchProfile,
68 SzFlags flags = SzSearchByAttributesDefaultFlags) = 0;
69
70 // [SzConfigRetryable]
71 virtual std::string SearchByAttributes(
72 const std::string& attributes,
73 SzFlags flags = SzSearchByAttributesDefaultFlags) = 0;
74
75 // [SzConfigRetryable]
76 virtual std::string WhySearch(const std::string& attributes,
77 int64_t entityID,
78 const std::string& searchProfile = "",
79 SzFlags flags = SzWhySearchDefaultFlags) = 0;
80
81 // ---- Retrieval ----
82 // [SzConfigRetryable]
83 virtual std::string GetEntity(int64_t entityID,
84 SzFlags flags = SzEntityDefaultFlags) = 0;
85
86 // [SzConfigRetryable]
87 virtual std::string GetEntity(const std::string& dataSourceCode,
88 const std::string& recordID,
89 SzFlags flags = SzEntityDefaultFlags) = 0;
90
91 // [SzConfigRetryable]
92 virtual std::string GetRecord(const std::string& dataSourceCode,
93 const std::string& recordID,
94 SzFlags flags = SzRecordDefaultFlags) = 0;
95
96 // ---- Interesting entities ----
97 // [SzConfigRetryable]
98 virtual std::string FindInterestingEntities(
99 int64_t entityID,
100 SzFlags flags = SzFindInterestingEntitiesDefaultFlags) = 0;
101
102 // [SzConfigRetryable]
103 virtual std::string FindInterestingEntities(
104 const std::string& dataSourceCode, const std::string& recordID,
105 SzFlags flags = SzFindInterestingEntitiesDefaultFlags) = 0;
106
107 // ---- Path ----
108 // [SzConfigRetryable]
109 virtual std::string FindPath(
110 int64_t startEntityID, int64_t endEntityID, int32_t maxDegrees,
111 const std::set<int64_t>& avoidEntityIDs = {},
112 const std::set<std::string>& requiredDataSources = {},
113 SzFlags flags = SzFindPathDefaultFlags) = 0;
114
115 // [SzConfigRetryable]
116 virtual std::string FindPath(
117 const std::string& startDataSourceCode, const std::string& startRecordID,
118 const std::string& endDataSourceCode, const std::string& endRecordID,
119 int32_t maxDegrees,
120 const std::set<std::pair<std::string, std::string>>& avoidRecordKeys = {},
121 const std::set<std::string>& requiredDataSources = {},
122 SzFlags flags = SzFindPathDefaultFlags) = 0;
123
124 // ---- Network ----
125 // [SzConfigRetryable]
126 virtual std::string FindNetwork(
127 const std::set<int64_t>& entityIDs, int32_t maxDegrees,
128 int32_t buildOutDegrees, int32_t buildOutMaxEntities,
129 SzFlags flags = SzFindNetworkDefaultFlags) = 0;
130
131 // [SzConfigRetryable]
132 virtual std::string FindNetwork(
133 const std::set<std::pair<std::string, std::string>>& recordKeys,
134 int32_t maxDegrees, int32_t buildOutDegrees, int32_t buildOutMaxEntities,
135 SzFlags flags = SzFindNetworkDefaultFlags) = 0;
136
137 // ---- Why / How / Virtual ----
138 // [SzConfigRetryable]
139 virtual std::string WhyRecordInEntity(
140 const std::string& dataSourceCode, const std::string& recordID,
141 SzFlags flags = SzWhyRecordInEntityDefaultFlags) = 0;
142
143 // [SzConfigRetryable]
144 virtual std::string WhyRecords(
145 const std::string& dataSourceCode1, const std::string& recordID1,
146 const std::string& dataSourceCode2, const std::string& recordID2,
147 SzFlags flags = SzWhyRecordsDefaultFlags) = 0;
148
149 // [SzConfigRetryable]
150 virtual std::string WhyEntities(
151 int64_t entityID1, int64_t entityID2,
152 SzFlags flags = SzWhyEntitiesDefaultFlags) = 0;
153
154 // [SzConfigRetryable]
155 virtual std::string HowEntity(int64_t entityID,
156 SzFlags flags = SzHowEntityDefaultFlags) = 0;
157
158 // [SzConfigRetryable]
159 virtual std::string GetVirtualEntity(
160 const std::set<std::pair<std::string, std::string>>& recordKeys,
161 SzFlags flags = SzVirtualEntityDefaultFlags) = 0;
162
163 // ---- Export ----
164 // [SzConfigRetryable]
166 SzFlags flags = SzExportDefaultFlags) = 0;
167
168 // [SzConfigRetryable]
170 const std::string& csvColumnList, SzFlags flags = SzExportDefaultFlags) = 0;
171
172 // [SzConfigRetryable]
173 virtual std::string FetchNext(SzExportHandle exportHandle) = 0;
174
175 virtual void CloseExportReport(SzExportHandle exportHandle) = 0;
176
177 // ---- Redo ----
178 // [SzConfigRetryable]
179 virtual std::string ProcessRedoRecord(const std::string& redoRecord,
180 SzFlags flags = SzRedoDefaultFlags) = 0;
181
182 // [SzConfigRetryable]
183 virtual std::string GetRedoRecord() = 0;
184
185 virtual int64_t CountRedoRecords() = 0;
186};
187
188} // namespace senzing::sdk
189
190#endif // SENZING_SDK_SZENGINE_HPP
The core Senzing entity-resolution engine.
Definition SzEngine.hpp:28
virtual std::string SearchByAttributes(const std::string &attributes, const std::string &searchProfile, SzFlags flags=SzSearchByAttributesDefaultFlags)=0
virtual std::string GetStats()=0
Returns JSON workload statistics for this engine instance.
virtual void PrimeEngine()=0
Pre-loads engine resources to reduce first-call latency.
virtual std::string FetchNext(SzExportHandle exportHandle)=0
virtual std::string GetRedoRecord()=0
virtual std::string SearchByAttributes(const std::string &attributes, SzFlags flags=SzSearchByAttributesDefaultFlags)=0
virtual std::string ProcessRedoRecord(const std::string &redoRecord, SzFlags flags=SzRedoDefaultFlags)=0
virtual std::string GetEntity(int64_t entityID, SzFlags flags=SzEntityDefaultFlags)=0
virtual std::string GetVirtualEntity(const std::set< std::pair< std::string, std::string > > &recordKeys, SzFlags flags=SzVirtualEntityDefaultFlags)=0
virtual std::string WhySearch(const std::string &attributes, int64_t entityID, const std::string &searchProfile="", SzFlags flags=SzWhySearchDefaultFlags)=0
virtual std::string FindPath(const std::string &startDataSourceCode, const std::string &startRecordID, const std::string &endDataSourceCode, const std::string &endRecordID, int32_t maxDegrees, const std::set< std::pair< std::string, std::string > > &avoidRecordKeys={}, const std::set< std::string > &requiredDataSources={}, SzFlags flags=SzFindPathDefaultFlags)=0
virtual ~SzEngine()=default
virtual std::string WhyEntities(int64_t entityID1, int64_t entityID2, SzFlags flags=SzWhyEntitiesDefaultFlags)=0
virtual std::string ReevaluateEntity(int64_t entityID, SzFlags flags=SzReevaluateEntityDefaultFlags)=0
virtual int64_t CountRedoRecords()=0
virtual SzExportHandle ExportCsvEntityReport(const std::string &csvColumnList, SzFlags flags=SzExportDefaultFlags)=0
virtual std::string GetEntity(const std::string &dataSourceCode, const std::string &recordID, SzFlags flags=SzEntityDefaultFlags)=0
virtual std::string DeleteRecord(const std::string &dataSourceCode, const std::string &recordID, SzFlags flags=SzDeleteRecordDefaultFlags)=0
virtual void CloseExportReport(SzExportHandle exportHandle)=0
virtual std::string GetRecord(const std::string &dataSourceCode, const std::string &recordID, SzFlags flags=SzRecordDefaultFlags)=0
virtual std::string AddRecord(const std::string &dataSourceCode, const std::string &recordID, const std::string &recordDefinition, SzFlags flags=SzAddRecordDefaultFlags)=0
virtual std::string FindNetwork(const std::set< int64_t > &entityIDs, int32_t maxDegrees, int32_t buildOutDegrees, int32_t buildOutMaxEntities, SzFlags flags=SzFindNetworkDefaultFlags)=0
virtual std::string WhyRecordInEntity(const std::string &dataSourceCode, const std::string &recordID, SzFlags flags=SzWhyRecordInEntityDefaultFlags)=0
virtual std::string HowEntity(int64_t entityID, SzFlags flags=SzHowEntityDefaultFlags)=0
virtual std::string GetRecordPreview(const std::string &recordDefinition, SzFlags flags=SzRecordPreviewDefaultFlags)=0
virtual std::string FindInterestingEntities(int64_t entityID, SzFlags flags=SzFindInterestingEntitiesDefaultFlags)=0
virtual std::string WhyRecords(const std::string &dataSourceCode1, const std::string &recordID1, const std::string &dataSourceCode2, const std::string &recordID2, SzFlags flags=SzWhyRecordsDefaultFlags)=0
virtual SzExportHandle ExportJsonEntityReport(SzFlags flags=SzExportDefaultFlags)=0
virtual std::string FindInterestingEntities(const std::string &dataSourceCode, const std::string &recordID, SzFlags flags=SzFindInterestingEntitiesDefaultFlags)=0
virtual std::string FindPath(int64_t startEntityID, int64_t endEntityID, int32_t maxDegrees, const std::set< int64_t > &avoidEntityIDs={}, const std::set< std::string > &requiredDataSources={}, SzFlags flags=SzFindPathDefaultFlags)=0
virtual std::string ReevaluateRecord(const std::string &dataSourceCode, const std::string &recordID, SzFlags flags=SzReevaluateRecordDefaultFlags)=0
virtual std::string FindNetwork(const std::set< std::pair< std::string, std::string > > &recordKeys, int32_t maxDegrees, int32_t buildOutDegrees, int32_t buildOutMaxEntities, SzFlags flags=SzFindNetworkDefaultFlags)=0
Definition SzCoreConfig.hpp:20
std::uintptr_t SzExportHandle
Opaque export-report handle, mirroring the C# IntPtr.
Definition SzEngine.hpp:25