@neverblink/ohi 0.18.3 → 0.18.5

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/dist/catalog.js CHANGED
@@ -33,6 +33,10 @@ function searchResult(bytes, page, perPage) {
33
33
  if (!object(raw) || "grouped_hits" in raw || !Array.isArray(raw.hits) || !object(raw.request_params)) {
34
34
  throw new Error("Expected an ungrouped search response with hits and request_params.");
35
35
  }
36
+ if (raw.facet_counts !== undefined &&
37
+ !(Array.isArray(raw.facet_counts) && raw.facet_counts.every((facet) => object(facet) && Array.isArray(facet.counts)))) {
38
+ throw new Error("Expected facet_counts to be a list of facets with counts.");
39
+ }
36
40
  const result = {
37
41
  hits: raw.hits.map((hit) => {
38
42
  if (!object(hit) || !object(hit.document))
@@ -51,15 +55,12 @@ function searchResult(bytes, page, perPage) {
51
55
  return {
52
56
  ...result,
53
57
  // Formats added after this SDK version are discarded
54
- hits: result.hits.flatMap(({ base_url, namespace, name, version, title, description, formats, licenses, published_at, keywords }) => {
58
+ hits: result.hits.flatMap((hit) => {
59
+ const { formats } = hit;
55
60
  const known = Array.isArray(formats) ? formats.filter((format) => !isNew(format, knownFormats)) : formats;
56
61
  if (Array.isArray(formats) && formats.length > 0 && known.length === 0)
57
62
  return [];
58
- return [{ base_url, namespace, name, version, title, description, formats: known, licenses, published_at,
59
- ...(keywords === undefined ? {} : { keywords }) }];
60
- }),
61
- ...(result.facet_counts === undefined ? {} : {
62
- facet_counts: result.facet_counts.map(({ field_name, counts }) => ({ field_name, counts: counts.map(({ value, count }) => ({ value, count })) })),
63
+ return [{ ...hit, formats: known }];
63
64
  }),
64
65
  };
65
66
  }
@@ -1,3 +1,13 @@
1
+ /** A person or organization involved with an ontology. */
2
+ export interface Agent {
3
+ /** How to reach them, such as an email address. */
4
+ contact?: string;
5
+ /** A web page about them, such as a homepage or a profile. */
6
+ link?: string;
7
+ /** Name of the person or organization. */
8
+ name: string;
9
+ [key: string]: unknown;
10
+ }
1
11
  /** Ontology content in a declared format, with explicitly identified entry files. */
2
12
  export interface Artifact {
3
13
  /** Ontology language and syntax of the artifact. */
@@ -43,6 +53,14 @@ export interface CatalogError {
43
53
  /** Original target supplied by the caller, when available. */
44
54
  url?: string;
45
55
  }
56
+ /** A paper that introduces or describes an ontology. */
57
+ export interface Citation {
58
+ /** A web page about the paper, such as its DOI. */
59
+ link?: string;
60
+ /** Title of the paper, or its full citation. */
61
+ title: string;
62
+ [key: string]: unknown;
63
+ }
46
64
  /** A reference to an exact immutable publication required by this publication. */
47
65
  export interface Dependency {
48
66
  /** Permanent absolute URL identifying one exact immutable publication. GET this exact URL returns its publication JSON. Do not append a filename. */
@@ -96,8 +114,12 @@ export interface LockedFile {
96
114
  export interface Publication {
97
115
  /** Available artifacts of this ontology. Each artifact URL occurs once. Multiple artifacts may share a format. */
98
116
  artifacts: Artifact[];
117
+ /** The people or organizations that made the ontology. */
118
+ authors: Agent[];
99
119
  /** Permanent absolute URL identifying one exact immutable publication. GET this exact URL returns its publication JSON. Do not append a filename. */
100
120
  base_url: string;
121
+ /** The people or organizations that contributed to the ontology. */
122
+ contributors?: Agent[];
101
123
  /** 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. */
102
124
  dependencies: Dependency[];
103
125
  /** Short description of the ontology's domain and intended use. */
@@ -108,6 +130,8 @@ export interface Publication {
108
130
  keywords: string[];
109
131
  /** 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. */
110
132
  licenses: string[];
133
+ /** The third-party people or organizations that maintain the ontology in the ohi index. */
134
+ maintainers?: Agent[];
111
135
  /** Short catalog identifier, qualified by namespace. The namespace/name pair identifies the same ontology across releases. */
112
136
  name: string;
113
137
  /** Namespace qualifying the ontology name, such as w3c in w3c/prov-o. */
@@ -116,12 +140,16 @@ export interface Publication {
116
140
  namespace_iri?: string;
117
141
  /** Number of elements in the publication's native format, as published upstream, such as the classes and properties of an OWL ontology. */
118
142
  native_element_count?: number;
143
+ /** Upstream official sources of the ontology, such as its homepage or repository. */
144
+ original_sources: string[];
119
145
  /** Optional abbreviation for namespace_iri, without whitespace or a colon. Requires namespace_iri. This constraint does not certify prefix syntax for every ontology language. */
120
146
  preferred_prefix?: string;
147
+ /** Papers that introduce or describe the ontology. */
148
+ publications?: Citation[];
121
149
  /** 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. */
122
150
  published_at: string;
123
- /** Name of the upstream person or organization responsible for publishing the ontology. Not inferred from catalog namespace. */
124
- publisher: string;
151
+ /** The people or organizations that publish the ontology upstream. */
152
+ publishers: Agent[];
125
153
  /** Metadata contract revision, independent of the ontology's version. */
126
154
  schema_version: number;
127
155
  /** Display title of the ontology. */
@@ -132,8 +160,12 @@ export interface Publication {
132
160
  }
133
161
  /** Summary of one immutable publication. */
134
162
  export interface SearchHit {
163
+ /** The people or organizations that made the ontology. */
164
+ authors: Agent[];
135
165
  /** Permanent absolute URL identifying one exact immutable publication. GET this exact URL returns its publication JSON. Do not append a filename. */
136
166
  base_url: string;
167
+ /** The people or organizations that contributed to the ontology. */
168
+ contributors?: Agent[];
137
169
  /** Short description of the ontology's domain and intended use. */
138
170
  description: string;
139
171
  /** Number of LinkML elements in the publication. */
@@ -141,17 +173,25 @@ export interface SearchHit {
141
173
  /** Formats of the publication's available artifacts. Each value identifies both the ontology language and serialization syntax, as in artifact.format. */
142
174
  formats: Format[];
143
175
  /** Keywords describing the ontology's subject. An empty list means no keywords are provided. */
144
- keywords?: string[];
176
+ keywords: string[];
145
177
  /** 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. */
146
178
  licenses: string[];
179
+ /** The third-party people or organizations that maintain the ontology in the ohi index. */
180
+ maintainers?: Agent[];
147
181
  /** Short catalog identifier, qualified by namespace. The namespace/name pair identifies the same ontology across releases. */
148
182
  name: string;
149
183
  /** Namespace qualifying the ontology name, such as w3c in w3c/prov-o. */
150
184
  namespace: string;
151
185
  /** Number of elements in the publication's native format, as published upstream, such as the classes and properties of an OWL ontology. */
152
186
  native_element_count?: number;
187
+ /** Upstream official sources of the ontology, such as its homepage or repository. */
188
+ original_sources: string[];
189
+ /** Papers that introduce or describe the ontology. */
190
+ publications?: Citation[];
153
191
  /** 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. */
154
192
  published_at: string;
193
+ /** The people or organizations that publish the ontology upstream. */
194
+ publishers: Agent[];
155
195
  /** Display title of the ontology. */
156
196
  title: string;
157
197
  /** Complete publication version label, including amendments. */
@@ -3,7 +3,7 @@ export declare const formats: Record<Format, true>;
3
3
  /** Whether a value is text outside an enum, so added to it after this SDK version. */
4
4
  export declare function isNew(value: unknown, known: object): boolean;
5
5
  /**
6
- * Decode publication metadata, discarding extras and artifacts with a format or origin added
7
- * after this SDK version. Field values are not validated.
6
+ * Decode publication metadata, discarding artifacts with a format or origin added after this SDK
7
+ * version. Fields that the model doesn't have are kept. Field values are not validated.
8
8
  */
9
9
  export declare function decodePublication(text: string): Publication;
@@ -9,8 +9,8 @@ export function isNew(value, known) {
9
9
  return typeof value === "string" && !Object.hasOwn(known, value);
10
10
  }
11
11
  /**
12
- * Decode publication metadata, discarding extras and artifacts with a format or origin added
13
- * after this SDK version. Field values are not validated.
12
+ * Decode publication metadata, discarding artifacts with a format or origin added after this SDK
13
+ * version. Fields that the model doesn't have are kept. Field values are not validated.
14
14
  */
15
15
  export function decodePublication(text) {
16
16
  const data = JSON.parse(text);
@@ -32,21 +32,5 @@ export function decodePublication(text) {
32
32
  if (dependencyUrls.includes(data.base_url)) {
33
33
  throw new Error("dependencies must not contain the publication itself");
34
34
  }
35
- return {
36
- schema_version: data.schema_version,
37
- base_url: data.base_url,
38
- version: data.version,
39
- namespace: data.namespace,
40
- name: data.name,
41
- title: data.title,
42
- published_at: data.published_at,
43
- publisher: data.publisher,
44
- licenses: data.licenses,
45
- ...(data.namespace_iri === undefined ? {} : { namespace_iri: data.namespace_iri }),
46
- ...(data.preferred_prefix === undefined ? {} : { preferred_prefix: data.preferred_prefix }),
47
- description: data.description,
48
- keywords: data.keywords,
49
- artifacts: artifacts.map(({ format, url, origin, roots, size_bytes, sha256 }) => ({ format, url, origin, roots, size_bytes, sha256 })),
50
- dependencies: data.dependencies.map(({ base_url }) => ({ base_url })),
51
- };
35
+ return { ...data, artifacts };
52
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neverblink/ohi",
3
- "version": "0.18.3",
3
+ "version": "0.18.5",
4
4
  "description": "Search ontologies on ohi.dev, inspect their metadata and download their files.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://ohi.dev/docs/reference/sdks/",