Know()
domain-modeling verbs (INSTANCE-scoped, chainable) -------------------- Build a domain knowledgebase with NO globals: oKB = new stzKnowledgeGraph("restaurant") oKB.Know("margherita", "dish"). KnowRelation("margherita", "contains", "tomato-sauce"). ConstrainRelation("pairs-with", :Symmetric) The natural-world globals (StzKnow/StzKnowRelation) are a SEPARATE feature -- the default shared world behind WhatIs/AreRelated. A scoped domain (a DLM's brain, an app's world) owns its own graph instance.
aussi écrite: KnowEntity
Exemples de base (2)
oRest = new stzKnowledgeGraph("restaurant")
oRest.Know("margherita", "dish").Know("tiramisu", "dish")
oRest.AddConversationQ("setup").SetGoal(StzGoalQ().RequireEach("dish", "contains"))
? len( oRest.GapsIn("setup") )2
exécuté le 2026-10-02 04:24 dans la bibliothèque au commit 0e72e2e2c ; tiré de 13-the-gap-question.en.md(s'ouvre dans un nouvel onglet)
oKB = new stzKnowledgeGraph("menu")
oKB.Know("margherita", "dish").Know("tiramisu", "dish").Know("pizza", "dish")
oKB.KnowRelation("margherita", "kind-of", "pizza")
oKB.KnowRelation("pizza", "kind-of", "food")
oKB.KnowRelation("margherita", "contains", "tomato")
? @@( oKB.Query([ "?x", "is-a", "dish" ]) )
? @@( oKB.Query([ "margherita", "contains", "?o" ]) )[ "margherita", "tiramisu", "pizza" ] [ "tomato" ]
exécuté le 2026-10-02 04:24 dans la bibliothèque au commit 0e72e2e2c ; tiré de 12-teach-a-world.en.md(s'ouvre dans un nouvel onglet)
Les extensions de cette méthode
Chaque extension, et si elle existe pour cette méthode ; une extension qui existe se compose avec les autres (FindSTCS).
Chaque exemple est un fichier de test de la bibliothèque, exécuté dans la bibliothèque pour cette page ; seuls ceux dont la sortie a tenu toutes les promesses écrites par leur fichier sont montrés. Les explications, les titres et le code sont ceux de la bibliothèque, en anglais.
Voir aussi
- La classe stzKnowledgeGraph
- La référence du domaine : Diagrammes et graphes
- Les autres méthodes de ces exemples : stzKnowledgeGraph.AddConversation · stzKnowledgeGraph.GapsIn · stzKnowledgeGraph.KnowRelation · stzKnowledgeGraph.Query

