-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix issue #143 by introducing an explicit meta type on M3 types
- Loading branch information
Showing
6 changed files
with
112 additions
and
9 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { builtinPrimitives, concatenator, LanguageFactory, lastOf } from "@lionweb/core" | ||
|
||
const factory = new LanguageFactory( | ||
"meta", | ||
"1", | ||
concatenator("-"), | ||
lastOf | ||
) | ||
|
||
/** | ||
* A "meta" language in which every instance of a meta concept has name "{A|a}[n]<name of meta concept>". | ||
* This is useful to test {@link ClassifierDeducer classifier deducers} with. | ||
*/ | ||
export const metaLanguage = factory.language | ||
|
||
const anAnnotation = factory.annotation("AnAnnotation") | ||
|
||
const aConcept = factory.concept("AConcept", false) | ||
const aProperty = factory.property(aConcept, "aProperty").ofType(builtinPrimitives.jsonDatatype) | ||
const aContainment = factory.containment(aConcept, "aContainment").ofType(aConcept) | ||
const aReference = factory.reference(aConcept, "aReference").ofType(aConcept) | ||
aConcept.havingFeatures(aProperty, aContainment, aReference) | ||
|
||
const anEnumeration = factory.enumeration("AnEnumeration") | ||
const anEnumerationLiteral = factory.enumerationLiteral(anEnumeration, "anEnumerationLiteral") | ||
anEnumeration.havingLiterals(anEnumerationLiteral) | ||
|
||
const anInterface = factory.interface("AnInterface") | ||
|
||
metaLanguage.havingEntities(anAnnotation, aConcept, anEnumeration, anInterface) | ||
|
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,15 @@ | ||
import {assert} from "chai" | ||
const {equal} = assert | ||
|
||
import {allContaineds} from "@lionweb/core" | ||
import {metaLanguage} from "../languages/meta.js" | ||
|
||
|
||
describe("meta-typed classifier deducer" , () => { | ||
it("works for M3", () => { | ||
for (const thing of allContaineds(metaLanguage)) { | ||
equal(thing.metaType(), thing.constructor.name) | ||
} | ||
}) | ||
}) | ||
|