-
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.
Merge pull request #11 from culturecreates/feature/recon
Feature/recon
- Loading branch information
Showing
29 changed files
with
358 additions
and
53 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,11 +1,22 @@ | ||
import { Module } from "@nestjs/common"; | ||
import { AppController } from "./controller/app.controller"; | ||
import { AppService } from "./service/app.service"; | ||
import { ManifestController, ReconciliationController } from "./controller"; | ||
import { ManifestService, ReconciliationService } from "./service"; | ||
import { ArtsdataService } from "./service/artsdata"; | ||
import { HttpService } from "./service/http"; | ||
|
||
@Module({ | ||
imports: [], | ||
controllers: [AppController], | ||
providers: [AppService] | ||
controllers: [ | ||
ManifestController, | ||
ReconciliationController | ||
], | ||
providers: [ | ||
ManifestService, | ||
ReconciliationService, | ||
ArtsdataService, | ||
HttpService | ||
|
||
] | ||
}) | ||
export class AppModule { | ||
} |
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 @@ | ||
export * from './system.config'; |
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,8 @@ | ||
import * as dotenv from "dotenv"; | ||
|
||
dotenv.config(); | ||
const { env } = process; | ||
|
||
export const ARTSDATA: { ENDPOINT: string } = { | ||
ENDPOINT: env.ARTSDATA_ENDPOINT || "https://db.artsdata.ca/" | ||
}; |
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 @@ | ||
export const QUERIES = { | ||
|
||
RECONCILITAION_QUERY:` | ||
PREFIX luc: <http://www.ontotext.com/owlim/lucene#> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
PREFIX schema: <http://schema.org/> | ||
SELECT | ||
?originalUri | ||
?score (sample(?names) as ?name) | ||
(sample(?disambiguatingDescriptions) as ?disambiguatingDescription) | ||
?type | ||
?typeLabel | ||
WHERE { | ||
values ?query { "QUERY_PLACE_HOLDER" } | ||
values ?type { TYPE_PLACE_HOLDER } | ||
?originalUri a ?type ; | ||
luc:Name ?query; | ||
rdfs:label ?names ; | ||
luc:score ?score . | ||
FILTER (STRSTARTS(STR(?originalUri),"http://kg.artsdata.ca/resource/K" )) | ||
OPTIONAL { | ||
?originalUri schema:disambiguatingDescription ?disambiguatingDescriptions . | ||
} | ||
OPTIONAL { | ||
?type rdfs:label ?type_label_raw filter(lang(?type_label_raw) = "") | ||
} | ||
OPTIONAL { | ||
?type rdfs:label ?type_label_en filter(lang(?type_label_en) = "en") | ||
} | ||
BIND(COALESCE(?type_label_en, ?type_label_raw, "") as ?typeLabel) | ||
} GROUP BY ?originalUri ?score ?type ?typeLabel | ||
` | ||
|
||
|
||
|
||
}; |
This file was deleted.
Oops, something went wrong.
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,2 @@ | ||
export * from "./manifest" | ||
export * from "./recon" |
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 @@ | ||
export * from "./manifest.controller" |
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,23 @@ | ||
import { Test, TestingModule } from "@nestjs/testing"; | ||
import { ManifestController } from "./manifest.controller"; | ||
import * as MANIFEST from "../../constant/manifest.constant.json"; | ||
import { ManifestService } from "../../service"; | ||
|
||
describe('ManifestController', () => { | ||
let manifestController: ManifestController; | ||
|
||
beforeEach(async () => { | ||
const app: TestingModule = await Test.createTestingModule({ | ||
controllers: [ManifestController], | ||
providers: [ManifestService] | ||
}).compile(); | ||
|
||
manifestController = app.get<ManifestController>(ManifestController); | ||
}); | ||
|
||
describe("manifest", () => { | ||
it("should return Service Manifest", () => { | ||
expect(manifestController.getServiceManifest()).toBe(MANIFEST); | ||
}); | ||
}); | ||
}); |
8 changes: 4 additions & 4 deletions
8
src/controller/app.controller.ts → ...ontroller/manifest/manifest.controller.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./recon.controller" |
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,37 @@ | ||
import { Controller, Get, Query } from "@nestjs/common"; | ||
import { ApiOperation, ApiQuery, ApiResponse, ApiTags } from "@nestjs/swagger"; | ||
import { ReconciliationResponse } from "../../dto"; | ||
import { ReconciliationService } from "../../service"; | ||
import { ReconciliationTypesEnum } from "../../enum"; | ||
|
||
@Controller() | ||
@ApiTags("APIs") | ||
export class ReconciliationController { | ||
constructor(private readonly _reconciliationService: ReconciliationService) { | ||
} | ||
|
||
@Get("/recon") | ||
@ApiOperation({ summary: "Reconcile" }) | ||
@ApiResponse({ status: 200, type: ReconciliationResponse, isArray: true, description: "Reconciliation response" }) | ||
@ApiResponse({ status: 500, description: "Internal server error" }) | ||
@ApiQuery({ | ||
name: "name", | ||
description: "Name of the entity to reconcile", | ||
required: true, | ||
explode: false, | ||
type: String | ||
}) | ||
@ApiQuery({ | ||
name: "type", | ||
description: "Type of the entity to reconcile", | ||
required: true, | ||
explode: false, | ||
enum: Object.values(ReconciliationTypesEnum) | ||
}) | ||
async reconcile( | ||
@Query("name") name: string, | ||
@Query("type") type: string | ||
): Promise<ReconciliationResponse[]> { | ||
return await this._reconciliationService.reconcile(name, type); | ||
} | ||
} |
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,3 @@ | ||
export * from "./manifest.dto"; | ||
export * from "./recon.dto"; | ||
|
Oops, something went wrong.