/// <summary> /// Create a clone of this term defintion /// </summary> /// <returns></returns> public JsonLdTermDefinition Clone() { var clone = new JsonLdTermDefinition() { IriMapping = this.IriMapping, Reverse = this.Reverse, TypeMapping = this.TypeMapping, LanguageMapping = this.LanguageMapping, HasLanguageMapping = this.HasLanguageMapping, ContainerMapping = this.ContainerMapping, Nest = this.Nest, LocalContext = LocalContext?.DeepClone(), // TODO: Check if it correct to just directly clone the local context }; return(clone); }
/// <summary> /// Add a term definition to this context /// </summary> /// <param name="key"></param> /// <param name="termDefinition"></param> public void AddTerm(string key, JsonLdTermDefinition termDefinition) { _termDefinitions.Add(key, termDefinition); }
/// <summary> /// Attempt to get an existing term defintion /// </summary> /// <param name="term">The key for the term to be retrieved</param> /// <param name="termDefinition">Receives the term definition found</param> /// <returns>True if an entry was found for <paramref name="term"/>, false otherwise</returns> public bool TryGetTerm(string term, out JsonLdTermDefinition termDefinition) { return(_termDefinitions.TryGetValue(term, out termDefinition)); }
/// <summary> /// Add or update an existing term definition /// </summary> /// <param name="term">The term key</param> /// <param name="definition">The new value for the term definition</param> public void SetTerm(string term, JsonLdTermDefinition definition) { _termDefinitions[term] = definition; }