Skip to content
Snippets Groups Projects
create_fact.txt 2.01 KiB
Newer Older
  • Learn to ignore specific revisions
  • Paul-Walcher's avatar
    Paul-Walcher committed
    
    in gadget: use Factadder
    
    factadder adds the fact to the server, use standard method AddFactIfNotFound
    
    fact: fact to add
    samestep: if the fact belongs conceptually to the previously added one
    
    Fact.cs: Caches all facts
    
    see  TestFact as an example
    parseFact interprets new MMT fact.
    
    
    Paul-Walcher's avatar
    Paul-Walcher committed
    --------------------------------------
    
    In Assets\InteractionEngine\FactHandling\Facts create your own fact
    
    First, add your scroll you Implemented into Assets\Scripts\MMTServer\CommunicationProtocal\MMTConstants.cs
    Follow the definitions of previous srolls/functions.
    
    Then, in Assets\InteractionEngine\FactHandling\Facts.ParsingDictionary.Dictionary add an entry with your
    MMTConstant as key and the parseFact Method of the Fact class you're going to implement.
    
    Then in Assets\InteractionEngine\FactHandling\Facts.ParsingDictionary add a line to the lines
    that look like [JsonSubtypes,.KnownSubType(typeof(YOUR_FACTCLASS), nameof(YOUR_FACTCLASS))]
    
    Your fact should include:
    
    1.) 	A constructor that calls base(). Constructor can have SomDoc, which is the MMT URI as OMS.
    
    2.) 	define: A method parseFact(List<Fact>, MMTFact fact). 
    		Then, in this method, you will try to add your fact to the ParsingDictionary in Assets\InteractionEngine\FactHandling\Facts,
    		then add it to the first argument (the list).
    
    3.)	define: public override bool HasDependentFact => [true/false]	
    
    4.)	define: GetDeendentFactIds(), which gives back a string array of the dependent Ids of your facts.
    
    5.)	define: GetHashCode()
    
    6.) 	define: EquivalentWrapped(YOUR_FACTCLASS, YOUR_FACTCLASS), which is a Method that
    		returns true if the two facts are (approximately) equal
    
    7.)	define: _ReInitializeMe(Dictionary<string, string> old_to_new), that gets called when the Fact
    		gets reinstantiated
    
    8.)	define: MakeMMTDecalaration(), which gives back a new MMTFact
    
    9.)	define: Defines(), which gives back a SOMDoc(MMTObject) of your class
    
    
    
    
    ----------------------------------------------------------
    
    1.) In Assets\InteractionEngine\FactHandling\Facts create your own fact. ()
    
    	
    2.)