Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class RepositoryAPI {
- public static void main(String[] args) {
- File dataDir = new File("C:\Temp\sesameRepo\KB_Exemplar");
- try {
- Repository repo = createRepository(dataDir);
- addRDFToRepository(repo);
- } catch (RepositoryException e) {
- e.printStackTrace();
- }
- }
- private static Repository createRepository(File dataDir) throws RepositoryException {
- Repository repos = new SailRepository(new MemoryStore(dataDir));
- repos.initialize();
- return repos;
- }
- private static void addRDFToRepository(Repository repo) {
- File file = new File("C:\LDMVelocityWork\KB_Quality_Exemplar_BE_Ownership.ttl");
- String baseURI = "http://data.jpmchase.net/cib/cia/KBQualityExemplar";
- try{
- RepositoryConnection con = repo.getConnection();
- try{
- con.add(file, baseURI, RDFFormat.RDFXML);
- } catch (IOException e) {
- e.printStackTrace();
- }
- finally {
- con.close();
- }
- }
- catch (OpenRDFException e) {
- }
- }
- }
- File file = new File("C:\LDMVelocityWork\KB_Quality_Exemplar_BE_Ownership.ttl");
- String baseURI = "http://data.jpmchase.net/cib/cia/KBQualityExemplar";
- try{
- RepositoryConnection con = repo.getConnection();
- try{
- con.add(file, baseURI, RDFFormat.RDFXML);
- } catch (IOException e) {
- e.printStackTrace();
- }
- finally {
- con.close();
- }
- }
- catch (OpenRDFException e) {
- }
- con.add(file, baseURI, RDFFormat.RDFXML);
- con.add(file, baseURI, RDFFormat.TURTLE);
- conn.export(new TurtleWriter());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement