本文整理了Java中org.apache.clerezza.commons.rdf.Graph.removeAll()
方法的一些代码示例,展示了Graph.removeAll()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.removeAll()
方法的具体详情如下:
包路径:org.apache.clerezza.commons.rdf.Graph
类名称:Graph
方法名:removeAll
暂无
代码示例来源:origin: org.apache.clerezza/rdf.core
@Override
public Boolean run() {
return graph.removeAll(c);
}
});
代码示例来源:origin: apache/clerezza
@Override
public Boolean run() {
return graph.removeAll(c);
}
});
代码示例来源:origin: org.apache.clerezza/rdf.core.test
@Override
public boolean removeAll(Collection<?> c) {
return wrapped.removeAll(c);
}
代码示例来源:origin: apache/clerezza
@Override
public boolean removeAll(Collection<?> c) {
return wrapped.removeAll(c);
}
代码示例来源:origin: apache/clerezza
@Override
public boolean removeAll(Collection<?> c) {
checkWrite();
return wrapped.removeAll(c);
}
代码示例来源:origin: org.apache.clerezza/rdf.core
@Override
public boolean removeAll(Collection<?> c) {
checkWrite();
return wrapped.removeAll(c);
}
代码示例来源:origin: apache/stanbol
private void clearRoles(BlankNodeOrIRI userResource) {
systemGraph.removeAll(filterToArray(userResource, SIOC.has_function, null));
}
代码示例来源:origin: org.apache.clerezza.commons-rdf/commons-rdf-impl-utils
private static void replaceNode(Graph graph, BlankNode bNode, BlankNodeOrIRI replacementNode) {
Set<Triple> triplesToRemove = new HashSet<Triple>();
for (Triple triple : graph) {
Triple replacementTriple = getReplacement(triple, bNode, replacementNode);
if (replacementTriple != null) {
triplesToRemove.add(triple);
graph.add(replacementTriple);
}
}
graph.removeAll(triplesToRemove);
}
private static Triple getReplacement(Triple triple, BlankNode bNode, BlankNodeOrIRI replacementNode) {
代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza
void registerOntologyDeletion(OWLOntologyID publicKey) {
Set<Triple> toRemove = new HashSet<Triple>();
Set<OWLOntologyID> aliases = listAliases(publicKey);
aliases.add(publicKey);
for (OWLOntologyID alias : aliases) {
IRI ontologyId = buildResource(alias);
// Also removes aliases and dependencies.
// XXX Too extreme?
for (Iterator<Triple> it = graph.filter(ontologyId, null, null); it.hasNext();)
toRemove.add(it.next());
for (Iterator<Triple> it = graph.filter(null, null, ontologyId); it.hasNext();)
toRemove.add(it.next());
}
graph.removeAll(toRemove);
}
代码示例来源:origin: apache/stanbol
void registerOntologyDeletion(OWLOntologyID publicKey) {
Set<Triple> toRemove = new HashSet<Triple>();
Set<OWLOntologyID> aliases = listAliases(publicKey);
aliases.add(publicKey);
for (OWLOntologyID alias : aliases) {
IRI ontologyId = buildResource(alias);
// Also removes aliases and dependencies.
// XXX Too extreme?
for (Iterator<Triple> it = graph.filter(ontologyId, null, null); it.hasNext();)
toRemove.add(it.next());
for (Iterator<Triple> it = graph.filter(null, null, ontologyId); it.hasNext();)
toRemove.add(it.next());
}
graph.removeAll(toRemove);
}
代码示例来源:origin: apache/stanbol
private void clearPermissions(BlankNodeOrIRI subject) {
ArrayList<Triple> buffer = new ArrayList<Triple>();
Lock readLock = systemGraph.getLock().readLock();
readLock.lock();
try {
Iterator<Triple> permissions = systemGraph.filter(subject, PERMISSION.hasPermission, null);
while (permissions.hasNext()) {
Triple permissionTriple = permissions.next();
buffer.add(permissionTriple);
BlankNodeOrIRI permissionNode = (BlankNodeOrIRI) permissionTriple.getObject();
Iterator<Triple> permissionTriples = systemGraph.filter(permissionNode, null, null);
while (permissionTriples.hasNext()) {
buffer.add(permissionTriples.next());
}
}
} finally {
readLock.unlock();
}
systemGraph.removeAll(buffer);
}
代码示例来源:origin: apache/stanbol
@Override
public void clearDependencies(OWLOntologyID dependent) {
if (dependent == null) throw new IllegalArgumentException("dependent cannot be null");
log.debug("Clearing dependencies for {}", dependent);
Set<Triple> dependencies = new HashSet<Triple>();
synchronized (meta) {
Set<OWLOntologyID> aliases = listAliases(dependent);
aliases.add(dependent);
for (OWLOntologyID depalias : aliases) {
IRI dep = buildResource(depalias);
Iterator<Triple> it = meta.filter(dep, DEPENDS_ON_URIREF, null);
while (it.hasNext()) {
Triple t = it.next();
dependencies.add(t);
log.debug(" ... Set {} as a dependency to remove.", t.getObject());
}
it = meta.filter(null, HAS_DEPENDENT_URIREF, dep);
while (it.hasNext()) {
Triple t = it.next();
dependencies.add(t);
log.debug(" ... Set {} as a dependency to remove.", t.getSubject());
}
}
meta.removeAll(dependencies);
}
log.debug(" ... DONE clearing dependencies.");
}
代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza
@Override
public void clearDependencies(OWLOntologyID dependent) {
if (dependent == null) throw new IllegalArgumentException("dependent cannot be null");
log.debug("Clearing dependencies for {}", dependent);
Set<Triple> dependencies = new HashSet<Triple>();
synchronized (meta) {
Set<OWLOntologyID> aliases = listAliases(dependent);
aliases.add(dependent);
for (OWLOntologyID depalias : aliases) {
IRI dep = buildResource(depalias);
Iterator<Triple> it = meta.filter(dep, DEPENDS_ON_URIREF, null);
while (it.hasNext()) {
Triple t = it.next();
dependencies.add(t);
log.debug(" ... Set {} as a dependency to remove.", t.getObject());
}
it = meta.filter(null, HAS_DEPENDENT_URIREF, dep);
while (it.hasNext()) {
Triple t = it.next();
dependencies.add(t);
log.debug(" ... Set {} as a dependency to remove.", t.getSubject());
}
}
meta.removeAll(dependencies);
}
log.debug(" ... DONE clearing dependencies.");
}
代码示例来源:origin: apache/stanbol
void mapLocator(org.semanticweb.owlapi.model.IRI locator, IRI graphName) {
if (graphName == null) throw new IllegalArgumentException("A null graph name is not allowed.");
// Null locator is a legal argument, will remove all locator mappings from the supplied graph
Set<Triple> remove = new HashSet<Triple>();
for (Iterator<Triple> nodes = graph.filter(graphName, null, null); nodes.hasNext();) {
Triple t = nodes.next();
// isOntology |= RDF.type.equals(t.getPredicate()) && OWL.Ontology.equals(t.getObject());
if (RETRIEVED_FROM_URIREF.equals(t.getPredicate())) remove.add(t);
}
graph.removeAll(remove);
if (locator != null) {
Literal litloc = LiteralFactory.getInstance().createTypedLiteral(
new IRI(locator.toString()));
graph.add(new TripleImpl(graphName, RETRIEVED_FROM_URIREF, litloc));
}
}
代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza
for (it = meta.filter(sessionur, null, null); it.hasNext();)
removeUs.add(it.next());
meta.removeAll(removeUs);
log.debug("Done; removed {} triples in {} ms.", removeUs.size(), System.currentTimeMillis()
- before);
代码示例来源:origin: apache/stanbol
/**
* Deletes a named user
*
* @param userName
*/
private void remove(String userName) {
RDFTerm userResource = getNamedUser(userName).getNode();
Iterator<Triple> userTriples = systemGraph.filter((BlankNodeOrIRI) userResource, null, null);
ArrayList<Triple> buffer = new ArrayList<Triple>();
Lock readLock = systemGraph.getLock().readLock();
readLock.lock();
try {
while (userTriples.hasNext()) {
Triple triple = userTriples.next();
buffer.add(triple);
}
} finally {
readLock.unlock();
}
// ImmutableGraph context = getNamedUser(userName).getNodeContext();
Lock writeLock = systemGraph.getLock().writeLock();
writeLock.lock();
try {
systemGraph.removeAll(buffer);
} finally {
writeLock.unlock();
}
}
代码示例来源:origin: apache/stanbol
/**
* Deletes a named user
*
* @param userName
*/
private void deleteRole(String roleName) {
RDFTerm roleResource = getNamedRole(roleName).getNode();
Iterator<Triple> roleTriples = systemGraph.filter((BlankNodeOrIRI) roleResource, null, null);
ArrayList<Triple> buffer = new ArrayList<Triple>();
Lock readLock = systemGraph.getLock().readLock();
readLock.lock();
try {
while (roleTriples.hasNext()) {
Triple triple = roleTriples.next();
buffer.add(triple);
}
} finally {
readLock.unlock();
}
// is lock needed?
Lock writeLock = systemGraph.getLock().writeLock();
writeLock.lock();
try {
systemGraph.removeAll(buffer);
} finally {
writeLock.unlock();
}
}
代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza
void mapLocator(org.semanticweb.owlapi.model.IRI locator, IRI graphName) {
if (graphName == null) throw new IllegalArgumentException("A null graph name is not allowed.");
// Null locator is a legal argument, will remove all locator mappings from the supplied graph
Set<Triple> remove = new HashSet<Triple>();
for (Iterator<Triple> nodes = graph.filter(graphName, null, null); nodes.hasNext();) {
Triple t = nodes.next();
// isOntology |= RDF.type.equals(t.getPredicate()) && OWL.Ontology.equals(t.getObject());
if (RETRIEVED_FROM_URIREF.equals(t.getPredicate())) remove.add(t);
}
graph.removeAll(remove);
if (locator != null) {
Literal litloc = LiteralFactory.getInstance().createTypedLiteral(
new IRI(locator.toString()));
graph.add(new TripleImpl(graphName, RETRIEVED_FROM_URIREF, litloc));
}
}
代码示例来源:origin: apache/stanbol
model.removeAll(remove);
model.addAll(add);
代码示例来源:origin: org.apache.clerezza/rdf.stable.serializer
private boolean fillMSG(Triple triple, Graph tc,
Graph msg) {
boolean containsBlankNode = false;
RDFTerm resource = triple.getSubject();
if (resource instanceof BlankNode) {
containsBlankNode = true;
} else {
resource = triple.getObject();
if (resource instanceof BlankNode) {
containsBlankNode = true;
}
}
if (containsBlankNode) {
GraphNode gn = new GraphNode(resource, tc);
ImmutableGraph context = gn.getNodeContext();
msg.addAll(context);
tc.removeAll(context);
} else {
msg.add(triple);
tc.remove(triple);
}
return containsBlankNode;
}
内容来源于网络,如有侵权,请联系作者删除!