-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: enable other data meta models
- Loading branch information
Showing
7 changed files
with
65 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/rdf-attribute-table.ts → src/models/facade-x/rdf-attribute-table.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { GeoPackage } from "@ngageoint/geopackage"; | ||
import type * as RDF from "@rdfjs/types"; | ||
import type { GeoPackageOptions } from "../geopackage.js"; | ||
|
||
/** | ||
* The type signature of a quads generating function | ||
* | ||
* @param geopackage The GeoPackage instance | ||
* @param options Options that may guide the generation of the quads. | ||
*/ | ||
export type QuadsGeneratorFunc = ( | ||
geopackage: GeoPackage, | ||
options: GeoPackageOptions, | ||
) => Generator<RDF.Quad>; | ||
|
||
/** Singleton registry of Quad generating models */ | ||
export class ModelRegistry { | ||
private static MODEL_REGISTRY: Record<string, QuadsGeneratorFunc> = {}; | ||
/** | ||
* Register a quads generator | ||
* | ||
* @param modelName Name to register the model by | ||
* @param mainFunc Function that returns a quads generator | ||
*/ | ||
static add(modelName: string, mainFunc: QuadsGeneratorFunc) { | ||
this.MODEL_REGISTRY[modelName] = mainFunc; | ||
} | ||
|
||
/** | ||
* Get a registered quads generator | ||
* | ||
* @param modelName Name of registered generator | ||
*/ | ||
static get(modelName: string): QuadsGeneratorFunc { | ||
return this.MODEL_REGISTRY[modelName]; | ||
} | ||
|
||
/** Return a list of known models */ | ||
static knownModels(): string[] { | ||
return Object.keys(this.MODEL_REGISTRY); | ||
} | ||
} |