From 05a8bc2e6a94ed73a2fb2a1b89a4801ac16baf2b Mon Sep 17 00:00:00 2001 From: Jesse Wright <63333554+jeswr@users.noreply.github.com> Date: Tue, 1 Aug 2023 23:27:50 +1000 Subject: [PATCH] BREAKING CHANGE: Remove `blogic` option. Blogic is now always enabled by default. BREAKING CHANGE: `blogic` option has been removed. --- README.md | 4 ---- __test_utils__/util.ts | 12 +++--------- lib/transformers.ts | 16 ++-------------- package.json | 4 ++-- 4 files changed, 7 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 33767383..6748f622 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,6 @@ const data = ` const result = await n3reasoner(data, undefined, { output: 'derivations', - blogic: false, outputType: 'string' }); ``` @@ -77,9 +76,6 @@ The `options` parameter can be used to configure the reasoning process. The foll - `deductive_closure`: output deductive closure, a.k.a `--pass` - `deductive_closure_plus_rules`: output deductive closure plus rules, a.k.a `--pass-all` - `grounded_deductive_closure_plus_rules`: ground the rules and output deductive closure plus rules, a.k.a `--pass-all-ground` -- `blogic`: Whether to use the blogic or not. Used to support [RDF surfaces](https://w3c-cg.github.io/rdfsurfaces/). - - `true`: use blogic - - `false`: do not use blogic (default) - `outputType`: The type of output (if different from the input) - `string`: output as string - `quads`: output as array of RDF/JS Quads diff --git a/__test_utils__/util.ts b/__test_utils__/util.ts index 51b7ffa5..a2047ff2 100644 --- a/__test_utils__/util.ts +++ b/__test_utils__/util.ts @@ -215,29 +215,23 @@ export function universalTests() { it('should reject n3reasoner on blogic and any output', async () => { // @ts-expect-error - const res = n3reasoner(dataQuads, undefined, { output: 'dervations', blogic: true }); + const res = n3reasoner(dataQuads, undefined, { output: 'dervations' }); expect(res).rejects.toThrowError() }); it('should reject n3reasoner on query string and blogic', async () => { - const res = n3reasoner(dataQuads, '{?S ?P ?O} => {?S ?P ?O}', { blogic: true }); + const res = n3reasoner(dataQuads, '{?S ?P ?O} => {?S ?P ?O}'); expect(res).rejects.toThrowError() }); it('should execute the n3reasoner using blogic', async () => { - const resultStr: string = await n3reasoner(blogicData, undefined, { blogic: true }); + const resultStr: string = await n3reasoner(blogicData); const quads = (new Parser({ format: 'text/n3' })).parse(resultStr); expect(quads).toBeRdfIsomorphic(resultBlogicQuads); }); - it('should fail executing blogic using the n3reasoner without blogic enabled', async () => { - const resultStr: string = await n3reasoner(blogicData, undefined, { blogic: false }); - const quads = (new Parser({ format: 'text/n3' })).parse(resultStr); - expect(quads).not.toBeRdfIsomorphic(resultBlogicQuads); - }); - it('should throw error when eye cannot process the query', async () => { await expect(n3reasoner('invalid', 'invalid')).rejects.toThrowError('Error while executing query'); }); diff --git a/lib/transformers.ts b/lib/transformers.ts index 45ed267e..d2647d25 100644 --- a/lib/transformers.ts +++ b/lib/transformers.ts @@ -9,10 +9,6 @@ import EYE_PVM from './eye'; import { queryOnce } from './query'; export type ICoreQueryOptions = { - blogic: true; - output?: undefined; -} | { - blogic?: false; output?: 'derivations' | 'deductive_closure' | 'deductive_closure_plus_rules' | 'grounded_deductive_closure_plus_rules'; } @@ -44,23 +40,17 @@ export function SwiplEye(options?: Partial | undefined) { * @param queryString The query (in Notation3) * @param options The reasoner options * - output: What to output with implicit queries (default: undefined) - * - blogic: Whether to use blogic (default: false) * @returns The same SWIPL module */ export function runQuery( Module: SWIPLModule, data: string, queryString?: string, - { blogic, output }: Options = {}, + { output }: Options = {}, ): SWIPLModule { const args: string[] = ['--nope', '--quiet', 'data.nq']; - if (blogic) { - if (output || queryString) { - throw new Error('Cannot use blogic with explicit output or query'); - } - args.push('--blogic'); - } else if (queryString) { + if (queryString) { if (output) { throw new Error('Cannot use explicit output with explicit query'); } @@ -110,7 +100,6 @@ export type Query = Data | undefined * @param query The query as RDF/JS quads * @param options The reasoner options * - output: What to output with implicit queries (default: undefined) - * - blogic: Whether to use blogic (default: false) * - outputType: The type of output, either 'string' or 'quads' (default: type of input data) * - SWIPL: The SWIPL module to use (default: bundled SWIPL) * @returns The result of the query as RDF/JS quads @@ -154,7 +143,6 @@ export async function executeBasicEyeQuery(swipl: typeof SWIPL, data: Data, quer * @param query The query as RDF/JS quads * @param options The reasoner options * - output: What to output with implicit queries (default: undefined) - * - blogic: Whether to use blogic (default: false) * - outputType: The type of output, either 'string' or 'quads' (default: type of input data) * @returns The result of the query as RDF/JS quads */ diff --git a/package.json b/package.json index c0cd99c5..15003a2f 100644 --- a/package.json +++ b/package.json @@ -137,8 +137,8 @@ }, "config": { "eye": { - "name": "v4.10.2", - "url": "https://api.github.com/repos/eyereasoner/eye/releases/114309345" + "name": "v4.10.8", + "url": "https://api.github.com/repos/eyereasoner/eye/releases/114636496" } }, "dependencies": {