本文整理汇总了C#中Statement.Invert方法的典型用法代码示例。如果您正苦于以下问题:C# Statement.Invert方法的具体用法?C# Statement.Invert怎么用?C# Statement.Invert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statement
的用法示例。
在下文中一共展示了Statement.Invert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetFuncProperty
protected void SetFuncProperty(Entity predicate, object value, bool forward) {
Resource v = toRes(value);
Statement search = new Statement(ent, predicate, null);
Statement replace = new Statement(ent, predicate, v);
if (!forward) {
if (v != null && !(v is Entity)) throw new ArgumentException("Cannot set this property to a literal value.");
search = search.Invert();
replace = replace.Invert();
}
if (v != null) {
foreach (Statement s in model.Select(search)) {
model.Replace(s, replace);
return;
}
model.Add(replace);
} else {
model.Remove(search);
}
}
示例2: SetNonFuncProperty
protected void SetNonFuncProperty(Entity predicate, object[] values, bool forward) {
Statement search = new Statement(ent, predicate, null);
if (!forward)
search = search.Invert();
model.Remove(search);
if (values != null) {
foreach (object value in values) {
Resource v = toRes(value);
if (v == null) throw new ArgumentNullException("element of values array");
if (!forward && !(v is Entity)) throw new ArgumentException("Cannot set this property to a literal value.");
Statement add = new Statement(ent, predicate, v);
if (!forward) add = add.Invert();
model.Add(add);
}
}
}
示例3: RemoveValue
protected void RemoveValue(Entity predicate, object value, bool forward) {
if (value == null) throw new ArgumentNullException("value");
Resource v = toRes(value);
if (!forward && !(v is Entity)) throw new ArgumentException("Cannot set this property to a literal value.");
Statement rem = new Statement(ent, predicate, v);
if (!forward) rem = rem.Invert();
model.Remove(rem);
}