本文整理了Java中org.openrdf.model.Model.remove()
方法的一些代码示例,展示了Model.remove()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.remove()
方法的具体详情如下:
包路径:org.openrdf.model.Model
类名称:Model
方法名:remove
[英]Removes statements with the specified subject, predicate, object and (optionally) context exist in this model. The subject, predicate and object parameters can be null to indicate wildcards. The contexts parameter is a wildcard and accepts zero or more values. If no contexts are specified, statements will be removed disregarding their context. If one or more contexts are specified, statements with a context matching one of these will be removed. Note: to remove statements without an associated context, specify the value null and explicitly cast it to type Resource.
Examples: model.remove(s1, null, null) removes any statements in this model have subject s1,
model.remove(null, null, null, c1) removes any statements in this model have context c1,
model.remove(null, null, null, (Resource)null) removes any statements in this model have no associated context,
model.remove(null, null, null, c1, c2, c3) removes any statements in this model have context c1, c2 or c3.
[中]删除此模型中存在的具有指定主语、谓语、宾语和(可选)上下文的语句。主语、谓语和宾语参数可以为null以表示通配符。contexts参数是一个通配符,接受零个或多个值。如果没有指定上下文,语句将被删除,而不考虑上下文。如果指定了一个或多个上下文,则上下文与其中一个匹配的语句将被删除。注意:要删除没有关联上下文的语句,请指定null值并显式将其转换为Resource类型。
例子:模型。remove(s1,null,null)删除此模型中任何主题为s1的语句,
模型remove(null,null,null,c1)删除此模型中具有上下文c1的任何语句,
模型remove(null,null,null,(Resource)null)删除此模型中没有关联上下文的任何语句,
模型remove(null,null,null,c1,c2,c3)删除此模型中上下文为c1,c2或c3的任何语句。
代码示例来源:origin: anno4j/anno4j
public boolean remove(Value subj, URI pred, Value obj) {
if (subj == null || subj instanceof Resource)
return model.remove((Resource) subj, pred, obj);
return false;
}
代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-object
public boolean remove(Value subj, URI pred, Value obj) {
if (subj == null || subj instanceof Resource)
return model.remove((Resource) subj, pred, obj);
return false;
}
代码示例来源:origin: org.openrdf.sesame/sesame-sail-inferencer
@Override
public void statementRemoved(Statement st) {
boolean removed = (newStatements != null) ? newStatements.remove(st) : false;
if (!removed) {
// trigger full rebuild
statementsRemoved = true;
newStatements = null;
}
}
代码示例来源:origin: org.openrdf.alibaba/alibaba-model
public boolean remove(Value subj, Value pred, Value obj,
Value... contexts) {
boolean modified = false;
for (Model model : models) {
modified |= model.remove(subj, pred, obj, contexts);
}
return modified;
}
代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.model.sesame
/**
* Removes the value from the parsed property
* @param property
* @param value
*/
private boolean removeValue(URI property, Value value){
if(value != null){
return model.remove(subject, property, value);
} else {
return false;
}
}
代码示例来源:origin: apache/stanbol
/**
* Removes the value from the parsed property
* @param property
* @param value
*/
private boolean removeValue(URI property, Value value){
if(value != null){
return model.remove(subject, property, value);
} else {
return false;
}
}
代码示例来源:origin: org.openrdf.sesame/sesame-model
/**
* @deprecated since 4.0. Use
* {@link #remove(Resource, IRI, Value, Resource...)} instead.
*/
@Deprecated
public default boolean remove(Resource subj, URI pred, Value obj, Resource... contexts) {
return remove(subj, (IRI)pred, obj, contexts);
}
代码示例来源:origin: org.openrdf.alibaba/alibaba-model
@Override
protected void removeIteration(Iterator<Statement> union, Resource subj,
URI pred, Value obj, Resource... contexts) {
Iterator<Statement> iter = ((UnionIterator) union).iter;
int idx = ((UnionIterator) union).idx;
for (int i = 0; i < models.length; i++) {
Model model = models[i];
if (i == idx) {
iter.remove();
} else {
model.remove(subj, pred, obj, contexts);
}
}
}
代码示例来源:origin: org.openrdf.sesame/sesame-sail-base
@Override
public synchronized void clear(Resource... contexts) {
if (contexts != null && contexts.length == 0) {
if (approved != null) {
approved.remove(null, null, null);
}
if (approvedContexts != null) {
approvedContexts.clear();
}
statementCleared = true;
}
else {
if (approved != null) {
approved.remove(null, null, null, contexts);
}
if (approvedContexts != null) {
approvedContexts.removeAll(Arrays.asList(contexts));
}
if (deprecatedContexts == null) {
deprecatedContexts = new HashSet<Resource>();
}
deprecatedContexts.addAll(Arrays.asList(contexts));
}
}
代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.model.sesame
@Override
public void removeAll(String field) throws IllegalArgumentException {
if(field == null){
throw new IllegalArgumentException("The parsed field MUST NOT be NULL");
} else if(field.isEmpty()){
throw new IllegalArgumentException("The parsed field MUST NOT be Empty");
}
model.remove(subject, sesameFactory.createURI(field), null);
}
代码示例来源:origin: apache/stanbol
@Override
public void removeAll(String field) throws IllegalArgumentException {
if(field == null){
throw new IllegalArgumentException("The parsed field MUST NOT be NULL");
} else if(field.isEmpty()){
throw new IllegalArgumentException("The parsed field MUST NOT be Empty");
}
model.remove(subject, sesameFactory.createURI(field), null);
}
代码示例来源:origin: org.openrdf.alibaba/alibaba-model
public boolean remove(Value subj, Value pred, Value obj,
Value... contexts) {
return getDelegate().remove(subj, pred, obj, contexts);
}
代码示例来源:origin: org.openrdf.sesame/sesame-model
@Override
public boolean remove(Resource s, IRI p, Value o, Resource... c) {
if (s == null) {
s = subj;
}
if (p == null) {
p = pred;
}
if (o == null) {
o = obj;
}
if (c != null && c.length == 0) {
c = contexts;
}
if (!accept(s, p, o, c)) {
return false;
}
return model.remove(s, p, o, c);
}
代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-optimistic
public void removeLater(Statement st) {
getAddedModel().remove(st);
removed.get(this).add(st);
}
代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-optimistic
public void removeLater(Statement st) {
getAddedModel().remove(st);
removed.get(this).add(st);
}
代码示例来源:origin: org.openrdf.sesame/sesame-sail-base
@Override
public synchronized void approve(Resource subj, IRI pred, Value obj, Resource ctx) {
if (deprecated != null) {
deprecated.remove(subj, pred, obj, ctx);
}
if (approved == null) {
approved = createEmptyModel();
}
approved.add(subj, pred, obj, ctx);
if (ctx != null) {
if (approvedContexts == null) {
approvedContexts = new HashSet<Resource>();
}
approvedContexts.add(ctx);
}
}
代码示例来源:origin: stackoverflow.com
dataset.begin(ReadWrite.WRITE);
try {
Model m = dataset.getDefaultModel();
m.remove(m.createResource("http://http://www.stackoverflow.com/example/Ronnie"), MY_ONTOLOGY.NAME, m.createLiteral("Ronald"));
dataset.commit();
} finally {
dataset.end();
}
代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-optimistic
public void addLater(Resource subj, URI pred, Value obj,
Resource... contexts) {
Resource[] ctxs = notNull(contexts);
if (ctxs.length == 0) {
ctxs = new Resource[] { null };
}
getRemovedModel().remove(subj, pred, obj, ctxs);
added.get(this).add(subj, pred, obj, contexts);
}
代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-optimistic
public void addLater(Resource subj, URI pred, Value obj,
Resource... contexts) {
Resource[] ctxs = notNull(contexts);
if (ctxs.length == 0) {
ctxs = new Resource[] { null };
}
getRemovedModel().remove(subj, pred, obj, ctxs);
added.get(this).add(subj, pred, obj, contexts);
}
代码示例来源:origin: org.openrdf.sesame/sesame-sail-base
@Override
public synchronized void deprecate(Resource subj, IRI pred, Value obj, Resource ctx) {
if (approved != null) {
approved.remove(subj, pred, obj, ctx);
}
if (deprecated == null) {
deprecated = createEmptyModel();
}
deprecated.add(subj, pred, obj, ctx);
if (approvedContexts != null && approvedContexts.contains(ctx)
&& !approved.contains(null, null, null, ctx))
{
approvedContexts.remove(ctx);
}
}
内容来源于网络,如有侵权,请联系作者删除!