use of org.eclipse.rdf4j.model.Statement in project rdf4j by eclipse.
the class TreeModel method removeAll.
private void removeAll(TreeSet<Statement> owner, StatementTree chosen, Iterator<Statement> iter) {
while (iter.hasNext()) {
Statement last = iter.next();
for (StatementTree tree : trees) {
if (tree.owns(owner)) {
tree.reindex();
tree.remove(last);
} else if (tree != chosen) {
tree.remove(last);
}
}
// remove from chosen
iter.remove();
}
}
use of org.eclipse.rdf4j.model.Statement in project rdf4j by eclipse.
the class SPARQLConnection method addWithoutCommit.
@Override
protected void addWithoutCommit(Resource subject, IRI predicate, Value object, Resource... contexts) throws RepositoryException {
ValueFactory f = getValueFactory();
Statement st = f.createStatement(subject, predicate, object);
List<Statement> list = new ArrayList<Statement>(1);
list.add(st);
String sparqlCommand = createInsertDataCommand(list, contexts);
sparqlTransaction.append(sparqlCommand);
sparqlTransaction.append("; ");
}
use of org.eclipse.rdf4j.model.Statement in project rdf4j by eclipse.
the class SPARQLConnection method removeWithoutCommit.
@Override
protected void removeWithoutCommit(Resource subject, IRI predicate, Value object, Resource... contexts) throws RepositoryException {
String sparqlCommand = "";
if (subject != null && predicate != null && object != null) {
ValueFactory f = getValueFactory();
Statement st = f.createStatement(subject, predicate, object);
List<Statement> list = new ArrayList<Statement>(1);
list.add(st);
sparqlCommand = createDeleteDataCommand(list, contexts);
} else {
sparqlCommand = createDeletePatternCommand(subject, predicate, object, contexts);
}
sparqlTransaction.append(sparqlCommand);
sparqlTransaction.append("; ");
}
use of org.eclipse.rdf4j.model.Statement in project rdf4j by eclipse.
the class RDFXMLParserTest method testRDFXMLWhitespace.
@Test
public void testRDFXMLWhitespace() throws Exception {
try (final InputStream in = this.getClass().getResourceAsStream("/org/eclipse/rdf4j/rio/rdfxml/rdfxml-whitespace-literal.rdf")) {
parser.parse(in, "");
}
Statement stmt1 = sc.getStatements().iterator().next();
assertEquals(1, sc.getStatements().size());
assertEquals(RDFS.LABEL, stmt1.getPredicate());
assertEquals(vf.createLiteral(" Literal with whitespace "), stmt1.getObject());
}
use of org.eclipse.rdf4j.model.Statement in project rdf4j by eclipse.
the class JSONLDInternalTripleCallback method triple.
private void triple(String s, String p, String value, String datatype, String language, String graph) {
if (s == null || p == null || value == null) {
// TODO: i don't know what to do here!!!!
return;
}
final Resource subject = createResource(s);
final IRI predicate = vf.createIRI(p);
final IRI datatypeURI = datatype == null ? null : vf.createIRI(datatype);
Value object;
try {
object = RDFParserHelper.createLiteral(value, language, datatypeURI, getParserConfig(), getParserErrorListener(), getValueFactory());
} catch (final RDFParseException e) {
throw new RuntimeException(e);
}
Statement result;
if (graph == null) {
result = vf.createStatement(subject, predicate, object);
} else {
result = vf.createStatement(subject, predicate, object, createResource(graph));
}
if (handler != null) {
try {
handler.handleStatement(result);
} catch (final RDFHandlerException e) {
throw new RuntimeException(e);
}
}
}
Aggregations