当前位置: 首页>>代码示例>>C#>>正文


C# Triple.AsEnumerable方法代码示例

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


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

示例1: 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

示例2: match

        public java.util.Iterator match(dotSesame.Resource r, dotSesame.URI uri, dotSesame.Value v, params dotSesame.Resource[] rarr)
        {
            INode s = (r != null) ? SesameConverter.FromSesameResource(r, this._mapping) : null;
            INode p = (uri != null) ? SesameConverter.FromSesameUri(uri, this._mapping) : null;
            INode o = (v != null) ? SesameConverter.FromSesameValue(v, this._mapping) : null;
            //Contexts are Ignored for matches on a single Graph

            IEnumerable<Triple> ts;

            if (s != null)
            {
                if (p != null)
                {
                    if (o != null)
                    {
                        //Matching on Subject Predicate and Object
                        Triple t = new Triple(s, p, o);
                        if (this._g.ContainsTriple(t))
                        {
                            ts = t.AsEnumerable();
                        }
                        else
                        {
                            ts = Enumerable.Empty<Triple>();
                        }
                    }
                    else
                    {
                        //Just matching on Subject Predicate
                        ts = this._g.GetTriplesWithSubjectPredicate(s, p);
                    }
                }
                else
                {
                    if (o != null)
                    {
                        //Matching on Subject Object
                        ts = this._g.GetTriplesWithSubjectObject(s, o);
                    }
                    else
                    {
                        //Just Matching on Subject
                        ts = this._g.GetTriplesWithSubject(s);
                    }
                }
            }
            else if (p != null)
            {
                if (o != null)
                {
                    //Matching on Predicate Object
                    ts = this._g.GetTriplesWithPredicateObject(p, o);
                }
                else
                {
                    //Just Matching on Predicate
                    ts = this._g.GetTriplesWithPredicate(p);
                }
            }
            else if (o != null)
            {
                //Matching on Object only
                ts = this._g.GetTriplesWithObject(o);
            }
            else
            {
                //Matching anything
                ts = this._g.Triples;
            }

            return new DotNetEnumerableWrapper(ts.Select(t => SesameConverter.ToSesame(t, this._mapping)));
        }
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:72,代码来源:DotNetRdfGraph.cs


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