General Semantic Mapping Class which reads schema mapping from json files on disk
Exemplo n.º 1
0
 /// <summary>
 /// Gets semantic type names (qualified with Vocabulary ID) for the Schema.
 /// </summary>
 /// <returns>The semantic type names.</returns>
 public string[] GetSemanticTypeNames()
 {
     if (_semanticTypeNames == null)
     {
         _semanticTypeNames = Semantics.Select(s => SemanticMapping.GetQualifiedTypeName(s.Entity, s.Prefix, Localization)).ToArray();
     }
     return(_semanticTypeNames);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Get a list with schema entity names for its vocabularies.
        /// Using vocabulary name rather than prefix from json, as the prefixes can be different in the view.
        /// </summary>
        /// <remarks>
        /// Using <see cref="ILookup{TKey,TElement}"/> rather than a <see cref="Dictionary{TKey,TValue}"/> because it will allow for duplicate keys.
        /// Duplicate keys make no sense, but we might have them, so this prevents runtime exceptions.
        /// </remarks>
        /// <returns>List with entity names indexed by vocabulary</returns>
        public ILookup <string, string> GetEntityNames()
        {
            List <KeyValuePair <string, string> > entityNames = new List <KeyValuePair <string, string> >();

            foreach (SchemaSemantics schemaSemantics in Semantics)
            {
                string vocab = SemanticMapping.GetVocabulary(schemaSemantics.Prefix, Localization);
                entityNames.Add(new KeyValuePair <string, string>(vocab, schemaSemantics.Entity));
            }

            return(entityNames.ToLookup(x => x.Key, x => x.Value));
        }