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

C# Triple类代码示例

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

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



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

示例1: HandleTripleInternal

 protected override bool HandleTripleInternal(Triple t)
 {
     if (t.Subject.NodeType == NodeType.Uri)
     {
         if (t.Predicate.Equals(this._rdfType))
         {
             if (t.Object.Equals(this._rdfsClass) || t.Object.Equals(this._rdfsDatatype) || t.Object.Equals(this._rdfProperty))
             {
                 if (!this._terms.Contains(t.Subject))
                 {
                     this._terms.Add(t.Subject);
                 }
             }
         }
         else if (t.Predicate.Equals(this._rdfsLabel) && t.Object.NodeType == NodeType.Literal)
         {
             if (!this._termLabels.ContainsKey(t.Subject))
             {
                 this._termLabels.Add(t.Subject, ((ILiteralNode)t.Object).Value);
             }
         }
         else if (t.Predicate.Equals(this._rdfsComment) && t.Object.NodeType == NodeType.Literal)
         {
             if (!this._termComments.ContainsKey(t.Subject))
             {
                 this._termLabels.Add(t.Subject, ((ILiteralNode)t.Object).Value);
             }
         }
     }
     return true;
 }
开发者ID:jbunzel,项目名称:MvcRQ_git,代码行数:31,代码来源:TermDetectionHandler.cs


示例2: MakeBrighstarTriple

        private static Model.Triple MakeBrighstarTriple(Triple t, string uniqueImportId)
        {
            var ret = new Model.Triple
            {
                Subject = Stringify(t.Subject, uniqueImportId),
                Predicate = Stringify(t.Predicate, uniqueImportId)
            };


            if (t.Object is UriNode)
            {
                ret.Object = t.Object.ToString();
            }
            else if (t.Object is LiteralNode)
            {
                var ln = (LiteralNode)t.Object;
                ret.DataType = ln.DataType == null ? Constants.DefaultDatatypeUri : ln.DataType.ToString();
                ret.IsLiteral = true;
                ret.Object = ln.Value;
                ret.LangCode = ln.Language;
            }
            else if (t.Object is BlankNode)
            {
                ret.Object = String.Format("{0}/{1}/{2}", Constants.GeneratedUriPrefix, uniqueImportId,
                                            ((BlankNode) t.Object).InternalID);
            }
            if (t.GraphUri != null)
            {
                ret.Graph = t.GraphUri.ToString();
            }
            return ret;
        }
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:32,代码来源:BrightstarIOManager.cs


示例3: AddLoaderException

 private void AddLoaderException(Triple<Assembly, Type, Exception> loaderException)
 {
     lock (this)
     {
         this.loaderExceptions.Add(loaderException);
     }
 }
开发者ID:metadeta96,项目名称:openpdn,代码行数:7,代码来源:EffectsCollection.cs


示例4: AddTripleLiteral

        /// <summary>
        /// Adds the literal triple to a graph.
        /// </summary>
        /// <param name="graph">The graph.</param>
        /// <param name="subject">The subject.</param>
        /// <param name="predicate">The predicate.</param>
        /// <param name="obj">The object (resource).</param>
        /// <remarks></remarks>
        public static void AddTripleLiteral(Graph graph, string subject, string predicate, string obj, string datatype)
        {
            string xmlSchemaDatatype;
            switch (datatype)
            {
                case "Url":
                    xmlSchemaDatatype = XmlSpecsHelper.XmlSchemaDataTypeAnyUri;
                    break;
                case "Date":
                    xmlSchemaDatatype = XmlSpecsHelper.XmlSchemaDataTypeDateTime;
                    break;
                case "Integer":
                    xmlSchemaDatatype = XmlSpecsHelper.XmlSchemaDataTypeInteger;
                    break;
                case "Ntext":
                    xmlSchemaDatatype = XmlSpecsHelper.XmlSchemaDataTypeString;
                    break;
                case "Nvarchar":
                    xmlSchemaDatatype = XmlSpecsHelper.XmlSchemaDataTypeString;
                    break;
                default:
                    xmlSchemaDatatype = XmlSpecsHelper.XmlSchemaDataTypeString;
                    break;
            }

            Triple triple = null;
            if (subject.StartsWith("http") && predicate.StartsWith("http"))
            {
                triple = new Triple(
                        graph.CreateUriNode(new Uri(subject)),
                        graph.CreateUriNode(new Uri(predicate)),
                        graph.CreateLiteralNode(obj, new Uri(xmlSchemaDatatype))
                        );
            }
            else if (!subject.StartsWith("http") && predicate.StartsWith("http"))
            {
                triple = new Triple(
                        graph.CreateUriNode(subject),
                        graph.CreateUriNode(new Uri(predicate)),
                        graph.CreateLiteralNode(obj, new Uri(xmlSchemaDatatype))
                        );
            }
            else if (subject.StartsWith("http") && !predicate.StartsWith("http"))
            {
                triple = new Triple(
                        graph.CreateUriNode(new Uri(subject)),
                        graph.CreateUriNode(predicate),
                        graph.CreateLiteralNode(obj, new Uri(xmlSchemaDatatype))
                        );
            }
            else if (!subject.StartsWith("http") && !predicate.StartsWith("http"))
            {
                triple = new Triple(
                        graph.CreateUriNode(subject),
                        graph.CreateUriNode(predicate),
                        graph.CreateLiteralNode(obj, new Uri(xmlSchemaDatatype))
                        );
            }
            graph.Assert(triple);
        }
开发者ID:coding3d,项目名称:InstantRDF,代码行数:68,代码来源:Helper.cs


示例5: GambatteColor

		// the version of gambatte in bizhawk
		public static Triple GambatteColor(Triple c)
		{
			Triple ret;
			ret.r = (c.r * 13 + c.g * 2 + c.b) >> 1;
			ret.g = (c.g * 3 + c.b) << 1;
			ret.b = (c.r * 3 + c.g * 2 + c.b * 11) >> 1;
			return ret;
		}
开发者ID:ddugovic,项目名称:RASuite,代码行数:9,代码来源:GBColors.cs


示例6: Multiply

 /// <summary> Multiplies a 3x3 matrix by a 1x3 pythagorean triple. </summary>
 static Triple Multiply(int[,] matrix, Triple triple)
 {
     Triple result;
     result.a = matrix[0,0]*triple.a + matrix[1,0]*triple.b + matrix[2,0]*triple.c;
     result.b = matrix[0,1]*triple.a + matrix[1,1]*triple.b + matrix[2,1]*triple.c;
     result.c = matrix[0,2]*triple.a + matrix[1,2]*triple.b + matrix[2,2]*triple.c;
     return result;
 }
开发者ID:tjvezina,项目名称:ProjectEuler,代码行数:9,代码来源:Program.cs


示例7: Format

 /// <summary>
 /// Formats a Triple as a String
 /// </summary>
 /// <param name="t">Triple</param>
 /// <returns></returns>
 public override string Format(Triple t)
 {
     if (t.GraphUri == null)
     {
         return base.Format(t);
     }
     else
     {
         return this.Format(t.Subject, TripleSegment.Subject) + " " + this.Format(t.Predicate, TripleSegment.Predicate) + " " + this.Format(t.Object, TripleSegment.Object) + " <" + this.FormatUri(t.GraphUri) + "> .";
     }
 }
开发者ID:jmahmud,项目名称:RDFer,代码行数:16,代码来源:NQuadsFormatter.cs


示例8: insertLearningObject

        /// <summary>
        /// 
        /// </summary>
        /// <param name="g"></param>
        /// <param name="LO"></param>
        public void insertLearningObject(ref Graph g, LearningObjectContextModel LO)
        {
            g.NamespaceMap.AddNamespace("onto", new Uri("http://www.owl-ontologies.com/OntoAdapt2.owl#"));

            IUriNode sujeito = g.CreateUriNode("onto:" + LO.LearningObject_ID);
            INode rdfType = g.CreateUriNode("rdf:type");
            INode objeto = g.CreateUriNode("onto:LearningObject");

            Triple triple = new Triple(sujeito, rdfType, objeto);
            g.Assert(triple);
        }
开发者ID:mabech,项目名称:Projeto-Mestrado,代码行数:16,代码来源:OntoLearningObject.cs


示例9: ToJena

        public static Statement ToJena(Triple t, JenaMapping mapping)
        {
            Resource s;
            Property p;
            RDFNode o;
            s = ToJenaResource(t.Subject, mapping);
            p = ToJenaProperty(t.Predicate, mapping);
            o = ToJenaNode(t.Object, mapping);

            return mapping.Model.createStatement(s, p, o);
        }
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:11,代码来源:JenaConverter.cs


示例10: Contains

 /// <summary>
 /// Checks whether the Triple exists in the Collection
 /// </summary>
 /// <param name="t">Triple to check for</param>
 /// <returns></returns>
 /// <exception cref="RdfStorageException">Thrown if the underlying StatementSource is not a SelectableSource</exception>
 public override bool Contains(Triple t)
 {
     if (this._source is SelectableSource)
     {
         Statement stmt = SemWebConverter.ToSemWeb(t, this._mapping);
         return ((SelectableSource)this._source).Contains(stmt);
     }
     else
     {
         throw new RdfStorageException("The underlying StatementSource does not support the Contains() operation");
     }
 }
开发者ID:jbunzel,项目名称:MvcRQ_git,代码行数:18,代码来源:SemWebTripleCollection.cs


示例11: insertComunidadeMoodle

        /// <summary>
        /// 
        /// </summary>
        /// <param name="g"></param>
        public void insertComunidadeMoodle(ref Graph g)
        {
            g = new Graph();
            g.NamespaceMap.AddNamespace("onto", new Uri("http://www.owl-ontologies.com/OntoAdapt2.owl#"));

            IUriNode sujeito = g.CreateUriNode("onto:" + student.Matricula);
            INode rdfType = g.CreateUriNode("onto:ComunidadeMoodle");
            ILiteralNode literal = g.CreateLiteralNode(student.ComunidadeMoodle);

            Triple triple = new Triple(sujeito, rdfType, literal);
            g.Assert(triple);
        }
开发者ID:mabech,项目名称:Projeto-Mestrado,代码行数:16,代码来源:OntoStudent.cs


示例12: insertDeviceMediaPreference

        /// <summary>
        /// 
        /// </summary>
        /// <param name="g"></param>
        /// <param name="strLearningStyle"></param>
        public void insertDeviceMediaPreference(ref Graph g)
        {
            g = new Graph();
            g.NamespaceMap.AddNamespace("onto", new Uri("http://www.owl-ontologies.com/OntoAdapt2.owl#"));

            IUriNode sujeito = g.CreateUriNode("onto:" + Device.model_name);
                INode rdfType = g.CreateUriNode("onto:hasDeviceMediaPreference");
                IUriNode objeto = g.CreateUriNode(new Uri("http://www.owl-ontologies.com/OntoAdapt2.owl#" + Device.MediaPreference));

                Triple triple = new Triple(sujeito, rdfType, objeto);
                g.Assert(triple);
        }
开发者ID:mabech,项目名称:Projeto-Mestrado,代码行数:17,代码来源:OntoDevice.cs


示例13: Assert

 /// <summary>
 /// Asserts a Triple in the Graph
 /// </summary>
 /// <param name="t">The Triple to add to the Graph</param>
 public override void Assert(Triple t)
 {
     try
     {
         this._lockManager.EnterWriteLock();
         base.Assert(t);
     }
     finally
     {
         this._lockManager.ExitWriteLock();
     }
 }
开发者ID:jbunzel,项目名称:MvcRQ_git,代码行数:16,代码来源:ThreadSafeGraph.cs


示例14: insertLearningObjectComunidade

        /// <summary>
        /// Insere LO a comunidade
        /// </summary>
        /// <param name="g"></param>
        /// <param name="LO"></param>
        public void insertLearningObjectComunidade(ref Graph g, LearningObjectContextModel LO)
        {
            g = new Graph();
            g.NamespaceMap.AddNamespace("onto", new Uri("http://www.owl-ontologies.com/OntoAdapt2.owl#"));

            IUriNode sujeito = g.CreateUriNode("onto:" + LO.LearningObject_ID);
            INode rdfType = g.CreateUriNode("onto:LO_MoodleCommunity");
            ILiteralNode objeto = g.CreateLiteralNode(LO.MoodleCommunity);

            Triple triple = new Triple(sujeito, rdfType, objeto);
            g.Assert(triple);
        }
开发者ID:mabech,项目名称:Projeto-Mestrado,代码行数:17,代码来源:OntoLearningObject.cs


示例15: InsertDeviceBrand

        /// <summary>
        /// 
        /// </summary>
        /// <param name="g"></param>
        public void InsertDeviceBrand(ref Graph g)
        {
            g = new Graph();
            g.NamespaceMap.AddNamespace("onto", new Uri("http://www.owl-ontologies.com/OntoAdapt2.owl#"));

            IUriNode sujeito = g.CreateUriNode("onto:" + Device.model_name);
            INode rdfType = g.CreateUriNode("onto:Brand");
            ILiteralNode literal = g.CreateLiteralNode(Device.Brand_Name);

            Triple triple = new Triple(sujeito, rdfType, literal);
            g.Assert(triple);
        }
开发者ID:mabech,项目名称:Projeto-Mestrado,代码行数:16,代码来源:OntoDevice.cs


示例16: HandleTripleInternal

 /// <summary>
 /// Handles Triples by asserting them into the appropriate Graph creating the Graph if necessary
 /// </summary>
 /// <param name="t">Triple</param>
 /// <returns></returns>
 protected override bool HandleTripleInternal(Triple t)
 {
     if (!this._store.HasGraph(t.GraphUri))
     {
         Graph g = new Graph();
         g.BaseUri = t.GraphUri;
         this._store.Add(g);
     }
     IGraph target = this._store.Graph(t.GraphUri);
     target.Assert(t.CopyTriple(target));
     return true;
 }
开发者ID:jbunzel,项目名称:MvcRQ_git,代码行数:17,代码来源:StoreHandler.cs


示例17: add

 public bool add(dotSesame.Resource r, dotSesame.URI uri, dotSesame.Value v, params dotSesame.Resource[] rarr)
 {
     Triple t = new Triple(SesameConverter.FromSesameResource(r, this._mapping), SesameConverter.FromSesameUri(uri, this._mapping), SesameConverter.FromSesameValue(v, this._mapping));
     if (this._g.ContainsTriple(t))
     {
         return false;
     }
     else
     {
         this._g.Assert(t);
         return true;
     }
 }
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:13,代码来源:DotNetRdfGraph.cs


示例18: Matches

 /// <summary>
 /// Returns true if this triple matches the specified triple allowing
 /// NULL in Graph, Subject, Predicate an Object to stand for a wildcard
 /// </summary>
 /// <param name="other">The other triple to match with</param>
 /// <returns>True if there is a match in the non-null parts of both triples, false otherwise</returns>
 public bool Matches(Triple other)
 {
     return NullOrMatch(Graph, other.Graph) &&
            NullOrMatch(Subject, other.Subject) &&
            NullOrMatch(Predicate, other.Predicate) &&
            (Object == null || other.Object == null ||
             (
                 IsLiteral == other.IsLiteral &&
                 DataType == other.DataType &&
                 LangCode == other.LangCode &&
                 Object == other.Object
             ));
 }
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:19,代码来源:Triple.cs


示例19: GetTriples

 private IEnumerable<Triple> GetTriples(Resource r, Property p, RDFNode rdfn)
 {
     if (r == null)
     {
         if (p == null)
         {
             //Object specified
             return this._g.GetTriplesWithObject(JenaConverter.FromJenaNode(rdfn, this._mapping));
         }
         else if (rdfn == null)
         {
             //Predicate specified
             return this._g.GetTriplesWithPredicate(JenaConverter.FromJenaProperty(p, this._mapping));
         }
         else
         {
             //Object and Predicate specified
             return this._g.GetTriplesWithPredicateObject(JenaConverter.FromJenaProperty(p, this._mapping), JenaConverter.FromJenaNode(rdfn, this._mapping));
         }
     }
     else if (p == null)
     {
         if (rdfn == null)
         {
             //Subject specified
             return this._g.GetTriplesWithSubject(JenaConverter.FromJenaResource(r, this._mapping));
         }
         else
         {
             //Subject and Object specified
             return this._g.GetTriplesWithSubjectObject(JenaConverter.FromJenaResource(r, this._mapping), JenaConverter.FromJenaNode(rdfn, this._mapping));
         }
     }
     else if (rdfn == null)
     {
         //Subject and Predicate specified
         return this._g.GetTriplesWithSubjectPredicate(JenaConverter.FromJenaResource(r, this._mapping), JenaConverter.FromJenaProperty(p, this._mapping));
     }
     else
     {
         Triple t = new Triple(JenaConverter.FromJenaResource(r, this._mapping), JenaConverter.FromJenaProperty(p, this._mapping), JenaConverter.FromJenaNode(rdfn, this._mapping));
         if (this._g.ContainsTriple(t))
         {
             return t.AsEnumerable();
         }
         else
         {
             return Enumerable.Empty<Triple>();
         }
     }
 }
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:51,代码来源:GraphModel.cs


示例20: Page_Init

 protected void Page_Init(object sender, EventArgs e)
 {
     _element = PageElement as PageElementWithErrorDto;
     if (_element == null)
     {
         throw new BugException("Crm literature received an incompatible page element \"" + PageElement.GetType().Name + "\"");
     }
         _controls = new List<Triple<PersonalDataSectionElements, WebControl, Label>>();
         countryRegionControl = null;
         if (_questionnaire.QuestionnaireId == 4258)
             QuestionnaireID = "4259";
         else
             QuestionnaireID = _questionnaire.QuestionnaireId.ToString();            
 }
开发者ID:amalapannuru,项目名称:RFC,代码行数:14,代码来源:WucQuestionCrmLiterature.ascx.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# TripleStore类代码示例发布时间:2022-05-24
下一篇:
C# TriggerType类代码示例发布时间: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