Esempio n. 1
0
 /// <summary>
 /// Retrieves a namespace from the register by seeking presence of its prefix.
 /// If not found, and the EnablePrefixCCService configuration is true, it
 /// tries to resolve the prefix with a lookup to prefix.cc service.
 /// </summary>
 public static RDFNamespace GetByPrefix(String prefix)
 {
     if (prefix != null && prefix.Trim() != String.Empty)
     {
         var result = Instance.Register.Find(ns => ns.Prefix.Equals(prefix.Trim(), StringComparison.Ordinal));
         if (result == null && EnablePrefixCCService)
         {
             result = RDFModelUtilities.LookupPrefixCC(prefix.Trim(), 1);
         }
         return(result);
     }
     return(null);
 }
Esempio n. 2
0
        /// <summary>
        /// Retrieves a namespace from the register by seeking presence of its Uri.
        /// If not found, and the EnablePrefixCCService configuration is true, it
        /// tries to resolve the namespace with a reverse lookup to prefix.cc service.
        /// </summary>
        public static RDFNamespace GetByNamespace(String nSpace)
        {
            Uri tempNS = RDFModelUtilities.GetUriFromString(nSpace.Trim());

            if (tempNS != null)
            {
                var result = Instance.Register.Find(ns => ns.Namespace.Equals(tempNS));
                if (result == null && EnablePrefixCCService)
                {
                    result = RDFModelUtilities.LookupPrefixCC(nSpace.Trim(), 2);
                }
                return(result);
            }
            return(null);
        }