// TODO: Consider a mechanism of ignoring missing ontology providers. Use case: partial publications, i.e. updated assembly with new mappings, but not published prefix mapping.
        private static Uri GetTermUri(IOntologyProvider ontologyProvider, string namespacePrefix, string termName)
        {
            var resolvedUri = ontologyProvider.ResolveUri(namespacePrefix, termName);

            if (resolvedUri == null)
            {
                var message = string.Format("Cannot resolve QName {0}:{1}", namespacePrefix, termName);
                LogTo.Fatal(message);
                throw new MappingException(message);
            }

            return resolvedUri;
        }
        // TODO: Consider a mechanism of ignoring missing ontology providers. Use case: partial publications, i.e. updated assembly with new mappings, but not published prefix mapping.
        private static Uri GetTermUri(IOntologyProvider ontologyProvider, string namespacePrefix, string termName, ILogger log)
        {
            var resolvedUri = ontologyProvider.ResolveUri(namespacePrefix, termName);

            if (resolvedUri == null)
            {
                var message = string.Format("Cannot resolve QName {0}:{1}", namespacePrefix, termName);
                log.Fatal(message);
                throw new MappingException(message);
            }

            return(resolvedUri);
        }
Example #3
0
 /// <summary>Tries to resolve a prefix for given Uri.</summary>
 /// <param name="ontologies">Instance of the <see cref="IOntologyProvider"/>.</param>
 /// <param name="uriString">Uri to be resolved.</param>
 /// <returns><see cref="String" /> beeing a prefix of the given Uri or <b>null</b>.</returns>
 public static string ResolveUri(this IOntologyProvider ontologies, string uriString)
 {
     return(ontologies.ResolveUri(new Uri(uriString)));
 }