Exemplo n.º 1
0
 // add ontologies to repository
 public Model(Collection<File> rdfFilesToImport) {
   this();
   this.schemaContext = this.repository.getValueFactory().createURI("http://localhost/context");
   // this.schemaContext=this.repository.getValueFactory().createURI(TestDriver.getConfigurations().getString(Configurations.ENDPOINT_URL));
   try {
     RepositoryConnection repoConn = this.repository.getConnection();
     for (File file : rdfFilesToImport) {
       System.out.println("Adding file: " + file.getName());
       repoConn.add(
           file,
           this.schemaContext.toString(),
           RDFFormat.forMIMEType(file.getName()),
           this
               .schemaContext); // forMIMEType finds the file format in order to read more than one
                                // rdfformats
       System.out.println("FILE ADDED");
     }
     repoConn.close();
   } catch (IOException | RDFParseException | RepositoryException ex) {
     ex.printStackTrace();
   }
 }