@neverblink/ohi 0.17.1 → 0.18.0

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 CHANGED
@@ -1,6 +1,6 @@
1
- # Ohi SDK
1
+ # ohi SDK
2
2
 
3
- The Ohi SDK lets Python and TypeScript applications search publications, inspect metadata, download selected files and save supplied file selections.
3
+ The ohi SDK lets Python and TypeScript applications search publications, inspect metadata, download selected files and save supplied file selections.
4
4
 
5
5
  Install on Python 3.10 or later:
6
6
 
@@ -14,4 +14,4 @@ Install for Node 22 or later, or a browser application:
14
14
  npm install @neverblink/ohi
15
15
  ```
16
16
 
17
- See the [SDK guide](https://github.com/NeverBlink-OSS/linkml-scala/blob/main/ohi/README.md) for usage, browser requirements and API behavior.
17
+ See the [SDK guide](https://github.com/NeverBlink-OSS/ohi/blob/main/ohi/README.md) for usage, browser requirements and API behavior.
package/dist/catalog.js CHANGED
@@ -1,13 +1,4 @@
1
- import { newAjv } from "./ajv.js";
2
1
  import { decodePublication } from "./publication.js";
3
- import configSchema from "./catalog-config.schema.json" with { type: "json" };
4
- import requestSchema from "./search-request.schema.json" with { type: "json" };
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" });
11
2
  export class CatalogException extends Error {
12
3
  error;
13
4
  constructor(error, options) {
@@ -18,8 +9,6 @@ export class CatalogException extends Error {
18
9
  }
19
10
  function httpUrl(value, operation) {
20
11
  try {
21
- if (!validateUri(value))
22
- throw new TypeError("Invalid URI.");
23
12
  const url = new URL(value);
24
13
  if (!(url.protocol === "http:" || url.protocol === "https:") || !url.hostname || url.username || url.password) {
25
14
  throw new TypeError("Invalid HTTP(S) URL.");
@@ -54,18 +43,13 @@ function searchResult(bytes, page, perPage) {
54
43
  search_cutoff: raw.search_cutoff,
55
44
  ...(raw.facet_counts === undefined ? {} : { facet_counts: raw.facet_counts }),
56
45
  };
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
46
  if (result.page !== page || result.per_page !== perPage || result.hits.length > perPage) {
64
47
  throw new Error("Search response does not match the requested page and page size.");
65
48
  }
66
49
  return {
67
50
  ...result,
68
- hits: result.hits.map(({ base_url, namespace, name, version, title, description, formats, licenses, published_at }) => ({ base_url, namespace, name, version, title, description, formats, licenses, published_at })),
51
+ hits: result.hits.map(({ base_url, namespace, name, version, title, description, formats, licenses, published_at, keywords }) => ({ base_url, namespace, name, version, title, description, formats, licenses, published_at,
52
+ ...(keywords === undefined ? {} : { keywords }) })),
69
53
  ...(result.facet_counts === undefined ? {} : {
70
54
  facet_counts: result.facet_counts.map(({ field_name, counts }) => ({ field_name, counts: counts.map(({ value, count }) => ({ value, count })) })),
71
55
  }),
@@ -77,10 +61,6 @@ export class CatalogClient {
77
61
  timeoutMs;
78
62
  constructor(config = {}) {
79
63
  const url = config.search_url;
80
- if (!validateConfig(config)) {
81
- throw new CatalogException({ code: "INVALID_INPUT", operation: "CONFIGURE",
82
- ...(typeof url === "string" ? { url } : {}), message: ajv.errorsText(validateConfig.errors) });
83
- }
84
64
  if ((config.search_url === undefined) !== (config.query_by === undefined)) {
85
65
  throw new CatalogException({ code: "INVALID_INPUT", operation: "CONFIGURE",
86
66
  ...(url === undefined ? {} : { url }), message: "Supply both search_url and query_by, or omit both." });
@@ -101,12 +81,6 @@ export class CatalogClient {
101
81
  }
102
82
  async search(request) {
103
83
  const endpoint = this.config.search_url;
104
- if (!validateRequest(request) ||
105
- (request.page !== undefined && !Number.isSafeInteger(request.page)) ||
106
- (request.max_facet_values !== undefined && !Number.isSafeInteger(request.max_facet_values))) {
107
- throw new CatalogException({ code: "INVALID_INPUT", operation: "SEARCH",
108
- url: endpoint, message: "Supply a valid search query and representable integer parameters." });
109
- }
110
84
  const page = request.page ?? 1;
111
85
  const perPage = request.per_page ?? 10;
112
86
  const url = new URL(endpoint);
@@ -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 final immutable file bytes, before HTTP content encoding, as exactly 64 lowercase hexadecimal characters. */
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;
package/dist/generated.js CHANGED
@@ -1,3 +1,3 @@
1
- // Generated by LinkML-Scala from https://ohi.neverblink.eu/contracts/package
1
+ // Generated by ohi LinkML from https://ohi.neverblink.eu/contracts/package
2
2
  // DO NOT EDIT.
3
3
  export {};
@@ -1,3 +1,3 @@
1
- // Generated by LinkML-Scala from https://ohi.neverblink.eu/contracts/catalog-config
1
+ // Generated by ohi LinkML from https://ohi.neverblink.eu/contracts/catalog-config
2
2
  // DO NOT EDIT.
3
3
  export {};
@@ -1,3 +1,3 @@
1
- // Generated by LinkML-Scala from https://ohi.neverblink.eu/contracts/catalog-error
1
+ // Generated by ohi LinkML from https://ohi.neverblink.eu/contracts/catalog-error
2
2
  // DO NOT EDIT.
3
3
  export {};
@@ -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
- /** Exact direct selections and the complete file set supplied by the application. */
8
+ /** Direct selections and their artifact files. */
9
9
  export interface Lock {
10
- /** Complete supplied artifact download records in supplied order. Each selection must match one file by exact base_url and url. Each pair occurs once. */
10
+ /** Each (base_url, url) pair is unique. Every selection matches a file by that pair. */
11
11
  files: LockedFile[];
12
- /** Lock record revision, independent of ontology and publication schema versions. */
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";
@@ -1,3 +1,3 @@
1
- // Generated by LinkML-Scala from https://ohi.neverblink.eu/contracts/lock
1
+ // Generated by ohi LinkML from https://ohi.neverblink.eu/contracts/lock
2
2
  // DO NOT EDIT.
3
3
  export {};
@@ -1,3 +1,3 @@
1
- // Generated by LinkML-Scala from https://ohi.neverblink.eu/contracts/lock-error
1
+ // Generated by ohi LinkML from https://ohi.neverblink.eu/contracts/lock-error
2
2
  // DO NOT EDIT.
3
3
  export {};
@@ -22,6 +22,8 @@ export interface SearchHit {
22
22
  description: string;
23
23
  /** Formats of the publication's available artifacts. Each value identifies both the ontology language and serialization syntax, as in artifact.format. */
24
24
  formats: Format[];
25
+ /** Keywords describing the ontology's subject. An empty list means no keywords are provided. */
26
+ keywords?: string[];
25
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. */
26
28
  licenses: string[];
27
29
  /** Short catalog identifier, qualified by namespace. The namespace/name pair identifies the same ontology across releases. URLs must not be derived from this identifier. */
@@ -1,3 +1,3 @@
1
- // Generated by LinkML-Scala from https://ohi.neverblink.eu/contracts/search
1
+ // Generated by ohi LinkML from https://ohi.neverblink.eu/contracts/search
2
2
  // DO NOT EDIT.
3
3
  export {};
@@ -1,3 +1,3 @@
1
- // Generated by LinkML-Scala from https://ohi.neverblink.eu/contracts/search-request
1
+ // Generated by ohi LinkML from https://ohi.neverblink.eu/contracts/search-request
2
2
  // DO NOT EDIT.
3
3
  export {};
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) && data.format_version !== 1) {
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
- if (!validate(data))
30
- throw new Error(ajv.errorsText(validate.errors));
31
- const selections = uniquePairs(data.selections, "selections");
32
- const files = uniquePairs(data.files, "files");
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 data;
38
+ return lock;
37
39
  }
38
40
  catch (cause) {
39
41
  throw new LockException({ code: "INVALID_LOCK", operation,
@@ -1,3 +1,3 @@
1
1
  import type { Publication } from "./generated.js";
2
- /** Decode publication metadata, validating consumed fields and discarding extras. */
2
+ /** Decode publication metadata, discarding extras. Field values are not validated. */
3
3
  export declare function decodePublication(text: string): Publication;
@@ -1,18 +1,9 @@
1
- import { newAjv } from "./ajv.js";
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.17.1",
4
- "description": "Ohi catalog search, publication inspection and artifact retrieval.",
3
+ "version": "0.18.0",
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/linkml-scala.git",
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
@@ -1,3 +0,0 @@
1
- import { Ajv2020 } from "ajv/dist/2020.js";
2
- /** A validator that knows every format the generated schemas use. */
3
- export declare function newAjv(): Ajv2020;
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
- }
@@ -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
- }
@@ -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
- }
@@ -1,203 +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
- "title": {
120
- "title": "title",
121
- "description": "Display title of the ontology.",
122
- "type": "string",
123
- "pattern": "^[\\s\\S]*\\S"
124
- },
125
- "published_at": {
126
- "title": "published_at",
127
- "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.",
128
- "type": "string",
129
- "format": "date-time"
130
- },
131
- "namespace": {
132
- "title": "namespace",
133
- "description": "Namespace qualifying the ontology name, such as w3c in w3c/prov-o.",
134
- "type": "string",
135
- "pattern": "^[\\s\\S]*\\S"
136
- }
137
- },
138
- "additionalProperties": true
139
- },
140
- "FacetCount": {
141
- "title": "FacetCount",
142
- "description": "Counts for the returned values of one indexed field.",
143
- "type": "object",
144
- "required": [
145
- "field_name",
146
- "counts"
147
- ],
148
- "properties": {
149
- "field_name": {
150
- "title": "field_name",
151
- "description": "Indexed field used for this facet.",
152
- "type": "string"
153
- },
154
- "counts": {
155
- "title": "counts",
156
- "description": "Value counts in search-result order.",
157
- "type": "array",
158
- "items": {
159
- "$ref": "#/$defs/FacetValueCount"
160
- }
161
- }
162
- },
163
- "additionalProperties": true
164
- },
165
- "FacetValueCount": {
166
- "title": "FacetValueCount",
167
- "description": "A facet value and its matching-publication count.",
168
- "type": "object",
169
- "required": [
170
- "value",
171
- "count"
172
- ],
173
- "properties": {
174
- "value": {
175
- "title": "value",
176
- "description": "Facet value or range label.",
177
- "type": "string"
178
- },
179
- "count": {
180
- "title": "count",
181
- "description": "Number of matching publications for this facet value or range.",
182
- "type": "integer",
183
- "minimum": 0
184
- }
185
- },
186
- "additionalProperties": true
187
- },
188
- "Format": {
189
- "title": "Format",
190
- "description": "A combination of ontology language and syntax.",
191
- "type": "string",
192
- "enum": [
193
- "owl-turtle",
194
- "owl-rdfxml",
195
- "rdfs-turtle",
196
- "linkml-yaml",
197
- "ossie-yaml"
198
- ]
199
- }
200
- },
201
- "title": "Publication search result",
202
- "description": "One page of ungrouped publication search results, with the matching count and effective pagination settings and optional facet counts."
203
- }