亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日韩免费一区二区| 国产精品一区二区果冻传媒| 久久女同互慰一区二区三区| 在线影视一区二区三区| 国产精品亚洲视频| 狠狠色综合日日| 一区二区三区成人在线视频| 亚洲精品国产a久久久久久| 激情久久五月天| 91国偷自产一区二区三区观看 | 亚洲成人激情社区| 成人av小说网| 精品精品欲导航| 性做久久久久久免费观看| 99精品视频一区二区三区| 精品国产污污免费网站入口 | 国产精品久久久久影院亚瑟| 久久99精品一区二区三区| 欧美色视频在线观看| 国产日韩欧美在线一区| 美女任你摸久久| 欧美男女性生活在线直播观看| 亚洲福利一区二区三区| 91老师国产黑色丝袜在线| 国产日韩欧美激情| 国产高清在线精品| 久久这里只有精品视频网| 麻豆国产欧美日韩综合精品二区| 欧美吞精做爰啪啪高潮| 日韩美女精品在线| 国产高清不卡二三区| 精品99一区二区| 激情文学综合网| 久久久久国产一区二区三区四区 | 美女视频一区在线观看| 日韩一区二区免费在线观看| 日韩1区2区3区| 欧美蜜桃一区二区三区| 亚洲主播在线观看| 欧美日本在线视频| 免费日本视频一区| 26uuu精品一区二区| 美女视频免费一区| 26uuu色噜噜精品一区二区| 一区二区三区四区国产精品| 免费高清在线一区| 精久久久久久久久久久| 99re8在线精品视频免费播放| 欧美日韩国产不卡| 国产精品二三区| 国产一区二区精品久久| 欧美精品国产精品| 国产精品嫩草99a| 日韩中文字幕一区二区三区| 91色在线porny| 精品国产一二三| 夜夜夜精品看看| 99久久久久久| 中文字幕国产一区| 国产一区视频网站| 日韩欧美一区二区视频| 一区二区三区四区在线免费观看 | 1024亚洲合集| 国产成人精品免费一区二区| 日韩一区二区三区视频在线观看| 亚洲靠逼com| 91色porny在线视频| 中文字幕乱码日本亚洲一区二区| 久久se精品一区二区| 欧美日韩一区二区三区在线看| 亚洲欧美另类小说| 岛国精品在线观看| 亚洲国产精品二十页| 国产精品一二三在| 国产欧美日韩不卡免费| 国产一区二区主播在线| 欧美精品日日鲁夜夜添| 午夜精品一区二区三区免费视频| 欧美午夜精品免费| 日韩中文字幕区一区有砖一区 | 国内精品伊人久久久久av一坑| 欧美在线视频不卡| 一区二区三区美女| 欧美影视一区在线| 国产精品久线在线观看| 97精品国产露脸对白| 亚洲欧美日韩电影| 欧美系列日韩一区| 中文字幕成人在线观看| 99国产精品久久久久久久久久| 亚洲欧洲国产专区| 欧洲日韩一区二区三区| 天堂影院一区二区| 精品成人a区在线观看| 免费成人你懂的| 久久久久久久久蜜桃| 国产成人小视频| 亚洲欧美国产毛片在线| 欧美亚洲综合网| 毛片av一区二区三区| 久久在线观看免费| 日本精品裸体写真集在线观看| 一个色在线综合| 欧美www视频| 粉嫩一区二区三区在线看| 亚洲人成在线观看一区二区| 欧美精品在线观看播放| 国产曰批免费观看久久久| 国产精品传媒在线| 日韩一区二区三区精品视频| 国产一区二区不卡| 亚洲综合色自拍一区| 欧美一区二区三区四区五区 | 国产成人高清视频| 一区二区三区在线免费观看| 日韩亚洲欧美一区二区三区| 暴力调教一区二区三区| 日韩国产欧美一区二区三区| 国产欧美日本一区视频| 色先锋aa成人| 日韩精品高清不卡| 欧美哺乳videos| 欧美在线高清视频| 精品一区二区国语对白| 亚洲人成网站精品片在线观看| 精品日韩一区二区三区免费视频| 一本大道久久a久久精品综合| 麻豆精品一区二区av白丝在线| 亚洲精品自拍动漫在线| 精品国产乱码久久久久久1区2区| 91蜜桃婷婷狠狠久久综合9色| 麻豆高清免费国产一区| 亚洲成a天堂v人片| 中文字幕一区二区三区不卡| 精品少妇一区二区三区| 欧美久久久久免费| 欧美日韩精品一区二区三区四区 | 日韩理论电影院| 久久你懂得1024| 欧美大肚乱孕交hd孕妇| 欧美日本在线一区| 欧美日韩一区二区在线观看| av在线综合网| 国产91丝袜在线播放九色| 久久99精品视频| 狠狠色狠狠色综合系列| 久久国产福利国产秒拍| 精品一区二区在线播放| 另类欧美日韩国产在线| 久久精品国产99国产精品| 日日摸夜夜添夜夜添精品视频| 亚洲v日本v欧美v久久精品| 亚洲美女视频在线观看| 亚洲人成网站色在线观看| 亚洲人成在线播放网站岛国| 国产精品国产a| 亚洲人成人一区二区在线观看| 国产精品久久久久一区| 日本乱人伦aⅴ精品| 在线观看免费成人| 精品福利一区二区三区免费视频| 亚洲欧美在线观看| 久久国产尿小便嘘嘘尿| 91成人看片片| 国产精品欧美一级免费| 日产欧产美韩系列久久99| voyeur盗摄精品| 欧美xxxx老人做受| 亚洲午夜av在线| 不卡视频一二三四| 欧美一级片在线看| 一片黄亚洲嫩模| 成人免费高清在线| 欧美成人国产一区二区| 亚洲大片免费看| 91免费版在线| 国产精品国产三级国产aⅴ中文 | 成人激情视频网站| 精品久久久久久最新网址| 亚洲成人免费电影| 91在线高清观看| 日本一区二区成人| 国产一区二区三区电影在线观看 | 日本道精品一区二区三区| 久久久久久日产精品| 久久www免费人成看片高清| 欧美日韩免费视频| 亚洲综合一区在线| 欧洲激情一区二区| 综合电影一区二区三区| 色网站国产精品| 亚洲欧美日本韩国| 一本一道久久a久久精品综合蜜臀| 日本一区二区三区dvd视频在线| 激情综合网av| 国产午夜精品在线观看| 精品一区二区三区免费毛片爱| 日韩一区二区三免费高清| 日本伊人午夜精品| 欧美一级理论片|