use of org.openrdf.model.Statement in project vcell by virtualcell.
the class IndexedGraph method retainAll.
public boolean retainAll(Collection<?> collection) {
boolean hasChanged = false;
Iterator<Statement> iterator = statements.iterator();
while (iterator.hasNext()) {
Statement statement = iterator.next();
if (!collection.contains(statement)) {
iterator.remove();
removeFromAllMaps(statement);
hasChanged = true;
}
}
return hasChanged;
}
use of org.openrdf.model.Statement in project vcell by virtualcell.
the class SesameRioUtil method writeRDFToRDFWriter.
private static void writeRDFToRDFWriter(RDFWriter rdfWriter, Graph graph, Map<String, String> nsMap) throws RDFHandlerException {
rdfWriter.startRDF();
for (Map.Entry<String, String> entry : nsMap.entrySet()) {
rdfWriter.handleNamespace(entry.getKey(), entry.getValue());
}
for (Statement statement : graph) {
rdfWriter.handleStatement(statement);
}
rdfWriter.endRDF();
}
use of org.openrdf.model.Statement in project vcell by virtualcell.
the class VCMetaDataMiriamManager method removeStoredCrossReferencedLink.
public void removeStoredCrossReferencedLink(MiriamResource miriamResource, URL url) {
ValueFactory valueFactory = vcMetaData.getRdfData().getValueFactory();
Resource resource = valueFactory.createURI(miriamResource.getMiriamURN());
Iterator<Statement> iter = vcMetaData.getRdfData().match(resource, MIRIAM.BioProperties.isDescribedBy, valueFactory.createLiteral(url.toString()));
while (iter.hasNext()) {
iter.next();
iter.remove();
}
}
use of org.openrdf.model.Statement in project blueprints by tinkerpop.
the class SailGraph method addEdge.
public Edge addEdge(final Object id, final Vertex outVertex, final Vertex inVertex, final String label) {
if (label == null)
throw ExceptionFactory.edgeLabelCanNotBeNull();
Value outVertexValue = ((SailVertex) outVertex).getRawVertex();
Value inVertexValue = ((SailVertex) inVertex).getRawVertex();
if (!(outVertexValue instanceof Resource)) {
throw new IllegalArgumentException(outVertex.toString() + " is not a legal URI or blank node");
}
try {
URI labelURI = new URIImpl(this.expandPrefix(label));
Statement statement = new StatementImpl((Resource) outVertexValue, labelURI, inVertexValue);
SailHelper.addStatement(statement, this.sailConnection.get());
return new SailEdge(statement, this);
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
}
use of org.openrdf.model.Statement in project blueprints by tinkerpop.
the class SailVertex method updateLiteral.
private void updateLiteral(final Literal oldLiteral, final Literal newLiteral) {
try {
final Set<Statement> statements = new HashSet<Statement>();
final CloseableIteration<? extends Statement, SailException> results = this.graph.getSailConnection().get().getStatements(null, null, oldLiteral, false);
while (results.hasNext()) {
statements.add(results.next());
}
results.close();
this.graph.getSailConnection().get().removeStatements(null, null, oldLiteral);
for (Statement statement : statements) {
SailHelper.addStatement(statement.getSubject(), statement.getPredicate(), newLiteral, statement.getContext(), this.graph.getSailConnection().get());
}
} catch (SailException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
Aggregations