@neverblink/ohi 0.17.2 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -8
- package/dist/catalog.d.ts +10 -1
- package/dist/catalog.js +52 -30
- package/dist/generated.d.ts +2 -2
- package/dist/generated.js +1 -1
- package/dist/generated_config.js +1 -1
- package/dist/generated_error.js +1 -1
- package/dist/generated_lock.d.ts +5 -4
- package/dist/generated_lock.js +1 -1
- package/dist/generated_lock_error.js +1 -1
- package/dist/generated_search.d.ts +1 -1
- package/dist/generated_search.js +1 -1
- package/dist/generated_search_request.d.ts +2 -0
- package/dist/generated_search_request.js +1 -1
- package/dist/lock.js +13 -11
- package/dist/publication.d.ts +1 -1
- package/dist/publication.js +1 -10
- package/package.json +16 -7
- package/dist/ajv.d.ts +0 -3
- package/dist/ajv.js +0 -38
- package/dist/catalog-config.schema.json +0 -35
- package/dist/lock.schema.json +0 -111
- package/dist/package.schema.json +0 -225
- package/dist/search-request.schema.json +0 -63
- package/dist/search.schema.json +0 -211
package/README.md
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ohi SDK for TypeScript
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Search ontologies on [ohi.dev](https://ohi.dev), inspect their metadata, download selected files and save file selections.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Works with Node 22 or later and browsers with Fetch. Browsers need CORS access to the catalog, publication and artifact endpoints.
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
|
|
8
|
+
npm install @neverblink/ohi
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Search, inspect the first hit and download its first file:
|
|
12
12
|
|
|
13
|
-
```
|
|
14
|
-
|
|
13
|
+
```typescript
|
|
14
|
+
import { CatalogClient } from "@neverblink/ohi";
|
|
15
|
+
|
|
16
|
+
const client = new CatalogClient();
|
|
17
|
+
const page = await client.search({ q: "sensors", page: 1, per_page: 10 });
|
|
18
|
+
if (page.hits.length > 0) {
|
|
19
|
+
const publication = await client.inspect(page.hits[0].base_url);
|
|
20
|
+
const artifact = publication.artifacts[0];
|
|
21
|
+
const content = await client.get(artifact.url);
|
|
22
|
+
}
|
|
15
23
|
```
|
|
16
24
|
|
|
17
|
-
|
|
25
|
+
`get` returns the file's bytes as a `Uint8Array`. File reading and writing are in `@neverblink/ohi/node`.
|
|
26
|
+
|
|
27
|
+
**See the [SDK documentation](https://ohi.dev/docs/reference/sdks/)** for configuration, file selections, metadata and errors.
|
package/dist/catalog.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Publication } from "./generated.js";
|
|
|
2
2
|
import type { CatalogConfig } from "./generated_config.js";
|
|
3
3
|
import type { CatalogError } from "./generated_error.js";
|
|
4
4
|
import type { SearchRequest } from "./generated_search_request.js";
|
|
5
|
-
import type { SearchResult } from "./generated_search.js";
|
|
5
|
+
import type { SearchHit, SearchResult } from "./generated_search.js";
|
|
6
6
|
export declare class CatalogException extends Error {
|
|
7
7
|
readonly error: CatalogError;
|
|
8
8
|
constructor(error: CatalogError, options?: ErrorOptions);
|
|
@@ -11,8 +11,17 @@ export declare class CatalogException extends Error {
|
|
|
11
11
|
export declare class CatalogClient {
|
|
12
12
|
private readonly config;
|
|
13
13
|
private readonly timeoutMs;
|
|
14
|
+
private readonly base;
|
|
15
|
+
private readonly latestUrl;
|
|
14
16
|
constructor(config?: CatalogConfig);
|
|
15
17
|
search(request: SearchRequest): Promise<SearchResult>;
|
|
18
|
+
/** Return the search hit for the latest version of `namespace/name`, or undefined when the catalog has no such
|
|
19
|
+
* ontology.
|
|
20
|
+
*/
|
|
21
|
+
latest(reference: string): Promise<SearchHit | undefined>;
|
|
22
|
+
/** Fetch the publication at an absolute HTTP(S) URL, of the release `namespace/name@version`, or of the latest
|
|
23
|
+
* version of `namespace/name`.
|
|
24
|
+
*/
|
|
16
25
|
inspect(baseUrl: string): Promise<Publication>;
|
|
17
26
|
get(url: string): Promise<Uint8Array>;
|
|
18
27
|
private request;
|
package/dist/catalog.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import { newAjv } from "./ajv.js";
|
|
2
1
|
import { decodePublication } from "./publication.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import resultSchema from "./search.schema.json" with { type: "json" };
|
|
6
|
-
const ajv = newAjv();
|
|
7
|
-
const validateConfig = ajv.compile(configSchema);
|
|
8
|
-
const validateRequest = ajv.compile(requestSchema);
|
|
9
|
-
const validateResult = ajv.compile(resultSchema);
|
|
10
|
-
const validateUri = ajv.compile({ type: "string", format: "uri" });
|
|
2
|
+
const searchPath = "/search/collections/packages/documents/search";
|
|
3
|
+
const referencePattern = /^([^/@\p{White_Space}`]+)\/([^/@\p{White_Space}`]+)(?:@([^/@\p{White_Space}+`]+))?$/u;
|
|
11
4
|
export class CatalogException extends Error {
|
|
12
5
|
error;
|
|
13
6
|
constructor(error, options) {
|
|
@@ -18,8 +11,6 @@ export class CatalogException extends Error {
|
|
|
18
11
|
}
|
|
19
12
|
function httpUrl(value, operation) {
|
|
20
13
|
try {
|
|
21
|
-
if (!validateUri(value))
|
|
22
|
-
throw new TypeError("Invalid URI.");
|
|
23
14
|
const url = new URL(value);
|
|
24
15
|
if (!(url.protocol === "http:" || url.protocol === "https:") || !url.hostname || url.username || url.password) {
|
|
25
16
|
throw new TypeError("Invalid HTTP(S) URL.");
|
|
@@ -54,12 +45,6 @@ function searchResult(bytes, page, perPage) {
|
|
|
54
45
|
search_cutoff: raw.search_cutoff,
|
|
55
46
|
...(raw.facet_counts === undefined ? {} : { facet_counts: raw.facet_counts }),
|
|
56
47
|
};
|
|
57
|
-
if (!validateResult(result))
|
|
58
|
-
throw new Error(ajv.errorsText(validateResult.errors));
|
|
59
|
-
if (!Number.isSafeInteger(result.total) ||
|
|
60
|
-
result.facet_counts?.some(({ counts }) => counts.some(({ count }) => !Number.isSafeInteger(count)))) {
|
|
61
|
-
throw new Error("Search integers exceed the supported range.");
|
|
62
|
-
}
|
|
63
48
|
if (result.page !== page || result.per_page !== perPage || result.hits.length > perPage) {
|
|
64
49
|
throw new Error("Search response does not match the requested page and page size.");
|
|
65
50
|
}
|
|
@@ -76,12 +61,10 @@ function searchResult(bytes, page, perPage) {
|
|
|
76
61
|
export class CatalogClient {
|
|
77
62
|
config;
|
|
78
63
|
timeoutMs;
|
|
64
|
+
base;
|
|
65
|
+
latestUrl;
|
|
79
66
|
constructor(config = {}) {
|
|
80
67
|
const url = config.search_url;
|
|
81
|
-
if (!validateConfig(config)) {
|
|
82
|
-
throw new CatalogException({ code: "INVALID_INPUT", operation: "CONFIGURE",
|
|
83
|
-
...(typeof url === "string" ? { url } : {}), message: ajv.errorsText(validateConfig.errors) });
|
|
84
|
-
}
|
|
85
68
|
if ((config.search_url === undefined) !== (config.query_by === undefined)) {
|
|
86
69
|
throw new CatalogException({ code: "INVALID_INPUT", operation: "CONFIGURE",
|
|
87
70
|
...(url === undefined ? {} : { url }), message: "Supply both search_url and query_by, or omit both." });
|
|
@@ -92,6 +75,10 @@ export class CatalogClient {
|
|
|
92
75
|
throw new CatalogException({ code: "INVALID_INPUT", operation: "CONFIGURE", url,
|
|
93
76
|
message: "Supply a search_url without a query or fragment." });
|
|
94
77
|
}
|
|
78
|
+
if (!url.endsWith(searchPath)) {
|
|
79
|
+
throw new CatalogException({ code: "INVALID_INPUT", operation: "CONFIGURE", url,
|
|
80
|
+
message: `Supply a search_url that ends with ${searchPath}.` });
|
|
81
|
+
}
|
|
95
82
|
}
|
|
96
83
|
this.config = {
|
|
97
84
|
...config,
|
|
@@ -99,15 +86,11 @@ export class CatalogClient {
|
|
|
99
86
|
query_by: config.query_by ?? "title,name,description,namespace",
|
|
100
87
|
};
|
|
101
88
|
this.timeoutMs = config.timeout_ms ?? 30000;
|
|
89
|
+
this.base = this.config.search_url.slice(0, -searchPath.length);
|
|
90
|
+
this.latestUrl = `${this.base}/search/collections/packages_latest/documents/search`;
|
|
102
91
|
}
|
|
103
92
|
async search(request) {
|
|
104
|
-
const endpoint = this.config.search_url;
|
|
105
|
-
if (!validateRequest(request) ||
|
|
106
|
-
(request.page !== undefined && !Number.isSafeInteger(request.page)) ||
|
|
107
|
-
(request.max_facet_values !== undefined && !Number.isSafeInteger(request.max_facet_values))) {
|
|
108
|
-
throw new CatalogException({ code: "INVALID_INPUT", operation: "SEARCH",
|
|
109
|
-
url: endpoint, message: "Supply a valid search query and representable integer parameters." });
|
|
110
|
-
}
|
|
93
|
+
const endpoint = request.all_releases ? this.config.search_url : this.latestUrl;
|
|
111
94
|
const page = request.page ?? 1;
|
|
112
95
|
const perPage = request.per_page ?? 10;
|
|
113
96
|
const url = new URL(endpoint);
|
|
@@ -132,13 +115,52 @@ export class CatalogClient {
|
|
|
132
115
|
message: "The search response is invalid." }, { cause });
|
|
133
116
|
}
|
|
134
117
|
}
|
|
118
|
+
/** Return the search hit for the latest version of `namespace/name`, or undefined when the catalog has no such
|
|
119
|
+
* ontology.
|
|
120
|
+
*/
|
|
121
|
+
async latest(reference) {
|
|
122
|
+
const parts = referencePattern.exec(reference);
|
|
123
|
+
if (parts === null || parts[3] !== undefined) {
|
|
124
|
+
throw new CatalogException({ code: "INVALID_INPUT", operation: "SEARCH", url: reference,
|
|
125
|
+
message: "Supply an ontology reference namespace/name without a version." });
|
|
126
|
+
}
|
|
127
|
+
const [, namespace, name] = parts;
|
|
128
|
+
const filter = `namespace:=\`${namespace}\` && name:=\`${name}\``;
|
|
129
|
+
const result = await this.search({ q: "*", filter_by: filter });
|
|
130
|
+
// The := filter ignores case and separators, so look-alikes such as w3c/DCAT can match.
|
|
131
|
+
return result.hits.find((hit) => hit.namespace === namespace && hit.name === name);
|
|
132
|
+
}
|
|
133
|
+
/** Fetch the publication at an absolute HTTP(S) URL, of the release `namespace/name@version`, or of the latest
|
|
134
|
+
* version of `namespace/name`.
|
|
135
|
+
*/
|
|
135
136
|
async inspect(baseUrl) {
|
|
136
|
-
|
|
137
|
+
let url = baseUrl;
|
|
138
|
+
const parts = referencePattern.exec(baseUrl);
|
|
139
|
+
if (parts !== null) {
|
|
140
|
+
const [, namespace, name, version] = parts;
|
|
141
|
+
if (version !== undefined) {
|
|
142
|
+
url = `${this.base}/files/packages/${[namespace, name, version].map(encodeURIComponent).join("/")}/`;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
const hit = await this.latest(baseUrl);
|
|
146
|
+
if (hit === undefined) {
|
|
147
|
+
throw new CatalogException({ code: "HTTP_ERROR", operation: "INSPECT", url: baseUrl, status: 404,
|
|
148
|
+
message: `No ontology matches ${baseUrl}.` });
|
|
149
|
+
}
|
|
150
|
+
url = hit.base_url;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
else if (!/^https?:\/\//i.test(baseUrl)) {
|
|
154
|
+
// new URL repairs "http:/host" and strips tabs, so require the literal prefix before parsing.
|
|
155
|
+
throw new CatalogException({ code: "INVALID_INPUT", operation: "INSPECT", url: baseUrl,
|
|
156
|
+
message: "Supply an absolute HTTP(S) URL or an ontology reference namespace/name[@version]." });
|
|
157
|
+
}
|
|
158
|
+
const bytes = await this.request(httpUrl(url, "INSPECT"), "INSPECT", url);
|
|
137
159
|
try {
|
|
138
160
|
return decodePublication(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
139
161
|
}
|
|
140
162
|
catch (cause) {
|
|
141
|
-
throw new CatalogException({ code: "INVALID_RESPONSE", operation: "INSPECT", url
|
|
163
|
+
throw new CatalogException({ code: "INVALID_RESPONSE", operation: "INSPECT", url, status: 200,
|
|
142
164
|
message: "The publication metadata is invalid." }, { cause });
|
|
143
165
|
}
|
|
144
166
|
}
|
package/dist/generated.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export interface Artifact {
|
|
|
6
6
|
origin: ArtifactOrigin;
|
|
7
7
|
/** Permanent absolute URLs of the entry files from which this artifact's ontology is loaded. */
|
|
8
8
|
roots: string[];
|
|
9
|
-
/** SHA-256 of the
|
|
9
|
+
/** SHA-256 of the file bytes before HTTP content encoding. */
|
|
10
10
|
sha256: string;
|
|
11
11
|
/** Byte length of the final immutable artifact file, before HTTP content encoding. Measured from the same bytes as sha256. */
|
|
12
12
|
size_bytes: number;
|
|
@@ -34,7 +34,7 @@ export interface Publication {
|
|
|
34
34
|
keywords: string[];
|
|
35
35
|
/** Reported license names or standard identifiers such as Apache-2.0. Empty means no information supplied. The list specifies neither AND nor OR combination semantics. */
|
|
36
36
|
licenses: string[];
|
|
37
|
-
/** Short catalog identifier, qualified by namespace. The namespace/name pair identifies the same ontology across releases.
|
|
37
|
+
/** Short catalog identifier, qualified by namespace. The namespace/name pair identifies the same ontology across releases. */
|
|
38
38
|
name: string;
|
|
39
39
|
/** Namespace qualifying the ontology name, such as w3c in w3c/prov-o. */
|
|
40
40
|
namespace: string;
|
package/dist/generated.js
CHANGED
package/dist/generated_config.js
CHANGED
package/dist/generated_error.js
CHANGED
package/dist/generated_lock.d.ts
CHANGED
|
@@ -5,16 +5,15 @@ export interface ArtifactSelection {
|
|
|
5
5
|
/** Permanent absolute download URL of an immutable ontology file. */
|
|
6
6
|
url: string;
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
8
|
+
/** Direct selections and their artifact files. */
|
|
9
9
|
export interface Lock {
|
|
10
|
-
/**
|
|
10
|
+
/** Each (base_url, url) pair is unique. Every selection matches a file by that pair. */
|
|
11
11
|
files: LockedFile[];
|
|
12
|
-
/**
|
|
12
|
+
/** Version 1 omits file hashes. Version 2 requires sha256 for every file. */
|
|
13
13
|
format_version: number;
|
|
14
14
|
/** Direct publication and artifact selections in supplied order. */
|
|
15
15
|
selections: ArtifactSelection[];
|
|
16
16
|
}
|
|
17
|
-
/** One artifact download identity and format. Excludes entry roots and integrity metadata. */
|
|
18
17
|
export interface LockedFile {
|
|
19
18
|
/** Permanent absolute URL identifying one exact immutable publication. GET this exact URL returns its publication JSON. Do not append a filename. */
|
|
20
19
|
base_url: string;
|
|
@@ -22,6 +21,8 @@ export interface LockedFile {
|
|
|
22
21
|
format: Format;
|
|
23
22
|
/** Permanent absolute download URL of an immutable ontology file. */
|
|
24
23
|
url: string;
|
|
24
|
+
/** SHA-256 of the file bytes before HTTP content encoding. */
|
|
25
|
+
sha256?: string;
|
|
25
26
|
}
|
|
26
27
|
/** A combination of ontology language and syntax. */
|
|
27
28
|
export type Format = "owl-turtle" | "owl-rdfxml" | "rdfs-turtle" | "linkml-yaml" | "ossie-yaml";
|
package/dist/generated_lock.js
CHANGED
|
@@ -26,7 +26,7 @@ export interface SearchHit {
|
|
|
26
26
|
keywords?: string[];
|
|
27
27
|
/** Reported license names or standard identifiers such as Apache-2.0. Empty means no information supplied. The list specifies neither AND nor OR combination semantics. */
|
|
28
28
|
licenses: string[];
|
|
29
|
-
/** Short catalog identifier, qualified by namespace. The namespace/name pair identifies the same ontology across releases.
|
|
29
|
+
/** Short catalog identifier, qualified by namespace. The namespace/name pair identifies the same ontology across releases. */
|
|
30
30
|
name: string;
|
|
31
31
|
/** Namespace qualifying the ontology name, such as w3c in w3c/prov-o. */
|
|
32
32
|
namespace: string;
|
package/dist/generated_search.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Query and options for retrieving one page of ontology publications. */
|
|
2
2
|
export interface SearchRequest {
|
|
3
|
+
/** Search every release instead of each ontology's latest version. */
|
|
4
|
+
all_releases?: boolean;
|
|
3
5
|
/** Typesense facet expression over facetable fields. */
|
|
4
6
|
facet_by?: string;
|
|
5
7
|
/** Typesense filter expression over filterable fields. */
|
package/dist/lock.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { newAjv } from "./ajv.js";
|
|
2
|
-
import schema from "./lock.schema.json" with { type: "json" };
|
|
3
|
-
const ajv = newAjv();
|
|
4
|
-
const validate = ajv.compile(schema);
|
|
5
1
|
export class LockException extends Error {
|
|
6
2
|
error;
|
|
7
3
|
constructor(error, options) {
|
|
@@ -21,19 +17,25 @@ function uniquePairs(records, field) {
|
|
|
21
17
|
}
|
|
22
18
|
function checkedLock(data, operation) {
|
|
23
19
|
if (typeof data === "object" && data !== null && !Array.isArray(data) &&
|
|
24
|
-
"format_version" in data && Number.isInteger(data.format_version) &&
|
|
20
|
+
"format_version" in data && Number.isInteger(data.format_version) &&
|
|
21
|
+
data.format_version !== 1 && data.format_version !== 2) {
|
|
25
22
|
throw new LockException({ code: "UNSUPPORTED_VERSION", operation,
|
|
26
|
-
message: `Unsupported lock revision ${data.format_version}. Supply revision 1 or use a reader supporting this revision.` });
|
|
23
|
+
message: `Unsupported lock revision ${data.format_version}. Supply revision 1 or 2 or use a reader supporting this revision.` });
|
|
27
24
|
}
|
|
28
25
|
try {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
const lock = data;
|
|
27
|
+
if (lock.format_version === 1 && lock.files.some((file) => file.sha256 !== undefined)) {
|
|
28
|
+
throw new Error("Revision 1 files must omit sha256.");
|
|
29
|
+
}
|
|
30
|
+
if (lock.format_version === 2 && lock.files.some((file) => file.sha256 === undefined)) {
|
|
31
|
+
throw new Error("Revision 2 files require sha256.");
|
|
32
|
+
}
|
|
33
|
+
const selections = uniquePairs(lock.selections, "selections");
|
|
34
|
+
const files = uniquePairs(lock.files, "files");
|
|
33
35
|
if ([...selections].some((selection) => !files.has(selection))) {
|
|
34
36
|
throw new Error("Every selection must have a corresponding file record.");
|
|
35
37
|
}
|
|
36
|
-
return
|
|
38
|
+
return lock;
|
|
37
39
|
}
|
|
38
40
|
catch (cause) {
|
|
39
41
|
throw new LockException({ code: "INVALID_LOCK", operation,
|
package/dist/publication.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Publication } from "./generated.js";
|
|
2
|
-
/** Decode publication metadata,
|
|
2
|
+
/** Decode publication metadata, discarding extras. Field values are not validated. */
|
|
3
3
|
export declare function decodePublication(text: string): Publication;
|
package/dist/publication.js
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import schema from "./package.schema.json" with { type: "json" };
|
|
3
|
-
const ajv = newAjv();
|
|
4
|
-
const validate = ajv.compile(schema);
|
|
5
|
-
/** Decode publication metadata, validating consumed fields and discarding extras. */
|
|
1
|
+
/** Decode publication metadata, discarding extras. Field values are not validated. */
|
|
6
2
|
export function decodePublication(text) {
|
|
7
3
|
const data = JSON.parse(text);
|
|
8
|
-
if (!validate(data))
|
|
9
|
-
throw new Error(ajv.errorsText(validate.errors));
|
|
10
4
|
if (data.preferred_prefix !== undefined && data.namespace_iri === undefined) {
|
|
11
5
|
throw new Error("preferred_prefix requires namespace_iri");
|
|
12
6
|
}
|
|
13
|
-
if (data.artifacts.some(({ size_bytes }) => !Number.isSafeInteger(size_bytes))) {
|
|
14
|
-
throw new Error("artifact size_bytes exceeds the supported integer range");
|
|
15
|
-
}
|
|
16
7
|
const artifactUrls = data.artifacts.map(({ url }) => url);
|
|
17
8
|
if (new Set(artifactUrls).size !== artifactUrls.length) {
|
|
18
9
|
throw new Error("artifacts must have unique URLs");
|
package/package.json
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neverblink/ohi",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.18.1",
|
|
4
|
+
"description": "Search ontologies on ohi.dev, inspect their metadata and download their files.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
+
"homepage": "https://ohi.dev/docs/reference/sdks/",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/NeverBlink-OSS/
|
|
9
|
+
"url": "git+https://github.com/NeverBlink-OSS/ohi.git",
|
|
9
10
|
"directory": "ohi/typescript"
|
|
10
11
|
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/NeverBlink-OSS/ohi/issues"
|
|
14
|
+
},
|
|
15
|
+
"author": "NeverBlink (https://neverblink.eu)",
|
|
16
|
+
"keywords": [
|
|
17
|
+
"ohi",
|
|
18
|
+
"ontology",
|
|
19
|
+
"owl",
|
|
20
|
+
"rdf",
|
|
21
|
+
"linkml",
|
|
22
|
+
"catalog"
|
|
23
|
+
],
|
|
11
24
|
"publishConfig": {
|
|
12
25
|
"access": "public"
|
|
13
26
|
},
|
|
@@ -28,10 +41,6 @@
|
|
|
28
41
|
"test": "npm run build && node --test test/*.test.mjs",
|
|
29
42
|
"test:browser": "npm run build && node --test test/browser.mjs"
|
|
30
43
|
},
|
|
31
|
-
"dependencies": {
|
|
32
|
-
"ajv": "8.20.0",
|
|
33
|
-
"ajv-formats": "3.0.1"
|
|
34
|
-
},
|
|
35
44
|
"devDependencies": {
|
|
36
45
|
"@types/node": "22.20.5",
|
|
37
46
|
"esbuild": "0.28.2",
|
package/dist/ajv.d.ts
DELETED
package/dist/ajv.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Ajv2020 } from "ajv/dist/2020.js";
|
|
2
|
-
import addFormats from "ajv-formats";
|
|
3
|
-
/** A validator that knows every format the generated schemas use. */
|
|
4
|
-
export function newAjv() {
|
|
5
|
-
const ajv = new Ajv2020();
|
|
6
|
-
// The CommonJS plugin exposes its callable default under NodeNext.
|
|
7
|
-
addFormats.default(ajv, ["uri", "date-time"]);
|
|
8
|
-
// ajv-formats has no `iri`. RFC 3987 maps an IRI to a URI by percent-encoding its non-ASCII
|
|
9
|
-
// characters, so an IRI is valid when that URI is.
|
|
10
|
-
const isUri = ajv.compile({ type: "string", format: "uri" });
|
|
11
|
-
ajv.addFormat("iri", (s) => {
|
|
12
|
-
const uri = toUri(s);
|
|
13
|
-
return uri !== undefined && isUri(uri);
|
|
14
|
-
});
|
|
15
|
-
return ajv;
|
|
16
|
-
}
|
|
17
|
-
/** The URI for an IRI, or undefined if the IRI has a character that is neither ASCII nor `ucschar`. */
|
|
18
|
-
function toUri(iri) {
|
|
19
|
-
let uri = "";
|
|
20
|
-
for (const c of iri) {
|
|
21
|
-
const cp = c.codePointAt(0);
|
|
22
|
-
if (cp < 0x80)
|
|
23
|
-
uri += c;
|
|
24
|
-
else if (isUcsChar(cp))
|
|
25
|
-
uri += encodeURIComponent(c);
|
|
26
|
-
else
|
|
27
|
-
return undefined;
|
|
28
|
-
}
|
|
29
|
-
return uri;
|
|
30
|
-
}
|
|
31
|
-
/** True for a code point in RFC 3987's `ucschar`, which an IRI may carry unencoded. */
|
|
32
|
-
function isUcsChar(cp) {
|
|
33
|
-
return (cp >= 0xa0 && cp <= 0xd7ff) || (cp >= 0xf900 && cp <= 0xfdcf) ||
|
|
34
|
-
(cp >= 0xfdf0 && cp <= 0xffef) ||
|
|
35
|
-
// Planes 1 to 13, each without its last two code points, then most of plane 14.
|
|
36
|
-
(cp >= 0x10000 && cp <= 0xdfffd && (cp & 0xffff) <= 0xfffd) ||
|
|
37
|
-
(cp >= 0xe1000 && cp <= 0xefffd);
|
|
38
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://ohi.neverblink.eu/contracts/catalog-config",
|
|
4
|
-
"$ref": "#/$defs/CatalogConfig",
|
|
5
|
-
"$defs": {
|
|
6
|
-
"CatalogConfig": {
|
|
7
|
-
"title": "CatalogConfig",
|
|
8
|
-
"type": "object",
|
|
9
|
-
"properties": {
|
|
10
|
-
"search_url": {
|
|
11
|
-
"title": "search_url",
|
|
12
|
-
"description": "Complete HTTP search endpoint, including its collection path. Omit both search_url and query_by to use https://api.ohi.dev/search/collections/packages/documents/search. Supply both to select another catalog.",
|
|
13
|
-
"type": "string",
|
|
14
|
-
"format": "iri"
|
|
15
|
-
},
|
|
16
|
-
"query_by": {
|
|
17
|
-
"title": "query_by",
|
|
18
|
-
"description": "Comma-separated indexed fields used for text search. Omit both query_by and search_url to use title,name,description,namespace at ohi.dev. Supply both to select another catalog.",
|
|
19
|
-
"type": "string",
|
|
20
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
21
|
-
},
|
|
22
|
-
"timeout_ms": {
|
|
23
|
-
"title": "timeout_ms",
|
|
24
|
-
"description": "Positive native request timeout in milliseconds. Omitted means 30000.",
|
|
25
|
-
"type": "integer",
|
|
26
|
-
"minimum": 1,
|
|
27
|
-
"maximum": 2147483647
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"additionalProperties": false
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"title": "Catalog connection settings",
|
|
34
|
-
"description": "Search endpoint and request timeout settings for a catalog client."
|
|
35
|
-
}
|
package/dist/lock.schema.json
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://ohi.neverblink.eu/contracts/lock",
|
|
4
|
-
"$ref": "#/$defs/Lock",
|
|
5
|
-
"$defs": {
|
|
6
|
-
"Lock": {
|
|
7
|
-
"title": "Lock",
|
|
8
|
-
"description": "Exact direct selections and the complete file set supplied by the application.",
|
|
9
|
-
"type": "object",
|
|
10
|
-
"required": [
|
|
11
|
-
"format_version",
|
|
12
|
-
"files",
|
|
13
|
-
"selections"
|
|
14
|
-
],
|
|
15
|
-
"properties": {
|
|
16
|
-
"format_version": {
|
|
17
|
-
"title": "format_version",
|
|
18
|
-
"description": "Lock record revision, independent of ontology and publication schema versions.",
|
|
19
|
-
"type": "integer",
|
|
20
|
-
"minimum": 1,
|
|
21
|
-
"maximum": 1
|
|
22
|
-
},
|
|
23
|
-
"files": {
|
|
24
|
-
"title": "files",
|
|
25
|
-
"description": "Complete supplied artifact download records in supplied order. Each selection must match one file by exact base_url and url. Each pair occurs once.",
|
|
26
|
-
"type": "array",
|
|
27
|
-
"items": {
|
|
28
|
-
"$ref": "#/$defs/LockedFile"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"selections": {
|
|
32
|
-
"title": "selections",
|
|
33
|
-
"description": "Direct publication and artifact selections in supplied order.",
|
|
34
|
-
"type": "array",
|
|
35
|
-
"items": {
|
|
36
|
-
"$ref": "#/$defs/ArtifactSelection"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"additionalProperties": false
|
|
41
|
-
},
|
|
42
|
-
"LockedFile": {
|
|
43
|
-
"title": "LockedFile",
|
|
44
|
-
"description": "One artifact download identity and format. Excludes entry roots and integrity metadata.",
|
|
45
|
-
"type": "object",
|
|
46
|
-
"required": [
|
|
47
|
-
"format",
|
|
48
|
-
"base_url",
|
|
49
|
-
"url"
|
|
50
|
-
],
|
|
51
|
-
"properties": {
|
|
52
|
-
"format": {
|
|
53
|
-
"$ref": "#/$defs/Format",
|
|
54
|
-
"title": "format",
|
|
55
|
-
"description": "Ontology language and syntax of the artifact."
|
|
56
|
-
},
|
|
57
|
-
"base_url": {
|
|
58
|
-
"title": "base_url",
|
|
59
|
-
"description": "Permanent absolute URL identifying one exact immutable publication. GET this exact URL returns its publication JSON. Do not append a filename.",
|
|
60
|
-
"type": "string",
|
|
61
|
-
"format": "iri"
|
|
62
|
-
},
|
|
63
|
-
"url": {
|
|
64
|
-
"title": "url",
|
|
65
|
-
"description": "Permanent absolute download URL of an immutable ontology file.",
|
|
66
|
-
"type": "string",
|
|
67
|
-
"format": "iri"
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
"additionalProperties": false
|
|
71
|
-
},
|
|
72
|
-
"ArtifactSelection": {
|
|
73
|
-
"title": "ArtifactSelection",
|
|
74
|
-
"description": "Exact publication identity and artifact download URL, compared without normalization.",
|
|
75
|
-
"type": "object",
|
|
76
|
-
"required": [
|
|
77
|
-
"base_url",
|
|
78
|
-
"url"
|
|
79
|
-
],
|
|
80
|
-
"properties": {
|
|
81
|
-
"base_url": {
|
|
82
|
-
"title": "base_url",
|
|
83
|
-
"description": "Permanent absolute URL identifying one exact immutable publication. GET this exact URL returns its publication JSON. Do not append a filename.",
|
|
84
|
-
"type": "string",
|
|
85
|
-
"format": "iri"
|
|
86
|
-
},
|
|
87
|
-
"url": {
|
|
88
|
-
"title": "url",
|
|
89
|
-
"description": "Permanent absolute download URL of an immutable ontology file.",
|
|
90
|
-
"type": "string",
|
|
91
|
-
"format": "iri"
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
"additionalProperties": false
|
|
95
|
-
},
|
|
96
|
-
"Format": {
|
|
97
|
-
"title": "Format",
|
|
98
|
-
"description": "A combination of ontology language and syntax.",
|
|
99
|
-
"type": "string",
|
|
100
|
-
"enum": [
|
|
101
|
-
"owl-turtle",
|
|
102
|
-
"owl-rdfxml",
|
|
103
|
-
"rdfs-turtle",
|
|
104
|
-
"linkml-yaml",
|
|
105
|
-
"ossie-yaml"
|
|
106
|
-
]
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
"title": "Supplied complete file lock",
|
|
110
|
-
"description": "Exact direct selections and the complete file set supplied by the application."
|
|
111
|
-
}
|
package/dist/package.schema.json
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://ohi.neverblink.eu/contracts/package",
|
|
4
|
-
"$ref": "#/$defs/Publication",
|
|
5
|
-
"$defs": {
|
|
6
|
-
"Publication": {
|
|
7
|
-
"title": "Publication",
|
|
8
|
-
"description": "One immutable release of one ontology, including its metadata, artifacts and dependencies. Package, publication and release refer to the same entity.",
|
|
9
|
-
"type": "object",
|
|
10
|
-
"required": [
|
|
11
|
-
"name",
|
|
12
|
-
"description",
|
|
13
|
-
"schema_version",
|
|
14
|
-
"version",
|
|
15
|
-
"publisher",
|
|
16
|
-
"keywords",
|
|
17
|
-
"title",
|
|
18
|
-
"dependencies",
|
|
19
|
-
"published_at",
|
|
20
|
-
"namespace",
|
|
21
|
-
"licenses",
|
|
22
|
-
"artifacts",
|
|
23
|
-
"base_url"
|
|
24
|
-
],
|
|
25
|
-
"properties": {
|
|
26
|
-
"name": {
|
|
27
|
-
"title": "name",
|
|
28
|
-
"description": "Short catalog identifier, qualified by namespace. The namespace/name pair identifies the same ontology across releases. URLs must not be derived from this identifier.",
|
|
29
|
-
"type": "string",
|
|
30
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
31
|
-
},
|
|
32
|
-
"description": {
|
|
33
|
-
"title": "description",
|
|
34
|
-
"description": "Short description of the ontology's domain and intended use.",
|
|
35
|
-
"type": "string",
|
|
36
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
37
|
-
},
|
|
38
|
-
"schema_version": {
|
|
39
|
-
"title": "schema_version",
|
|
40
|
-
"description": "Metadata contract revision, independent of the ontology's version.",
|
|
41
|
-
"type": "integer",
|
|
42
|
-
"minimum": 2,
|
|
43
|
-
"maximum": 2
|
|
44
|
-
},
|
|
45
|
-
"version": {
|
|
46
|
-
"title": "version",
|
|
47
|
-
"description": "Complete publication version label, including amendments.",
|
|
48
|
-
"type": "string",
|
|
49
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
50
|
-
},
|
|
51
|
-
"namespace_iri": {
|
|
52
|
-
"title": "namespace_iri",
|
|
53
|
-
"description": "Optional preferred primary RDF term namespace. Preserve the complete value including any trailing delimiter. Not the catalog namespace and not necessarily the ontology IRI.",
|
|
54
|
-
"type": "string",
|
|
55
|
-
"format": "iri"
|
|
56
|
-
},
|
|
57
|
-
"publisher": {
|
|
58
|
-
"title": "publisher",
|
|
59
|
-
"description": "Name of the upstream person or organization responsible for publishing the ontology. Not inferred from catalog namespace.",
|
|
60
|
-
"type": "string",
|
|
61
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
62
|
-
},
|
|
63
|
-
"keywords": {
|
|
64
|
-
"title": "keywords",
|
|
65
|
-
"description": "Keywords describing the ontology's subject. An empty list means no keywords are provided.",
|
|
66
|
-
"type": "array",
|
|
67
|
-
"items": {
|
|
68
|
-
"type": "string"
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
"title": {
|
|
72
|
-
"title": "title",
|
|
73
|
-
"description": "Display title of the ontology.",
|
|
74
|
-
"type": "string",
|
|
75
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
76
|
-
},
|
|
77
|
-
"dependencies": {
|
|
78
|
-
"title": "dependencies",
|
|
79
|
-
"description": "Complete set of direct and indirect runtime dependency publications, excluding this publication. Each base_url occurs once. An empty list means this publication has no runtime dependencies.",
|
|
80
|
-
"type": "array",
|
|
81
|
-
"items": {
|
|
82
|
-
"$ref": "#/$defs/Dependency"
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
"published_at": {
|
|
86
|
-
"title": "published_at",
|
|
87
|
-
"description": "First successful Hub publication time for this immutable release. Backend emits UTC date-time text with Z. Consumers accept timezone-bearing RFC 3339 text. Fixed for the lifetime of this publication. Not an upstream release date.",
|
|
88
|
-
"type": "string",
|
|
89
|
-
"format": "date-time"
|
|
90
|
-
},
|
|
91
|
-
"namespace": {
|
|
92
|
-
"title": "namespace",
|
|
93
|
-
"description": "Namespace qualifying the ontology name, such as w3c in w3c/prov-o.",
|
|
94
|
-
"type": "string",
|
|
95
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
96
|
-
},
|
|
97
|
-
"licenses": {
|
|
98
|
-
"title": "licenses",
|
|
99
|
-
"description": "Reported license names or standard identifiers such as Apache-2.0. Empty means no information supplied. The list specifies neither AND nor OR combination semantics.",
|
|
100
|
-
"type": "array",
|
|
101
|
-
"items": {
|
|
102
|
-
"type": "string",
|
|
103
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
"artifacts": {
|
|
107
|
-
"title": "artifacts",
|
|
108
|
-
"description": "Available artifacts of this ontology. Each artifact URL occurs once. Multiple artifacts may share a format.",
|
|
109
|
-
"type": "array",
|
|
110
|
-
"minItems": 1,
|
|
111
|
-
"items": {
|
|
112
|
-
"$ref": "#/$defs/Artifact"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
"preferred_prefix": {
|
|
116
|
-
"title": "preferred_prefix",
|
|
117
|
-
"description": "Optional abbreviation for namespace_iri, without whitespace or a colon. Requires namespace_iri. This constraint does not certify prefix syntax for every ontology language.",
|
|
118
|
-
"type": "string",
|
|
119
|
-
"pattern": "^[^\\s:]+(?![\\s\\S])"
|
|
120
|
-
},
|
|
121
|
-
"base_url": {
|
|
122
|
-
"title": "base_url",
|
|
123
|
-
"description": "Permanent absolute URL identifying one exact immutable publication. GET this exact URL returns its publication JSON. Do not append a filename.",
|
|
124
|
-
"type": "string",
|
|
125
|
-
"format": "iri"
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
"additionalProperties": true
|
|
129
|
-
},
|
|
130
|
-
"Artifact": {
|
|
131
|
-
"title": "Artifact",
|
|
132
|
-
"description": "Ontology content in a declared format, with explicitly identified entry files.",
|
|
133
|
-
"type": "object",
|
|
134
|
-
"required": [
|
|
135
|
-
"format",
|
|
136
|
-
"url",
|
|
137
|
-
"size_bytes",
|
|
138
|
-
"roots",
|
|
139
|
-
"sha256",
|
|
140
|
-
"origin"
|
|
141
|
-
],
|
|
142
|
-
"properties": {
|
|
143
|
-
"format": {
|
|
144
|
-
"$ref": "#/$defs/Format",
|
|
145
|
-
"title": "format",
|
|
146
|
-
"description": "Ontology language and syntax of the artifact."
|
|
147
|
-
},
|
|
148
|
-
"url": {
|
|
149
|
-
"title": "url",
|
|
150
|
-
"description": "Permanent absolute download URL of an immutable ontology file.",
|
|
151
|
-
"type": "string",
|
|
152
|
-
"format": "iri"
|
|
153
|
-
},
|
|
154
|
-
"size_bytes": {
|
|
155
|
-
"title": "size_bytes",
|
|
156
|
-
"description": "Byte length of the final immutable artifact file, before HTTP content encoding. Measured from the same bytes as sha256.",
|
|
157
|
-
"type": "integer",
|
|
158
|
-
"minimum": 0
|
|
159
|
-
},
|
|
160
|
-
"roots": {
|
|
161
|
-
"title": "roots",
|
|
162
|
-
"description": "Permanent absolute URLs of the entry files from which this artifact's ontology is loaded.",
|
|
163
|
-
"type": "array",
|
|
164
|
-
"minItems": 1,
|
|
165
|
-
"items": {
|
|
166
|
-
"type": "string",
|
|
167
|
-
"format": "iri"
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
"sha256": {
|
|
171
|
-
"title": "sha256",
|
|
172
|
-
"description": "SHA-256 of the final immutable file bytes, before HTTP content encoding, as exactly 64 lowercase hexadecimal characters.",
|
|
173
|
-
"type": "string",
|
|
174
|
-
"pattern": "^[0-9a-f]{64}(?![\\s\\S])"
|
|
175
|
-
},
|
|
176
|
-
"origin": {
|
|
177
|
-
"$ref": "#/$defs/ArtifactOrigin",
|
|
178
|
-
"title": "origin",
|
|
179
|
-
"description": "Origin of the artifact content."
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
"additionalProperties": true
|
|
183
|
-
},
|
|
184
|
-
"Dependency": {
|
|
185
|
-
"title": "Dependency",
|
|
186
|
-
"description": "A reference to an exact immutable publication required by this publication.",
|
|
187
|
-
"type": "object",
|
|
188
|
-
"required": [
|
|
189
|
-
"base_url"
|
|
190
|
-
],
|
|
191
|
-
"properties": {
|
|
192
|
-
"base_url": {
|
|
193
|
-
"title": "base_url",
|
|
194
|
-
"description": "Permanent absolute URL identifying one exact immutable publication. GET this exact URL returns its publication JSON. Do not append a filename.",
|
|
195
|
-
"type": "string",
|
|
196
|
-
"format": "iri"
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
"additionalProperties": true
|
|
200
|
-
},
|
|
201
|
-
"ArtifactOrigin": {
|
|
202
|
-
"title": "ArtifactOrigin",
|
|
203
|
-
"description": "Origin of published artifact content.",
|
|
204
|
-
"type": "string",
|
|
205
|
-
"enum": [
|
|
206
|
-
"UPSTREAM",
|
|
207
|
-
"GENERATED"
|
|
208
|
-
]
|
|
209
|
-
},
|
|
210
|
-
"Format": {
|
|
211
|
-
"title": "Format",
|
|
212
|
-
"description": "A combination of ontology language and syntax.",
|
|
213
|
-
"type": "string",
|
|
214
|
-
"enum": [
|
|
215
|
-
"owl-turtle",
|
|
216
|
-
"owl-rdfxml",
|
|
217
|
-
"rdfs-turtle",
|
|
218
|
-
"linkml-yaml",
|
|
219
|
-
"ossie-yaml"
|
|
220
|
-
]
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
"title": "Publication metadata",
|
|
224
|
-
"description": "Metadata for one immutable ontology release, its artifacts and its dependencies."
|
|
225
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://ohi.neverblink.eu/contracts/search-request",
|
|
4
|
-
"$ref": "#/$defs/SearchRequest",
|
|
5
|
-
"$defs": {
|
|
6
|
-
"SearchRequest": {
|
|
7
|
-
"title": "SearchRequest",
|
|
8
|
-
"description": "Query and options for retrieving one page of ontology publications.",
|
|
9
|
-
"type": "object",
|
|
10
|
-
"required": [
|
|
11
|
-
"q"
|
|
12
|
-
],
|
|
13
|
-
"properties": {
|
|
14
|
-
"page": {
|
|
15
|
-
"title": "page",
|
|
16
|
-
"description": "One-based page number. Omitted means 1.",
|
|
17
|
-
"type": "integer",
|
|
18
|
-
"minimum": 1
|
|
19
|
-
},
|
|
20
|
-
"filter_by": {
|
|
21
|
-
"title": "filter_by",
|
|
22
|
-
"description": "Typesense filter expression over filterable fields.",
|
|
23
|
-
"type": "string",
|
|
24
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
25
|
-
},
|
|
26
|
-
"per_page": {
|
|
27
|
-
"title": "per_page",
|
|
28
|
-
"description": "Maximum hits requested for this page, from 1 through 250. Omitted means 10.",
|
|
29
|
-
"type": "integer",
|
|
30
|
-
"minimum": 1,
|
|
31
|
-
"maximum": 250
|
|
32
|
-
},
|
|
33
|
-
"facet_by": {
|
|
34
|
-
"title": "facet_by",
|
|
35
|
-
"description": "Typesense facet expression over facetable fields.",
|
|
36
|
-
"type": "string",
|
|
37
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
38
|
-
},
|
|
39
|
-
"q": {
|
|
40
|
-
"title": "q",
|
|
41
|
-
"description": "Text query over the configured search fields. Use the wildcard * for browsing.",
|
|
42
|
-
"type": "string",
|
|
43
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
44
|
-
},
|
|
45
|
-
"sort_by": {
|
|
46
|
-
"title": "sort_by",
|
|
47
|
-
"description": "Typesense sort expression. Omitted preserves default search ordering.",
|
|
48
|
-
"type": "string",
|
|
49
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
50
|
-
},
|
|
51
|
-
"max_facet_values": {
|
|
52
|
-
"title": "max_facet_values",
|
|
53
|
-
"description": "Maximum values returned per facet. Omitted uses the backend default.",
|
|
54
|
-
"type": "integer",
|
|
55
|
-
"minimum": 1
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"additionalProperties": false
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"title": "Publication search request",
|
|
62
|
-
"description": "Search query, filters, facets, ordering and pagination for ontology publications."
|
|
63
|
-
}
|
package/dist/search.schema.json
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://ohi.neverblink.eu/contracts/search",
|
|
4
|
-
"$ref": "#/$defs/SearchResult",
|
|
5
|
-
"$defs": {
|
|
6
|
-
"SearchResult": {
|
|
7
|
-
"title": "SearchResult",
|
|
8
|
-
"description": "One ordered page of publication summaries, with count, effective paging information and optional facet counts.",
|
|
9
|
-
"type": "object",
|
|
10
|
-
"required": [
|
|
11
|
-
"page",
|
|
12
|
-
"total",
|
|
13
|
-
"per_page",
|
|
14
|
-
"hits",
|
|
15
|
-
"search_cutoff"
|
|
16
|
-
],
|
|
17
|
-
"properties": {
|
|
18
|
-
"page": {
|
|
19
|
-
"title": "page",
|
|
20
|
-
"description": "Effective one-based page for this response.",
|
|
21
|
-
"type": "integer",
|
|
22
|
-
"minimum": 1
|
|
23
|
-
},
|
|
24
|
-
"total": {
|
|
25
|
-
"title": "total",
|
|
26
|
-
"description": "Matching indexed publications after query and filters, before pagination. May be incomplete when search_cutoff is true. An exact total can exceed the retrieval window.",
|
|
27
|
-
"type": "integer",
|
|
28
|
-
"minimum": 0
|
|
29
|
-
},
|
|
30
|
-
"per_page": {
|
|
31
|
-
"title": "per_page",
|
|
32
|
-
"description": "Effective requested page size, not the number of returned hits.",
|
|
33
|
-
"type": "integer",
|
|
34
|
-
"minimum": 1,
|
|
35
|
-
"maximum": 250
|
|
36
|
-
},
|
|
37
|
-
"hits": {
|
|
38
|
-
"title": "hits",
|
|
39
|
-
"description": "Publication summaries in search-result order.",
|
|
40
|
-
"type": "array",
|
|
41
|
-
"items": {
|
|
42
|
-
"$ref": "#/$defs/SearchHit"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
"facet_counts": {
|
|
46
|
-
"title": "facet_counts",
|
|
47
|
-
"description": "Facet values and counts for the query and filters, independently of hit pagination. The number of returned facet values may be limited.",
|
|
48
|
-
"type": "array",
|
|
49
|
-
"items": {
|
|
50
|
-
"$ref": "#/$defs/FacetCount"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"search_cutoff": {
|
|
54
|
-
"title": "search_cutoff",
|
|
55
|
-
"description": "Whether search stopped early. When true, hits or total may be incomplete.",
|
|
56
|
-
"type": "boolean"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"additionalProperties": true
|
|
60
|
-
},
|
|
61
|
-
"SearchHit": {
|
|
62
|
-
"title": "SearchHit",
|
|
63
|
-
"description": "Summary of one immutable publication.",
|
|
64
|
-
"type": "object",
|
|
65
|
-
"required": [
|
|
66
|
-
"licenses",
|
|
67
|
-
"name",
|
|
68
|
-
"description",
|
|
69
|
-
"base_url",
|
|
70
|
-
"version",
|
|
71
|
-
"formats",
|
|
72
|
-
"title",
|
|
73
|
-
"published_at",
|
|
74
|
-
"namespace"
|
|
75
|
-
],
|
|
76
|
-
"properties": {
|
|
77
|
-
"licenses": {
|
|
78
|
-
"title": "licenses",
|
|
79
|
-
"description": "Reported license names or standard identifiers such as Apache-2.0. Empty means no information supplied. The list specifies neither AND nor OR combination semantics.",
|
|
80
|
-
"type": "array",
|
|
81
|
-
"items": {
|
|
82
|
-
"type": "string",
|
|
83
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
"name": {
|
|
87
|
-
"title": "name",
|
|
88
|
-
"description": "Short catalog identifier, qualified by namespace. The namespace/name pair identifies the same ontology across releases. URLs must not be derived from this identifier.",
|
|
89
|
-
"type": "string",
|
|
90
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
91
|
-
},
|
|
92
|
-
"description": {
|
|
93
|
-
"title": "description",
|
|
94
|
-
"description": "Short description of the ontology's domain and intended use.",
|
|
95
|
-
"type": "string",
|
|
96
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
97
|
-
},
|
|
98
|
-
"base_url": {
|
|
99
|
-
"title": "base_url",
|
|
100
|
-
"description": "Permanent absolute URL identifying one exact immutable publication. GET this exact URL returns its publication JSON. Do not append a filename.",
|
|
101
|
-
"type": "string",
|
|
102
|
-
"format": "iri"
|
|
103
|
-
},
|
|
104
|
-
"version": {
|
|
105
|
-
"title": "version",
|
|
106
|
-
"description": "Complete publication version label, including amendments.",
|
|
107
|
-
"type": "string",
|
|
108
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
109
|
-
},
|
|
110
|
-
"formats": {
|
|
111
|
-
"title": "formats",
|
|
112
|
-
"description": "Formats of the publication's available artifacts. Each value identifies both the ontology language and serialization syntax, as in artifact.format.",
|
|
113
|
-
"type": "array",
|
|
114
|
-
"minItems": 1,
|
|
115
|
-
"items": {
|
|
116
|
-
"$ref": "#/$defs/Format"
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
"keywords": {
|
|
120
|
-
"title": "keywords",
|
|
121
|
-
"description": "Keywords describing the ontology's subject. An empty list means no keywords are provided.",
|
|
122
|
-
"type": "array",
|
|
123
|
-
"items": {
|
|
124
|
-
"type": "string"
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
"title": {
|
|
128
|
-
"title": "title",
|
|
129
|
-
"description": "Display title of the ontology.",
|
|
130
|
-
"type": "string",
|
|
131
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
132
|
-
},
|
|
133
|
-
"published_at": {
|
|
134
|
-
"title": "published_at",
|
|
135
|
-
"description": "First successful Hub publication time for this immutable release. Backend emits UTC date-time text with Z. Consumers accept timezone-bearing RFC 3339 text. Fixed for the lifetime of this publication. Not an upstream release date.",
|
|
136
|
-
"type": "string",
|
|
137
|
-
"format": "date-time"
|
|
138
|
-
},
|
|
139
|
-
"namespace": {
|
|
140
|
-
"title": "namespace",
|
|
141
|
-
"description": "Namespace qualifying the ontology name, such as w3c in w3c/prov-o.",
|
|
142
|
-
"type": "string",
|
|
143
|
-
"pattern": "^[\\s\\S]*\\S"
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
"additionalProperties": true
|
|
147
|
-
},
|
|
148
|
-
"FacetCount": {
|
|
149
|
-
"title": "FacetCount",
|
|
150
|
-
"description": "Counts for the returned values of one indexed field.",
|
|
151
|
-
"type": "object",
|
|
152
|
-
"required": [
|
|
153
|
-
"field_name",
|
|
154
|
-
"counts"
|
|
155
|
-
],
|
|
156
|
-
"properties": {
|
|
157
|
-
"field_name": {
|
|
158
|
-
"title": "field_name",
|
|
159
|
-
"description": "Indexed field used for this facet.",
|
|
160
|
-
"type": "string"
|
|
161
|
-
},
|
|
162
|
-
"counts": {
|
|
163
|
-
"title": "counts",
|
|
164
|
-
"description": "Value counts in search-result order.",
|
|
165
|
-
"type": "array",
|
|
166
|
-
"items": {
|
|
167
|
-
"$ref": "#/$defs/FacetValueCount"
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
"additionalProperties": true
|
|
172
|
-
},
|
|
173
|
-
"FacetValueCount": {
|
|
174
|
-
"title": "FacetValueCount",
|
|
175
|
-
"description": "A facet value and its matching-publication count.",
|
|
176
|
-
"type": "object",
|
|
177
|
-
"required": [
|
|
178
|
-
"value",
|
|
179
|
-
"count"
|
|
180
|
-
],
|
|
181
|
-
"properties": {
|
|
182
|
-
"value": {
|
|
183
|
-
"title": "value",
|
|
184
|
-
"description": "Facet value or range label.",
|
|
185
|
-
"type": "string"
|
|
186
|
-
},
|
|
187
|
-
"count": {
|
|
188
|
-
"title": "count",
|
|
189
|
-
"description": "Number of matching publications for this facet value or range.",
|
|
190
|
-
"type": "integer",
|
|
191
|
-
"minimum": 0
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
"additionalProperties": true
|
|
195
|
-
},
|
|
196
|
-
"Format": {
|
|
197
|
-
"title": "Format",
|
|
198
|
-
"description": "A combination of ontology language and syntax.",
|
|
199
|
-
"type": "string",
|
|
200
|
-
"enum": [
|
|
201
|
-
"owl-turtle",
|
|
202
|
-
"owl-rdfxml",
|
|
203
|
-
"rdfs-turtle",
|
|
204
|
-
"linkml-yaml",
|
|
205
|
-
"ossie-yaml"
|
|
206
|
-
]
|
|
207
|
-
}
|
|
208
|
-
},
|
|
209
|
-
"title": "Publication search result",
|
|
210
|
-
"description": "One page of ungrouped publication search results, with the matching count and effective pagination settings and optional facet counts."
|
|
211
|
-
}
|