Skip to content

Commit c69cd34

Browse files
committed
extract attributeConceptOf & entityConceptOf
1 parent 3c82442 commit c69cd34

File tree

4 files changed

+28
-8
lines changed

4 files changed

+28
-8
lines changed

src/concept-lattice/generate-by-join-and-meet-are-the-same.test.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import assert from "node:assert"
22
import test from "node:test"
33
import { createContextFromCrossTable } from "../context/createContextFromCrossTable.js"
44
import { planets } from "../examples/planets.js"
5+
import { waterbodies } from "../examples/waterbodies.js"
56
import { generateConceptSetByJoin } from "./generateConceptSetByJoin.js"
67
import { generateConceptSetByMeet } from "./generateConceptSetByMeet.js"
78

@@ -15,12 +16,12 @@ test("by join and meet are the same -- planets", () => {
1516
)
1617
})
1718

18-
// test("by join and meet are the same -- waterbodies", () => {
19-
// const context = createContextFromCrossTable(waterbodies)
19+
test("by join and meet are the same -- waterbodies", () => {
20+
const context = createContextFromCrossTable(waterbodies)
2021

21-
// assert(
22-
// generateConceptSetByJoin(context).isEqualTo(
23-
// generateConceptSetByMeet(context),
24-
// ),
25-
// )
26-
// })
22+
assert(
23+
generateConceptSetByJoin(context).isEqualTo(
24+
generateConceptSetByMeet(context),
25+
),
26+
)
27+
})

src/concept/attributeConceptOf.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { Attribute, Context } from "../context/Context.js"
2+
import type { Concept } from "./Concept.js"
3+
import { conceptFromAttributes } from "./conceptFromAttributes.js"
4+
5+
export function attributeConceptOf(
6+
context: Context,
7+
attribute: Attribute,
8+
): Concept {
9+
return conceptFromAttributes(context, [attribute])
10+
}

src/concept/entityConceptOf.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { Context, Entity } from "../context/Context.js"
2+
import type { Concept } from "./Concept.js"
3+
import { conceptFromEntities } from "./conceptFromEntities.js"
4+
5+
export function entityConceptOf(context: Context, entity: Entity): Concept {
6+
return conceptFromEntities(context, [entity])
7+
}

src/concept/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export * from "./assertSameContext.js"
2+
export * from "./attributeConceptOf.js"
23
export * from "./bottomConcept.js"
34
export * from "./closureAttributes.js"
45
export * from "./closureEntities.js"
@@ -9,6 +10,7 @@ export * from "./conceptFromEntities.js"
910
export * from "./conceptJoin.js"
1011
export * from "./conceptMeet.js"
1112
export * from "./createConceptSet.js"
13+
export * from "./entityConceptOf.js"
1214
export * from "./isExtent.js"
1315
export * from "./isIntent.js"
1416
export * from "./topConcept.js"

0 commit comments

Comments
 (0)