-
Notifications
You must be signed in to change notification settings - Fork 0
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
4 changed files
with
65 additions
and
17 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 |
---|---|---|
@@ -1,32 +1,33 @@ | ||
# learn | ||
|
||
回顾 lattice 书,看看还函数需要加什么 API | ||
实现 lattice 书中的 "from theory to practice" | ||
读 rudolf wille 的原始论文和书 | ||
`utils/QuotientSet.test` | ||
|
||
# context | ||
|
||
`generateAllConcepts(context)` | ||
`generateNewConcepts(context)` | ||
`generateConcepts(context)` | ||
|
||
如何处理对 context 的修改? | ||
|
||
- 由于 concept 包含 context, | ||
所以 context 必须是 immutable 的, | ||
所以对 context 的修改必须是 functional 的。 | ||
# learn | ||
|
||
- 增加与删除 entity 或 attribute; | ||
- 修改某个 entity 和 attribute 的关系。 | ||
实现 lattice 书中的 "from theory to practice" | ||
|
||
# lattice | ||
|
||
实现 concept 之间的序关系 | ||
|
||
lessGeneral | ||
moreGeneral | ||
- lessGeneral | ||
- moreGeneral | ||
|
||
`buildLattice(context)` | ||
|
||
# later | ||
# optimize | ||
|
||
`Context` -- use double index `entityAttributeIndex` and `attributeEntityIndex` | ||
|
||
# editing context | ||
|
||
如何处理对 context 的修改? | ||
|
||
- 由于 concept 包含 context, | ||
所以 context 必须是 immutable 的, | ||
所以对 context 的修改必须是 functional 的。 | ||
|
||
- 增加与删除 entity 或 attribute; | ||
- 修改某个 entity 和 attribute 的关系。 |
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,8 @@ | ||
import type { Concept } from "../concept/index.js" | ||
import type { Context } from "./index.js" | ||
|
||
export function generateConcepts(context: Context): Array<Concept> { | ||
const targets: Array<Concept> = [] | ||
const results: Array<Concept> = [] | ||
return results | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
export type QuotientSetOpitons<T> = { | ||
equal: (x: T, y: T) => boolean | ||
} | ||
|
||
export class QuotientSet<T> { | ||
representatives: Array<T> | ||
equal: (x: T, y: T) => boolean | ||
|
||
constructor(options: QuotientSetOpitons<T>) { | ||
this.representatives = [] | ||
this.equal = options.equal | ||
} | ||
|
||
has(x: T): boolean { | ||
const found = this.representatives.find((y) => this.equal(x, y)) | ||
if (found === undefined) return false | ||
else return true | ||
} | ||
|
||
add(x: T): this { | ||
const found = this.representatives.find((y) => this.equal(x, y)) | ||
if (found === undefined) { | ||
this.representatives.push(x) | ||
} | ||
|
||
return this | ||
} | ||
|
||
delete(x: T): boolean { | ||
const foundIndex = this.representatives.findIndex((y) => this.equal(x, y)) | ||
if (foundIndex === -1) { | ||
return false | ||
} | ||
|
||
this.representatives.splice(foundIndex, 1) | ||
return true | ||
} | ||
} |