-
Notifications
You must be signed in to change notification settings - Fork 3
/
StatementCopyingHandler.java
42 lines (37 loc) · 1.47 KB
/
StatementCopyingHandler.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* JB4JSON-LD Jackson
* Copyright (C) 2023 Czech Technical University in Prague
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package cz.cvut.kbss.jsonld.jackson.environment;
import org.eclipse.rdf4j.model.Statement;
import org.eclipse.rdf4j.repository.RepositoryConnection;
import org.eclipse.rdf4j.repository.RepositoryException;
import org.eclipse.rdf4j.rio.RDFHandlerException;
import org.eclipse.rdf4j.rio.helpers.AbstractRDFHandler;
public class StatementCopyingHandler extends AbstractRDFHandler {
private final RepositoryConnection connection;
public StatementCopyingHandler(RepositoryConnection connection) {
this.connection = connection;
}
@Override
public void handleStatement(Statement st) throws RDFHandlerException {
try {
connection.add(st);
} catch (RepositoryException e) {
throw new RuntimeException(e);
}
}
}