示例#1
0
        /// <summary>
        /// Returns the JObject of the page if we have it.
        /// </summary>
        private JObject GetEntityFromPage(Uri entity)
        {
            JObject result = null;

            if (Utility.IsRootUri(entity))
            {
                JsonLdPage matchingPage = null;
                if (_pages.TryGetValue(entity, out matchingPage))
                {
                    matchingPage.UpdateLastUsed();
                    result = matchingPage.Compacted;
                }
            }

            return(result);
        }
示例#2
0
        /// <summary>
        /// True if the page has been added to the cache.
        /// </summary>
        public bool HasPageOfEntity(Uri entity)
        {
            bool result = false;
            Uri  uri    = Utility.GetUriWithoutHash(entity);

            JsonLdPage page = null;

            if (_pages.TryGetValue(uri, out page))
            {
                // make the page as accessed so it stays around
                page.UpdateLastUsed();
                result = !page.IsDisposed; // to be extra safe
            }

            return(result);
        }
示例#3
0
 /// <summary>
 /// Called by JsonLdPage after the graph has loaded.
 /// </summary>
 private void AddCallback(JsonLdPage page)
 {
     page.UpdateLastUsed();
     MergeGraph(page.Graph);
 }