@lde/dataset-registry-client 0.6.17 → 0.7.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/dist/client.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { Dataset } from '@lde/dataset';
2
+ import { DatasetSchema } from './schema.js';
3
+ import { type SchemaSearchInterface } from 'ldkit';
2
4
  import { Paginator } from './paginator.js';
5
+ export type SearchCriteria = SchemaSearchInterface<typeof DatasetSchema>;
3
6
  export declare class Client {
4
7
  private readonly sparqlEndpoint;
5
8
  private readonly schema;
@@ -59,6 +62,10 @@ export declare class Client {
59
62
  readonly '@type': "xsd:nonNegativeInteger";
60
63
  readonly '@optional': true;
61
64
  };
65
+ readonly compressFormat: {
66
+ readonly '@id': "dcat:compressFormat";
67
+ readonly '@optional': true;
68
+ };
62
69
  readonly conformsTo: {
63
70
  readonly '@id': "dcterms:conformsTo";
64
71
  readonly '@optional': true;
@@ -71,7 +78,7 @@ export declare class Client {
71
78
  };
72
79
  };
73
80
  });
74
- query(criteria: object): Promise<Paginator<Dataset>>;
81
+ query(criteria: SearchCriteria): Promise<Paginator<Dataset>>;
75
82
  query(constructQuery: string): Promise<Paginator<Dataset>>;
76
83
  }
77
84
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,cAAc,CAAC;AAIrD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,qBAAa,MAAM;IAEf,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,cAAc,EAAE,GAAG,EACnB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAgB;IAGlC,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACpD,KAAK,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;CAoElE"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,OAAO,aAAa,CAAC,CAAC;AAEzE,qBAAa,MAAM;IAEf,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,cAAc,EAAE,GAAG,EACnB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAgB;IAGlC,KAAK,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5D,KAAK,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;CA2ElE"}
package/dist/client.js CHANGED
@@ -26,7 +26,7 @@ export class Client {
26
26
  }
27
27
  else {
28
28
  // With search criteria the results are paginated.
29
- total = await datasets.count({ ...args });
29
+ total = await datasets.count({ where: args });
30
30
  pageSize = 1000;
31
31
  }
32
32
  return new Paginator(async (offset, limit) => {
@@ -37,7 +37,11 @@ export class Client {
37
37
  items = await datasets.query(prepareQuery(args));
38
38
  }
39
39
  else {
40
- items = await datasets.find({ ...args, take: limit, skip: offset });
40
+ items = await datasets.find({
41
+ where: args,
42
+ take: limit,
43
+ skip: offset,
44
+ });
41
45
  }
42
46
  return items.map((dataset) => new Dataset({
43
47
  iri: new URL(dataset.$id),
@@ -48,6 +52,7 @@ export class Client {
48
52
  distributions: dataset.distribution.map((d) => {
49
53
  const distribution = new Distribution(new URL(d.accessURL), d.mediaType ?? undefined, d.conformsTo ? new URL(d.conformsTo) : undefined);
50
54
  distribution.byteSize = d.byteSize ?? undefined;
55
+ distribution.compressFormat = d.compressFormat ?? undefined;
51
56
  distribution.lastModified = d.modified ?? undefined;
52
57
  return distribution;
53
58
  }),
package/dist/dcat.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export declare const dcat: import("ldkit/namespaces").NamespaceInterface<{
2
2
  readonly iri: "http://www.w3.org/ns/dcat#";
3
3
  readonly prefix: "dcat:";
4
- readonly terms: readonly ["Dataset", "Distribution", "accessURL", "keyword", "mediaType", "byteSize", "distribution", "modified", "downloadURL"];
4
+ readonly terms: readonly ["Dataset", "Distribution", "accessURL", "compressFormat", "keyword", "mediaType", "byteSize", "distribution", "modified", "downloadURL"];
5
5
  }>;
6
6
  //# sourceMappingURL=dcat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dcat.d.ts","sourceRoot":"","sources":["../src/dcat.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI;;;;EAcN,CAAC"}
1
+ {"version":3,"file":"dcat.d.ts","sourceRoot":"","sources":["../src/dcat.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI;;;;EAeN,CAAC"}
package/dist/dcat.js CHANGED
@@ -6,6 +6,7 @@ export const dcat = createNamespace({
6
6
  'Dataset',
7
7
  'Distribution',
8
8
  'accessURL',
9
+ 'compressFormat',
9
10
  'keyword',
10
11
  'mediaType',
11
12
  'byteSize',
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAelD"}
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAYA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAwBlD"}
package/dist/query.js CHANGED
@@ -1,18 +1,21 @@
1
- import { Generator, Parser } from 'sparqljs';
1
+ import { Parser } from '@traqula/parser-sparql-1-1';
2
+ import { Generator } from '@traqula/generator-sparql-1-1';
3
+ import { AstFactory, } from '@traqula/rules-sparql-1-1';
2
4
  import { ldkit, rdf } from 'ldkit/namespaces';
3
- import { DataFactory } from 'n3';
4
5
  const generator = new Generator();
6
+ const F = new AstFactory();
5
7
  export function prepareQuery(query) {
6
8
  const parsed = new Parser().parse(query);
7
- if (parsed.type !== 'query' || 'CONSTRUCT' !== parsed.queryType) {
9
+ if (parsed.type !== 'query' || parsed.subType !== 'construct') {
8
10
  throw new Error('Must be CONSTRUCT query');
9
11
  }
10
- const template = parsed.template;
11
- template.push({
12
- subject: template[0].subject,
13
- predicate: DataFactory.namedNode(rdf.type),
14
- object: DataFactory.namedNode(ldkit.Resource),
15
- });
16
- parsed.template = template;
17
- return generator.stringify(parsed);
12
+ const construct = parsed;
13
+ const firstTriple = construct.template.triples[0];
14
+ // Clone the template triples so we don't mutate the WHERE clause
15
+ // (CONSTRUCT WHERE shorthand shares the same BGP object).
16
+ construct.template = F.patternBgp([
17
+ ...construct.template.triples,
18
+ F.triple(firstTriple.subject, F.termNamed(F.gen(), rdf.type), F.termNamed(F.gen(), ldkit.Resource)),
19
+ ], F.gen());
20
+ return generator.generate(construct);
18
21
  }
package/dist/schema.d.ts CHANGED
@@ -54,6 +54,10 @@ export declare const DatasetSchema: {
54
54
  readonly '@type': "xsd:nonNegativeInteger";
55
55
  readonly '@optional': true;
56
56
  };
57
+ readonly compressFormat: {
58
+ readonly '@id': "dcat:compressFormat";
59
+ readonly '@optional': true;
60
+ };
57
61
  readonly conformsTo: {
58
62
  readonly '@id': "dcterms:conformsTo";
59
63
  readonly '@optional': true;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmEhB,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuEhB,CAAC"}
package/dist/schema.js CHANGED
@@ -56,6 +56,10 @@ export const DatasetSchema = {
56
56
  '@type': xsd.nonNegativeInteger,
57
57
  '@optional': true,
58
58
  },
59
+ compressFormat: {
60
+ '@id': dcat.compressFormat,
61
+ '@optional': true,
62
+ },
59
63
  conformsTo: {
60
64
  '@id': dcterms.conformsTo,
61
65
  '@optional': true,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@lde/dataset-registry-client",
3
- "version": "0.6.17",
3
+ "version": "0.7.1",
4
4
  "repository": {
5
- "url": "https://github.com/ldengine/lde",
5
+ "url": "git+https://github.com/ldelements/lde.git",
6
6
  "directory": "packages/dataset-registry-client"
7
7
  },
8
8
  "type": "module",
@@ -23,15 +23,14 @@
23
23
  "!**/*.tsbuildinfo"
24
24
  ],
25
25
  "dependencies": {
26
- "@lde/dataset": "0.6.10",
27
- "ldkit": "^2.5.2",
28
- "n3": "^1.26.0",
29
- "sparqljs": "^3.7.3",
26
+ "@lde/dataset": "0.7.0",
27
+ "@traqula/generator-sparql-1-1": "^1.0.3",
28
+ "@traqula/parser-sparql-1-1": "^1.0.3",
29
+ "@traqula/rules-sparql-1-1": "^1.0.3",
30
+ "ldkit": "^2.6.0",
30
31
  "tslib": "^2.3.0"
31
32
  },
32
33
  "devDependencies": {
33
- "@comunica/query-sparql-file": "^5.1.3",
34
- "@types/n3": "^1.26.0",
35
- "@types/sparqljs": "^3.1.12"
34
+ "@comunica/query-sparql-file": "^5.1.3"
36
35
  }
37
36
  }