本文整理汇总了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>();
}
}
}
示例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)));
}