Skip to content

Commit

Permalink
SzEngine WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
arawinters committed Jan 14, 2025
1 parent 0f63507 commit 2ad5dbf
Show file tree
Hide file tree
Showing 11 changed files with 277 additions and 70 deletions.
Empty file.
1 change: 1 addition & 0 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"szdiagnostic/reinitialize.ts":"tsx szdiagnostic/reinitialize.ts",
"szengine/addRecord.ts":"tsx szengine/addRecord.ts",
"szengine/exportJsonStream.ts":"tsx szengine/exportJsonStream.ts",
"szengine/primeEngine.ts":"tsx szengine/primeEngine.ts",
"szproduct/getVersion.ts": "tsx szproduct/getVersion.ts",
"szproduct/getLicense.ts": "tsx szproduct/getLicense.ts",
"grpc_tools_node_protoc/helloworld.ts": "tsx grpc_tools_node_protoc/helloworld.ts"
Expand Down
5 changes: 3 additions & 2 deletions examples/szengine/addRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const szParamFactory = new SzAbstractFactory(`0.0.0.0:8261`);
const szEngine = szParamFactory.createEngine();

const DATA_SOURCE_CODE = "TEST";
const FLAGS = SzEngineFlags.SZ_WITH_INFO;
const FLAGS = SzEngineFlags.SZ_WITH_INFO; // should be "4611686018427387904" not "1073741824"
//const FLAGS = 4611686018427387904;
const RECORD_DEFINITION = {
"RECORD_TYPE": "PERSON",
"PRIMARY_NAME_LAST": "Smith",
Expand Down Expand Up @@ -35,7 +36,7 @@ const RECORD_DEFINITION = {
'}';*/
const RECORD_ID = "1";

await szEngine.addRecord(DATA_SOURCE_CODE, RECORD_ID, RECORD_DEFINITION).then((resp) => {
await szEngine.addRecord(DATA_SOURCE_CODE, RECORD_ID, RECORD_DEFINITION, FLAGS).then((resp) => {
console.log('Hi!', resp);
});

Expand Down
8 changes: 3 additions & 5 deletions examples/szengine/exportJsonStream.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import { SzSdkAbstractFactory, SzEngineFlags } from '../../dist/@senzing/sz-sdk-nodejs-grpc';
import { SzAbstractFactory, SzEngineFlags } from '../../dist/@senzing/sz-sdk-nodejs-grpc';
import { SzEngine } from '../../dist/@senzing/sz-sdk-nodejs-grpc/szEngine';

const szParamFactory = new SzSdkAbstractFactory(`0.0.0.0:8261`);
const szParamFactory = new SzAbstractFactory(`0.0.0.0:8261`);
const szEngine = szParamFactory.createEngine();

const DATA_SOURCE_CODE = "TEST";
const FLAGS = SzEngineFlags.SZ_WITH_INFO;
const MAX_TIME = 5000;
let RESULT = "";

await szEngine.exportJsonEntityReport(FLAGS).then((resp) => {
szEngine.exportJsonEntityReport(FLAGS).then((resp) => {
console.log(`resp: \n`, resp);
}, (err)=>{
console.error(err);
});

setTimeout(()=> {});

/*exportStream.on('data', (fragment) => {
if((fragment as string).length === 0) {
// close connection
Expand Down
8 changes: 8 additions & 0 deletions examples/szengine/primeEngine.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { SzAbstractFactory } from '../../dist/@senzing/sz-sdk-nodejs-grpc';

const szParamFactory = new SzAbstractFactory(`0.0.0.0:8261`);
const szEngine = szParamFactory.createEngine();

szEngine.primeEngine().then((res) => {
console.log('engine priming');
});
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ export * from './szproduct/szproduct_pb';

export { SzAbstractFactoryOptions, SzAbstractFactory } from "./szfactorycreator/szFactoryCreator";
export { SzEngineFlags } from "./senzing/SzEngineFlags";
export { SzConfig } from "./szConfig";
export { SzConfigManager } from "./szConfigManager";
export { SzDiagnostic } from "./szDiagnostic";
export { SzEngine } from "./szEngine";
export { SzProduct } from "./szProduct";
export * from "./senzing/SzError";
74 changes: 37 additions & 37 deletions src/senzing/SzEngineFlags.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

export class SzEngineFlags {
static SZ_INCLUDE_FEATURE_SCORES = 1 << 26
static SZ_INCLUDE_MATCH_KEY_DETAILS = 1 << 34
static SZ_INCLUDE_FEATURE_SCORES = 1n << 26n;
static SZ_INCLUDE_MATCH_KEY_DETAILS = 1n << 34n;

// Flags for exporting entity data.
static SZ_EXPORT_INCLUDE_MULTI_RECORD_ENTITIES = 1 << 0
static SZ_EXPORT_INCLUDE_POSSIBLY_SAME = 1 << 1
static SZ_EXPORT_INCLUDE_POSSIBLY_RELATED = 1 << 2
static SZ_EXPORT_INCLUDE_NAME_ONLY = 1 << 3
static SZ_EXPORT_INCLUDE_DISCLOSED = 1 << 4
static SZ_EXPORT_INCLUDE_SINGLE_RECORD_ENTITIES = 1 << 5
static SZ_EXPORT_INCLUDE_MULTI_RECORD_ENTITIES = 1n << 0n;
static SZ_EXPORT_INCLUDE_POSSIBLY_SAME = 1n << 1n;
static SZ_EXPORT_INCLUDE_POSSIBLY_RELATED = 1n << 2n;
static SZ_EXPORT_INCLUDE_NAME_ONLY = 1n << 3n;
static SZ_EXPORT_INCLUDE_DISCLOSED = 1n << 4n
static SZ_EXPORT_INCLUDE_SINGLE_RECORD_ENTITIES = 1n << 5n
static SZ_EXPORT_INCLUDE_ALL_ENTITIES = SzEngineFlags.SZ_EXPORT_INCLUDE_MULTI_RECORD_ENTITIES | SzEngineFlags.SZ_EXPORT_INCLUDE_SINGLE_RECORD_ENTITIES
static SZ_EXPORT_INCLUDE_ALL_HAVING_RELATIONSHIPS = (
this.SZ_EXPORT_INCLUDE_POSSIBLY_SAME
Expand All @@ -19,10 +19,10 @@ export class SzEngineFlags {
)

// Flags for outputting entity relation data.
static SZ_ENTITY_INCLUDE_POSSIBLY_SAME_RELATIONS = 1 << 6
static SZ_ENTITY_INCLUDE_POSSIBLY_RELATED_RELATIONS = 1 << 7
static SZ_ENTITY_INCLUDE_NAME_ONLY_RELATIONS = 1 << 8
static SZ_ENTITY_INCLUDE_DISCLOSED_RELATIONS = 1 << 9
static SZ_ENTITY_INCLUDE_POSSIBLY_SAME_RELATIONS = 1n << 6n;
static SZ_ENTITY_INCLUDE_POSSIBLY_RELATED_RELATIONS = 1n << 7n;
static SZ_ENTITY_INCLUDE_NAME_ONLY_RELATIONS = 1n << 8n;
static SZ_ENTITY_INCLUDE_DISCLOSED_RELATIONS = 1n << 9n;
static SZ_ENTITY_INCLUDE_ALL_RELATIONS = (
SzEngineFlags.SZ_ENTITY_INCLUDE_POSSIBLY_SAME_RELATIONS
| SzEngineFlags.SZ_ENTITY_INCLUDE_POSSIBLY_RELATED_RELATIONS
Expand All @@ -32,41 +32,41 @@ export class SzEngineFlags {

// Flags for outputting entity feature data.

static SZ_ENTITY_INCLUDE_ALL_FEATURES = 1 << 10
static SZ_ENTITY_INCLUDE_REPRESENTATIVE_FEATURES = 1 << 11
static SZ_ENTITY_INCLUDE_ALL_FEATURES = 1n << 10n;
static SZ_ENTITY_INCLUDE_REPRESENTATIVE_FEATURES = 1n << 11n;

// Flags for getting extra information about an entity.

static SZ_ENTITY_INCLUDE_ENTITY_NAME = 1 << 12
static SZ_ENTITY_INCLUDE_RECORD_SUMMARY = 1 << 13
static SZ_ENTITY_INCLUDE_RECORD_TYPES = 1 << 28
static SZ_ENTITY_INCLUDE_RECORD_DATA = 1 << 14
static SZ_ENTITY_INCLUDE_RECORD_MATCHING_INFO = 1 << 15
static SZ_ENTITY_INCLUDE_RECORD_JSON_DATA = 1 << 16
static SZ_ENTITY_INCLUDE_RECORD_UNMAPPED_DATA = 1 << 31
static SZ_ENTITY_INCLUDE_RECORD_FEATURE_IDS = 1 << 18
static SZ_ENTITY_INCLUDE_RECORD_FEATURE_DETAILS = 1 << 35
static SZ_ENTITY_INCLUDE_RECORD_FEATURE_STATS = 1 << 36
static SZ_ENTITY_INCLUDE_RELATED_ENTITY_NAME = 1 << 19
static SZ_ENTITY_INCLUDE_RELATED_MATCHING_INFO = 1 << 20
static SZ_ENTITY_INCLUDE_RELATED_RECORD_SUMMARY = 1 << 21
static SZ_ENTITY_INCLUDE_RELATED_RECORD_TYPES = 1 << 29
static SZ_ENTITY_INCLUDE_RELATED_RECORD_DATA = 1 << 22
static SZ_ENTITY_INCLUDE_ENTITY_NAME = 1n << 12n;
static SZ_ENTITY_INCLUDE_RECORD_SUMMARY = 1n << 13n;
static SZ_ENTITY_INCLUDE_RECORD_TYPES = 1n << 28n;
static SZ_ENTITY_INCLUDE_RECORD_DATA = 1n << 14n;
static SZ_ENTITY_INCLUDE_RECORD_MATCHING_INFO = 1n << 15n;
static SZ_ENTITY_INCLUDE_RECORD_JSON_DATA = 1n << 16n;
static SZ_ENTITY_INCLUDE_RECORD_UNMAPPED_DATA = 1n << 31n;
static SZ_ENTITY_INCLUDE_RECORD_FEATURE_IDS = 1n << 18n;
static SZ_ENTITY_INCLUDE_RECORD_FEATURE_DETAILS = 1n << 35n;
static SZ_ENTITY_INCLUDE_RECORD_FEATURE_STATS = 1n << 36n;
static SZ_ENTITY_INCLUDE_RELATED_ENTITY_NAME = 1n << 19n;
static SZ_ENTITY_INCLUDE_RELATED_MATCHING_INFO = 1n << 20n;
static SZ_ENTITY_INCLUDE_RELATED_RECORD_SUMMARY = 1n << 21n;
static SZ_ENTITY_INCLUDE_RELATED_RECORD_TYPES = 1n << 29n;
static SZ_ENTITY_INCLUDE_RELATED_RECORD_DATA = 1n << 22n;

// Flags for extra feature data.
static SZ_ENTITY_INCLUDE_INTERNAL_FEATURES = 1 << 23
static SZ_ENTITY_INCLUDE_FEATURE_STATS = 1 << 24
static SZ_ENTITY_INCLUDE_INTERNAL_FEATURES = 1n << 23n;
static SZ_ENTITY_INCLUDE_FEATURE_STATS = 1n << 24n;

// Flags for finding entity path data.
static SZ_FIND_PATH_STRICT_AVOID = 1 << 25
static SZ_FIND_PATH_INCLUDE_MATCHING_INFO = 1 << 30
static SZ_FIND_NETWORK_INCLUDE_MATCHING_INFO = 1 << 33
static SZ_FIND_PATH_STRICT_AVOID = 1n << 25n;
static SZ_FIND_PATH_INCLUDE_MATCHING_INFO = 1n << 30n;
static SZ_FIND_NETWORK_INCLUDE_MATCHING_INFO = 1n << 33n;

// Flags for including search result feature scores.
static SZ_SEARCH_INCLUDE_STATS = 1 << 27
static SZ_SEARCH_INCLUDE_STATS = 1n << 27n;

// Flag for returning with info responses.
static SZ_WITH_INFO = 1 << 62
static SZ_WITH_INFO = 1n << 62n;

// Flags for searching for entities.

Expand Down Expand Up @@ -112,7 +112,7 @@ export class SzEngineFlags {
)

// The recommended default flag values for exporting entities.
static SZ_EXPORT_DEFAULT_FLAGS = SzEngineFlags.SZ_EXPORT_INCLUDE_ALL_ENTITIES | SzEngineFlags.SZ_ENTITY_DEFAULT_FLAGS
static SZ_EXPORT_DEFAULT_FLAGS = (SzEngineFlags.SZ_EXPORT_INCLUDE_ALL_ENTITIES | SzEngineFlags.SZ_ENTITY_DEFAULT_FLAGS).toString() as unknown as number;

// The recommended default flag values for finding entity paths.
static SZ_FIND_PATH_DEFAULT_FLAGS = (
Expand Down
Loading

0 comments on commit 2ad5dbf

Please sign in to comment.