• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Model.Triple类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中BrightstarDB.Model.Triple的典型用法代码示例。如果您正苦于以下问题:C# Triple类的具体用法?C# Triple怎么用?C# Triple使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Triple类属于BrightstarDB.Model命名空间,在下文中一共展示了Triple类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TestSimpleQuery

        public void TestSimpleQuery()
        {
            var sid = Guid.NewGuid().ToString();
            using (var store = _storeManager.CreateStore(Configuration.StoreLocation + "\\" + sid))
            {
                var t = new Triple
                            {
                                Subject = "http://www.networkedplanet.com/people/10",
                                Predicate = "http://www.networkedplanet.com/model/isa",
                                Object = "http://www.networkedplanet.com/types/person"
                            };
                store.InsertTriple(t);

                store.Commit(Guid.Empty);
            }
            using (var store = _storeManager.OpenStore(Configuration.StoreLocation + "\\" + sid))
            {
                var triples = store.GetResourceStatements("http://www.networkedplanet.com/people/10");
                Assert.AreEqual(1, triples.Count());

                // do query 
                const string query =
                    "select ?t where { ?t <http://www.networkedplanet.com/model/isa> <http://www.networkedplanet.com/types/person> }";
                store.ExecuteSparqlQuery(query, SparqlResultsFormat.Xml);
            }
        }
开发者ID:phatcher,项目名称:BrightstarDB,代码行数:26,代码来源:QueryTests.cs


示例2: TestLookupByIdentifierAndType

        public void TestLookupByIdentifierAndType()
        {
            var sid = Guid.NewGuid().ToString();
            using (var store = _storeManager.CreateStore(Configuration.StoreLocation + "\\" + sid))
            {

                var t = new Triple
                            {
                                Subject = "http://www.networkedplanet.com/people/10",
                                Predicate = "http://www.networkedplanet.com/model/isa",
                                Object = "http://www.networkedplanet.com/types/person"
                            };
                store.InsertTriple(t);

                store.Commit(Guid.Empty);
            }

            using (var store = _storeManager.OpenStore(Configuration.StoreLocation + "\\" + sid))
            {
                // do query 
                const string query =
                    "select ?t where { ?t <http://www.networkedplanet.com/model/isa> <http://www.networkedplanet.com/types/person> . FILTER ( ?t = <http://www.networkedplanet.com/people/10> ) }";
                var doc = XDocument.Parse(store.ExecuteSparqlQuery(query, SparqlResultsFormat.Xml));

                Assert.IsTrue(doc.SparqlResultRows().Count() == 1);
                Assert.AreEqual("http://www.networkedplanet.com/people/10",
                                doc.SparqlResultRows().FirstOrDefault().GetColumnValue("t").ToString());
            }
        }
开发者ID:phatcher,项目名称:BrightstarDB,代码行数:29,代码来源:QueryTests.cs


示例3: Triple

 public void Triple(Triple t)
 {
     string dt = null;
     if (t.IsLiteral && t.DataType != null) dt = t.DataType.ToString();
     _sink.Triple(t.Subject, t.Subject.StartsWith("_:"),
                  t.Predicate, t.Predicate.StartsWith("_:"),
                  t.Object.ToString(), !t.IsLiteral && t.ToString().StartsWith("_:"),
                  t.IsLiteral, dt, t.LangCode, t.Graph.ToString());
 }
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:9,代码来源:BrightstarTripleSinkAdapter.cs


示例4: TestInsert1000000TriplesWithUniqueSubjectResources

        public void TestInsert1000000TriplesWithUniqueSubjectResources()
        {
            var sid = Guid.NewGuid().ToString();
            var store = _storeManager.CreateStore(BrightstarDB.Configuration.StoreLocation + "\\" + sid);

            var start = DateTime.UtcNow;
            for (int i = 0; i < 1000000; i++)
            {
                var t = new Triple
                {
                    Subject = "http://www.networkedplanet.com/people/" + i,
                    Predicate = "http://www.networkedplanet.com/model/isa",
                    Object = "http://www.networkedplanet.com/types/person"
                };
                store.InsertTriple(t);
            }
            var end = DateTime.UtcNow;
            Console.WriteLine("Insert triples took " + (end - start).TotalMilliseconds);

            start = DateTime.UtcNow;
            store.Commit(Guid.Empty);
            end = DateTime.UtcNow;
            Console.WriteLine("Commit triples took " + (end - start).TotalMilliseconds);
        }
开发者ID:phatcher,项目名称:BrightstarDB,代码行数:24,代码来源:ScalingTests.cs


示例5: InsertTriple

 /// <summary>
 /// Inserts a triple into the store
 /// </summary>
 /// <param name="triple"></param>
 public void InsertTriple(Triple triple)
 {
     InsertTriple(triple.Subject, triple.Predicate, triple.Object, triple.IsLiteral, triple.DataType,
                  triple.LangCode, triple.Graph ?? Constants.DefaultGraphUri);
 }
开发者ID:rexwhitten,项目名称:BrightstarDB,代码行数:9,代码来源:Store.cs


示例6: AddLiteralProperty

        private void AddLiteralProperty(IDataObject type, string value, string dataType, string langCode = null)
        {
            CheckLoaded();

            var triple = new Triple
                             {
                                 Graph = _store.UpdateGraphUri,
                                 IsLiteral = true,
                                 Object = value,
                                 DataType = dataType,
                                 LangCode = langCode,
                                 Predicate = type.Identity,
                                 Subject = Identity
                             };

            // add to DataObject state triples
            _triples.Add(triple);

            // add to txn
            _store.AddTriples.Add(triple);
        }
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:21,代码来源:DataObject.cs


示例7: SetVersionTriple

        private void SetVersionTriple(Triple triple)
        {
            // see if there are any triples for this property
            bool haveMatch = _triples.Any(t => t.Predicate.Equals(triple.Predicate));
            if (haveMatch)
            {
                // remove all triples in current state that match the predicate
                _triples.RemoveAll(t => t.Predicate.Equals(triple.Predicate));

                // remove any existing property triple in the add triples collection
                _store.AddTriples.RemoveAll(t => t.Subject.Equals(triple.Subject) && t.Predicate.Equals(triple.Predicate));
            }

            // Because this is a set, we use a wildcard to delete any existing properties with the same predicate
            if (!_isNew && !_store.DeletePatterns.Any(t => t.Subject.Equals(triple.Subject) && t.Predicate.Equals(triple.Predicate) && t.Object.Equals(Constants.WildcardUri)))
            {
                _store.DeletePatterns.Add(new Triple
                {
                    Subject = triple.Subject,
                    Predicate = triple.Predicate,
                    Object = Constants.WildcardUri,
                    Graph = _store.VersionGraphUri
                });
            }

            // add new triple to current triples
            _triples.Add(triple);

            // add new triple to txn add triples
            _store.AddTriples.Add(triple);
        }
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:31,代码来源:DataObject.cs


示例8: SetPropertyLiteral

        private void SetPropertyLiteral(IDataObject type, string value, string dataType, string langCode = null)
        {
            CheckLoaded();

            if (type.Identity.Equals(Constants.VersionPredicateUri))
            {
                // Update of version property has slightly different handling due to different target graph
                var triple = new Triple
                    {
                        Subject = Identity,
                        Predicate = Constants.VersionPredicateUri,
                        IsLiteral = true,
                        Object = value,
                        DataType = dataType,
                        LangCode = langCode,
                        Graph = _store.VersionGraphUri
                    };
                SetVersionTriple(triple);
            }
            else
            {
                // create a new value triple
                var triple = new Triple
                    {
                        Subject = Identity,
                        Predicate = type.Identity,
                        IsLiteral = true,
                        Object = value,
                        DataType = dataType,
                        LangCode = langCode,
                        Graph = _store.UpdateGraphUri
                    };

                // use common method for updating local state and the txn
                SetTriple(triple);
            }
            // return this DataObject
            return;
        }
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:39,代码来源:DataObject.cs


示例9: SetRelatedObject

        /// <summary>
        /// Sets the property of this object to the specified data object
        /// </summary>
        /// <param name="type">The type of the property to set</param>
        /// <param name="value">The new value of the property</param>
        /// <returns>This IDataObject to allow chained calls</returns>
        /// <remarks>This method will remove all existing properties of type <paramref name="type"/> from this data object
        /// and add a single replacement property of the same type with <paramref name="value"/> as the property value.</remarks>
        private IDataObject SetRelatedObject(IDataObject type, IDataObject value)
        {
            CheckLoaded();

            // create a new value triple
            var triple = new Triple
                             {
                                 Graph = Constants.DefaultGraphUri,
                                 IsLiteral = false,
                                 Object = value.Identity,
                                 Predicate = type.Identity,
                                 Subject = Identity
                             };

            // use common method for updating local state and the txn
            SetTriple(triple);

            // return this DataObject
            return this;
        }
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:28,代码来源:DataObject.cs


示例10: TestMatchTriplesWithNulls

        public virtual void TestMatchTriplesWithNulls()
        {
            var sid = Guid.NewGuid().ToString();
            var t1 = new Triple
            {
                Subject = "http://www.networkedplanet.com/people/10",
                Predicate = "http://www.networkedplanet.com/model/isa",
                Object = "bob",
                DataType = RdfDatatypes.String,
                IsLiteral = true
            };
            var t2 = new Triple
            {
                Subject = "http://www.networkedplanet.com/people/10",
                Predicate = "http://www.networkedplanet.com/model/isa",
                Object = "kal",
                DataType = RdfDatatypes.String,
                IsLiteral = true
            };
            using (var store = StoreManager.CreateStore(Configuration.StoreLocation + "\\" + sid))
            {
                store.InsertTriple(t1);
                store.InsertTriple(t2);

                store.Commit(Guid.Empty);
            }
            // match triple
            using (var store = StoreManager.OpenStore(Configuration.StoreLocation + "\\" + sid))
            {
                var matches = store.Match(t1.Subject, t1.Predicate, t1.Object, true, RdfDatatypes.String, null,
                                          Constants.DefaultGraphUri);
                Assert.AreEqual(1, matches.Count());
                matches = store.Match(t1.Subject, t1.Predicate, t1.Object, true, RdfDatatypes.String, null, graphs: null);
                Assert.AreEqual(1, matches.Count(), "Failed to match triple using null graphs array");
            }

            using (var store = StoreManager.OpenStore(Configuration.StoreLocation + "\\" + sid))
            {
                var triples = store.GetResourceStatements("http://www.networkedplanet.com/people/10");
                Assert.AreEqual(2, triples.Count());
            }
        }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:42,代码来源:StoreTestsBase.cs


示例11: TestInsertAndRetrieveXmlLiteral

        public virtual void TestInsertAndRetrieveXmlLiteral()
        {
            var sid = Guid.NewGuid().ToString();
            var doc = new XDocument(
                new XComment("This is a comment"),
                new XElement("Root",
                             new XElement("Child1", "data1"),
                             new XElement("Child2", "data2"),
                             new XElement("Child3", "data3"),
                             new XElement("Child2", "data4"),
                             new XElement("Info5", "info5"),
                             new XElement("Info6", "info6"),
                             new XElement("Info7", "info7"),
                             new XElement("Info8", "info8")
                    )
                );

            var t = new Triple
                        {
                            Subject = "http://www.networkedplanet.com/people/10",
                            Predicate = "http://www.networkedplanet.com/model/isa",
                            Object = doc.ToString(),
                            DataType = RdfDatatypes.XmlLiteral,
                            IsLiteral = true
                        };
            using (var store = StoreManager.CreateStore(Configuration.StoreLocation + "\\" + sid))
            {
                store.InsertTriple(t);

                store.Commit(Guid.Empty);
            }

            // match triple
            using (var store = StoreManager.OpenStore(Configuration.StoreLocation + "\\" + sid))
            {
                var matches = store.Match(t.Subject, t.Predicate, t.Object, true,
                                          RdfDatatypes.XmlLiteral, null, Constants.DefaultGraphUri)
                    .ToList();
                Assert.AreEqual(1, matches.Count());

                // check document is ok.
                var outDoc = XDocument.Parse(matches.First().Object);

                Assert.IsNotNull(outDoc);
                Assert.IsNotNull(outDoc.Root);
                Assert.AreEqual(8, outDoc.Root.Elements().Count());
            }
        }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:48,代码来源:StoreTestsBase.cs


示例12: TestInsertAndRetrieveLiteralObjectTriple

        public virtual void TestInsertAndRetrieveLiteralObjectTriple()
        {
            var sid = Guid.NewGuid().ToString();
            var t = new Triple
            {
                Subject = "http://www.networkedplanet.com/people/10",
                Predicate = "http://www.networkedplanet.com/model/isa",
                Object = "graham",
                LangCode = "en",
                IsLiteral = true
            };
            using (var store = StoreManager.CreateStore(Configuration.StoreLocation + "\\" + sid))
            {
                store.InsertTriple(t);
                store.Commit(Guid.Empty);
            }

            // match triple
            using (var store = StoreManager.OpenStore(Configuration.StoreLocation + "\\" + sid))
            {
                var matches = store.Match(t.Subject, t.Predicate, t.Object, true,
                                          RdfDatatypes.PlainLiteral, "en", Constants.DefaultGraphUri).ToList();
                Assert.AreEqual(1, matches.Count());
                var tout = matches.First();
                Assert.AreEqual("en", tout.LangCode);
                Assert.AreEqual(RdfDatatypes.PlainLiteral, tout.DataType);
            }
        }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:28,代码来源:StoreTestsBase.cs


示例13: TestInsertAndRetrieveTripleWithSameLiteralAndDifferentDataType

        public virtual void TestInsertAndRetrieveTripleWithSameLiteralAndDifferentDataType()
        {
            var sid = Guid.NewGuid().ToString();
            var store = StoreManager.CreateStore(Configuration.StoreLocation + "\\" + sid);

            var t = new Triple
                        {
                            Subject = "http://www.networkedplanet.com/people/10",
                            Predicate = "http://www.networkedplanet.com/model/isa",
                            Object = "24/03/76",
                            DataType = RdfDatatypes.String,
                            IsLiteral = true
                        };
            store.InsertTriple(t);

            t = new Triple
                    {
                        Subject = "http://www.networkedplanet.com/people/10",
                        Predicate = "http://www.networkedplanet.com/model/isa",
                        Object = "24/03/76",
                        DataType = RdfDatatypes.DateTime,
                        IsLiteral = true
                    };
            store.InsertTriple(t);
            store.Commit(Guid.Empty);

            // match triple
            store = StoreManager.OpenStore(Configuration.StoreLocation + "\\" + sid, true);

            var matches = store.Match(t.Subject, t.Predicate, t.Object, true,
                                      RdfDatatypes.DateTime, null, Constants.DefaultGraphUri);
            Assert.AreEqual(1, matches.Count());
            matches = store.Match(t.Subject, t.Predicate, t.Object, true,
                                  RdfDatatypes.String, null, Constants.DefaultGraphUri);
            Assert.AreEqual(1, matches.Count());
        }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:36,代码来源:StoreTestsBase.cs


示例14: TestDeleteTriples

        public virtual void TestDeleteTriples()
        {
            var sid = Guid.NewGuid().ToString();
            var t1 = new Triple
                         {
                             Subject = "http://www.networkedplanet.com/people/10",
                             Predicate = "http://www.networkedplanet.com/model/isa",
                             Object = "bob",
                             IsLiteral = true
                         };
            var t2 = new Triple
                         {
                             Subject = "http://www.networkedplanet.com/people/10",
                             Predicate = "http://www.networkedplanet.com/model/isa",
                             Object = "kal",
                             IsLiteral = true
                         };

            using (var store = StoreManager.CreateStore(Configuration.StoreLocation + "\\" + sid))
            {
                store.InsertTriple(t1);
                store.InsertTriple(t2);
                store.Commit(Guid.Empty);
            }
            // delete triple
            using (var store = StoreManager.OpenStore(Configuration.StoreLocation + "\\" + sid))
            {
                store.DeleteTriple(t2);
                store.Commit(Guid.Empty);
            }
            using (var store = StoreManager.OpenStore(Configuration.StoreLocation + "\\" + sid))
            {
                var triples = store.GetResourceStatements("http://www.networkedplanet.com/people/10");
                Assert.AreEqual(1, triples.Count());
            }
        }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:36,代码来源:StoreTestsBase.cs


示例15: TestFetchMultipleResourceStatements

        public virtual void TestFetchMultipleResourceStatements()
        {
            var sid = Guid.NewGuid().ToString();
            var store = StoreManager.CreateStore(Configuration.StoreLocation + "\\" + sid);

            for (int i = 0; i < 1000; i++)
            {
                var t = new Triple
                            {
                                Subject = "http://www.networkedplanet.com/people/gra",
                                Predicate = "http://www.networkedplanet.com/model/hasSkill",
                                Object = "http://www.networkedplanet.com/skills/" + i
                            };
                store.InsertTriple(t);
            }

            store.Commit(Guid.Empty);

            store = StoreManager.OpenStore(Configuration.StoreLocation + "\\" + sid, true);

            var triples = store.GetResourceStatements("http://www.networkedplanet.com/people/gra");

            Assert.AreEqual(1000, triples.Count());
        }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:24,代码来源:StoreTestsBase.cs


示例16: TestRecoverFromBadCommitPointWrite

        public virtual void TestRecoverFromBadCommitPointWrite()
        {
            var sid = Guid.NewGuid().ToString();
            using (var store = StoreManager.CreateStore(Configuration.StoreLocation + "\\" + sid))
            {
                Assert.AreEqual(1, store.GetCommitPoints().First().CommitNumber);
                var t = new Triple
                            {
                                Subject = "http://www.networkedplanet.com/people/10",
                                Predicate = "http://www.networkedplanet.com/model/isa",
                                Object = "bob",
                                DataType = RdfDatatypes.String,
                                IsLiteral = true
                            };
                store.InsertTriple(t);

                t = new Triple
                        {
                            Subject = "http://www.networkedplanet.com/people/10",
                            Predicate = "http://www.networkedplanet.com/model/isa",
                            Object = "kal",
                            DataType = RdfDatatypes.String,
                            IsLiteral = true
                        };
                store.InsertTriple(t);

                store.Commit(Guid.Empty);

                Assert.AreEqual(2, store.GetCommitPoints().First().CommitNumber);

                t = new Triple
                        {
                            Subject = "http://www.networkedplanet.com/people/10",
                            Predicate = "http://www.networkedplanet.com/model/isa",
                            Object = "gra",
                            DataType = RdfDatatypes.String,
                            IsLiteral = true
                        };

                store.InsertTriple(t);
                store.Commit(Guid.Empty);
                Assert.AreEqual(3, store.GetCommitPoints().First().CommitNumber);
            }
            var storePath = Path.Combine(Configuration.StoreLocation, sid);
            var masterFilePath = Path.Combine(Configuration.StoreLocation, sid, MasterFile.MasterFileName);


            using (var store = StoreManager.OpenStore(storePath))
            {
                Assert.AreEqual(3, store.GetCommitPoints().First().CommitNumber);
                Assert.AreEqual(3, store.GetResourceStatements("http://www.networkedplanet.com/people/10").Count());
            }

            // mess with the file
            using (var stream = new FileStream(masterFilePath, FileMode.Open, FileAccess.ReadWrite))
            {
                stream.Seek(-130, SeekOrigin.End);
                stream.WriteByte(5);
                stream.Flush();
            }

            // open it and should still be at the third commit point (using second copy)
            using (var store = StoreManager.OpenStore(storePath))
            {
                Assert.AreEqual(3, store.GetCommitPoints().First().CommitNumber);
                var triples = store.GetResourceStatements("http://www.networkedplanet.com/people/10");
                Assert.AreEqual(3, triples.Count());

                // Mess with the file again (fuck up the duplicate copy)
                using (var stream = new FileStream(masterFilePath, FileMode.Open, FileAccess.ReadWrite))
                {
                    stream.Seek(-5, SeekOrigin.End);
                    var currentValue = (byte)stream.ReadByte();
                    stream.Seek(-1, SeekOrigin.Current);
                    stream.WriteByte((byte)~currentValue);
                    stream.Flush();
                }
            }

            // Open it now and we will be back to the second commit point
            // Need to clear the page cache to ensure that in this simple test we don't get an old cached version of the page
            PageCache.Instance.Clear();
            BPlusTreeStoreManager.MasterFileCache.Clear();

            using (var store = StoreManager.OpenStore(storePath))
            {
                Assert.AreEqual(2, store.GetCommitPoints().First().CommitNumber);
                var triples = store.GetResourceStatements("http://www.networkedplanet.com/people/10").ToList();
                Assert.AreEqual(2, triples.Count());
            }
        }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:91,代码来源:StoreTestsBase.cs


示例17: TestReadStoreCacheValueRespected

        public void TestReadStoreCacheValueRespected()
        {
            var sid = Guid.NewGuid().ToString();
            var store = _storeManager.CreateStore(Configuration.StoreLocation + "\\" + sid);

            var t = new Triple
            {
                Subject = "http://www.networkedplanet.com/people/10",
                Predicate = "http://www.networkedplanet.com/model/isa",
                Object = "bob",
                DataType = RdfDatatypes.String,
                IsLiteral = true
            };
            store.InsertTriple(t);

            t = new Triple
            {
                Subject = "http://www.networkedplanet.com/people/10",
                Predicate = "http://www.networkedplanet.com/model/isa",
                Object = "kal",
                DataType = RdfDatatypes.String,
                IsLiteral = true
            };
            store.InsertTriple(t);

            store.Commit(Guid.Empty);

            Configuration.ReadStoreObjectCacheSize = 0;

            var store1 = _storeManager.OpenStore(Configuration.StoreLocation + "\\" + sid, true) as Store;
            var triples = store1.GetResourceStatements("http://www.networkedplanet.com/people/10");
            Assert.AreEqual(2, triples.Count());
            Assert.AreEqual(0, store1.CacheCount);

            Configuration.ReadStoreObjectCacheSize = 100000;

            store1 = _storeManager.OpenStore(Configuration.StoreLocation + "\\" + sid, true) as Store;
            triples = store1.GetResourceStatements("http://www.networkedplanet.com/people/10");
            Assert.AreEqual(2, triples.Count());
            Assert.IsTrue(store1.CacheCount > 0);
        }
开发者ID:Garwin4j,项目名称:BrightstarDB,代码行数:41,代码来源:BTreeStoreTests.cs


示例18: TestSparql1

        public virtual void TestSparql1()
        {
            var sid = Guid.NewGuid().ToString();
            using (var store = StoreManager.CreateStore(Configuration.StoreLocation + "\\" + sid))
            {

                var t = new Triple
                            {
                                Subject = "http://www.networkedplanet.com/people/10",
                                Predicate = "http://www.networkedplanet.com/model/isa",
                                Object = "bob",
                                DataType = RdfDatatypes.String,
                                IsLiteral = true
                            };
                store.InsertTriple(t);
                t = new Triple
                        {
                            Subject = "http://www.networkedplanet.com/people/10",
                            Predicate = "http://www.networkedplanet.com/model/worksfor",
                            Object = "http://www.networkedplanet.com/np",
                        };
                store.InsertTriple(t);
                store.Commit(Guid.Empty);
            }
            // match triple
            using (var store = StoreManager.OpenStore(Configuration.StoreLocation + "\\" + sid))
            {
                const string query =
                    "select ?t where { ?t <http://www.networkedplanet.com/model/worksfor> <http://www.networkedplanet.com/np> }";
                var result = store.ExecuteSparqlQuery(query, SparqlResultsFormat.Xml);
                Assert.IsNotNull(result);

                var resultDoc = XDocument.Parse(result);
                var rows = resultDoc.Descendants(SparqlResult + "result").ToList();
                Assert.AreEqual(1, rows.Count());

                var uriBinding = rows.Descendants(SparqlResult + "uri").FirstOrDefault();
                Assert.IsNotNull(uriBinding);
                Assert.AreEqual("http://www.networkedplanet.com/people/10", uriBinding.Value);
            }
        }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:41,代码来源:StoreTestsBase.cs


示例19: CreateTypedObject

 /// <summary>
 /// Maps the xsd data type to a .NET type for literal values or creates / looks up a DataObject for 
 /// resources. BNodes get mapped to DataObjects.
 /// </summary>
 /// <param name="triple"></param>
 /// <returns></returns>
 private object CreateTypedObject(Triple triple)
 {
     if (triple.IsLiteral)
     {
         object retValue;
         if (RdfDatatypes.TryParseLiteralString(triple.Object, triple.DataType, out retValue))
         {
             return retValue;
         }
         return triple.Object;
     }
     return _store.MakeDataObject(triple.Object);
 }
开发者ID:stangelandcl,项目名称:BrightstarDB,代码行数:19,代码来源:DataObject.cs


示例20: TestListCommitPoints

        public virtual void TestListCommitPoints()
        {
            var sid = Guid.NewGuid().ToString();
            var store = StoreManager.CreateStore(Configuration.StoreLocation + "\\" + sid);

            Assert.AreEqual(1, store.GetCommitPoints().Count());

            var t = new Triple
                        {
                            Subject = "http://www.networkedplanet.com/people/10",
                            Predicate = "http://www.networkedplanet.com/model/isa",
                            Object = "bob",
                            DataType = RdfDatatypes.String,
                            IsLiteral = true
                        };
            store.InsertTriple(t);
            store.Commit(Guid.Empty);

            Assert.AreEqual(2, store.GetCommitPoints().Count());

            t = new Triple
                    {
                        Subject = "http://www.networkedplanet.com/people/11",
                        Predicate = "http://www.networkedplanet.com/model/isa",
                        Object = "bob",
                        DataType = RdfDatatypes.String,
                        IsLiteral = true
                    };
            store.InsertTriple(t);
            store.Commit(Guid.Empty);

            Assert.AreEqual(3, store.GetCommitPoints().Count());
        }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:33,代码来源:StoreTestsBase.cs



注:本文中的BrightstarDB.Model.Triple类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Server.StoreWorker类代码示例发布时间:2022-05-24
下一篇:
C# Client.EmbeddedDataObjectContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap