-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
103 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@hydrofoil/shape-to-query": patch | ||
--- | ||
|
||
When used in node shape, class constraint would produce an incorrect pattern |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@hydrofoil/shape-to-query": minor | ||
--- | ||
|
||
Change the abstract methods of constraint components to separate property shape and node shape constraints |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
'watch-files': [ | ||
'./**/*.ts' | ||
], | ||
require: require.resolve('./mocha-setup.cjs'), | ||
loader: 'ts-node/esm' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
packages/shape-to-query/test/model/constraint/class.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { schema } from '@tpluscode/rdf-ns-builders' | ||
import { expect } from 'chai' | ||
import $rdf from 'rdf-ext' | ||
import { sparql } from '@tpluscode/rdf-string' | ||
import { variable } from '../../variable.js' | ||
import { ClassConstraintComponent } from '../../../model/constraint/class.js' | ||
|
||
describe('model/constraint/class', () => { | ||
before(() => import('../../sparql.js')) | ||
|
||
describe('buildPatterns', () => { | ||
context('node shape', () => { | ||
it('creates correct pattern', () => { | ||
// given | ||
const constraint = new ClassConstraintComponent(schema.DefinedTerm) | ||
|
||
// when | ||
const whereClause = constraint.buildPatterns({ | ||
focusNode: $rdf.namedNode('this'), | ||
valueNode: variable(), | ||
variable, | ||
rootPatterns: undefined, | ||
}) | ||
|
||
// then | ||
expect(whereClause).to.equalPatterns('<this> a schema:DefinedTerm .') | ||
}) | ||
}) | ||
|
||
context('property shape', () => { | ||
it('creates correct pattern', () => { | ||
// given | ||
const constraint = new ClassConstraintComponent(schema.DefinedTerm) | ||
|
||
// when | ||
const whereClause = constraint.buildPatterns({ | ||
focusNode: $rdf.namedNode('this'), | ||
valueNode: variable(), | ||
variable, | ||
rootPatterns: undefined, | ||
propertyPath: sparql`prop`, | ||
}) | ||
|
||
// then | ||
expect(whereClause).to.equalPatterns('?valueNode a schema:DefinedTerm .') | ||
}) | ||
}) | ||
}) | ||
}) |