亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? versionedstorage.cs

?? Perst開源實時數據庫
?? CS
?? 第 1 頁 / 共 4 頁
字號:
using System;
using System.Collections;
using Perst;

namespace Rdf 
{
    /// <summary>Root class for Perst storage</summary>
    public class DatabaseRoot:PersistentResource 
    {
        /// <summary>Root object in the graph</summary>
        public VersionHistory rootObject;
        /// <summary>Index used to access object by URI prefix</summary>
        public Index          prefixUriIndex;
        /// <summary>Index used to access object by URI suffix</summary>
        public Index          suffixUriIndex;
        /// <summary>Index used to search object by string property name:value pair</summary>
        public CompoundIndex  strPropIndex;
        /// <summary>Index used to search object by numeric property name:value pair</summary>
        public CompoundIndex  numPropIndex;
        /// <summary>Index used to search object by datetime property name:value pair</summary>
        public CompoundIndex  timePropIndex;
        /// <summary>Index used to search object by reference property name:value pair</summary>
        public CompoundIndex  refPropIndex;
        /// <summary>Index used to locate property definition by property name</summary>
        public FieldIndex     propDefIndex;
        /// <summary>Index used to perform spatial search locating overlapped rectangles</summary>
        public Index          inverseIndex;
        /// <summary>Inverse keywords index</summary>
        public SpatialIndexR2 spatialIndex;
        /// <summary>Set of the latest versions</summary>
        public ISet           latest;
        /// <summary>Timestamp index</summary>
        public FieldIndex     timeIndex;
        /// <summary>Type of the types</summary>
        public VersionHistory metatype;
    }

    /// <summary>Which verions of the object should be inspected</summary>
    public enum SearchKind 
    {
        /// <summary>Latest version in version history</summary>
        LatestVersion,
        /// <summary>All versions in version history</summary>
        AllVersions,
        /// <summary>Latest version before sepcified timestamp</summary>
        LatestBefore,
        /// <summary>Oldest version after sepcified timestamp</summary>
        OldestAfter
    }

    /// <summary>
    /// Main class
    /// </summary>
    public class VersionedStorage 
    { 
        Storage      db;
        DatabaseRoot root;

        /// <summary>
        /// List of separator characters used to split string into keywords
        /// </summary>
        public static char[] keywordSeparators = 
        {
            ' ', 
            ','
        };

        /// <summary>
        /// List of most commonly used words which should be ignored andnot included in inverse index
        /// </summary>
        public static Hashtable keywordStopList = new Hashtable();

        static VersionedStorage()  
        {
            keywordStopList["the"] = true;
            keywordStopList["at"] = true;
            keywordStopList["of"] = true;
            keywordStopList["a"] = true;
            keywordStopList["to"] = true;
            keywordStopList["at"] = true;
            keywordStopList["and"] = true;
            keywordStopList["or"] = true;
            keywordStopList["i"] = true;
        }

        /// <summary>Open database</summary>
        /// <param name="filePath">path to the database file</param>    
        public void Open(string filePath) 
        { 
            db = StorageFactory.Instance.CreateStorage(); 
            db.Open(filePath);
            root = (DatabaseRoot)db.Root;
            if (root == null) 
            {
                root = new DatabaseRoot();
                root.prefixUriIndex = db.CreateIndex(typeof(string), true);
                root.suffixUriIndex = db.CreateIndex(typeof(string), true);
                root.strPropIndex = db.CreateIndex(new Type[]{typeof(PropDef), typeof(string)}, false);
                root.numPropIndex = db.CreateIndex(new Type[]{typeof(PropDef), typeof(double)}, false);
                root.refPropIndex = db.CreateIndex(new Type[]{typeof(PropDef), typeof(VersionHistory)}, false);
                root.timePropIndex = db.CreateIndex(new Type[]{typeof(PropDef), typeof(DateTime)}, false);
                root.propDefIndex = db.CreateFieldIndex(typeof(PropDef), "name", true);            
                root.timeIndex = db.CreateFieldIndex(typeof(Thing), "timestamp", false);
                root.inverseIndex = db.CreateIndex(typeof(string), false);
                root.spatialIndex = db.CreateSpatialIndexR2();
                root.latest = db.CreateSet();
                CreateMetaType();
                db.Root = root;
            }
        }
    
        /// <summary>Get verion history by URI</summary>
        /// <param name="uri">object URI</param>
        /// <returns>version history or null if no such object is found</returns>
        public VersionHistory GetObject(string uri) 
        {
            return (VersionHistory)root.prefixUriIndex[uri];
        }

        /// <summary>Get latest verion of object with specified URI</summary>
        /// <param name="uri">object URI</param>
        /// <returns>latest version of object or null if no such object is found</returns>
        public Thing GetLatestVersion(string uri) 
        {
            VersionHistory vh = (VersionHistory)root.prefixUriIndex[uri];
            return (vh != null) ? vh.Latest : null;
        }        

        /// <summary>Get verion history by URI and timestamp</summary>
        /// <param name="uri">object URI</param>
        /// <param name="kind">search kind, should be object SearchKind.LatestVersion, SearchKind.LatestBefore or 
        /// SearchKind.OldestAfter</param>
        /// <param name="timestamp">timestamp used to locate version</param>
        /// <returns>version of the object or null if no such version is found</returns>
        public Thing GetVersion(string uri, SearchKind kind, DateTime timestamp) 
        {
            VersionHistory vh = (VersionHistory)root.prefixUriIndex[uri];
            if (vh != null) 
            { 
                return vh.GetVersion(kind, timestamp);
            }
            return null;
        }

        /// <summary>Create bew object. If version history with this URI is not exists, it is created first.
        /// Then new object version is created and appended to this version history.
        /// </summary>
        /// <param name="uri">object URI</param>
        /// <param name="type">URI of object type</param>
        /// <param name="props">object properties</param>
        /// <returns>created object version</returns>
        public Thing CreateObject(string uri, string type, NameVal[] props) 
        {
            VersionHistory vh = (VersionHistory)root.prefixUriIndex[uri];
            if (vh == null) 
            {
                VersionHistory typeVh = null;
                typeVh = GetObject(type);
                if (typeVh == null) 
                { 
                    typeVh = CreateVersionHistory(type, root.metatype);
                    CreateObject(root.metatype.Latest, typeVh, new NameVal[0]);
                }
                vh = CreateVersionHistory(uri, typeVh);
            } 
            else 
            { 
                root.latest.Remove(vh.Latest);
            }
            return CreateObject(vh.type.Latest, vh, props); 
        }

        /// <summary>Get iterator through object matching specified search parameters</summary>
        /// <param name="type">String representing type of the object (direct or indirect - IsInstanceOf
        /// method will be used to check if object belongs to the specified type). It may be null, 
        /// in this case type criteria is skipped.</param>
        /// <param name="uri">Object URI pattern. It may be null, in this case URI is not inspected.</param>
        /// <param name="patterns">array of name:value pairs specifying search condition for object properties</param>
        /// <param name="kind">search kind used to select inspected versions</param>
        /// <param name="timestamp">timestamp used to select versions, if kind is SearchKind.LatestVersion
        /// or SearchKind.AllVersions this parameter is ignored</param>
        /// <returns>Enumerator through object meet search criteria.</returns>
        public IEnumerable Search(string type, string uri, NameVal[] patterns, SearchKind kind, DateTime timestamp) 
        {
            VersionHistory typeVh = null;
            root.SharedLock();
            try 
            {
                if (type != null) 
                { 
                    typeVh = GetObject(type);
                    if (typeVh == null) 
                    { 
                        return new object[0]; // empty selection
                    }
                }
                if (uri != null) 
                {
                    int wc = uri.IndexOf('*');
                    if (wc < 0) 
                    { 
                        return new SearchResult(root, typeVh, null, patterns, kind, timestamp, root.prefixUriIndex.GetEnumerator(uri, uri));
                    } 
                    else if (wc > 0) 
                    { 
                        String prefix = uri.Substring(0, wc);
                        return new SearchResult(root, typeVh, uri, patterns, kind, timestamp, root.prefixUriIndex.GetEnumerator(prefix));
                    } 
                    else if ((wc = uri.LastIndexOf('*')) < uri.Length-1) 
                    {
                        String suffix = ReverseString(uri.Substring(wc+1, uri.Length-wc-1));
                        return new SearchResult(root, typeVh, uri, patterns, kind, timestamp, root.suffixUriIndex.GetEnumerator(suffix));
                    }
                }
                if (patterns.Length > 0) 
                { 
                    NameVal prop = patterns[0];
                    object val = prop.val;
                    NameVal[] restOfPatterns = SubArray(patterns);

                    switch (prop.name) 
                    {
                        case Symbols.Timestamp: 
                  
                            if (val is Range) 
                            { 
                                Range range = (Range)val;
                                if (range.from is DateTime) 
                                {
                                    Key fromKey = new Key((DateTime)range.from, range.fromInclusive);
                                    Key tillKey = new Key((DateTime)range.till, range.tillInclusive);
                                    return new SearchResult(root, typeVh, uri, restOfPatterns, kind, timestamp, 
                                        root.timeIndex.GetEnumerator(fromKey, tillKey));
                                    
                                }
                            } 
                            else if (val is DateTime) 
                            {
                                Key key = new Key((DateTime)val);
                                return new SearchResult(root, typeVh, uri, restOfPatterns, kind, timestamp, 
                                    root.timeIndex.GetEnumerator(key, key));                            
                            } 
                            return new object[0]; // empty selection
                        case Symbols.Rectangle:
                            if (val is NameVal[]) 
                            {
                                NameVal[] coord = (NameVal[])val;
                                if (coord.Length == 4) 
                                {
                                    RectangleR2 r = new RectangleR2((double)coord[0].val, 
                                        (double)coord[1].val, 
                                        (double)coord[2].val, 
                                        (double)coord[3].val);
                                    return new SearchResult(root, typeVh, uri, restOfPatterns, kind, timestamp, 
                                        root.spatialIndex.Overlaps(r).GetEnumerator());
                                }
                            }
                            break;
                        case Symbols.Point:
                            if (val is NameVal[]) 
                            {
                                NameVal[] coord = (NameVal[])val;
                                if (coord.Length == 2) 
                                {
                                    double x = (double)coord[0].val;
                                    double y = (double)coord[1].val;
                                    RectangleR2 r = new RectangleR2(x, y, x, y);
                                    return new SearchResult(root, typeVh, uri, restOfPatterns, kind, timestamp, 
                                        root.spatialIndex.Overlaps(r).GetEnumerator());
                                }
                            }
                            break;
                        case Symbols.Keyword:
                            if (val is string) 
                            {
                                ArrayList keywords = new ArrayList();
                                foreach (string keyword in ((string)val).ToLower().Split(keywordSeparators)) 
                                {
                                    if (keyword.Length > 0 && !keywordStopList.ContainsKey(keyword))
                                    {
                                        keywords.Add(keyword);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
青青草国产成人av片免费| 一本色道综合亚洲| 97久久精品人人做人人爽50路| 欧美在线色视频| 国产日韩欧美精品电影三级在线| 亚洲一区二区在线观看视频| 国产成人啪免费观看软件| 91精品国产综合久久精品性色| 一区在线观看视频| 国产一区二区三区香蕉| 欧美一二三区在线观看| 一区二区三区在线免费观看| 国产成人av网站| 欧美精品一区二区三区视频| 午夜精品久久久久久久蜜桃app| www.日韩av| 久久精品亚洲乱码伦伦中文| 国产制服丝袜一区| 日韩一区二区三区电影在线观看 | 91黄色小视频| 18涩涩午夜精品.www| 国产精华液一区二区三区| 日韩欧美国产一区二区在线播放| 亚洲成a天堂v人片| 欧美色图在线观看| 一区二区三区四区在线播放| 91色九色蝌蚪| 亚洲男同1069视频| 91麻豆国产香蕉久久精品| 国产精品大尺度| av午夜一区麻豆| 亚洲欧洲美洲综合色网| av毛片久久久久**hd| 亚洲视频免费在线观看| 在线观看av一区| 亚洲va在线va天堂| 欧美一区二区三区日韩| 美女诱惑一区二区| 久久综合九色综合97_久久久| 激情综合色综合久久| 久久丝袜美腿综合| 不卡的电视剧免费网站有什么| 中文字幕中文字幕在线一区| 91看片淫黄大片一级在线观看| 亚洲自拍偷拍网站| 在线观看91av| 国产麻豆精品theporn| 日本一区二区三区免费乱视频| 国产·精品毛片| 综合电影一区二区三区| 欧美中文字幕一二三区视频| 日本在线不卡一区| 国产日韩欧美精品一区| 日本丶国产丶欧美色综合| 亚洲国产裸拍裸体视频在线观看乱了| 欧美日韩国产综合一区二区三区| 蜜桃av一区二区三区电影| 欧美国产日韩精品免费观看| 91麻豆国产在线观看| 日韩高清一级片| 欧美激情自拍偷拍| 欧美日韩免费不卡视频一区二区三区| 欧美aaaaaa午夜精品| 久久精品一级爱片| 欧美日韩大陆在线| 国产在线播放一区| 亚洲精品福利视频网站| 日韩精品一区二区三区视频播放| 成人免费视频app| 亚洲成av人在线观看| 欧美国产日本韩| 欧美日韩精品一区二区在线播放| 国产在线精品一区二区不卡了| 亚洲欧美偷拍卡通变态| 欧美电影免费提供在线观看| 色综合天天做天天爱| 国产一区二区视频在线播放| 午夜一区二区三区在线观看| 国产亚洲一区二区在线观看| 欧美精品1区2区3区| 成人黄色777网| 久久爱另类一区二区小说| 亚洲伊人伊色伊影伊综合网| 国产欧美日韩精品a在线观看| 欧美人妇做爰xxxⅹ性高电影| 国产成人在线看| 久久国产尿小便嘘嘘| 亚洲在线免费播放| 国产精品色婷婷| 欧美精品一区二区在线观看| 欧美精品在欧美一区二区少妇| 99在线热播精品免费| 国产乱妇无码大片在线观看| 亚洲国产cao| 一区二区免费看| 亚洲欧美日韩久久精品| 久久精品人人做人人综合| 欧美成人国产一区二区| 3atv在线一区二区三区| 欧美日韩免费在线视频| 在线日韩国产精品| 色婷婷综合在线| 91视频在线看| 99精品在线观看视频| 成人av在线资源网| 丁香激情综合五月| 国产福利一区二区三区视频在线 | 久久精品夜夜夜夜久久| 精品国产不卡一区二区三区| 日韩一区二区三区视频在线观看| 宅男噜噜噜66一区二区66| 欧美高清www午色夜在线视频| 欧美视频一区二区三区四区| 欧美影片第一页| 欧美日本精品一区二区三区| 欧美日韩极品在线观看一区| 3d动漫精品啪啪1区2区免费| 欧美一区二区三区视频在线 | 国产成人精品一区二| 丁香婷婷综合激情五月色| 国产福利视频一区二区三区| 国产福利精品导航| 成人精品免费视频| 99国产精品99久久久久久| 日本精品一级二级| 宅男噜噜噜66一区二区66| 欧美电影免费观看高清完整版在线 | 精品日韩欧美在线| 久久蜜桃av一区二区天堂| 国产嫩草影院久久久久| 国产精品久久久久影院亚瑟| 亚洲欧美成aⅴ人在线观看| 一级中文字幕一区二区| 日一区二区三区| 久久成人免费日本黄色| 粉嫩嫩av羞羞动漫久久久| 91首页免费视频| 日韩西西人体444www| 国产精品丝袜一区| 一区二区三区毛片| 六月丁香综合在线视频| 成人av网站大全| 91精品在线一区二区| 久久久久久久电影| 一区二区三区日韩欧美精品| 日本亚洲视频在线| youjizz久久| 欧美一级高清大全免费观看| 国产精品久久综合| 美女视频黄 久久| 99精品国产视频| 日韩欧美在线观看一区二区三区| 日本一区二区动态图| 日韩影院在线观看| 成人福利电影精品一区二区在线观看| 欧美三区免费完整视频在线观看| 久久天堂av综合合色蜜桃网| 亚洲乱码国产乱码精品精可以看| 另类中文字幕网| 91精品1区2区| 国产欧美日韩综合精品一区二区 | 麻豆成人久久精品二区三区红 | 欧美综合视频在线观看| 精品久久国产字幕高潮| 亚洲自拍与偷拍| 国产91丝袜在线播放九色| 8v天堂国产在线一区二区| 最近中文字幕一区二区三区| 老司机精品视频线观看86| 在线视频中文字幕一区二区| 久久免费电影网| 麻豆精品蜜桃视频网站| 欧美色综合网站| 亚洲黄色在线视频| 国产九色精品成人porny| 日韩一区二区免费在线电影| 亚洲精选视频在线| 国产91精品精华液一区二区三区| 日韩一区二区精品在线观看| 亚洲第一福利视频在线| 色综合婷婷久久| 亚洲视频香蕉人妖| 成人三级伦理片| 国产欧美精品一区二区三区四区 | 色视频成人在线观看免| 欧美激情综合五月色丁香小说| 久久国产精品区| 日韩一区二区三| 蜜桃视频免费观看一区| 欧美巨大另类极品videosbest | 欧美一区二区二区| 日韩高清在线不卡| 91精品国产手机| 日韩av电影天堂| 在线不卡一区二区| 免费在线成人网| 精品乱人伦小说| 国产综合久久久久影院| 26uuu成人网一区二区三区| 经典一区二区三区|